/* ---------- Theme ----------
   Dark is the default (also with no JS). Light is opt-in via the toggle. */

:root {
  --red:   #ec2326;
  --grey:  #717373;
  --paper: #f4f2ec;
  --ink:   #16140f;

  --bg:       var(--ink);
  --fg:       var(--paper);
  --muted:    #a3a39b;
  --strip-bg: var(--paper);
  --strip-fg: var(--ink);
  --tile-ink-bg: var(--paper);
  --tile-ink-fg: var(--ink);
  --line:     var(--paper);
  --dash-fg:  var(--red);

  --sans: 'Bricolage Grotesque', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --gutter: clamp(16px, 5vw, 72px);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg:       var(--paper);
  --fg:       var(--ink);
  --muted:    #5f6161;
  --strip-bg: var(--ink);
  --strip-fg: var(--paper);
  --tile-ink-bg: var(--ink);
  --tile-ink-fg: var(--paper);
  --line:     var(--ink);
  --dash-fg:  #c4141a;

  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

::selection { background: var(--red); color: #fff; }

a { color: inherit; }

/* ---------- Top bar ---------- */

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px var(--gutter);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-height: 44px;
}

.brand:hover { color: var(--fg); }
.brand svg { height: 18px; fill: var(--red); }

.theme-toggle {
  font: inherit;
  color: var(--fg);
  background: none;
  border: 1.5px solid var(--muted);
  border-radius: 999px;
  padding: 0 16px;
  min-height: 44px;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.theme-toggle:hover { border-color: var(--fg); }

.brand:focus-visible,
.theme-toggle:focus-visible,
.home-link:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

/* ---------- Main ---------- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(36px, 5vw, 64px);
  padding: clamp(16px, 3vw, 40px) var(--gutter) clamp(36px, 5vw, 56px);
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

/* ---------- Tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(5px, 1.4vw, 20px);
}

.tile {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid transparent;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(26px, 10vw, 150px);
  line-height: 1;
  letter-spacing: -0.03em;
  transform: rotate(var(--r, 0deg));
  transition: transform 0.3s cubic-bezier(.3, 1.7, .5, 1),
              background-color 0.25s, color 0.25s, border-color 0.25s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.tile:hover { transform: rotate(calc(var(--r, 0deg) * -2)) translateY(-8px); }

.tile:focus-visible {
  outline: 4px solid var(--fg);
  outline-offset: 5px;
}

.tile.spin { animation: spin 0.45s cubic-bezier(.3, 1.4, .5, 1); }

@keyframes spin {
  from { transform: rotate(calc(var(--r, 0deg) + 90deg)) scale(0.85); }
}

/* shapes */
.shape-sq   { border-radius: clamp(10px, 1.6vw, 22px); }
.shape-ci   { border-radius: 50%; }
.shape-leaf { border-radius: clamp(10px, 1.6vw, 22px) clamp(10px, 1.6vw, 22px) clamp(10px, 1.6vw, 22px) 40%; }

/* styles (a click cycles through these) */
.s-red  { background: var(--red);         color: #fff;               border-color: var(--red); }
.s-ink  { background: var(--tile-ink-bg); color: var(--tile-ink-fg); border-color: var(--tile-ink-bg); }
.s-line { background: transparent;        color: var(--fg);          border-color: var(--line); }
.s-grey { background: var(--grey);        color: var(--paper);       border-color: var(--grey); }
.s-dash { background: transparent;        color: var(--dash-fg);     border-color: var(--red); border-style: dashed; }

/* ---------- About ---------- */

.about {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 72px;
  align-items: flex-end;
  justify-content: space-between;
}

.name { flex: 1 1 420px; min-width: 0; }

.label {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.name h1 {
  margin-top: 10px;
  font-weight: 800;
  font-size: clamp(48px, 6.5vw, 104px);
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.lines {
  flex: 1 1 360px;
  min-width: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.lines li { display: flex; gap: 14px; align-items: baseline; }
.lines li span { color: var(--red); font-weight: 800; }

/* ---------- 404 ---------- */

.tiles-404 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 640px;
}

.tiles-404 .tile { cursor: default; font-size: clamp(64px, 14vw, 170px); }

.lost-copy h1 {
  margin-top: 10px;
  font-weight: 800;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.lost-copy p {
  margin-top: 16px;
  font-size: clamp(18px, 1.8vw, 22px);
  color: var(--muted);
}

.home-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 15px;
  text-decoration: none;
  border-bottom: 2px solid var(--red);
}

.home-link:hover { color: var(--red); }

/* ---------- Marquee strip ---------- */

.strip {
  background: var(--strip-bg);
  color: var(--strip-fg);
  padding: 16px 0;
  white-space: nowrap;
  overflow: hidden;
  transition: background-color 0.3s, color 0.3s;
}

.marquee {
  display: flex;
  width: max-content;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.01em;
  animation: slide 30s linear infinite;
}

.marquee span { padding-right: 32px; }

@keyframes slide { to { transform: translateX(-50%); } }

/* ---------- Footer ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 18px var(--gutter);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Chevron cursor follower ---------- */

.cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 14px;
  fill: var(--red);
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s;
  will-change: transform;
}

.cursor.on { opacity: 1; }

@media (hover: none), (pointer: coarse) {
  .cursor { display: none; }
}

/* ---------- Motion & small screens ---------- */

@media (prefers-reduced-motion: reduce) {
  body, .strip, .tile, .theme-toggle { transition: none; }
  .tile.spin { animation: none; }
  .marquee { animation: none; }
  .cursor { display: none; }
}

@media (max-width: 720px) {
  .tile { border-width: 3px; }
  .tile:hover { transform: rotate(var(--r, 0deg)); }
  .marquee { font-size: 20px; }
  .strip { padding: 12px 0; }
}
