/* ============================================================
   Homepage v2 — motion + imagery personality layer
   Grid homepage + shared nav/footer. Builds on colors_and_type.css.
   Boldness ~5: restrained editorial DNA, richer motion + bigger media.
   ============================================================ */

:root {
  /* motion intensity multiplier — driven by the Tweaks panel */
  --mo: 1;
  --reveal-dur: calc(var(--dur-reveal) * var(--mo));
  --stage-cap: 1680px;
}

html, body { overflow-x: clip; }
body { background: var(--paper); transition: background-color 620ms var(--ease-in-out); }

/* intro opens inverted — void canvas, paper type — and flips back to paper
   as the third beat lands. tokens swap so nav + intro move together. */
html.intro-dark {
  --paper: #0B0B0B;
  --ink: #F4F1EC;
  --ink-mute: rgba(244, 241, 236, 0.55);
  --rule: rgba(244, 241, 236, 0.20);
}
html.intro-dark body { background: #0B0B0B; }
.intro, .intro .intro-row .w, .intro-lbl, .intro-sub, .intro-foot,
.nav, .nav-mark, .nav-links a, .nav-meta {
  transition: background-color 620ms var(--ease-in-out),
              color 620ms var(--ease-in-out),
              border-color 620ms var(--ease-in-out);
}

.page {
  max-width: var(--stage-cap);
  margin: 0 auto;
  padding: 0 var(--margin);
}
.bleed { width: 100vw; margin-left: calc(50% - 50vw); }
@media (max-width: 720px) { .page { padding: 0 20px; } }

/* ---------- scroll intro ---------- */
.intro { position: relative; height: 240vh; background: var(--paper); }
html.intro-dark .intro { background: #0B0B0B; }
/* nav stays out of the way until the intro resolves (space is held, so the
   sticky stage height doesn't jump) */
html.intro-dark .nav { opacity: 0; pointer-events: none; }
.nav { opacity: 1; transition: opacity 620ms var(--ease-in-out); }
.intro-stage {
  position: sticky; top: 0; height: calc(100vh - var(--intro-nav, 88px));
  display: grid; grid-template-rows: 1fr auto; align-items: center;
  max-width: var(--stage-cap); margin: 0 auto; padding: 0 var(--margin);
  box-sizing: border-box; overflow: hidden;
}
.intro-inner { position: relative; height: 100%; min-height: 0; }
.intro-beat {
  position: absolute; left: 0; top: 50%; width: 100%;
  transform: translateY(-50%);
  will-change: opacity, transform;
}
.intro-lbl {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-mute); margin-bottom: 18px;
}
.intro-type { display: flex; flex-direction: column; gap: 10px; }
.intro-row {
  /* sized against BOTH axes so the beat always fits the stage row */
  --fs: max(42px, min(11.5vw, 15vh, 188px));
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: 0 0.16em; line-height: normal;
}
.intro-row .w {
  font-size: var(--fs); line-height: 0.98;
  letter-spacing: -0.03em; color: var(--ink); display: block;
}
.intro-row .f-serif { font-family: var(--font-serif); font-weight: 400; }
.intro-row .f-serif-i { font-family: var(--font-serif); font-weight: 400; font-style: italic; }
.intro-row .f-grot {
  font-family: var(--font-grotesk); font-weight: 700;
  letter-spacing: -0.045em; font-size: calc(var(--fs) * 0.9);
}
.intro-row .f-arch {
  font-family: var(--font-sans-alt); font-weight: 500;
  letter-spacing: -0.035em; font-size: calc(var(--fs) * 0.78);
}
.intro-row .accent { color: var(--accent); }
.intro-row .g { display: inline-block; }
html.anim-ready .intro-row .g { animation: intro-glyph calc(var(--dur-slow) * var(--mo)) var(--ease-out) both; }
@keyframes intro-glyph { from { opacity: 0; } to { opacity: 1; } }
.intro-row .sm { font-size: calc(var(--fs) * 0.38); font-weight: 400; }
.intro-sub {
  font-family: var(--font-sans); font-size: 15px; line-height: 1.5;
  color: var(--ink-mute); margin: 26px 0 0; max-width: 46ch;
}
.intro-foot {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 24px; padding-bottom: 34px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-mute);
}
.intro-cue { animation: intro-cue 2.4s var(--ease-in-out) infinite; }
@keyframes intro-cue { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.intro-skip { color: var(--ink-mute); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
.intro-skip:hover { color: var(--accent); }
.intro-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--rule); }
.intro-bar i { display: block; height: 100%; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); }
@media (max-width: 720px) {
  .intro { height: 220vh; }
  .intro-row { --fs: max(32px, min(15vw, 11vh, 84px)); }
}

/* ---------- shared reveal system ----------
   Resting state is VISIBLE — safe for print, PDF, no-JS and throttled contexts.
   The hidden-first entrance only applies once <html> has .anim-ready, which an
   inline head script adds optimistically and a watchdog removes if rAF never
   fires (i.e. animations can't run) so content is never stuck invisible. */
.reveal, .rise, .wipe { opacity: 1; transform: none; clip-path: none; }

html.anim-ready .reveal { opacity: 0; transform: translateY(20px); }
html.anim-ready .reveal.in { animation: rv-fade var(--reveal-dur) var(--ease-out) both; }
html.anim-ready .rise { opacity: 0; transform: translateY(40px); }
html.anim-ready .rise.in { animation: rv-rise var(--reveal-dur) var(--ease-out) both; }
html.anim-ready .wipe { clip-path: inset(0 0 100% 0); }
html.anim-ready .wipe.in { animation: rv-wipe calc(var(--reveal-dur) * 1.1) var(--ease-in-out) both; }

@keyframes rv-fade { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes rv-rise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes rv-wipe { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

@media (prefers-reduced-motion: reduce), print {
  html.anim-ready .reveal, html.anim-ready .rise, html.anim-ready .wipe {
    opacity: 1 !important; transform: none !important; clip-path: none !important; animation: none !important;
  }
}

/* ============================================================
   NAV  (shared)
   ============================================================ */
.nav {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 24px 0 22px; border-bottom: 1px solid var(--rule);
}
.nav-mark {
  font-family: var(--font-serif); font-style: italic; font-size: 22px;
  letter-spacing: -0.02em; color: var(--ink); white-space: nowrap;
}
.nav-links { display: flex; gap: 36px; font-size: 14px; }
.nav-links a { color: var(--ink-mute); position: relative; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -3px; height: 1px;
  background: var(--ink); transition: right var(--dur-base) var(--ease-out);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { right: 0; }
.nav-links a.is-active { color: var(--ink); }
.nav-links a.is-active::after { right: 0; background: var(--accent); }
.nav-meta {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-mute);
}

/* ============================================================
   FOOTER (shared)
   ============================================================ */
.footer {
  border-top: 1px solid var(--rule); padding: 56px 0 32px;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-top: 64px;
}
.footer-mark { font-family: var(--font-serif); font-style: italic; font-size: 34px; letter-spacing: -0.02em; }
.footer-col-title { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 12px; }
.footer-col a { display: block; font-size: 14px; color: var(--ink); padding: 4px 0; width: max-content; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  grid-column: 1 / -1; display: flex; justify-content: space-between; padding-top: 32px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute);
}

/* ============================================================
   DIRECTION B — GRID+
   ============================================================ */
.gp-featured {
  position: relative; background: var(--void); overflow: hidden;
  border-bottom: 1px solid var(--rule); min-height: min(82vh, 820px);
  display: flex; align-items: flex-end;
}
.gp-featured > video, .gp-featured > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
/* An iframe can't crop itself, so a Vimeo background needs the oversize-and-centre
   trick. A real <video> does it properly with object-fit, so it just fills the
   banner box — sizing it to 100vw tall made it overflow and show a thin middle
   slice of the frame instead. */
.gp-featured > iframe.gp-feat-video {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 100vw; height: calc(100vw * 16 / 9);
  min-width: 100%; min-height: 100%;
  border: 0; z-index: 0; pointer-events: none;
}
/* !important because video-resizing browser extensions force their own width,
   height and transform onto every <video> on the page, which squashes this one
   into a narrow strip and leaves the poster showing around it. */
.gp-featured > video.gp-feat-video {
  position: absolute !important; inset: 0 !important;
  width: 100% !important; height: 100% !important;
  object-fit: cover !important; object-position: center !important;
  transform: none !important; max-width: none !important; max-height: none !important;
  border: 0; z-index: 0; pointer-events: none;
}
.gp-featured::after { content:""; position:absolute; inset:0; z-index: 1; background:
  linear-gradient(to top, rgba(10,7,6,0.86), rgba(10,7,6,0.10) 58%, rgba(10,7,6,0.30)),
  linear-gradient(to right, rgba(10,7,6,0.62), rgba(10,7,6,0.12) 46%, rgba(10,7,6,0) 70%); }
.gp-feat-inner { position: relative; z-index: 2; width: 100%; max-width: var(--stage-cap); margin: 0 auto; padding: 0 var(--margin) 52px; }
.gp-kicker { display:flex; gap:14px; align-items:center; flex-wrap:wrap; font-family: var(--font-mono); font-size:11px; letter-spacing:.08em; text-transform:uppercase; color: var(--on-void); margin-bottom: 20px; }
.gp-kicker b { color: var(--paper-pure); font-weight: 500; }
.gp-kicker .dot { width:4px; height:4px; background: var(--accent); border-radius:999px; }
@font-face { font-family: 'Sino Sans'; src: url('../fonts/SinoSans-Regular.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
.gp-feat-title { font-family: 'Sino Sans', var(--font-sans); font-style: normal; font-weight: 400; font-size: clamp(28px, 6.4vw, 132px); line-height: .9; letter-spacing: -0.03em; color: var(--paper-pure); white-space: nowrap; }
.gp-feat-lead { margin-top: 20px; max-width: 52ch; font-size: 17px; line-height: 1.5; color: var(--on-void); }
.gp-feat-row { margin-top: 26px; display: flex; align-items: baseline; gap: 28px; flex-wrap: wrap; }
.gp-feat-cta { display:inline-flex; gap:10px; align-items:baseline; font-family: var(--font-mono); font-size:12px; letter-spacing:.08em; text-transform:uppercase; color: var(--paper-pure); border-bottom: 1px solid var(--paper-pure); padding-bottom: 5px; transition: gap var(--dur-base) var(--ease-out); }
.gp-feat-cta:hover { gap: 18px; }
.gp-feat-meta { font-family: var(--font-mono); font-size:11px; letter-spacing:.08em; text-transform:uppercase; color: var(--on-void); display:flex; gap:18px; flex-wrap:wrap; }

.gp-head {
  display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: end;
  padding: 64px 0 36px; border-bottom: 1px solid var(--rule);
}
.gp-head h1 { font-family: var(--font-serif); font-size: clamp(48px, 6vw, 100px); line-height: .94; letter-spacing: -0.03em; font-weight: 400; }
.gp-head h1 em { font-style: italic; }
.gp-head .side { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding-bottom: 12px; }
.gp-head .side .lbl { font-family: var(--font-mono); font-size:10px; letter-spacing:.08em; text-transform:uppercase; color: var(--ink-mute); margin-bottom: 8px; }
.gp-head .side p { font-size: 14px; line-height: 1.45; color: var(--ink-soft); }

.gp-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; padding: 36px 0 0; }
.gp-tile {
  position: relative; overflow: hidden; background: var(--paper-soft); cursor: pointer; display: block;
  border: 1px solid var(--rule); box-sizing: border-box; min-width: 0;
}
.gp-tile.s-wide { grid-column: span 4; aspect-ratio: 16 / 10; }
.gp-tile.s-tall { grid-column: span 2; aspect-ratio: 3 / 4; }
.gp-tile.s-half { grid-column: span 3; aspect-ratio: 4 / 3; }
.gp-tile.s-full { grid-column: span 6; aspect-ratio: 21 / 9; }
.gp-tile .media { position: absolute; inset: 0; }
.gp-tile .media img, .gp-tile .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1200ms var(--ease-out); }
.gp-tile .media video { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; object-fit: cover !important; transform: none !important; max-width: none !important; max-height: none !important; }
.gp-tile .media video { opacity: 0; transition: opacity 500ms var(--ease-out); }
.gp-tile.dark { background: #000; }
.gp-tile:hover .media img { transform: scale(1.04); }
.gp-tile:hover .media video { opacity: 1; }
.gp-tile[data-fit="contain"] .media img, .gp-tile[data-fit="contain"] .media video { object-fit: contain !important; }
.gp-tile[data-fit="contain"]:hover .media img { transform: none; }
.gp-tile .hv-embed { position: absolute; top: 50%; left: 50%; width: 100%; height: 100%; transform: translate(-50%, -50%) scale(1.16); border: 0; pointer-events: none; }
.gp-tile .hv-flip { background: #0b0b0b; perspective: 1600px; }
.gp-tile .hv-flip img { object-fit: cover; transform-origin: left center; transition: transform 780ms var(--ease-out), opacity 240ms linear; backface-visibility: hidden; }
.gp-tile:hover .hv-flip img { transform: none; }
.gp-tile:hover .hv-flip img.live { animation: flip-zoom 1400ms var(--ease-out) both; }
@keyframes flip-zoom { from { transform: scale(1.02); } to { transform: scale(1.16); } }
.gp-tile .hv-flip img.turned, .gp-tile:hover .hv-flip img.turned { transform: rotateY(-168deg); opacity: 0; }
.gp-tile .scrim, .gp-tile .tick, .gp-tile .cap { pointer-events: none; }
.gp-tile .scrim { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.62), transparent 52%); opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.gp-tile:hover .scrim { opacity: 1; }
.gp-tile .tick { position: absolute; top: 14px; left: 16px; font-family: var(--font-mono); font-size: 10px; letter-spacing:.08em; text-transform:uppercase; color: var(--paper); opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.gp-tile:hover .tick { opacity: .9; }
.gp-tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 18px 18px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px 16px; color: var(--paper); opacity: 0; transform: translateY(8px); transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
.gp-tile:hover .cap { opacity: 1; transform: none; }
.gp-tile .cap .t { grid-column: 1 / -1; font-family: var(--font-serif); font-style: italic; font-size: clamp(26px, 2.4vw, 40px); line-height: 1; letter-spacing: -0.02em; color: var(--paper-pure); }
/* each tile title in its project's own face */
@font-face { font-family: 'Osiris'; src: url('../fonts/Osiris.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Casta Thin'; src: url('../fonts/CASTA-THIN.OTF') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alphacorsa'; src: url('../fonts/Alphacorsa-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
.gp-tile[data-screen-label="tile/axis"] .cap .t { font-family: 'Osiris', var(--font-serif); font-style: normal; letter-spacing: -0.03em; }
.gp-tile[data-screen-label="tile/pestilence"] .cap .t { font-family: 'Casta Thin', var(--font-serif); font-style: normal; letter-spacing: 0; text-transform: uppercase; }
.gp-tile[data-screen-label="tile/sip-of-self"] .cap .t { font-family: 'Sino Sans', var(--font-sans); font-style: normal; letter-spacing: -0.03em; }
.gp-tile .cap .d { font-family: var(--font-mono); font-size: 10px; letter-spacing:.08em; text-transform:uppercase; }
.gp-tile .cap .y { font-family: var(--font-mono); font-size: 10px; letter-spacing:.08em; text-transform:uppercase; text-align: right; }
@media (max-width: 920px) {
  .gp-head { grid-template-columns: 1fr; gap: 22px; padding: 36px 0 24px; }
  .gp-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .gp-tile.s-wide, .gp-tile.s-tall, .gp-tile.s-half, .gp-tile.s-full { grid-column: span 2; aspect-ratio: 4 / 3; }
  .gp-tile .cap, .gp-tile .scrim, .gp-tile .tick { opacity: 1; transform: none; }
}

/* ---------- PHONE ---------- */
@media (max-width: 720px) {
  .nav { padding: 18px 0 16px; }
  .nav-meta { display: none; }
  .nav-links { gap: 22px; }
  .footer { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer > div:first-child { grid-column: 1 / -1; }
  .footer-bottom { flex-wrap: wrap; gap: 10px 24px; }
}
@media (max-width: 600px) {
  .gp-grid { grid-template-columns: 1fr; gap: 14px; padding-top: 26px; }
  .gp-tile.s-wide, .gp-tile.s-tall, .gp-tile.s-half, .gp-tile.s-full { grid-column: span 1; aspect-ratio: 4 / 3; }
  .gp-tile[data-fit="contain"] { aspect-ratio: 3 / 4; }
  .gp-featured { min-height: min(76vh, 620px); }
  .gp-feat-inner { padding-bottom: 36px; }
  .gp-feat-lead { font-size: 15px; }
  .footer { grid-template-columns: 1fr; gap: 26px; }
}
