/* ==========================================================================
   Llama AI — style.css
   Oat paper, warm ink, one llama.
   ========================================================================== */

:root {
  --cream: #edeae3;
  --ink: #15130f;
  --grass: #7f9b57;

  --bg: var(--cream);
  --fg: var(--ink);

  --serif: 'Instrument Serif', 'Iowan Old Style', 'Times New Roman', serif;
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --pad: clamp(20px, 3.3vw, 52px);
  --gutter: clamp(12px, 1.6vw, 24px);
  --header-h: 76px;
  --title-size: clamp(64px, 9.3vw, 176px);
  --drop: calc(var(--title-size) * 0.22 + 16px); /* the title's descenders hang below the ground line */
  --ground: calc(var(--pad) + var(--drop) + 60px);

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.77, 0, .18, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --theme-t: 1.1s;

  color-scheme: light;
}

html[data-theme='dark'] {
  --bg: var(--ink);
  --fg: var(--cream);
  color-scheme: dark;
}

/* ---------- base ------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: auto;
  background: var(--bg);
  transition: background-color var(--theme-t) var(--ease-io);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.55 var(--sans);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color var(--theme-t) var(--ease-io), color var(--theme-t) var(--ease-io);
}

html.is-locked, html.is-locked body { overflow: hidden; }

a { color: inherit; text-decoration: none; }
em { font-style: italic; }
p, h1, h2, h3 { margin: 0; font-weight: 400; }
svg { display: block; }

::selection { background: var(--fg); color: var(--bg); }
:focus-visible { outline: 1px solid currentColor; outline-offset: 5px; border-radius: 2px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: fixed; left: var(--pad); top: 12px; z-index: 120;
  padding: 10px 14px; background: var(--fg); color: var(--bg);
  font: 500 12px/1 var(--mono); transform: translateY(-200%);
}
.skip:focus { transform: none; }

.muted, .caption, .hero-sub, .apps-lede, .apps-item p {
  color: color-mix(in srgb, currentColor 62%, transparent);
}

.label, .caption, .status, .hero-eyebrow, .scroll-cue, .footer-bar, .apps-item .num {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.caption { text-transform: none; letter-spacing: 0.02em; }
.caption .fig { text-transform: uppercase; letter-spacing: 0.08em; margin-right: 0.6em; color: var(--fg); }
.caption em { font: italic 400 1.45em/1 var(--serif); letter-spacing: 0; }

.label { display: flex; gap: 0.9em; align-items: baseline; }
.label .num { opacity: 0.45; }

/* ---------- canvas + paper -------------------------------------------------- */

.field {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.grain {
  position: fixed; inset: 0; z-index: 70;
  pointer-events: none;
  opacity: 0.055;
  background-image: var(--grain, none);
  background-size: 180px 180px;
}

main, .site-footer { position: relative; z-index: 1; overflow-x: clip; }

/* ---------- loader ----------------------------------------------------------- */

.loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--cream); color: var(--ink);
  clip-path: inset(0 0 0 0);
  animation: loader-failsafe 0s 7s forwards;
}
.loader-mark { width: 46px; height: 58px; overflow: visible; }
.loader-mark .ear {
  fill: currentColor;
  transform-box: fill-box; transform-origin: 50% 100%;
  transform: scaleY(0);
}
html.is-loading .loader-mark .ear-l { animation: ear-perk 0.9s var(--ease-spring) forwards; }
html.is-loading .loader-mark .ear-r {
  animation: ear-perk 0.9s var(--ease-spring) 0.12s forwards, ear-twitch 0.7s var(--ease-out) 1s forwards;
}
html.is-revealed .loader {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.2s var(--ease-io);
}
html.is-revealed .loader-mark {
  transform: translateY(-36px); opacity: 0;
  transition: transform 1s var(--ease-io), opacity 0.6s ease;
}
html.is-ready .loader, html:not(.js) .loader { display: none; }

@keyframes ear-perk { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes ear-twitch {
  0% { transform: none; }
  25% { transform: rotate(16deg); }
  55% { transform: rotate(-6deg); }
  80% { transform: rotate(2deg); }
  100% { transform: none; }
}
@keyframes loader-failsafe { to { visibility: hidden; } }

/* ---------- header ----------------------------------------------------------- */

.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  height: var(--header-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 var(--pad);
  transition: transform 0.9s var(--ease-out);
}
.site-header.is-hidden { transform: translateY(-110%); }
.site-header::before {
  content: ''; position: absolute; inset: 0 0 -28px; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, var(--bg) 35%, transparent);
  opacity: 0; transition: opacity 0.6s var(--ease-out), background-color var(--theme-t);
}
.site-header.is-scrolled::before { opacity: 0.94; }

.brand { justify-self: start; display: inline-flex; align-items: center; gap: 11px; }
.brand-mark { width: 18px; height: 23px; overflow: visible; transform: translateY(-1px); }
.brand-mark .ear {
  fill: currentColor;
  transform-box: fill-box; transform-origin: 50% 100%;
  transition: transform 0.6s var(--ease-spring);
}
.brand:hover .ear-r { animation: ear-twitch 0.7s var(--ease-out); }
.brand:hover .ear-l { transform: rotate(-5deg); }
.brand-word { font: 400 25px/1 var(--serif); letter-spacing: -0.01em; transform: translateY(1px); }

.site-nav { display: flex; gap: clamp(20px, 2.6vw, 40px); font-size: 14px; }
.nav-link { display: inline-block; height: 1.3em; line-height: 1.3; overflow: hidden; }
.nav-link > span {
  display: block;
  text-shadow: 0 1.3em currentColor;
  transition: transform 0.7s var(--ease-out);
}
.nav-link:hover > span { transform: translateY(-1.3em); }

.status { justify-self: end; display: inline-flex; align-items: center; gap: 10px; }
.status i {
  position: relative; width: 6px; height: 6px; border-radius: 50%; background: var(--grass);
}
.status i::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; background: inherit;
  animation: pulse 2.6s var(--ease-out) infinite;
}
@keyframes pulse { 0% { transform: scale(1); opacity: 0.7; } 70%, 100% { transform: scale(3.4); opacity: 0; } }

/* ---------- hero ------------------------------------------------------------- */

.hero {
  position: relative;
  height: 100vh; height: 100svh; min-height: 620px;
}

.hero-eyebrow {
  position: absolute; left: var(--pad); top: calc(var(--header-h) + 4vh);
  display: flex; align-items: center; gap: 14px;
}
.hero-eyebrow .dash { width: 34px; height: 1px; background: currentColor; opacity: 0.35; }

.hero-title {
  position: absolute; left: var(--pad); bottom: var(--ground);
  font: 400 var(--title-size)/0.9 var(--serif);
  letter-spacing: -0.028em;
  transform: translateY(var(--title-shift, 0.05em)); /* set by JS: last baseline on the ground line */
}
.hero-title em { letter-spacing: -0.02em; }

/* A reveal mask with room for italic overhangs and descenders, without moving the text. */
.line { display: block; overflow: hidden; padding: 0 0.12em 0.16em; margin: 0 -0.12em -0.16em; }
.line > span { display: inline-block; will-change: transform; }

.hero-figure { position: absolute; margin: 0; right: var(--pad); bottom: var(--ground); top: calc(var(--header-h) + 2vh); width: min(44vw, 860px); }
.fig-anchor { position: absolute; inset: 0; }

.hero-ground {
  position: absolute; left: var(--pad); right: var(--pad); bottom: var(--ground);
  height: 1px; background: currentColor; opacity: 0.9;
  transform-origin: 0 50%;
}

.hero-foot {
  position: absolute; left: var(--pad); right: var(--pad);
  top: calc(100% - var(--ground) + var(--drop));
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter);
  align-items: start;
}
.hero-sub { grid-column: 1 / span 4; max-width: 38ch; font-size: 15px; line-height: 1.5; }
.scroll-cue { grid-column: 6 / span 3; white-space: nowrap; display: inline-flex; align-items: center; gap: 14px; justify-self: start; padding-top: 3px; }
.cue-track { position: relative; width: 56px; height: 1px; overflow: hidden; background: color-mix(in srgb, currentColor 22%, transparent); }
.cue-track i {
  position: absolute; inset: 0; background: currentColor;
  transform: translateX(-100%);
  animation: cue 2.4s var(--ease-io) infinite 2.6s;
}
@keyframes cue { 0% { transform: translateX(-100%); } 55% { transform: translateX(0); } 100% { transform: translateX(101%); } }
.hero-foot .caption { grid-column: 9 / span 4; justify-self: end; text-align: right; padding-top: 1px; }
.hero-foot .caption em { font-size: 1.5em; }

/* ---------- ethos ------------------------------------------------------------ */

.ethos { position: relative; height: 255vh; }
.ethos-pin {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter);
  align-content: start;
  padding: calc(var(--header-h) + 7vh) var(--pad) 0;
}
.ethos .label { grid-column: 1 / span 3; padding-top: 1.1em; }
.manifesto {
  grid-column: 4 / span 9;
  position: relative; z-index: 1;
  font: 400 clamp(30px, 3.55vw, 66px)/1.07 var(--serif);
  letter-spacing: -0.012em;
  text-wrap: pretty;
}
.manifesto .w { display: inline; opacity: 0.13; }
.fig-andes { top: auto; height: 42%; }
.ethos-caption { position: absolute; right: var(--pad); bottom: calc(var(--pad) - 4px); z-index: 1; }

/* ---------- apps ------------------------------------------------------------- */

.apps { position: relative; padding: 22vh var(--pad) 0; }
.apps-head, .apps-body {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter);
}
.apps-head .label { grid-column: 1 / span 3; padding-top: 2.4vw; }
.apps-title {
  grid-column: 4 / span 9;
  font: 400 clamp(78px, 12.4vw, 236px)/0.84 var(--serif);
  letter-spacing: -0.035em;
}
.apps-title .line:nth-child(2) { padding-left: 0.64em; }
.apps-lede { grid-column: 4 / span 4; margin-top: 7vh; max-width: 36ch; font-size: 16px; }

.apps-body { margin-top: 16vh; align-items: center; }
.apps-list { grid-column: 1 / span 6; list-style: none; margin: 0; padding: 0; }
.apps-item {
  position: relative;
  display: grid; grid-template-columns: minmax(64px, 7.5em) 1fr; column-gap: var(--gutter);
  padding: 34px 0 38px;
  transition: opacity 0.6s var(--ease-out);
}
.apps-item::before, .apps-item:last-child::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: currentColor; opacity: 0.2;
  transform-origin: 0 50%;
  transition: transform 1.6s var(--ease-out);
}
.apps-item:last-child::after { top: auto; bottom: 0; }
.apps-item .num { grid-row: span 2; padding-top: 0.85em; opacity: 0.5; }
.apps-item h3 {
  font: 400 clamp(32px, 3.1vw, 54px)/1 var(--serif);
  letter-spacing: -0.015em;
  margin-bottom: 14px;
  transition: transform 0.8s var(--ease-out);
}
.apps-item p { max-width: 42ch; font-size: 15px; }
.apps-list:hover .apps-item:not(:hover) { opacity: 0.32; }
.apps-item:hover h3 { transform: translateX(16px); }

.apps-figure { grid-column: 8 / span 5; position: relative; margin: 0; aspect-ratio: 1 / 1; }
.apps-figure .caption { position: absolute; left: 0; right: 0; bottom: -44px; text-align: center; }

.marquee {
  position: relative;
  margin: 30vh calc(var(--pad) * -1) 0;
  padding: 4vh 0 5vh;
  overflow: hidden;
  font: italic 400 clamp(64px, 10.5vw, 196px)/1 var(--serif);
  letter-spacing: -0.02em;
  /* Words drift in and out through soft edges; the 1px strip keeps the hairline crisp. */
  --fade: clamp(40px, 12vw, 240px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent), linear-gradient(#000 0 0);
  mask-image: linear-gradient(90deg, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent), linear-gradient(#000 0 0);
  -webkit-mask-size: 100% 100%, 100% 1px;
  mask-size: 100% 100%, 100% 1px;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.marquee::before {
  content: ''; position: absolute; top: 0; left: var(--pad); right: var(--pad); height: 1px;
  background: currentColor; opacity: 0.2;
}
.marquee-track { display: flex; width: max-content; will-change: transform; }
.marquee-set { display: flex; align-items: center; flex-shrink: 0; }
.marquee-set span { padding: 0 0.34em; white-space: nowrap; }
.marquee-set svg { width: 0.26em; height: 0.455em; overflow: visible; transform: translateY(-0.06em); }
.marquee-set svg path, .marquee-set svg ellipse { fill: currentColor; }

/* ---------- footer ----------------------------------------------------------- */

.site-footer {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  padding: 24vh var(--pad) var(--pad);
}
.footer-line {
  font: 400 clamp(36px, 4.7vw, 88px)/0.98 var(--serif);
  letter-spacing: -0.02em;
}
.footer-stage { position: relative; margin-top: auto; padding-top: 38vh; }
.wordmark {
  margin-left: -0.035em;
  font: 400 clamp(92px, 23.2vw, 470px)/0.8 var(--serif);
  letter-spacing: -0.045em;
  white-space: nowrap;
}
.wordmark .line { padding-top: 0.04em; margin-top: -0.04em; padding-bottom: 0.03em; margin-bottom: -0.03em; }
.fig-rest { inset: auto; left: 60%; width: 30%; bottom: 0; height: 32vh; }
.rest-caption { position: absolute; white-space: nowrap; }

.footer-bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  margin-top: 4vh; padding-top: 18px;
  border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}
.footer-joke { text-transform: none; letter-spacing: 0.02em; opacity: 0.55; }
.to-top { justify-self: end; display: inline-flex; gap: 8px; }

/* ---------- cursor ----------------------------------------------------------- */

.cursor { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; display: none; color: var(--fg); }
html.has-cursor .cursor { display: block; }
html.has-cursor, html.has-cursor * { cursor: none !important; }

.cursor-follow, .cursor-point { position: absolute; left: 0; top: 0; will-change: transform; }
.cursor-dot {
  position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: currentColor;
  transition: transform 0.4s var(--ease-out), opacity 0.3s;
}
.cursor-ring {
  position: absolute; width: 84px; height: 84px; margin: -42px 0 0 -42px;
  display: grid; place-items: center;
  border: 1px solid currentColor; border-radius: 50%;
  opacity: 0; transform: scale(0.3);
  transition: transform 0.6s var(--ease-out), opacity 0.4s var(--ease-out);
}
.cursor-label {
  font: 500 10px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap;
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.3s, transform 0.5s var(--ease-out);
}
.cursor.is-link .cursor-ring { opacity: 0.45; transform: scale(0.5); }
.cursor.is-link .cursor-dot { transform: scale(0.6); }
.cursor.is-pet .cursor-ring { opacity: 1; transform: scale(1); }
.cursor.is-pet .cursor-label { opacity: 1; transform: none; }
.cursor.is-pet .cursor-dot { transform: scale(0); }
.cursor.is-hidden .cursor-dot, .cursor.is-hidden .cursor-ring { opacity: 0; }

/* ---------- reveals ---------------------------------------------------------- */

.js .reveal .line > span {
  transform: translate3d(0, calc(100% + 0.2em), 0) rotate(3deg); /* fully below the mask */
  transform-origin: 0 100%;
  transition: transform 1.35s var(--ease-out) var(--delay, 0s);
}
.js .reveal .line:nth-child(2) > span { transition-delay: calc(var(--delay, 0s) + 0.08s); }
.js .reveal .line:nth-child(3) > span { transition-delay: calc(var(--delay, 0s) + 0.16s); }
.js .reveal.is-in .line > span { transform: none; }
.wordmark.is-measuring .line > span { transform: none !important; transition: none !important; }

.no-webgl .fig-anchor svg { width: 100%; height: 100%; opacity: 0.92; }
.no-webgl .apps-figure { display: none; }

.js .fade, .js .reveal-fade {
  opacity: 0; transform: translate3d(0, 14px, 0);
  transition: opacity 1.1s var(--ease-out), transform 1.3s var(--ease-out);
  transition-delay: var(--delay, 0s);
}
.js .fade.is-in, .js .reveal-fade.is-in { opacity: 1; transform: none; }

.js .hero-ground { transform: scaleX(0); transition: transform 1.7s var(--ease-io) 0.05s; }
html.is-revealed .hero-ground { transform: scaleX(1); }

.js .site-header > * { opacity: 0; transform: translateY(-8px); transition: opacity 1s var(--ease-out), transform 1.2s var(--ease-out); }
.js .site-header > :nth-child(2) { transition-delay: 0.08s; }
.js .site-header > :nth-child(3) { transition-delay: 0.16s; }
html.is-revealed .site-header > * { opacity: 1; transform: none; }

.js .apps-item::before, .js .apps-item:last-child::after { transform: scaleX(0); }
.js .apps-item > * { opacity: 0; transform: translateY(18px); transition: opacity 1s var(--ease-out), transform 1.2s var(--ease-out), color 0.6s; }
.js .apps-item.is-in::before, .js .apps-item.is-in:last-child::after { transform: scaleX(1); }
.js .apps-item.is-in > * { opacity: 1; transform: none; }
.js .apps-item.is-in > * { transition-delay: var(--delay, 0s); }
.js .apps-item.is-in > :nth-child(2) { transition-delay: calc(var(--delay, 0s) + 0.08s); }
.js .apps-item.is-in > :nth-child(3) { transition-delay: calc(var(--delay, 0s) + 0.16s); }

/* ---------- small screens -------------------------------------------------- */

@media (max-width: 860px) {
  :root {
    --header-h: 64px;
    --ground: calc(var(--pad) + 128px);
    --title-size: clamp(50px, 15.2vw, 120px);
    --title-top: calc(var(--header-h) + 7.5vh);
  }

  .status { display: none; }
  .site-header { grid-template-columns: 1fr auto; }
  .site-nav { justify-self: end; font-size: 13px; gap: 22px; }

  .hero-eyebrow { top: calc(var(--header-h) + 2.5vh); }
  .hero-title { bottom: auto; top: var(--title-top); transform: none; }
  /* Below the three title lines and their descenders, however short the phone. */
  .hero-figure { left: var(--pad); width: auto; top: max(37%, calc(var(--title-top) + var(--title-size) * 2.81 + 16px)); }
  .hero-foot { grid-template-columns: 1fr auto; row-gap: 16px; top: calc(100% - var(--ground) + 16px); }
  .cap-more { display: none; }
  .hero-sub { grid-column: 1 / -1; font-size: 14px; }
  .scroll-cue { grid-column: 1; }
  .hero-foot .caption { grid-column: 2; }

  .ethos { height: 260vh; }
  .ethos-pin { display: block; padding-top: calc(var(--header-h) + 5vh); }
  .ethos .label { padding: 0 0 22px; }
  .manifesto { font-size: clamp(25px, 6.6vw, 44px); line-height: 1.1; }
  .fig-andes { height: 34%; }
  .ethos-caption { left: var(--pad); right: auto; }

  .apps { padding-top: 22vh; }
  .apps-head, .apps-body { display: block; }
  .apps-head .label { padding: 0 0 20px; }
  .apps-title { font-size: clamp(64px, 20vw, 140px); }
  .apps-lede { margin-top: 28px; }
  .apps-body { margin-top: 8vh; display: flex; flex-direction: column-reverse; gap: 9vh; }
  .apps-figure { width: min(100%, 440px); margin: 0 auto; }
  .apps-item { grid-template-columns: 52px 1fr; padding: 26px 0 30px; }
  .apps-item p { font-size: 14px; }
  .marquee { margin-top: 18vh; }

  .site-footer { padding-top: 18vh; }
  .footer-stage { padding-top: 30vh; }
  .wordmark { font-size: 24.5vw; }
  .footer-bar { grid-template-columns: 1fr auto; row-gap: 10px; }
  .footer-joke { grid-column: 1 / -1; grid-row: 2; text-align: left; }
}

/* Reduce Motion: no travel, no parallax — content simply fades in. */
@media (prefers-reduced-motion: reduce) {
  html:not(.motion-full) *, html:not(.motion-full) *::before, html:not(.motion-full) *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
  }
  html.js:not(.motion-full) .reveal .line > span {
    transform: none !important; opacity: 0;
    transition: opacity 0.9s ease var(--delay, 0s) !important;
  }
  html.js:not(.motion-full) .reveal.is-in .line > span { opacity: 1; }
  html.js:not(.motion-full) .fade, html.js:not(.motion-full) .reveal-fade,
  html.js:not(.motion-full) .apps-item > *, html.js:not(.motion-full) .site-header > *,
  html.js:not(.motion-full) .hero-ground, html.js:not(.motion-full) .apps-item::before,
  html.js:not(.motion-full) .apps-item:last-child::after { transform: none !important; }
  html:not(.motion-full) .site-header { transition: none; }
}
