/* ThatFridge site-wide styles: tokens, nav, dark scene header, side index + panel layout, footer.
   Loaded by every page. Landing extras live in home.css, legal/support pages in doc.css.
   Warm editorial system: cream paper, near-black ink, one serif-italic accent per heading. */

/* Self-hosted fonts (SIL OFL 1.1; licences in /assets/fonts/). No third-party requests, so
   visitors' IPs never reach Google. Inter Tight is one variable file for 400-700. */
@font-face {
  font-family: "Inter Tight"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/assets/fonts/inter-tight-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter Tight"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/assets/fonts/inter-tight-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/instrument-serif-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/instrument-serif-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #f4eee3;
  --paper-2: #ebe3d3;
  --paper-3: #e4ddd0;
  --nav: #fffdf8;
  --ink: #1b1916;
  --ink-2: #57504a;
  --ink-3: #645c55;
  --line: rgba(27, 25, 22, 0.14);
  --accent: #8f5319;
  --night: #15110d;
  --night-2: #0d1116;

  /* Crew colors: bright values from the app for fills/dots, dark values for text on cream. */
  --guardian: #ff5f56;   --guardian-ink: #b3261e;
  --organizer: #3d6fe0;  --organizer-ink: #2a53b3;
  --chef: #f5a623;       --chef-ink: #8a5600;
  --shopkeeper: #39e07f; --shopkeeper-ink: #16723d;

  --sans: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }
/* Lenis takes over smoothing when it runs; native smooth-scroll would fight it. */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
em.s { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 5px var(--nav); border-radius: 2px; }
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--nav); padding: 10px 14px; text-decoration: none;
}
.skip:focus { top: 16px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 20px;
  background: var(--ink); color: var(--nav);
  font: 600 15px/1 var(--sans); letter-spacing: -0.005em;
  text-decoration: none; border-radius: 999px;
  transition: transform 200ms var(--ease), background-color 200ms var(--ease);
}
.btn:hover { background: #000; transform: translateY(-1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; }

/* ---------- Page transitions (see transitions.js) ----------
   "Continuous scene": every page opens on the same pixel scene, so instead of swapping pages the
   scene, the title card and the nav are shared elements that morph between pages (full-height
   hero on Home <-> short header on the legal pages). Only the page body underneath crossfades,
   drifting a little in the nav direction (html.vt-fwd / html.vt-back). Transform + opacity only,
   one ease curve throughout. transitions.js drops the shared names when an element is off-screen,
   so nothing flies in from outside the viewport. */
@view-transition { navigation: auto; }
:root { --vt-ease: cubic-bezier(0.22, 1, 0.36, 1); --vt-dur: 560ms; }
.hero-bg { view-transition-name: scene; }
.hero-card, .doc-card { view-transition-name: title-card; }

::view-transition-group(*) { animation-duration: var(--vt-dur); animation-timing-function: var(--vt-ease); }
/* Shared elements change shape (100vh hero <-> 46vh header, landing card <-> doc card): keep each
   snapshot at its natural size and clip it to the morphing box instead of stretching it. */
::view-transition-group(scene), ::view-transition-group(title-card) { overflow: clip; }
::view-transition-old(scene), ::view-transition-new(scene) {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%;
}
::view-transition-old(title-card), ::view-transition-new(title-card) {
  height: auto; object-fit: none; object-position: left top;
}
::view-transition-old(title-card) { animation: vt-out 200ms var(--vt-ease) both; }
::view-transition-new(title-card) { animation: vt-in 360ms var(--vt-ease) 140ms both; }

/* Page body: old one fades out quickly, new one fades in and settles. */
::view-transition-old(root) { animation: vt-out 220ms var(--vt-ease) both; }
::view-transition-new(root) { animation: vt-in-up 480ms var(--vt-ease) 80ms both; }
html.vt-fwd::view-transition-old(root) { animation: vt-out-left 240ms var(--vt-ease) both; }
html.vt-fwd::view-transition-new(root) { animation: vt-in-right 520ms var(--vt-ease) 80ms both; }
html.vt-back::view-transition-old(root) { animation: vt-out-right 240ms var(--vt-ease) both; }
html.vt-back::view-transition-new(root) { animation: vt-in-left 520ms var(--vt-ease) 80ms both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }
@keyframes vt-in-up { from { opacity: 0; transform: translateY(16px); } }
@keyframes vt-out-left { to { opacity: 0; transform: translateX(-32px); } }
@keyframes vt-out-right { to { opacity: 0; transform: translateX(32px); } }
@keyframes vt-in-right { from { opacity: 0; transform: translateX(40px); } }
@keyframes vt-in-left { from { opacity: 0; transform: translateX(-40px); } }

/* ---------- Header: announcement + floating nav ---------- */
.top {
  position: fixed; top: 16px; left: 50%; z-index: 50;
  width: min(720px, calc(100% - 32px));
  transform: translateX(-50%);
  background: var(--nav);
  box-shadow: 0 10px 40px rgba(10, 8, 6, 0.28);
  view-transition-name: site-nav;
  transition: transform 320ms var(--ease), box-shadow 320ms var(--ease);
}
/* Hidden while scrolling down; keyboard focus always brings it back. */
.top.hide:not(:focus-within) { transform: translate(-50%, calc(-100% - 24px)); box-shadow: none; }
.announce {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  height: 40px; overflow: hidden;
  font-size: 14px; color: var(--ink-2); text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: height 260ms var(--ease), border-color 260ms var(--ease);
}
.announce u { color: var(--ink); text-underline-offset: 3px; }
.announce svg { width: 12px; height: 12px; }
.scrolled .announce { height: 0; border-color: transparent; }
.nav {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 64px; padding: 0 12px 0 20px;
}
.nav-links { display: flex; gap: 4px; }
.nav-links a, .nav-right > a:not(.btn) {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  font-size: 15px; font-weight: 500; text-decoration: none; color: var(--ink);
  border-radius: 2px; transition: color 200ms var(--ease);
}
.nav-links a:hover, .nav-right > a:not(.btn):hover { color: var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.brand img { width: 30px; height: 31px; }
.brand span { font-weight: 700; font-size: 19px; letter-spacing: -0.03em; }
.nav-right { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 150px var(--gutter) 96px;
  background: var(--night);
  color: var(--nav);
}
.hero-bg { position: absolute; inset: -2%; z-index: -2; overflow: hidden; container-type: size; }
/* The stage keeps the art's 1180:842 ratio and covers the hero, so crew positions (in % of the
   stage) always land on the same floor tiles. Grade + drift apply to scene and crew together. */
.stage {
  position: absolute; left: 50%; top: 50%;
  width: max(100cqw, calc(100cqh * 1180 / 842)); aspect-ratio: 1180 / 842;
  transform: translate(-50%, -50%) scale(1.02);
  filter: saturate(0.85) brightness(0.6) sepia(0.2);
  animation: drift 40s ease-in-out infinite alternate;
}
.stage > img:first-child, .stage > picture, .stage > picture img { display: block; width: 100%; height: 100%; }
@keyframes drift { to { transform: translate(-50.6%, -50.4%) scale(1.05); } }
/* Film grain, like the reference's footage. Inside .hero-bg so it travels with the shared scene. */
.hero-bg::before {
  content: ""; position: absolute; inset: -50%; z-index: 2; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.13; mix-blend-mode: overlay;
  animation: grain 0.9s steps(3) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-3%, 2%); }
  66% { transform: translate(2%, -3%); }
  100% { transform: translate(-1%, 1%); }
}
/* Dark warm grade + vignette (also inside .hero-bg). Kept light enough that the scene still reads. */
.hero-bg::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, rgba(21, 17, 13, 0) 30%, rgba(21, 17, 13, 0.78) 100%),
    linear-gradient(180deg, rgba(40, 24, 10, 0.35) 0%, rgba(21, 17, 13, 0.25) 45%, rgba(21, 17, 13, 0.88) 100%);
}

/* ---------- After-hero layout: sticky side index + content panel ---------- */
.after-hero {
  --side: 280px;
  display: grid; grid-template-columns: var(--side) minmax(0, 1fr);
  background: var(--paper-3);
}
.side {
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 120px 24px 32px 48px;
}
.side ol { list-style: none; margin: 0; padding: 0; }
/* Dash between items, like a printed index. */
.side li + li::before {
  content: "\2013"; display: block; margin: 14px 0; color: var(--ink-3); line-height: 1;
}
.side a {
  display: inline-block; padding: 2px 0;
  font-size: 17px; font-weight: 500; line-height: 1.1; letter-spacing: -0.01em;
  color: var(--ink-3); text-decoration: none;
  transform-origin: left center;
  transition: font-size 450ms var(--ease), color 300ms var(--ease), letter-spacing 450ms var(--ease);
}
.side a:hover { color: var(--ink); }
.side a.active { font-size: 30px; font-weight: 600; letter-spacing: -0.035em; color: var(--ink); }
/* Hidden until the hero is scrolled past, then items slide in one after another. */
.js .side li {
  opacity: 0; transform: translateX(-14px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}
.js .side.on li { opacity: 1; transform: none; }
.js .side.on li:nth-child(2) { transition-delay: 60ms; }
.js .side.on li:nth-child(3) { transition-delay: 120ms; }
.js .side.on li:nth-child(4) { transition-delay: 180ms; }
.js .side.on li:nth-child(5) { transition-delay: 240ms; }
.js .side.on li:nth-child(6) { transition-delay: 300ms; }
.js .side.on li:nth-child(n+7) { transition-delay: 360ms; }

.panel {
  /* clip, not just hidden: hidden boxes can still be scrolled sideways by focus/scrollIntoView when a
     child pokes out (the CTA crew start 80px off to the side before they walk in). */
  min-width: 0; overflow: hidden; overflow: clip;
  margin: 16px 16px 16px 0; border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--line);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 20px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; background: var(--accent); }

/* Footer */
.foot { background: var(--night); color: rgba(255, 253, 248, 0.72); padding: 64px 0 0; font-size: 15px; overflow: hidden; }
/* Oversized wordmark bleeding off the bottom edge. */
.foot-mark {
  margin: 48px 0 0; padding: 0 var(--gutter);
  font-size: clamp(64px, 17.5vw, 300px); font-weight: 700; letter-spacing: -0.065em; line-height: 0.78;
  color: var(--paper); white-space: nowrap; text-align: center;
  transform: translateY(0.08em);
}
.foot .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.foot .brand span { color: var(--nav); }
.foot p { margin: 12px 0 0; max-width: 22em; }
.foot h2 { font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 10px; color: var(--nav); font-weight: 700; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li a { display: inline-flex; min-height: 36px; align-items: center; text-decoration: none; }
.foot a:hover { color: var(--nav); text-decoration: underline; text-underline-offset: 3px; }
.foot :focus-visible { outline-color: var(--nav); box-shadow: none; }
.foot .legal-line { max-width: none; grid-column: 1 / -1; margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(255, 253, 248, 0.14); font-size: 13px; }

/* Scroll reveal: only hides content when JS is running (html.js), so no-JS visitors see everything. */
.js .rv { opacity: 0; transform: translateY(18px); transition: opacity 600ms var(--ease), transform 600ms var(--ease); }
.js .rv.in { opacity: 1; transform: none; }
.js .rv-d1 { transition-delay: 80ms; }
.js .rv-d2 { transition-delay: 160ms; }
.js .rv-d3 { transition-delay: 240ms; }

/* No room for the side index: single column, panel goes edge to edge. */
@media (max-width: 1099px) {
  .after-hero { display: block; }
  .side { display: none; }
  .panel { margin: 0; border-radius: 0; box-shadow: none; }
}

/* Phone: compact nav, single-column footer. */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .top { top: 8px; width: calc(100% - 16px); }
  .announce { height: 34px; font-size: 13px; }
  .nav { grid-template-columns: 1fr auto; height: 56px; padding: 0 8px 0 12px; }
  .nav-links, .nav-right > a:not(.btn) { display: none; }
  .foot .wrap { grid-template-columns: 1fr; }
}
@media (min-width: 641px) and (max-width: 860px) {
  .foot .wrap { grid-template-columns: 1fr 1fr; }
  .foot .wrap > div:first-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* No morphing or drifting: a quick crossfade only. */
  ::view-transition-group(*) { animation-duration: 0s !important; }
  ::view-transition-old(*) { animation: vt-out 150ms linear both !important; }
  ::view-transition-new(*) { animation: vt-in 150ms linear both !important; }
  .stage, .hero-bg::before { animation: none; }
  .js .rv { opacity: 1; transform: none; transition: none; }
  .side a, .js .side li, .announce, .btn, .top { transition: none; }
}
