/* ──────────────────────────────────────────────────────────
   Идея оформления: приборная панель.
   Основа нейтральная, цвет дают сами продукты: лайм ReDrive,
   оранжевый ELM327, синий Quanta. Акцент страницы плавно
   меняется, пока вы листаете от проекта к проекту.
   ────────────────────────────────────────────────────────── */

@property --accent     { syntax: "<color>"; inherits: true; initial-value: #C6F24E; }
@property --accent-ink { syntax: "<color>"; inherits: true; initial-value: #C6F24E; }

:root {
  --lime: #C6F24E;
  --orange: #FF9F0A;
  --blue: #4B93FF;
  --red: #FF3B30;
  --on-accent: #0A0B0C;

  --curtain: #08090A;
  --stage: #08090A;

  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --display: "Sofia Sans Extra Condensed", "Arial Narrow", "Yu Gothic UI", "Malgun Gothic", "Nirmala UI", sans-serif;
  --text: "Sofia Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Martian Mono", "Cascadia Mono", Consolas, monospace;

  --g: clamp(16px, 3vw, 44px);
  --gap: clamp(16px, 2vw, 32px);
  --bar: 64px;
  --out: cubic-bezier(.16, 1, .3, 1);
  --io: cubic-bezier(.76, 0, .24, 1);

  --accent: var(--lime);
  --accent-ink: var(--lime-ink);
}

:root[data-theme="dark"] {
  --bg: #0A0B0C;
  --bg-2: #111315;
  --bg-3: #1A1D20;
  --fg: #EFF1EB;
  --fg-2: #AEB3AC;
  --fg-3: #80857F;
  --line: rgba(255, 255, 255, .11);
  --line-2: rgba(255, 255, 255, .22);
  --lime-ink: #C6F24E;
  --orange-ink: #FF9F0A;
  --blue-ink: #6CA7FF;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F1F0EA;
  --bg-2: #FAF9F5;
  --bg-3: #E5E3DA;
  --fg: #0F1112;
  --fg-2: #4C5052;
  --fg-3: #686C68;
  --line: rgba(15, 17, 18, .13);
  --line-2: rgba(15, 17, 18, .28);
  --lime-ink: #456800;
  --orange-ink: #A35400;
  --blue-ink: #1A58CC;
  color-scheme: light;
}

html[data-ch="elm"]    { --accent: var(--orange); --accent-ink: var(--orange-ink); }
html[data-ch="quanta"] { --accent: var(--blue);   --accent-ink: var(--blue-ink); }

html:not([data-lang="en"]) [lang="en"] { display: none !important; }
html[data-lang="en"] [lang="ru"] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1.125rem/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color .35s ease, color .35s ease;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
code { font-family: var(--mono); font-size: .78em; font-stretch: 75%; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; border-radius: 2px; }
section[id], article[id], main[id] { scroll-margin-top: calc(var(--bar) + 6px); }

.stage-tag, .status, .spec dt, .brief-text h4,
.wire-end, .pkt {
  font-family: var(--mono);
  font-stretch: 75%;
  font-size: .72rem;
  letter-spacing: .02em;
  line-height: 1.4;
}

.skip {
  position: fixed; left: var(--g); top: 8px; z-index: 100; padding: 8px 14px;
  background: var(--accent); color: var(--on-accent); transform: translateY(-160%);
}
.skip:focus { transform: none; }

/* ─── Intro ─── */
.curtain {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  display: grid; place-items: center;
  background: #EDE8DF; color: #141311;
  animation: lift 1.1s var(--io) 3.6s forwards;
}
.curtain.js-run { animation: none; }
.curtain.go { animation: lift 1.1s var(--io) forwards; }
@keyframes lift {
  to { transform: translateY(-105%); border-radius: 0 0 50% 50% / 0 0 14vh 14vh; visibility: hidden; }
}
.hello {
  display: inline-block; white-space: nowrap;
  font: 500 clamp(2.8rem, 1.8rem + 4vw, 5.2rem)/1.2 var(--serif);
  letter-spacing: -.01em;
  animation: hello-in .8s var(--out) .1s both;
}
.curtain.go .hello { animation: hello-out .7s var(--io) both; }
@keyframes hello-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes hello-out { to { opacity: 0; transform: translateY(-40px); } }

.after { transition: opacity .9s var(--out) calc(.3s + var(--d, 0s)), transform .9s var(--out) calc(.3s + var(--d, 0s)); }
.js.intro .after { opacity: 0; transform: translateY(20px); }

/* ─── Top bar ─── */
.bar {
  position: fixed; inset: 0 0 auto; z-index: 50;
  color: var(--fg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  transition: background-color .3s ease;
}
.bar:not(.is-stuck) { --fg: #EFF1EB; --fg-2: rgba(239, 241, 235, .8); --fg-3: rgba(239, 241, 235, .5); --line: rgba(255, 255, 255, .2); background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.bar-in { height: var(--bar); padding-inline: var(--g); display: flex; align-items: center; gap: clamp(20px, 2.6vw, 40px); }
.brand { margin-right: auto; font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; }
.bar-nav { display: flex; gap: clamp(20px, 2.6vw, 40px); font-size: .9375rem; font-weight: 500; }
.bar-nav a { color: var(--fg-2); transition: color .2s; }
.bar-nav a:hover { color: var(--fg); }
.bar-tools { display: flex; align-items: center; gap: 14px; }
.lang { display: flex; gap: 10px; font-size: .9375rem; font-weight: 500; }
.lang button { padding: 8px 2px; color: var(--fg-3); transition: color .2s; }
.lang button:hover { color: var(--fg); }
html[data-lang="ru"] [data-set-lang="ru"], html[data-lang="en"] [data-set-lang="en"] { color: var(--fg); }
.tool { width: 32px; height: 32px; margin-right: -7px; display: grid; place-items: center; color: var(--fg-2); transition: color .2s; }
.tool:hover { color: var(--fg); }
.tool svg { width: 18px; height: 18px; grid-area: 1 / 1; }
html[data-theme="dark"] .only-light, html[data-theme="light"] .only-dark { display: none; }

/* ─── Hero ─── */
.fit { font-family: var(--display); font-weight: 800; text-transform: uppercase; line-height: .86; letter-spacing: -.005em; white-space: nowrap; }
.fit-in { display: inline-block; }

/* A cloud of points that becomes the name and the work. Dark in both themes, like the project stages. */
.hero { position: relative; height: 135vh; background: #101010; }
.hero-pin {
  --fg: #EFF1EB; --fg-2: rgba(239, 241, 235, .8); --fg-3: rgba(239, 241, 235, .52); --bg: #0A0B0C;
  --line-2: rgba(255, 255, 255, .28); --accent: var(--lime);
  position: sticky; top: 0; height: 100svh; overflow: hidden; color: var(--fg);
  background: #06070A;
}
.hero-glow { --g: rgba(150, 165, 190, .12); position: absolute; inset: 0; background: radial-gradient(58% 56% at 50% 44%, var(--g), transparent 74%); opacity: 0; transition: opacity 1.4s ease; will-change: opacity; }
.hero-glow.on, html:not(.js) .hero-glow { opacity: 1; }
.hero-shade { position: absolute; inset: auto 0 0; height: 40%; z-index: 2; background: linear-gradient(0deg, rgba(5, 5, 6, .92) 14%, transparent); pointer-events: none; }
.hero-exit { position: absolute; inset: 0; z-index: 3; background: #101010; opacity: 0; pointer-events: none; }
.dust { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.hero-name { position: absolute; left: 50%; top: 43%; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none; }
.hero-name h1 { font: 500 clamp(88px, 18vw, 280px)/1 var(--serif); letter-spacing: -.025em; }
.js .hero-name { width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.hero-cap { position: absolute; left: 0; right: 0; bottom: clamp(104px, 15vh, 150px); z-index: 4; text-align: center; font: 800 clamp(2rem, 3.4vw, 3.4rem)/1 var(--display); text-transform: uppercase; opacity: 0; transform: translateY(10px); transition: opacity .35s ease, transform .5s var(--out); pointer-events: none; }
.hero-cap.on { opacity: 1; transform: none; }

.hero-foot { position: absolute; left: var(--g); right: var(--g); bottom: clamp(18px, 3.4vh, 34px); z-index: 4; display: grid; grid-template-columns: 1fr auto 1fr; align-items: last baseline; gap: 16px 32px; cursor: auto; }
.hero-role { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.hero-say { font-size: clamp(1.125rem, 1.4vw, 1.375rem); font-weight: 500; line-height: 1.2; letter-spacing: -.01em; max-width: 19em; transition: opacity .32s ease; }
.hero-say.out { opacity: 0; }
.hero-say span { animation: say-in .7s ease both; animation-delay: calc(var(--i) * 14ms); }
@keyframes say-in { from { opacity: 0; } }
.hero-role small { font-size: .9375rem; color: var(--fg-3); }
.picks { display: flex; gap: clamp(16px, 2.2vw, 34px); }
.pick { display: inline-flex; align-items: center; gap: 8px; font-size: .9375rem; font-weight: 500; color: var(--fg-2); white-space: nowrap; transition: color .35s; }
.pick i { width: 6px; height: 6px; border-radius: 50%; background: var(--pc); transition: box-shadow .35s; }
.pick small { display: inline-flex; align-items: center; gap: 3px; font-size: .875rem; font-weight: 400; font-variant-numeric: tabular-nums; color: var(--fg-3); }
.pick small svg { width: 11px; height: 11px; }
.pick:hover, .pick.on { color: var(--fg); }
.pick.on i { background: var(--pc); box-shadow: 0 0 12px var(--pc); }
.hero-cta { justify-self: end; display: flex; flex-wrap: nowrap; gap: 6px clamp(18px, 2.2vw, 32px); }
.hlink { display: inline-flex; align-items: center; gap: 6px; padding-block: 7px; font-size: .9375rem; font-weight: 500; white-space: nowrap; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .45s var(--out); }
.hlink:hover { background-size: 100% 1px; }
.hlink:first-child { color: var(--lime); }
@media (min-width: 1181px) { .hero-say { white-space: nowrap; } }
.hlink svg { width: 16px; height: 16px; transition: transform .45s var(--out); }
.hlink:hover svg { transform: translate(2px, -2px); }

.status { display: inline-flex; align-items: center; gap: 8px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: ping 2.4s ease-out infinite; }
@keyframes ping { 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.hero-cta, .links, .contact-links { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; padding: 0 18px; border-radius: 6px;
  border: 1px solid var(--line-2); font-size: 1rem; font-weight: 600; white-space: nowrap;
  transition: background-color .2s, color .2s, border-color .2s, transform .35s var(--out);
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: var(--fg); transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-fill { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-fill:hover { border-color: var(--accent); }

/* ─── Project cases ─── */
.case { --c: var(--lime); }
#elm { --c: var(--orange); }
#quanta { --c: var(--blue); }

.stage { position: relative; overflow: clip; background: var(--stage); color: #F3F4EF; padding: clamp(24px, 3.4vw, 56px) var(--g) clamp(32px, 4.4vw, 72px); }
.stage-top { position: relative; z-index: 0; display: flex; flex-direction: column-reverse; gap: clamp(12px, 1.4vw, 22px); }
.stage-tag { color: rgba(243, 244, 239, .62); }
.title { color: var(--c); font-size: 16vw; overflow: clip; padding-bottom: .05em; }
.js .title .fit-in { transform: translateY(102%); transition: transform 1.2s var(--out); }
.js .title.in .fit-in { transform: none; }

/* ReDrive stage */
.stage-rd {
  --pw: clamp(190px, 19.5vw, 340px);
  background: #101010;
  display: grid; grid-template-columns: minmax(0, 1fr) calc(var(--pw) * 1.78); column-gap: clamp(20px, 3vw, 56px);
}
.stage-rd::before {
  content: ""; position: absolute; inset: auto -10% -30% -10%; height: 70%;
  background: radial-gradient(50% 50% at 42% 60%, color-mix(in srgb, var(--lime) 15%, transparent), transparent 75%);
  pointer-events: none;
}
.stage-rd .stage-top { grid-column: 1; }
.car { grid-column: 1; position: relative; margin-top: clamp(-40px, -2vw, -10px); }
.car img { width: 100%; height: auto; mix-blend-mode: lighten; -webkit-mask-image: radial-gradient(72% 76% at 50% 52%, #000 60%, transparent 100%); mask-image: radial-gradient(72% 76% at 50% 52%, #000 60%, transparent 100%); }
.phones { grid-column: 2; grid-row: 1 / span 2; position: relative; align-self: center; height: calc(var(--pw) * 2.42); }
.phone {
  position: absolute; width: var(--pw); display: block; border-radius: calc(var(--pw) * .115); overflow: hidden;
  outline: 1px solid rgba(255, 255, 255, .18); outline-offset: -1px; box-shadow: 0 40px 90px rgba(0, 0, 0, .7);
  cursor: zoom-in;
}
.phone:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.phone img { width: 100%; height: auto; transition: transform .8s var(--out); }
.phone:hover img { transform: scale(1.025); }
.phone-b { left: 0; top: 0; }
.phone-a { right: 0; bottom: 0; }

/* Desktop window stages */
.stage-elm { background: radial-gradient(70% 60% at 40% 72%, color-mix(in srgb, var(--orange) 12%, transparent), transparent 75%), var(--stage); }
.stage-q { background: radial-gradient(70% 62% at 58% 70%, color-mix(in srgb, var(--blue) 24%, transparent), transparent 75%), #050917; }
.gallery {
  position: relative; z-index: 1; margin-top: clamp(-34px, -2.2vw, -8px);
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(170px, 16vw, 260px); gap: var(--gap); align-items: start;
}
.gallery-flip { grid-template-columns: clamp(170px, 16vw, 260px) minmax(0, 1fr); }
.shot {
  display: block; width: 100%; border-radius: 12px; overflow: hidden; cursor: zoom-in;
  outline: 1px solid rgba(255, 255, 255, .16); outline-offset: -1px; box-shadow: 0 40px 100px rgba(0, 0, 0, .65);
}
.shot:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.shot img { width: 100%; height: auto; transition: opacity .22s ease; }
.thumbs { display: grid; gap: 12px; padding-top: clamp(40px, 3.2vw, 56px); }
.thumb { display: grid; gap: 7px; text-align: left; color: rgba(243, 244, 239, .62); transition: color .2s; }
.thumb img { width: 100%; aspect-ratio: 16 / 9.6; object-fit: cover; object-position: top; border-radius: 6px; outline: 1px solid rgba(255, 255, 255, .14); outline-offset: -1px; opacity: .72; transition: opacity .2s, outline-color .2s; }
.thumb span { font: 400 .72rem/1.2 var(--mono); font-stretch: 75%; }
.thumb:hover { color: #F3F4EF; }
.thumb:hover img { opacity: 1; }
.thumb.is-on { color: var(--c); }
.thumb.is-on img { opacity: 1; outline: 2px solid var(--c); }

/* Brief under each stage */
.brief { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(32px, 4vw, 40px) var(--gap); padding: clamp(40px, 6vw, 96px) var(--g); }
.brief-claim { grid-column: 1 / 5; display: flex; flex-direction: column; gap: 26px; align-items: flex-start; }
.brief-claim h3 { font: 800 clamp(3rem, 5.2vw, 5.4rem)/.9 var(--display); text-transform: uppercase; text-wrap: balance; }
.brief-text { grid-column: 5 / 9; }
.brief-text h4 { font-weight: 400; color: var(--fg-3); margin-bottom: 8px; }
.brief-text p { text-wrap: pretty; color: var(--fg); }
.brief-text p + h4, .brief-text p + h4 + h4 { margin-top: 26px; }
.brief-text li { position: relative; padding: 6px 0 6px 20px; line-height: 1.34; }
.brief-text li::before { content: ""; position: absolute; left: 0; top: .9em; width: 11px; height: 2px; background: var(--accent-ink); }

.spec { grid-column: 9 / 13; display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--gap); align-self: start; }
.spec > div { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.spec > div:nth-child(-n+2) { grid-column: auto; flex-direction: column; justify-content: flex-start; gap: 6px; }
.spec > div:last-child { border-bottom: 1px solid var(--line); }
.spec dt { color: var(--fg-3); white-space: nowrap; }
.spec dd { font-size: 1rem; font-weight: 500; text-align: right; line-height: 1.25; }
.spec dd.big { font: 800 clamp(3.2rem, 4.6vw, 4.6rem)/.86 var(--display); text-align: left; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.spec dd.pipe { font: 400 .72rem/1.5 var(--mono); font-stretch: 75%; }

/* The wire that links ReDrive and the emulator */
.wire { padding: clamp(72px, 9vw, 140px) var(--g); border-top: 1px solid var(--line); overflow: clip; text-align: center; }
.wire-text { font: 500 clamp(2.8rem, 5.6vw, 5.8rem)/1.06 var(--serif); letter-spacing: -.02em; text-wrap: balance; max-width: 17em; margin-inline: auto; }
.wire-line { margin-top: clamp(32px, 4vw, 60px); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(12px, 2vw, 28px); }
.wire-end { display: inline-flex; align-items: center; gap: 8px; }
.wire-end::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.wire-track { container-type: inline-size; position: relative; height: 2px; background: linear-gradient(90deg, var(--lime), var(--orange)); }
.pkt { position: absolute; left: 0; white-space: nowrap; padding: 3px 7px; border-radius: 3px; transform: translateX(-50%); font-size: .68rem; color: var(--on-accent); will-change: transform, opacity; }
.pkt-tx { top: -30px; background: var(--lime); animation: tx 5s cubic-bezier(.45, .05, .55, .95) infinite; }
.pkt-rx { top: 8px; background: var(--orange); animation: rx 5s cubic-bezier(.45, .05, .55, .95) infinite; }
@keyframes tx { 0% { transform: translateX(calc(3cqw - 50%)); opacity: 0; } 6% { opacity: 1; } 44% { opacity: 1; } 50%, 100% { transform: translateX(calc(97cqw - 50%)); opacity: 0; } }
@keyframes rx { 0%, 50% { transform: translateX(calc(95cqw - 50%)); opacity: 0; } 56% { opacity: 1; } 94% { opacity: 1; } 100% { transform: translateX(calc(5cqw - 50%)); opacity: 0; } }

/* Question and answer with the emulator: nothing but the conversation */
.bench {
  --fg: #EFF1EB; --fg-2: rgba(239, 241, 235, .74); --fg-3: rgba(239, 241, 235, .46);
  color: var(--fg); padding: clamp(64px, 8vw, 120px) var(--g);
  background: radial-gradient(60% 70% at 50% 62%, color-mix(in srgb, var(--orange) 13%, transparent), transparent 72%), var(--stage);
}
.bench-head { max-width: 960px; margin: 0 auto clamp(28px, 3.6vw, 52px); text-align: center; }
.bench-head h3 { font: 800 clamp(2.8rem, 5vw, 5.2rem)/.94 var(--display); text-transform: uppercase; text-wrap: balance; }
.bench-head p { margin: 14px auto 0; max-width: 34em; color: var(--fg-2); text-wrap: balance; }
.talk { max-width: 960px; margin-inline: auto; }
.talk-log {
  --row: clamp(50px, 4.6vw, 62px);
  display: flex; flex-direction: column; justify-content: flex-end; height: calc(var(--row) * 6); margin: 0; padding: 0; list-style: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 34%); mask-image: linear-gradient(180deg, transparent, #000 34%);
}
.q-a { flex: 0 0 var(--row); display: grid; grid-template-columns: minmax(70px, 1fr) minmax(0, 2.4fr) minmax(0, 2fr); align-items: center; gap: 16px; opacity: .62; transition: opacity .5s ease; animation: q-in .5s var(--out) both; }
.q-a:last-child { opacity: 1; }
@keyframes q-in { from { transform: translateY(26px); opacity: 0; } }
.q-a code { font-size: clamp(.92rem, 1.3vw, 1.12rem); font-stretch: 75%; white-space: nowrap; }
.q-a .q { color: var(--orange); }
.q-a .a { color: var(--fg-2); }
.q-a .m { justify-self: end; font-size: clamp(1.05rem, 1.7vw, 1.5rem); font-weight: 500; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.talk-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; margin-top: clamp(20px, 2.6vw, 34px); }
.talk-keys button { padding: 8px 10px; font: 400 .82rem/1 var(--mono); font-stretch: 75%; color: var(--fg-3); transition: color .2s; }
.talk-keys button:hover { color: var(--orange); }
.talk-ask { display: flex; align-items: center; gap: 12px; max-width: 420px; margin: 14px auto 0; padding-bottom: 8px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .26) 22%, rgba(255, 255, 255, .26) 78%, transparent) 0 100% / 100% 1px no-repeat; font: 400 1rem/1 var(--mono); font-stretch: 75%; }
.talk-ask > span { color: var(--orange); }
.talk-ask input { flex: 1; min-width: 0; height: 38px; background: none; border: 0; outline: 0; color: var(--fg); font: inherit; font-size: 16px; font-stretch: 75%; text-transform: uppercase; }
.talk-ask input::placeholder { color: var(--fg-3); }
.talk-ask button { display: grid; place-items: center; width: 36px; height: 36px; color: var(--orange); transition: transform .4s var(--out); }
.talk-ask button:hover { transform: translate(2px, -2px); }
.talk-ask svg { width: 20px; height: 20px; }

/* ─── How I work: rows, everything centered on each row's axis ─── */
.sec { padding: clamp(64px, 8vw, 120px) var(--g); border-top: 1px solid var(--line); }
.sec-head { margin-bottom: clamp(28px, 4vw, 60px); }
.sec-head h2 { font: 800 clamp(3.4rem, 7.4vw, 8rem)/.9 var(--display); text-transform: uppercase; text-wrap: balance; }
.rules li { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: center; padding: clamp(22px, 2.6vw, 36px) 0; border-top: 1px solid var(--line); }
.rules li:last-child { border-bottom: 1px solid var(--line); }
.rule-n { grid-column: 1 / 2; font: 500 .9375rem/1 var(--text); color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.rules h3 { grid-column: 2 / 8; font: 800 clamp(2.3rem, 4.1vw, 4.4rem)/.94 var(--display); text-transform: uppercase; white-space: nowrap; }
.rules p { grid-column: 8 / 13; color: var(--fg-2); text-wrap: pretty; }

/* ─── What I do: three directions in the colors of the work ─── */
.dirs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.dir {
  position: relative; display: flex; flex-direction: column; min-height: clamp(340px, 33vw, 470px); padding: clamp(22px, 2.6vw, 36px); border-radius: 22px; overflow: hidden; color: #F3F4EF;
  background: radial-gradient(90% 70% at 85% 0%, color-mix(in srgb, var(--dc) 42%, transparent), transparent 72%), radial-gradient(70% 50% at 0% 100%, color-mix(in srgb, var(--dc) 14%, transparent), transparent 75%), #0D0F11;
  outline: 1px solid rgba(255, 255, 255, .1); outline-offset: -1px;
  transition: transform .6s var(--out);
}
.dir:hover { transform: translateY(-6px); }
.dir-ic { width: clamp(64px, 6.6vw, 96px); height: auto; fill: none; stroke: var(--dc); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dir h3 { margin-top: auto; font: 800 clamp(3rem, 4.8vw, 5.2rem)/.92 var(--display); text-transform: uppercase; }
.dir ul { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 16px; font-size: 1.0625rem; font-weight: 500; color: rgba(243, 244, 239, .76); }

/* ─── Contact and footer ─── */
.contact { position: relative; isolation: isolate; overflow-x: clip; overflow-y: visible; display: grid; justify-items: center; gap: 20px; padding: clamp(110px, 13vw, 200px) var(--g) clamp(48px, 6vw, 84px); text-align: center; border-top: 1px solid var(--line); }
.contact::before {
  content: ""; position: absolute; z-index: -1; left: 50%; bottom: -34%; width: min(1500px, 140vw); aspect-ratio: 2 / 1; transform: translateX(-50%); filter: blur(34px); pointer-events: none; will-change: transform;
  background:
    radial-gradient(36% 58% at 26% 56%, color-mix(in srgb, var(--lime) 46%, transparent), transparent 72%),
    radial-gradient(32% 60% at 51% 42%, color-mix(in srgb, var(--orange) 44%, transparent), transparent 72%),
    radial-gradient(36% 58% at 76% 58%, color-mix(in srgb, var(--blue) 56%, transparent), transparent 72%);
  animation: finale 12s ease-in-out infinite alternate;
}
@keyframes finale { from { transform: translateX(-53%) scale(1); } to { transform: translateX(-47%) scale(1.1); } }
.contact h2 { font: 500 clamp(3rem, 7vw, 7.2rem)/1.02 var(--serif); letter-spacing: -.022em; text-wrap: balance; }
.contact p { font-size: clamp(1.15rem, 1.5vw, 1.4rem); color: var(--fg-2); text-wrap: balance; }
.contact-links { justify-content: center; margin-top: 12px; }
.contact .btn-fill { background: var(--lime); border-color: var(--lime); color: var(--on-accent); }
.contact .btn:not(.btn-fill) { background: color-mix(in srgb, var(--bg) 40%, transparent); }
.foot { position: relative; padding: 0 var(--g) 18px; }
.bye { display: block; width: 100%; height: clamp(170px, 30vh, 320px); }
.foot-row { display: flex; justify-content: space-between; gap: 16px; padding-top: 14px; font-size: .9375rem; color: var(--fg-3); border-top: 1px solid var(--line); }
.foot-row a:hover { color: var(--fg); }

/* ═══ Colour, scale and depth. Everything here is still paint: no new motion per frame. ═══ */
.case { --ci: var(--lime-ink); }
#elm { --ci: var(--orange-ink); }
#quanta { --ci: var(--blue-ink); }

/* Each project is its own colour scene */
/* The car picture is opaque, so the light lies over it instead of behind: no box around the car. */
.stage-rd { background: #101010; }
.stage-rd::before { display: none; }
.stage-rd .car { z-index: 1; }
.stage-rd .phones { z-index: 2; }

/* No hard edges: every coloured block melts into the one next to it. */
.stage { --seam: clamp(90px, 11vw, 170px); padding-bottom: calc(var(--seam) + 8px); }
.stage::after { content: ""; position: absolute; inset: auto 0 0; height: var(--seam); background: linear-gradient(180deg, transparent, var(--bg)); pointer-events: none; }
.stage-elm::before, .stage-q::before { content: ""; position: absolute; inset: 0 0 auto; height: var(--seam); background: linear-gradient(180deg, var(--bg), transparent); pointer-events: none; }
.stage-q::before { background: linear-gradient(180deg, var(--stage), transparent); }
.bench { position: relative; background: radial-gradient(60% 60% at 50% 50%, color-mix(in srgb, var(--orange) 13%, transparent), transparent 72%), var(--stage); }
.bench::before { content: ""; position: absolute; inset: 0 0 auto; height: clamp(64px, 8vw, 120px); background: linear-gradient(180deg, var(--bg), transparent); pointer-events: none; }
.car img { -webkit-mask-image: none; mask-image: none; }

/* One large screenshot, and a quiet switch of screens under it */
.gallery, .gallery-flip { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: clamp(18px, 2vw, 28px); }
.gallery .shot { max-width: 1240px; }
.gallery-flip .thumbs { order: 2; }
.thumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 5px; border-radius: 99px; background: rgba(255, 255, 255, .07); }
.thumb { display: block; }
.thumb img { display: none; }
.thumb span { display: block; padding: 10px 18px; border-radius: 99px; font: 500 .9375rem/1 var(--text); font-stretch: normal; transition: background-color .25s, color .25s; }
.thumb.is-on span { background: var(--c); color: #0A0B0C; }
.stage-elm { background: radial-gradient(64% 62% at 40% 70%, color-mix(in srgb, var(--orange) 30%, transparent), transparent 74%), radial-gradient(40% 40% at 96% 8%, color-mix(in srgb, var(--orange) 14%, transparent), transparent 70%), var(--stage); }
.stage-q { background: radial-gradient(64% 62% at 60% 70%, color-mix(in srgb, var(--blue) 42%, transparent), transparent 74%), radial-gradient(40% 40% at 4% 8%, color-mix(in srgb, var(--blue) 20%, transparent), transparent 70%), #050917; }
.phone { outline: 0; box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 110px color-mix(in srgb, var(--c) 26%, transparent); }
.shot { outline: 0; border-radius: 16px; box-shadow: 0 40px 100px rgba(0, 0, 0, .6), 0 0 160px color-mix(in srgb, var(--c) 30%, transparent); }
.thumb img { border-radius: 10px; outline: 0; }
.thumb.is-on img { outline: 2px solid var(--c); }

/* Brief: a poster, not a table */
.brief { background: radial-gradient(40% 60% at 100% 50%, color-mix(in srgb, var(--c) 11%, transparent), transparent 72%); }
.brief-claim h3 { font-size: clamp(3rem, 4.7vw, 5rem); }
.brief-claim h3 em, .bench-head h3 em { font-style: normal; color: var(--ci); }
.bench-head h3 em { color: var(--orange); }
.spec > div { border-top-color: transparent; background: linear-gradient(90deg, var(--line), var(--line)) 0 0 / 100% 1px no-repeat; }
.spec > div:nth-child(-n+2) { background: none; padding-bottom: 22px; }
.spec > div:last-child { border-bottom-color: transparent; }
.spec dd.big { font-size: clamp(4.6rem, 7.4vw, 8rem); line-height: .8; color: var(--ci); }
.brief-text h4 { font: 800 1.5rem/1 var(--display); text-transform: uppercase; letter-spacing: .02em; color: var(--ci); }
.brief-text li::before { background: var(--ci); height: 2px; }

/* Buttons: solid, round, and they glow in the project's colour */
.btn { min-height: 50px; padding: 0 24px; border: 0; border-radius: 99px; background: var(--bg-3); transition: background-color .25s, color .25s, box-shadow .35s, transform .35s var(--out); }
.btn:hover { background: color-mix(in srgb, var(--fg) 13%, var(--bg-3)); transform: translateY(-3px); }
.btn-fill { background: var(--c, var(--accent)); color: var(--on-accent); }
.btn-fill:hover { background: var(--c, var(--accent)); box-shadow: 0 14px 38px color-mix(in srgb, var(--c, var(--accent)) 46%, transparent); }
.contact .btn-fill:hover { box-shadow: 0 14px 38px color-mix(in srgb, var(--lime) 46%, transparent); }
.btn svg { transition: transform .35s var(--out); }
.btn:hover svg:last-child { transform: translate(2px, -2px); }

/* The wire between the two projects */
.wire { border-top: 0; background: radial-gradient(44% 60% at 12% 50%, color-mix(in srgb, var(--lime) 12%, transparent), transparent 72%), radial-gradient(44% 60% at 88% 50%, color-mix(in srgb, var(--orange) 14%, transparent), transparent 72%); }
.wire-text em { font-style: italic; color: var(--orange-ink); }
.wire-track { height: 3px; border-radius: 3px; box-shadow: 0 0 22px color-mix(in srgb, var(--orange) 50%, transparent); }
.wire-end { font-weight: 600; }
.pkt { padding: 4px 9px; border-radius: 99px; font-weight: 500; }
.pkt-tx { top: -34px; }
.pkt-rx { top: 10px; }

/* Sections */
.sec { border-top: 0; }
.sec-head h2 em { font-style: normal; color: var(--lime-ink); }
#stack .sec-head h2 em { color: var(--orange-ink); }
.rules li:nth-child(1) { --rc: var(--lime-ink); }
.rules li:nth-child(2) { --rc: var(--orange-ink); }
.rules li:nth-child(3) { --rc: var(--blue-ink); }
.rule-n { font: 800 clamp(2.3rem, 4.1vw, 4.4rem)/.94 var(--display); color: var(--rc); }
.rules h3 { transition: color .35s ease, transform .6s var(--out); }
.rules li:hover h3 { color: var(--rc); transform: translateX(12px); }

/* Directions */
.dir { outline: 0; border-radius: 28px; background: radial-gradient(95% 75% at 88% 0%, color-mix(in srgb, var(--dc) 58%, transparent), transparent 72%), radial-gradient(70% 55% at 0% 100%, color-mix(in srgb, var(--dc) 20%, transparent), transparent 75%), #0D0F11; transition: transform .6s var(--out), box-shadow .6s ease; }
.dir:hover { transform: translateY(-8px); box-shadow: 0 30px 80px color-mix(in srgb, var(--dc) 26%, transparent); }
.dir h3 { color: var(--dc); }
.dir li { padding: 7px 14px; border-radius: 99px; background: rgba(255, 255, 255, .09); color: #F3F4EF; font-size: 1rem; }
.dir ul { gap: 8px; margin-top: 20px; }

/* Contact */
.contact { border-top: 0; }
.foot-row { border-top-color: transparent; }

@media (max-width: 820px) {
  .rule-n { margin-bottom: 4px; }
  .rules li:hover h3 { transform: none; }
  .spec dd.big { font-size: clamp(4.6rem, 22vw, 6.4rem); }
}
/* With no mouse there is no hover: each row lights up as it scrolls into view. */
@media (hover: none) {
  .rules li.in h3 { color: var(--rc); transition-delay: .25s; }
}

/* ─── Lightbox ─── */
.lb { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(5, 6, 7, .94); color: #F3F4EF; }
.lb[open] { display: grid; place-items: center; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.lb::backdrop { background: transparent; }
.lb figure { display: grid; justify-items: center; gap: 12px; padding: 56px clamp(16px, 7vw, 96px) 20px; max-height: 100dvh; }
.lb img { max-width: 100%; max-height: calc(100dvh - 120px); width: auto; height: auto; border-radius: 10px; }
.lb figcaption { font: 400 .75rem/1.3 var(--mono); font-stretch: 75%; color: rgba(243, 244, 239, .7); }
.lb-btn { position: fixed; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 6px; background: rgba(255, 255, 255, .08); transition: background-color .2s; }
.lb-btn:hover { background: rgba(255, 255, 255, .18); }
.lb-btn svg { width: 22px; height: 22px; }
.lb-close { top: 10px; right: 10px; }
.lb-prev { left: 10px; top: 50%; margin-top: -23px; }
.lb-next { right: 10px; top: 50%; margin-top: -23px; }
.lb.single .lb-prev, .lb.single .lb-next { display: none; }

/* ─── Reveal on scroll ─── */
.js .reveal { transition: opacity .9s var(--out), transform .9s var(--out); }
.js .reveal:not(.in) { opacity: 0; transform: translateY(24px); }

/* ─── Tablet and phone ─── */
@media (max-width: 1180px) {
  .hero-foot { grid-template-columns: minmax(0, 1fr) auto; }
  .picks { grid-column: 1 / -1; grid-row: 1; padding-bottom: 0; }
}
@media (max-width: 1080px) {
  .brief-claim { grid-column: 1 / -1; }
  .brief-text { grid-column: 1 / 8; }
  .spec { grid-column: 8 / 13; }
}
@media (max-width: 820px) {
  .bar-nav { display: none; }
  .hero { height: 100svh; }   /* on a phone the first screen does not hold the scroll back */
  .hero-cap { bottom: 250px; }
  .hero-foot { grid-template-columns: minmax(0, 1fr); }
  .picks { grid-row: auto; flex-wrap: wrap; gap: 8px 16px; }
  .hero-cta { justify-self: start; }
  .stage-rd { grid-template-columns: minmax(0, 1fr); --pw: min(46vw, 230px); }
  .phones { grid-column: 1; grid-row: auto; width: calc(var(--pw) * 1.78); margin: 4px auto 0; align-self: start; }
  .car { margin-top: 8px; }
  .gallery, .gallery-flip { grid-template-columns: minmax(0, 1fr); margin-top: 10px; }
  .gallery-flip .thumbs { order: 2; }
  .thumbs { border-radius: 24px; }
  .thumb span { padding: 10px 13px; font-size: .875rem; }
  .brief-text, .spec { grid-column: 1 / -1; }
  .talk-log { --row: 60px; }
  .q-a { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; gap: 2px 14px; align-content: center; }
  .q-a .m { grid-column: 2; justify-self: start; font-size: 1rem; color: var(--fg-2); }
  .q-a .q { grid-row: 1 / span 2; }
  .rule-n { grid-column: 1 / -1; margin-bottom: 8px; }
  .rules h3, .rules p { grid-column: 1 / -1; }
  .rules h3 { white-space: normal; }
  .rules p { margin-top: 10px; }
  .dirs { grid-template-columns: minmax(0, 1fr); }
  .dir { min-height: 270px; }
  .wire-line { grid-template-columns: 1fr 1fr; row-gap: 40px; }
  .wire-track { grid-column: 1 / -1; grid-row: 2; margin-block: 8px; }
  .wire-end:last-child { justify-self: end; grid-row: 1; grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .hero { height: auto; }
  .hero-pin { position: relative; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .curtain, .hello { display: none; }
  .js .reveal:not(.in), .js .title .fit-in { opacity: 1; transform: none; }
  .pkt-tx { left: 30%; }
  .pkt-rx { left: 70%; }
}

@media print {
  .bar, .curtain, .hello, .bench, .wire-line { display: none !important; }
  .js .reveal:not(.in), .js .title .fit-in { opacity: 1; transform: none; }
}
