:root {
  --paper: #eef1f4;
  --paper-2: #e2e7ed;
  --ink: #1b2430;
  --ink-soft: #3a4656;
  --muted: #5b6675;
  --line: #c9d0d9;
  --signal: #f2c200;
  --signal-ink: #2a2200;
  --route: #1f4fd1;
  --route-soft: #dfe7fb;
  --panel: #ffffff;
  --shadow: 0 1px 0 rgba(27, 36, 48, .06), 0 12px 32px -12px rgba(27, 36, 48, .25);
  --font: "Overpass", system-ui, sans-serif;
  --mono: "Overpass Mono", ui-monospace, monospace;
  --rail-h: 64px;
  --head-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151b23;
    --paper-2: #1d2530;
    --ink: #e8edf3;
    --ink-soft: #c3ccd7;
    --muted: #8f9bab;
    --line: #2e3947;
    --route: #7ea2ff;
    --route-soft: #22304d;
    --panel: #1b222c;
    --shadow: 0 12px 32px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151b23;
  --paper-2: #1d2530;
  --ink: #e8edf3;
  --ink-soft: #c3ccd7;
  --muted: #8f9bab;
  --line: #2e3947;
  --route: #7ea2ff;
  --route-soft: #22304d;
  --panel: #1b222c;
  --shadow: 0 12px 32px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--route); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--route); outline-offset: 2px; border-radius: 4px; }

/* ---------- header ---------- */
.head {
  position: fixed; inset: 0 0 auto 0; height: var(--head-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); }
.brand b { font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.brand span { color: var(--muted); font-size: 15px; }
.head-tools { display: flex; align-items: center; gap: 8px; }
.counter { font-family: var(--mono); font-size: 13px; color: var(--muted); min-width: 64px; text-align: right; margin-right: 6px; }
.icon-btn {
  height: 38px; min-width: 38px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px;
  cursor: pointer; font-size: 15px;
}
.icon-btn:hover { border-color: var(--ink-soft); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- deck ---------- */
.deck {
  position: fixed; top: var(--head-h); bottom: var(--rail-h); left: 0; right: 0;
  overflow: hidden;
}
.track {
  display: flex; height: 100%;
  transition: transform .6s cubic-bezier(.65, 0, .25, 1);
  will-change: transform;
}
.slide {
  flex: 0 0 100%; height: 100%; overflow-y: auto; overflow-x: hidden;
  padding: 24px 28px 32px;
  scrollbar-width: thin;
}
.slide[aria-hidden="true"] { visibility: hidden; transition: visibility 0s .6s; }

/* ---------- intro ---------- */
.intro { display: grid; align-content: center; min-height: 100%; max-width: 1180px; margin: 0 auto; gap: 28px; }
.intro h1 {
  font-size: clamp(34px, 4.3vw, 62px); line-height: 1.32; letter-spacing: -.022em;
  font-weight: 800; margin: 0; max-width: 21ch;
}
.det { position: relative; white-space: nowrap; }
.det::before {
  content: ""; position: absolute; inset: -.06em -.14em -.02em;
  border: 3px solid var(--signal); border-radius: 3px;
  clip-path: inset(0 100% 100% 0);
  animation: box .55s cubic-bezier(.7, 0, .3, 1) forwards;
  animation-delay: var(--d);
}
.det::after {
  content: attr(data-label); position: absolute; left: -.14em; bottom: 100%;
  transform: translateY(-2px);
  font: 600 13px/1 var(--mono); letter-spacing: 0; white-space: nowrap;
  background: var(--signal); color: var(--signal-ink); padding: 4px 6px 3px; border-radius: 3px 3px 0 0;
  opacity: 0; animation: lab .2s ease-out forwards; animation-delay: calc(var(--d) + .45s);
}
@keyframes box { to { clip-path: inset(0 0 0 0); } }
@keyframes lab { to { opacity: 1; } }

.intro-sub { font-size: clamp(18px, 1.6vw, 22px); color: var(--ink-soft); max-width: 60ch; margin: 0; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 20px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 17px; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.kbd-hint { color: var(--muted); font-size: 14px; }
kbd { font: 600 12px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--panel); }

.domains { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); margin-top: 12px; }
.domain { padding: 16px 18px 0 0; }
.domain + .domain { padding-left: 18px; border-left: 1px solid var(--line); }
.domain h2 { font-size: 16px; margin: 0 0 4px; font-weight: 800; }
.domain p { margin: 0; font-size: 15px; color: var(--muted); }
.domain button { all: unset; cursor: pointer; display: block; }
.domain button:hover h2 { color: var(--route); }
.domain button:focus-visible { outline: 3px solid var(--route); outline-offset: 4px; border-radius: 4px; }

/* ---------- project slide ---------- */
.proj {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px;
  max-width: 1400px; margin: 0 auto; min-height: 100%; align-items: center;
}
.proj-text { max-width: 60ch; }
.proj-group { font-size: 15px; color: var(--muted); margin: 0 0 6px; }
.proj-group i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: 0; }
.proj h2 { font-size: clamp(30px, 3.4vw, 48px); line-height: 1.05; letter-spacing: -.02em; margin: 0 0 10px; font-weight: 800; }
.pitch { font-size: 20px; line-height: 1.4; margin: 0 0 14px; color: var(--ink); }
.problem { color: var(--ink-soft); margin: 0 0 18px; }
.highlights { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.highlights li { padding-left: 22px; position: relative; font-size: 16px; }
.highlights li::before {
  content: ""; position: absolute; left: 0; top: .5em; width: 10px; height: 10px;
  border: 2px solid var(--signal); border-radius: 2px;
}
.highlights b { font-weight: 700; }
.stack { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.stack li { font-size: 13px; padding: 3px 9px; border-radius: 6px; background: var(--paper-2); color: var(--ink-soft); }
.proj-link { margin: 16px 0 0; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--muted); margin: 0; }
.facts b { color: var(--ink); font-weight: 700; }

.media { display: grid; gap: 10px; }
.media-tabs { display: flex; gap: 6px; }
.media-tabs button {
  border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 5px 12px; cursor: pointer; font-size: 14px;
}
.media-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.frame {
  position: relative; border-radius: 14px; overflow: hidden; background: #0f141a;
  box-shadow: var(--shadow); aspect-ratio: 16 / 10;
}
.frame video, .frame img { display: block; width: 100%; height: 100%; object-fit: contain; background: #0f141a; }
.frame-cap { font-size: 14px; color: var(--muted); margin: 0; }

/* ---------- outro ---------- */
.outro { max-width: 1180px; margin: 0 auto; min-height: 100%; display: grid; align-content: center; gap: 26px; }
.outro h2 { font-size: clamp(30px, 3.6vw, 52px); margin: 0; letter-spacing: -.02em; line-height: 1.05; }
.also { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px 32px; }
.also div { border-top: 1px solid var(--line); padding-top: 10px; }
.also h3 { font-size: 16px; margin: 0 0 2px; }
.also p { font-size: 14px; margin: 0; color: var(--muted); }
.contact { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- rail ---------- */
.rail {
  position: fixed; inset: auto 0 0 0; height: var(--rail-h); z-index: 20;
  display: flex; align-items: center; gap: 4px; padding: 0 28px;
  background: var(--paper); border-top: 1px solid var(--line);
}
.rail-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rail-group + .rail-group { margin-left: 14px; }
.rail-name { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-ticks { display: flex; gap: 4px; }
.tick {
  width: 30px; height: 8px; border-radius: 3px; border: 0; padding: 0; cursor: pointer;
  background: var(--line); position: relative;
}
.tick::after { content: ""; position: absolute; inset: -10px -2px; }
.tick[aria-current="true"] { background: var(--ink); }
.tick.seen { background: color-mix(in srgb, var(--ink) 35%, var(--line)); }
.rail-group[data-g] .tick[aria-current="true"] { background: var(--gc); }

/* ---------- overview ---------- */
.overview {
  position: fixed; inset: var(--head-h) 0 0 0; z-index: 30; background: var(--paper);
  overflow-y: auto; padding: 28px; display: none;
}
.overview.open { display: block; }
.ov-grid { max-width: 1300px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.ov-card {
  text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 0; cursor: pointer; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr;
}
.ov-card:hover { border-color: var(--ink-soft); }
.ov-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #0f141a; }
.ov-card div { padding: 12px 14px 14px; }
.ov-card small { color: var(--muted); font-size: 13px; }
.ov-card h3 { margin: 2px 0 4px; font-size: 18px; }
.ov-card p { margin: 0; font-size: 14px; color: var(--ink-soft); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  body { font-size: 16px; }
  .proj { grid-template-columns: 1fr; gap: 20px; align-items: start; }
  .media { order: -1; }
  .domains { grid-template-columns: 1fr 1fr; }
  .domain:nth-child(3) { border-left: 0; padding-left: 0; }
  .rail-name { display: none; }
  .tick { width: 16px; }
}
@media (max-width: 600px) {
  .head, .slide, .rail, .overview { padding-left: 16px; padding-right: 16px; }
  .brand span, .counter { display: none; }
  .domains { grid-template-columns: 1fr; }
  .domain + .domain { border-left: 0; padding-left: 0; }
  .tick { width: 10px; }
  .rail-group + .rail-group { margin-left: 8px; }
  .pitch { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .track { transition: none; }
  .det::before, .det::after { animation: none; clip-path: none; opacity: 1; }
}
