/* Chosen Systems home — dark editorial (layout after lorenzolottici.it), studio tokens in dark mode */
:root {
  --bg: oklch(0.13 0.006 140);
  --bg-2: oklch(0.17 0.008 140);
  --ink: oklch(0.95 0.008 140);
  --muted: oklch(0.72 0.012 140);
  --line: oklch(0.32 0.012 140);
  --moss: oklch(0.72 0.12 140);
  --amber: oklch(0.86 0.12 85);
  --seal: #c8281e;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Newsreader", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: clamp(16px, 3.4vw, 48px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--amber); outline-offset: 4px; border-radius: 2px; }

.skip {
  position: absolute; left: var(--gutter); top: -60px; z-index: 50;
  background: var(--ink); color: var(--bg); padding: 8px 14px; font-weight: 600;
}
.skip:focus { top: 12px; }

/* ---- world ---- */
#world, .world-fallback {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0;
}
#world { display: block; }
.world-fallback {
  display: none;
  background:
    radial-gradient(60% 40% at 70% 62%, oklch(0.62 0.11 75 / .55), transparent 70%),
    linear-gradient(to bottom, oklch(0.16 0.01 140), oklch(0.24 0.04 110) 58%, oklch(0.12 0.02 140) 59%);
}
.no-webgl #world { display: none; }
.no-webgl .world-fallback { display: block; }

/* ---- header (Lottici: mark top-left, stacked uppercase nav top-right) ---- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: clamp(20px, 3.4vw, 48px) var(--gutter) 0;
  pointer-events: none;
  transition: background .5s var(--ease), padding .5s var(--ease);
}
.top.solid {
  padding-top: 16px; padding-bottom: 16px;
  background: linear-gradient(to bottom, oklch(0.13 0.006 140 / .96), oklch(0.13 0.006 140 / .82));
  backdrop-filter: blur(8px);
  pointer-events: auto;
}
.top > * { pointer-events: auto; }
.brand img { width: 40px; height: 40px; }
.nav {
  display: grid; grid-template-columns: repeat(2, auto); gap: 4px 36px;
  font-size: .95rem; font-weight: 600; text-transform: uppercase; letter-spacing: .01em;
}
.nav a { position: relative; padding: 2px 0; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease);
}
.nav a:hover::after { transform: scaleX(1); }
.nav-cta { color: var(--amber); }

/* ---- hero (pinned while the camera crosses the ridges) ---- */
.hero { position: relative; z-index: 1; height: 260vh; }
.hero-pin {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: grid; grid-template-rows: auto 1fr auto auto;
  padding: calc(clamp(20px, 3.4vw, 48px) + 72px) var(--gutter) clamp(24px, 3.4vw, 48px);
}
.hero-label {
  margin: 0; font-size: .95rem; font-weight: 600; text-transform: uppercase; line-height: 1.45;
}
.hero-label span { color: var(--muted); }
.hero-title {
  align-self: end;
  margin: 0 0 clamp(16px, 2.4vw, 28px);
  font-size: clamp(2.6rem, 6.4vw, 6.2rem);
  font-weight: 600; line-height: .95; letter-spacing: -.035em; text-transform: uppercase;
  text-wrap: balance;
}
.hero-title .line { display: block; }
.hero-note {
  max-width: 40ch; margin: 0 0 clamp(28px, 4vw, 56px);
  color: var(--muted); font-size: 1.02rem;
}
.hero-note em {
  display: block; margin-bottom: 6px;
  font-family: var(--font-serif); font-style: italic; font-size: 1.3rem; color: var(--ink);
}
.hero-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding-top: 18px;
  border-top: 1px solid oklch(0.95 0 0 / .28);
  font-size: .95rem; font-weight: 600; text-transform: uppercase;
}
.foot-hint { margin: 0; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.hint-bar { width: 44px; height: 1px; background: oklch(0.95 0 0 / .25); position: relative; overflow: hidden; }
.hint-bar::after {
  content: ""; position: absolute; inset: 0; background: var(--amber);
  transform: scaleX(var(--p, 0)); transform-origin: left;
}
[data-depth] { will-change: transform, opacity; }

/* ---- sections (opaque, slide over the world) ---- */
.section {
  position: relative; z-index: 2; background: var(--bg);
  padding: clamp(80px, 12vw, 180px) var(--gutter);
}
.work { border-top: 1px solid var(--line); box-shadow: 0 -60px 120px oklch(0.13 0.006 140 / .9); }
.section-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px;
  margin-bottom: clamp(40px, 6vw, 88px);
}
.eyebrow {
  margin: 0; font-family: var(--font-mono); font-size: .8rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
h2 {
  margin: 0; font-size: clamp(2rem, 4.2vw, 3.9rem); font-weight: 600;
  line-height: 1; letter-spacing: -.03em; text-transform: uppercase; text-wrap: balance;
}
h3 { margin: 0; font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; }

/* work grid */
.work-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px);
}
.card--wide { grid-column: span 2; }
.card a, .card-inner { display: block; }
.card figure {
  margin: 0; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-2);
  border: 1px solid var(--line);
}
.work-grid { align-items: start; }
.card--wide figure { aspect-ratio: 2.3 / 1; }
@media (max-width: 960px) { .card--wide figure { aspect-ratio: 16 / 10; } }
.card img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center;
  transition: transform 1.1s var(--ease), filter .6s var(--ease);
  filter: saturate(.85);
}
.card a:hover img { transform: scale(1.035); filter: saturate(1); }
.card figure { position: relative; }
.clip { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.clip-toggle {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  font: 500 .72rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink); background: oklch(0.13 0.006 140 / .78); border: 1px solid oklch(0.95 0 0 / .22);
  padding: 7px 10px; cursor: pointer; backdrop-filter: blur(6px);
  opacity: .0; transition: opacity .3s var(--ease);
}
.card:hover .clip-toggle, .clip-toggle:focus-visible, .clip-toggle[aria-pressed="true"] { opacity: 1; }
.clip-toggle:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
@media (hover: none) { .clip-toggle { opacity: 1; } }
.card-meta {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: start;
  padding-top: 14px;
}
.card-meta p { margin: 0; grid-column: 1; color: var(--muted); font-size: .92rem; }
.tag {
  grid-column: 2; grid-row: 1 / span 2;
  font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  padding: 4px 8px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.tag--live { color: var(--moss); border-color: oklch(0.72 0.12 140 / .45); }

.type-tile {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  padding: clamp(18px, 2vw, 28px);
  background:
    radial-gradient(80% 70% at 85% 10%, oklch(0.42 0.1 140 / .35), transparent 70%),
    var(--bg-2);
}
.type-tile--kids { background: radial-gradient(80% 70% at 85% 10%, oklch(0.86 0.12 85 / .18), transparent 70%), var(--bg-2); }
.type-tile--dispatch { justify-content: center; gap: 4px; font-family: var(--font-mono); }
.tt-big { font-size: clamp(2.2rem, 3.6vw, 3.4rem); font-weight: 600; letter-spacing: -.04em; text-transform: uppercase; line-height: 1; }
.tt-k { font-size: .72rem; color: var(--amber); letter-spacing: .08em; }
.tt-v { font-size: .9rem; color: var(--muted); }
.type-tile--dispatch .tt-v { color: var(--ink); margin-bottom: 10px; }

/* services */
.svc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.svc-grid article { padding: 28px 28px 8px 0; }
.svc-grid article + article { padding-left: 28px; border-left: 1px solid var(--line); }
.svc-grid p { color: var(--muted); max-width: 36ch; }

/* process */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.steps li { border-top: 1px solid var(--line); padding-top: 20px; }
.step-n { font-family: var(--font-mono); font-size: .8rem; color: var(--amber); }
.steps h3 { margin: 18px 0 8px; }
.steps p { margin: 0; color: var(--muted); font-size: .95rem; }

/* contact */
.contact { padding-bottom: clamp(60px, 8vw, 120px); }
.contact h2 { margin-top: 24px; font-size: clamp(2.4rem, 6.4vw, 6.2rem); line-height: .95; }
.contact h2 a { transition: color .4s var(--ease); }
.contact h2 a:hover { color: var(--amber); }
.contact-sub { margin: 28px 0 0; color: var(--muted); font-family: var(--font-mono); font-size: .85rem; }

.foot {
  position: relative; z-index: 2; background: var(--bg);
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px var(--gutter); border-top: 1px solid var(--line);
  font-size: .85rem; color: var(--muted); text-transform: uppercase; font-weight: 600;
}
.foot p { margin: 0; }
.foot-seal { display: flex; align-items: center; gap: 8px; color: var(--seal); }

/* reveal */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---- responsive ---- */
@media (max-width: 960px) {
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card--wide { grid-column: span 2; }
  .card--wide figure { aspect-ratio: 16 / 10; height: auto; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .nav { grid-template-columns: auto; gap: 2px; text-align: right; font-size: .85rem; }
  .nav a:nth-child(2), .nav a:nth-child(3) { display: none; }
  .hero-label { font-size: .85rem; }
  .section-head { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; }
  .card--wide { grid-column: auto; }
  .svc-grid { grid-template-columns: 1fr; }
  .svc-grid article, .svc-grid article + article { padding: 24px 0 8px; border-left: 0; }
  .svc-grid article + article { border-top: 1px solid var(--line); }
  .steps { grid-template-columns: 1fr; }
  .hero { height: 200vh; }
  .foot-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero { height: auto; }
  .hero-pin { position: relative; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card img { transition: none; }
}

/* stretched title link: whole card clickable, pause button stays on top */
.card-inner { position: relative; }
.stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.stretch:focus-visible { outline: none; }
.stretch:focus-visible::after { outline: 2px solid var(--amber); outline-offset: 4px; }
.card:has(.stretch):hover h3 { color: var(--amber); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* WebHub typography rule: headers Newsreader italic, body/UI Inter */
h1, h2, h3, .hero-title, .tt-big {
  font-family: var(--font-serif); font-style: italic; font-weight: 400;
  text-transform: none; letter-spacing: -0.02em;
}
.hero-title { font-size: clamp(3rem, 7.4vw, 7.2rem); line-height: .92; }
h2 { line-height: 1.02; }
.contact h2 { font-size: clamp(2.8rem, 7.2vw, 7rem); }
h3 { font-size: 1.4rem; letter-spacing: -0.01em; }
