/* Home: the 20,000 Meebits as a living field behind the company's story. Shared tokens and the header are in
   site.css; the Nightshades section's own styles are in nightshades/nightshades.css. */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body.home { overflow-x: hidden; }

.display { font-family: var(--serif); font-weight: 400; letter-spacing: -0.025em; line-height: 0.92; }
.display em { font-style: italic; }
.body { font-size: 21px; line-height: 1.4; color: #C9C6BF; max-width: 36ch; margin: 0; }
.hero .mono, .meebits .mono, .building .mono, .writing .mono, .site-footer .mono, .loader-label { color: var(--mute); }

/* Outbound links: mono, underlined by a hairline, with an arrow */
.out { color: var(--paper); text-decoration: none; padding-bottom: 4px; border-bottom: 1px solid var(--line); transition: border-color 0.2s ease; }
.out:hover { border-color: var(--paper); }
.out::after { content: " \2197"; }
.home .site-header { padding: calc(30px + env(safe-area-inset-top)) calc(var(--gutter) + 14px) 14px; }

/* Loader: counts to 20,000 as the Meebits arrive */
.loader {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--ink);
  transition: opacity 0.9s ease, visibility 0s linear 0.9s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-count { font-family: var(--serif); font-size: clamp(72px, 14vw, 220px); line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

/* The field, fixed behind the page */
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; }
.stage-fallback { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; opacity: 0.6; }
main { position: relative; z-index: 1; }

.readout {
  position: fixed; z-index: 9; pointer-events: none;
  color: var(--paper); background: var(--ink); padding: 6px 9px; border: 1px solid var(--line);
  opacity: 0; transition: opacity 0.2s ease; white-space: nowrap;
}
.readout.on { opacity: 1; }

/* Type labels under the seven blocks */
.labels { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.block-label { position: absolute; transform: translate(-50%, 0); display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: 0; white-space: nowrap; }
.block-label .n { font-family: var(--serif); font-size: clamp(22px, 2.2vw, 34px); line-height: 1; color: var(--paper); }
.block-label .mono { color: var(--mute); }
.block-label .tick { width: 1px; background: rgba(237, 234, 228, 0.3); }

/* Hero */
.hero {
  min-height: 100vh; position: relative; pointer-events: none;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 calc(var(--gutter) + 14px) 64px;
}
.hero-inner { display: flex; flex-direction: column; gap: 22px; max-width: 1100px; }
.hero-inner .mono { margin: 0; }
.hero h1 { margin: 0; font-size: clamp(56px, 9vw, 150px); }
.hint { position: absolute; right: calc(var(--gutter) + 14px); bottom: 64px; margin: 0; }

.sticky { position: sticky; top: 0; height: 100vh; }

/* Meebits: the field regroups by type beside the text */
.meebits { height: 280vh; pointer-events: none; }
.meebits-intro {
  position: absolute; left: calc(var(--gutter) + 14px); top: 50%; transform: translateY(-50%);
  width: min(560px, 44vw); display: flex; flex-direction: column; gap: 18px;
  opacity: 0; transition: opacity 0.5s ease;
}
.meebits-intro.on { opacity: 1; }
.meebits-intro .mono { margin: 0; }
.meebits-intro h2 { margin: 0; font-size: clamp(44px, 5.4vw, 92px); }
.meebits-intro a { pointer-events: auto; }
.meebits-intro .body a { color: var(--paper); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; margin: 10px 0 0; }
.cta {
  align-self: flex-start;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); background: var(--paper); text-decoration: none; padding: 14px 18px;
  transition: background 0.2s ease;
}
.cta:hover { background: #FFFFFF; }
.cta::after { content: " \2192"; }

/* Nightshades rises over the field as night: its sky fades in from clear at the top, so the Meebits go dark under
   it (home.js dims them as it comes) instead of meeting a hard edge. */
.home .ns { background: none; }
.home .ns::before {
  content: ""; position: absolute; inset: 0; background: var(--ns-sky);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 45vh); mask-image: linear-gradient(to bottom, transparent, #000 45vh);
}

/* What we're building */
.building { background: var(--ink); padding: clamp(110px, 14vw, 220px) calc(var(--gutter) + 14px) clamp(80px, 10vw, 160px); display: flex; flex-direction: column; gap: 28px; }
.building .mono { margin: 0; }
.building .lead { margin: 0; font-size: clamp(56px, 9vw, 150px); }

/* Writing */
.writing { background: var(--ink); padding: clamp(96px, 12vw, 180px) calc(var(--gutter) + 14px); }
.writing > .mono { margin: 0; }
.writing .row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: baseline; gap: 8px 32px; padding: 30px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.writing .row:first-of-type { margin-top: 40px; border-top: 1px solid var(--line); }
.writing .row .display { font-size: clamp(28px, 3.2vw, 48px); transition: transform 0.4s ease; }
.writing .row:hover .display { transform: translateX(12px); }

/* Footer: contact, the name, and where else to find us */
.site-footer { background: var(--ink); padding: 0 calc(var(--gutter) + 14px) 48px; }
.site-footer > .mono { margin: 0; }
.footer-email { display: inline-block; margin: 26px 0 clamp(80px, 10vw, 150px); font-size: clamp(40px, 6vw, 96px); text-decoration: none; }
.footer-email:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.12em; }
.footer-mark { font-size: clamp(56px, 12.4vw, 230px); white-space: nowrap; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 18px 24px; margin-top: 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px 28px; }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s ease, transform 1s cubic-bezier(0.2, 0.7, 0.1, 1); }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 760px) {
  .hint { display: none; }
  .labels { display: none; }
  .home .site-header { padding-top: calc(26px + env(safe-area-inset-top)); }
  .home .site-nav a[href="#writing"], .home .site-nav a[href="#nightshades"] { display: none; }
  /* Phones: the text on top, the seven blocks below it */
  .meebits-intro { top: 96px; transform: none; width: auto; right: calc(var(--gutter) + 14px); gap: 14px; }
  .meebits-intro .body { font-size: 18px; }
  .writing .row { grid-template-columns: minmax(0, 1fr); }
  .footer-mark { font-size: 11.4vw; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { transition: none; opacity: 1; transform: none; }
}
