/* Linea Residence — 3D scroll story (ENSŌ.7) */
:root {
  --bg: #0b0b0a;
  --bg-2: #121211;
  --ink: #f3f0ea;
  --text: #b8b3aa;
  --muted: #77736b;
  --line: rgba(243, 240, 234, .14);
  --accent: #c2a579;
  --accent-2: #dcc6a0;
  --f-display: "Archivo", "Inter", system-ui, sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-serif: "Instrument Serif", "Times New Roman", serif;
  --gutter: clamp(16px, 4.2vw, 72px);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.77, 0, .175, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
body { margin: 0; font-family: var(--f-body); font-weight: 300; font-size: 16px; line-height: 1.7; background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

.d { font-family: var(--f-display); font-stretch: 125%; font-variation-settings: "wdth" 125; font-weight: 300; color: var(--ink); letter-spacing: -.05em; line-height: .92; margin: 0; text-transform: lowercase; }
.d em { font-family: var(--f-serif); font-style: italic; font-weight: 400; font-stretch: 100%; font-variation-settings: normal; letter-spacing: -.02em; text-transform: none; font-size: 1.08em; color: var(--accent-2); }
.eyebrow { display: inline-flex; align-items: center; gap: 14px; margin: 0 0 22px; font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--accent); font-weight: 400; }
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.wrap { padding-inline: var(--gutter); }

/* ---------------------------------------------------------------- header */
.hdr { position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 80px; padding-inline: var(--gutter); pointer-events: none; }
.hdr > * { pointer-events: auto; }
.hdr::before { content: ""; position: absolute; inset: 0 0 -30px; z-index: -1; pointer-events: none; background: linear-gradient(to bottom, rgba(11, 11, 10, .85), rgba(11, 11, 10, 0)); }
.hdr__logo img { height: 20px; width: auto; }
.hdr__title { font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink); }
.hdr__title span { color: var(--muted); }
.hdr__links { display: flex; gap: 28px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink); }
.hdr__links a { position: relative; }
.hdr__links a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .6s var(--ease); }
.hdr__links a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------------------------------------------------------------- loader */
.loader { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); transition: clip-path 1.1s var(--ease-io); clip-path: inset(0); }
.loader.is-done { clip-path: inset(0 0 100% 0); }
.loader__in { display: grid; justify-items: center; gap: 26px; }
@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.loader__enso { width: 120px; aspect-ratio: 360 / 373; -webkit-mask-image: conic-gradient(from 150deg, #000 var(--a), transparent var(--a)); mask-image: conic-gradient(from 150deg, #000 var(--a), transparent var(--a)); animation: paint 2.4s cubic-bezier(.6, .04, .3, 1) infinite; }
.loader__enso img { width: 100%; }
@keyframes paint { 0% { --a: 0deg; } 70%, 100% { --a: 360deg; } }
.loader__t { font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }

/* ---------------------------------------------------------------- intro */
.intro { position: relative; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: clamp(36px, 6vw, 84px); overflow: hidden; }
.intro__plan { position: absolute; inset: 0; display: grid; place-items: center; opacity: .5; }
.intro__plan img { width: min(78vh, 86vw); height: auto; animation: drift 24s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1) rotate(0deg); } to { transform: scale(1.06) rotate(-2deg); } }
.intro::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(11, 11, 10, 0) 0%, rgba(11, 11, 10, .7) 60%, var(--bg) 100%); }
.intro > .wrap { position: relative; z-index: 2; }
.intro__title { font-size: clamp(56px, 12vw, 220px); }
.intro__foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-top: clamp(28px, 4vw, 56px); flex-wrap: wrap; }
.intro__lead { max-width: 520px; margin: 0; font-size: clamp(17px, 1.5vw, 22px); line-height: 1.5; color: var(--ink); }
.intro__meta { display: flex; gap: clamp(24px, 4vw, 64px); }
.intro__meta div { display: flex; flex-direction: column; gap: 4px; }
.intro__meta dt { font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.intro__meta dd { margin: 0; font-size: 15px; color: var(--ink); }
.cue { position: absolute; left: 50%; bottom: 22px; z-index: 2; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.cue i { position: relative; width: 1px; height: 48px; background: var(--line); overflow: hidden; }
.cue i::after { content: ""; position: absolute; inset: 0; background: var(--ink); animation: drip 2.2s var(--ease-io) infinite; }
@keyframes drip { 0% { transform: translateY(-100%); } 50% { transform: none; } 100% { transform: translateY(100%); } }

/* ---------------------------------------------------------------- story (pinned 3D stage) */
.story { position: relative; height: 1400vh; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage__vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .55) 100%); }
/* arrival in reality: the render's own line drawing, then its light, then its colour */
.stage__reality { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.stage__reality img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage__reality .real { opacity: 0; will-change: opacity, filter, mask-image; }
.stage__reality .sketch { mix-blend-mode: screen; opacity: 0; will-change: opacity, mask-image; }
.stage__reality::after { content: ""; position: absolute; inset: 0; opacity: var(--shade, 0); background: linear-gradient(to top, rgba(6, 6, 5, .75), rgba(6, 6, 5, 0) 45%); }
.align .stage__reality .real { opacity: .45 !important; filter: none !important; -webkit-mask-image: none !important; mask-image: none !important; }
.align .stage__reality .sketch, .align .chapters { display: none; }
.ch__steps span { color: var(--muted); transition: color .6s; }
.ch__steps span::after { content: "→"; margin-left: 14px; color: var(--muted); }
.ch__steps span:last-child::after { content: none; }
.ch__steps span.is-on { color: var(--accent-2); }

.chapters { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.ch {
  position: absolute; left: var(--gutter); bottom: clamp(36px, 7vh, 88px); width: min(440px, calc(100vw - 2 * var(--gutter)));
  opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform 1s var(--ease);
}
.ch.is-on { opacity: 1; transform: none; }
.ch__no { display: block; font-family: var(--f-display); font-stretch: 125%; font-variation-settings: "wdth" 125; font-weight: 200; font-size: 15px; letter-spacing: .1em; color: var(--accent); margin-bottom: 18px; }
.ch__t { font-size: clamp(44px, 6vw, 104px); margin-bottom: 22px; }
.ch p { font-size: 15px; color: rgba(243, 240, 234, .82); max-width: 400px; text-shadow: 0 1px 18px rgba(0, 0, 0, .5); }
.ch__stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink); }
.ch__stats b { font-weight: 400; color: var(--accent-2); }
.ch--right { left: auto; right: var(--gutter); text-align: left; }

.rail { position: absolute; right: var(--gutter); top: 50%; z-index: 5; transform: translateY(-50%); display: flex; flex-direction: column; gap: 14px; }
.rail button { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 10px; letter-spacing: .24em; text-transform: uppercase; cursor: pointer; transition: color .5s; }
.rail button span { opacity: 0; transform: translateX(8px); transition: opacity .5s, transform .6s var(--ease); }
.rail button i { width: 18px; height: 1px; background: currentColor; transition: width .6s var(--ease), background .5s; }
.rail button:hover span, .rail button.is-on span { opacity: 1; transform: none; }
.rail button.is-on { color: var(--ink); }
.rail button.is-on i { width: 42px; background: var(--accent); }
.progress { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; height: 2px; background: rgba(243, 240, 234, .08); }
.progress i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }

.stage__fallback { display: none; position: absolute; inset: 0; background-size: cover; background-position: center; }
.no-gl #gl { display: none; }
.no-gl .stage__fallback { display: block; }

/* ---------------------------------------------------------------- after the story */
.sec { padding-block: clamp(96px, 14vw, 200px); }
.sec-head { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(12px, 1.8vw, 32px); align-items: end; margin-bottom: clamp(48px, 7vw, 110px); }
.sec-head .eyebrow { grid-column: 1 / -1; }
.sec-head .d { grid-column: 1 / span 8; font-size: clamp(42px, 7vw, 124px); }
.sec-head p { grid-column: 9 / -1; margin: 0; font-size: 15px; max-width: 420px; justify-self: end; }

.shot { position: relative; overflow: hidden; }
.shot img { width: 100%; height: 100%; object-fit: cover; will-change: transform; }
.shot--full { height: clamp(420px, 92vh, 1000px); }
.shot figcaption { position: absolute; left: var(--gutter); bottom: 24px; z-index: 2; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink); }
.shot--full::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(6, 6, 5, .55), rgba(6, 6, 5, 0) 35%); pointer-events: none; }
.pair { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(16px, 2.4vw, 40px); align-items: start; padding-block: clamp(64px, 9vw, 140px); }
.pair .shot:first-child { grid-column: 1 / span 6; aspect-ratio: 4 / 5; }
.pair .shot:last-child { grid-column: 8 / span 5; aspect-ratio: 4 / 5; margin-top: 18vh; }
.pair .shot figcaption { position: static; padding-top: 16px; color: var(--muted); }
.pair .shot { overflow: visible; }
.pair .shot > div { overflow: hidden; width: 100%; height: 100%; }

.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 40px); }
.level { border-top: 1px solid var(--line); padding-top: 24px; }
.level__plan { aspect-ratio: 1; overflow: hidden; background: #000; margin-bottom: 28px; }
.level__plan img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); transition: transform 1.4s var(--ease); }
.level:hover .level__plan img { transform: scale(1.12); }
.level__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.level__name { font-family: var(--f-display); font-stretch: 125%; font-variation-settings: "wdth" 125; font-size: clamp(24px, 2.4vw, 38px); font-weight: 300; letter-spacing: -.04em; color: var(--ink); text-transform: lowercase; }
.level__mark { font-size: 11px; letter-spacing: .2em; color: var(--accent); }
.level ul { list-style: none; margin: 0; padding: 0; }
.level li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.level li span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.level li.total { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--ink); }
.level li.total span:last-child { color: var(--accent-2); }
.total-all { margin-top: clamp(48px, 6vw, 80px); display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; }
.total-all .d { font-size: clamp(56px, 9vw, 160px); }
.total-all span { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }

.end { position: relative; padding-block: clamp(120px, 16vw, 240px); text-align: left; overflow: hidden; }
.end .d { font-size: clamp(54px, 11vw, 200px); margin-bottom: clamp(36px, 5vw, 64px); }
.end__row { display: flex; flex-wrap: wrap; gap: 14px; }
.btn { display: inline-flex; align-items: center; gap: 14px; padding: 16px 26px; border-radius: 40px; border: 1px solid rgba(243, 240, 234, .26); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink); transition: background .5s var(--ease), color .5s, border-color .5s; }
.btn:hover, .btn--solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); }
.end__enso { position: absolute; right: -6vw; top: 10%; width: clamp(260px, 36vw, 600px); opacity: .07; }
.ftr { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-block: 28px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

.rv { opacity: 0; transform: translateY(36px); transition: opacity 1.2s var(--ease), transform 1.4s var(--ease); }
.rv.is-in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .hdr__links { display: none; }
  .hdr__title { display: none; }
  .rail { display: none; }
  .ch { bottom: 28px; }
  .ch p { font-size: 14px; }
  .sec-head .d, .sec-head p { grid-column: 1 / -1; }
  .sec-head p { justify-self: start; margin-top: 24px; }
  .pair { display: flex; flex-direction: column; gap: 32px; }
  .pair .shot:last-child { margin-top: 0; }
  .levels { grid-template-columns: 1fr; gap: 64px; }
  .intro__meta { gap: 24px; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .rv { opacity: 1; transform: none; }
}
