:root {
  /* Paper — warm, creamy background */
  --color-paper: #fcf8ec;
  --color-paper-light: #fffcf3;
  --color-paper-edge: #ede3cb;

  /* Ink — warm, gentle text and edges */
  --color-ink: #2e2820;
  --color-ink-soft: #6b5f4e;
  --color-ink-faint: #a89e84;

  /* Yellow — Ariadne's thread, the accent */
  --color-thread-1: #f5d87e;
  --color-thread-2: #e8c45e;
  --color-thread-3: #ffe9a8;

  /* Logo colors — same family, ~50% more saturated */
  --color-logo-waiting: #d8c089;
  --color-logo-ready: #9fc480;
  --color-logo-running: #7eafc9;
  --color-logo-done: #9c9078;

  /* Shadow — warm, soft, restful */
  --shadow-paper:
    0 1px 0 rgba(46, 40, 32, 0.05), 0 8px 20px rgba(46, 40, 32, 0.04);

  /* Glow for focus states */
  --thread-glow: rgba(245, 216, 126, 0.25);

  /* Fonts */
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Paper grain — subtle SVG noise, fades up on load */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  animation: grain-fade-in 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ── Hero layout ───────────────────────────────────────────── */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  /* biome-ignore lint/suspicious/noDuplicateProperties: 100vh fallback for browsers without dvh */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 3rem 1.5rem;
  text-align: center;
}

/* ── Logo ──────────────────────────────────────────────────── */
/* Nested layers split the work so transforms never fight:
   .hero-logo owns the entrance (fade-scale-in) + resting headroom;
   .hero-logo-spin owns the wind-up rotation;
   .hero-logo-svg owns the click-bloom scale;
   .hero-logo-glow + .hero-logo-shimmer ride on the bloom.
   Rotation and scale live on separate elements, so hover-spin and
   click-bloom can run simultaneously without overriding each other. */
.hero-logo {
  position: relative;
  opacity: 0;
  /* A touch of headroom so the click-bloom has room to lean toward the
     viewer without nudging the layout. */
  margin-top: -0.35rem;
  margin-bottom: 0.35rem;
  transform: scale(0.85);
  animation: fade-scale-in 500ms cubic-bezier(0.33, 0.66, 0.66, 1) 100ms
    forwards;
}

.hero-logo-spin {
  position: relative;
  display: block;
  transform-origin: 50% 50%;
  cursor: pointer;
}

/* Wind-up-toy spin: a small counter-clockwise wind-back (anticipation),
   then a release into a full clockwise turn that accelerates out of the
   wind-back and settles with a hair of overshoot. */
.hero-logo-spin.is-winding {
  animation: logo-windup 1140ms cubic-bezier(0.2, 1.4, 0.28, 1) forwards;
}

.hero-logo-svg {
  display: block;
  width: 96px;
  height: 96px;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 8px 20px rgba(46, 40, 32, 0.06));
}

/* Click-bloom: the SVG grows a little and settles back. Layered with the
   glow halo and the shimmer sweep below. */
.hero-logo-svg.is-blooming {
  animation: logo-bloom 620ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Warm halo behind the mark — a soft glow that swells on bloom and fades. */
.hero-logo-glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.7);
}

.hero-logo-glow.is-blooming {
  animation: logo-glow 620ms cubic-bezier(0.33, 0.66, 0.66, 1) forwards;
}

/* Click glow ripple: JS spawns one per click, so rapid clicks stack
   overlapping glows that ripple together, then self-remove on animationend. */
.logo-glow-ripple {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  animation: logo-glow-ripple 660ms cubic-bezier(0.33, 0.66, 0.66, 1) forwards;
}

/* Specular shimmer: a diagonal band of brighter light, clipped to the
   logo box, that sweeps across once as the mark catches the light. */
.hero-logo-shimmer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  border-radius: 0.4rem;
  opacity: 0;
}

.hero-logo-shimmer::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -120%;
  width: 60%;
  height: 200%;
  transform: rotate(20deg);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 233, 168, 0.85) 50%,
    transparent 100%
  );
}

.hero-logo-shimmer.is-blooming {
  opacity: 1;
}

.hero-logo-shimmer.is-blooming::before {
  animation: logo-shimmer 620ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Tagline ───────────────────────────────────────────────── */
.hero-tagline {
  opacity: 0;
  transform: translateY(8px);
  animation: fade-slide-up 600ms cubic-bezier(0.33, 0.66, 0.66, 1) 350ms
    forwards;
}

.hero-tagline-main {
  margin: 0;
  font-family: var(--font-display);
  /* Single line at every width: nowrap keeps it on one line, the viewport-
     scaled clamp shrinks it on narrow screens so it never overflows.
     Unbounded is a wide display face, so the lower bound stays conservative. */
  white-space: nowrap;
  font-size: clamp(1.1rem, 6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--color-ink);
}

/* "more" — the four logo colors, clockwise from the top (m=waiting, o=ready,
   r=running, e=done), each letter given a faint metallic sheen: a vertical
   light→colour→shade gradient clipped to the glyph + a whisper of depth. */
.more-m {
  --c: var(--color-logo-waiting);
  --c-hi: #ece0bf;
  --c-lo: #b89a5f;
}
.more-o {
  --c: var(--color-logo-ready);
  --c-hi: #cfe3bd;
  --c-lo: #7aa45f;
}
.more-r {
  --c: var(--color-logo-running);
  --c-hi: #bcd8e6;
  --c-lo: #5b8aa5;
}
.more-e {
  --c: var(--color-logo-done);
  --c-hi: #c6bda8;
  --c-lo: #7c705a;
}
.more > span {
  color: var(--c); /* fallback where background-clip:text is unsupported */
  /* Two layers clipped to the glyph: a sweeping shimmer band (parked off-screen
     at rest) over the metallic light→colour→shade gradient. */
  background-image:
    linear-gradient(
      105deg,
      transparent 38%,
      rgba(255, 255, 255, 0.92) 50%,
      transparent 62%
    ),
    linear-gradient(165deg, var(--c-hi) 0%, var(--c) 46%, var(--c-lo) 100%);
  background-size:
    220% 100%,
    100% 100%;
  background-position:
    200% 0,
    0 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* a slight specular highlight + depth = "hint of metal" */
  filter: drop-shadow(0 0.5px 0.4px rgba(255, 255, 255, 0.5))
    drop-shadow(0 0.6px 0.5px rgba(70, 60, 40, 0.18));
}

/* Hover → a highlight glides across the word, staggered letter by letter so a
   single band appears to travel left→right. */
.more:hover > span {
  animation: more-shimmer 0.7s ease-out;
}
.more:hover .more-o {
  animation-delay: 0.07s;
}
.more:hover .more-r {
  animation-delay: 0.14s;
}
.more:hover .more-e {
  animation-delay: 0.21s;
}
@keyframes more-shimmer {
  from {
    background-position:
      200% 0,
      0 0;
  }
  to {
    background-position:
      -120% 0,
      0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .more:hover > span {
    animation: none;
  }
}

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

/* Sub-tagline: calm body type under the display headline — the product's
   posture in one line. The italic carries the emphasis. */
.hero-tagline-sub {
  margin: 0.6rem 0 0;
  font-family: var(--font-body);
  /* A tad bigger than before (1.15 → 1.35rem max) — still well under the
     title's 2.75rem so the hierarchy holds. */
  font-size: clamp(1.05rem, 3.4vw, 1.35rem);
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-ink-soft);
}

.hero-tagline-sub em {
  font-style: italic;
  color: var(--color-ink);
}

/* ── Download CTA ──────────────────────────────────────────── */
.hero-cta {
  margin-top: 0.5rem;
  /* Enters with a slide from the side (not a fade), after the tagline. */
  opacity: 0;
  transform: translateX(2.5rem);
  animation: slide-in-side 600ms cubic-bezier(0.33, 0.66, 0.66, 1) 600ms
    forwards;
}

.download {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.download-btn {
  position: relative;
  overflow: hidden; /* clip the sliding fill to the button shape */
  display: inline-flex;
  align-items: baseline;
  gap: 0.5ch;
  padding: 0.7em 1.4em;
  border: 2px solid var(--color-ink);
  border-radius: 0.6rem;
  text-decoration: none;
  color: var(--color-ink);
  background: transparent;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.95rem, 3.4vw, 1.25rem);
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    box-shadow 240ms ease,
    transform 240ms ease;
}

/* Outline by default; the butter-yellow fill slides in from the left on hover. */
.download-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--color-thread-1);
  transform: translateX(-101%);
  transition: transform 320ms cubic-bezier(0.33, 0.66, 0.66, 1);
}

.download-btn:hover::before,
.download-btn:focus-visible::before {
  transform: translateX(0);
}

.download-btn:hover,
.download-btn:focus-visible {
  box-shadow: var(--shadow-paper);
  transform: translateY(-1px);
}

.download-btn:focus-visible {
  outline: 3px solid var(--thread-glow);
  outline-offset: 3px;
}

/* Label rides above the sliding fill; ink reads cleanly on the yellow. */
.download-btn-label,
.download-btn-os {
  position: relative;
  z-index: 1;
}

.download-btn-os {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.72em;
  color: var(--color-ink-soft);
}

/* "mais" in the button wears the four logo colours, same mapping as the hero
   word (m=waiting, a=ready, i=running, s=done) — but flat: no metallic sheen
   or shimmer inside the button, just the colour. */
.download-mais-m {
  color: var(--color-logo-waiting);
}
.download-mais-a {
  color: var(--color-logo-ready);
}
.download-mais-i {
  color: var(--color-logo-running);
}
.download-mais-s {
  color: var(--color-logo-done);
}

/* "Other platforms" — appears only on hover/focus of the download control. */
.download-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  margin-top: 0.5rem;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  min-width: 9rem;
  background: var(--color-paper-light);
  border: 1px solid var(--color-paper-edge);
  border-radius: 0.6rem;
  box-shadow: var(--shadow-paper);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -6px);
  transition:
    opacity 200ms ease,
    transform 200ms ease,
    visibility 200ms;
}

/* Invisible bridge over the gap so moving button → menu keeps the hover. */
.download-menu::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 0.6rem;
}

.download:hover .download-menu,
.download:focus-within .download-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.download-menu-item {
  padding: 0.45rem 0.7rem;
  border-radius: 0.4rem;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-ink-soft);
  transition:
    background 160ms ease,
    color 160ms ease;
}

.download-menu-item:hover,
.download-menu-item:focus-visible {
  background: var(--color-thread-3);
  color: var(--color-ink);
  outline: none;
}

/* ── Keyframes ─────────────────────────────────────────────── */
@keyframes slide-in-side {
  from {
    opacity: 0;
    transform: translateX(2.5rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes grain-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.025;
  }
}

@keyframes fade-scale-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fade-slide-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Wind-up toy: wind back CCW (anticipation), then release into a full
   clockwise turn. The wind-back occupies the first ~18% (a deliberate,
   slow-in load of the spring); the release accelerates through 360°+ and
   eases past the mark before settling — a hair of overshoot at 92%, then
   a tiny recoil back to rest. 0° → -18° → +360° → +366° → +360°. */
@keyframes logo-windup {
  0% {
    transform: rotate(0deg);
    /* quick recoil to the wound position, easing to a soft stop */
    animation-timing-function: cubic-bezier(0.3, 0.7, 0.4, 1);
  }
  16% {
    transform: rotate(-22deg);
    /* From 16% the easeOutBack curve owns the whole release: it accelerates
       through 360°, crests a hair past it (the 1.4 overshoot), and settles
       back to 360° as one continuous curve — no keyframe reversal. */
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Click-bloom: extrude toward the viewer, then ease back. The overshoot
   bezier (1.56) on the class gives it the spring; the keyframe shapes the
   grow-and-return so it reads as a momentary blossom, not a pop-and-hold. */
@keyframes logo-bloom {
  0% {
    transform: scale(1);
  }
  38% {
    transform: scale(1.16);
  }
  100% {
    transform: scale(1);
  }
}

/* Warm halo swelling under the mark on bloom. */
@keyframes logo-glow {
  0% {
    opacity: 0;
    transform: scale(0.7);
    box-shadow: 0 0 0 0 var(--thread-glow);
  }
  38% {
    opacity: 1;
    transform: scale(1.15);
    box-shadow:
      0 0 22px 10px var(--thread-glow),
      0 0 8px 2px rgba(245, 216, 126, 0.5);
  }
  100% {
    opacity: 0;
    transform: scale(1.3);
    box-shadow: 0 0 0 0 var(--thread-glow);
  }
}

@keyframes logo-glow-ripple {
  0% {
    opacity: 0;
    transform: scale(0.7);
    box-shadow: 0 0 0 0 var(--thread-glow);
  }
  32% {
    opacity: 1;
    box-shadow:
      0 0 22px 10px var(--thread-glow),
      0 0 8px 2px rgba(245, 216, 126, 0.5);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
    box-shadow: 0 0 0 0 var(--thread-glow);
  }
}

/* Specular band sweeping left → right across the mark, once. */
@keyframes logo-shimmer {
  0% {
    left: -120%;
  }
  100% {
    left: 160%;
  }
}

/* ── Responsive ────────────────────────────────────────────── */
/* Tagline size is governed by the clamp() above (viewport-scaled, single
   line). Only the logo size steps down at these breakpoints. */
@media (max-width: 1199px) {
  .hero-logo-svg {
    width: 80px;
    height: 80px;
  }
}

@media (max-width: 767px) {
  .hero {
    padding: 2rem 1.5rem;
  }
  .hero-logo-svg {
    width: 64px;
    height: 64px;
  }
}

/* ── Reduced motion — disable the reveal ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  body::before {
    opacity: 0.025;
    animation: none;
  }
  .hero-logo {
    opacity: 1;
    transform: none;
    animation: none;
  }
  .hero-tagline {
    opacity: 1;
    transform: none;
    animation: none;
  }
  .hero-cta {
    opacity: 1;
    transform: none;
    animation: none;
  }
  /* Hover still fills, just without the slide. */
  .download-btn::before,
  .download-menu {
    transition: none;
  }

  /* No spin, no growth. The hover wind-up is suppressed entirely; the
     click-bloom degrades to a calm, brief glow with no scale or shimmer. */
  .hero-logo-spin.is-winding,
  .hero-logo-svg.is-blooming {
    animation: none;
    transform: none;
  }
  .hero-logo-shimmer.is-blooming {
    opacity: 0;
  }
  .hero-logo-shimmer.is-blooming::before {
    animation: none;
  }
  .hero-logo-glow.is-blooming {
    animation: logo-glow-calm 360ms ease forwards;
  }
  .logo-glow-ripple {
    animation: logo-glow-calm 360ms ease forwards;
  }
}

/* Reduced-motion bloom fallback: a gentle halo that fades in and out, no
   scale, no spin, no shimmer. */
@keyframes logo-glow-calm {
  0% {
    opacity: 0;
    transform: none;
    box-shadow: 0 0 0 0 var(--thread-glow);
  }
  50% {
    opacity: 1;
    transform: none;
    box-shadow: 0 0 16px 6px var(--thread-glow);
  }
  100% {
    opacity: 0;
    transform: none;
    box-shadow: 0 0 0 0 var(--thread-glow);
  }
}
