/* Melli website. Colors come from bloom-swarm/data/design-tokens.json.
   Shape rule: interactive controls are full pills; cards and media use --r-lg (outer) and --r-md (inner core);
   phone frames use --r-phone. Nothing else gets a radius. */

@font-face {
  font-family: "Fredoka";
  src: url("../fonts/fredoka-var.woff2") format("woff2");
  font-weight: 300 700;
  font-stretch: 75% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-var.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}
/* Metric-matched fallbacks keep the swap from shifting the layout. */
@font-face { font-family: "Fredoka Fallback"; src: local("Arial Rounded MT Bold"), local("Arial"); size-adjust: 96%; ascent-override: 98%; descent-override: 24%; }
@font-face { font-family: "Nunito Fallback"; src: local("Arial"); size-adjust: 101%; ascent-override: 100%; descent-override: 35%; }

:root {
  /* tokens: brand */
  --honey: #FFB300;
  --honey-dark: #C98A00;
  --honey-light: #FFE27A;
  --petal: #FF5C8A;
  --petal-deep: #D92D63;
  --leaf: #43D486;
  --leaf-deep: #178A47;
  --violet: #B07CFF;
  --sky: #DDF1FF;
  --sky-top: #6EC3F2;
  --night: #1E1B33;
  --night-horizon: #3B2F5C;
  --wasp: #D6344F;
  --grey-track: #B1B8C2;
  --grey-ground: #9AA4B1;
  --grey-sky: #D9DEE5;

  /* semantic (light: a warm honey morning) */
  --bg: #FFF3D1;
  --bg-deep: #FFE7A6;
  --surface: #FFF9EA;
  --surface-line: #EAD9A8;
  --ink: #22202B;
  --ink-soft: #4A4757;
  --ink-faint: #8A8295;
  --on-honey: #22202B;
  --shadow: 0 1px 0 rgb(255 255 255 / .7) inset, 0 34px 70px -38px rgb(120 72 0 / .45), 0 10px 24px -18px rgb(120 72 0 / .35);
  --shadow-soft: 0 24px 60px -36px rgb(120 72 0 / .40);

  --f-display: "Fredoka", "Fredoka Fallback", ui-rounded, system-ui, sans-serif;
  --f-body: "Nunito", "Nunito Fallback", ui-rounded, system-ui, sans-serif;

  --r-lg: 2rem;
  --r-md: 1.55rem;
  --r-phone: 2.1rem;
  --gutter: clamp(1rem, 4.2vw, 3.5rem);
  --maxw: 1320px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --z-nav: 40;
  --z-menu: 50;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* dark: the Night Garden */
    --bg: #1E1B33;
    --bg-deep: #2A2548;
    --surface: #272241;
    --surface-line: #3D3660;
    --ink: #FFF3D1;
    --ink-soft: #D9D0EE;
    --ink-faint: #A49BBF;
    --shadow: 0 1px 0 rgb(255 255 255 / .06) inset, 0 34px 70px -38px rgb(0 0 0 / .7), 0 10px 24px -18px rgb(0 0 0 / .5);
    --shadow-soft: 0 24px 60px -36px rgb(0 0 0 / .7);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 5.5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 500;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, picture, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 {
  font-family: var(--f-display);
  color: var(--ink);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--honey-dark); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--honey-light); color: #22202B; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.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; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 99; background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 999px; font-weight: 800; text-decoration: none; }
.skip:focus { top: 1rem; }

/* ---------------------------------------------------------------- icons (game UI glyphs used as masks) */
.ico { display: inline-block; width: 1em; height: 1em; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; flex: none; }
.ico--play { --m: url("../img/ui/icon_play.webp"); }
.ico--back { --m: url("../img/ui/icon_back.webp"); }
.ico--next { --m: url("../img/ui/icon_back.webp"); transform: scaleX(-1); }
.ico--check { --m: url("../img/ui/icon_check.webp"); }
.ico--close { --m: url("../img/ui/icon_close.webp"); }
.ico--lock { --m: url("../img/ui/icon_lock.webp"); }
.ico--star { --m: url("../img/ui/icon_star.webp"); }
.ico--bee { --m: url("../img/ui/icon_bee_white.webp"); }
.ico--book { --m: url("../img/ui/icon_book.webp"); }

/* ---------------------------------------------------------------- buttons */
.btn {
  --h: 3.5rem;
  display: inline-flex; align-items: center; gap: .85rem;
  min-height: var(--h);
  padding: .4rem .45rem .4rem 1.5rem;
  border-radius: 999px;
  border: 0;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: .005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease), background-color .3s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(2px) scale(.985); }
.btn__icon {
  display: grid; place-items: center;
  width: 2.65rem; height: 2.65rem; border-radius: 999px;
  font-size: .95rem;
  transition: transform .55s var(--ease);
}
.btn:hover .btn__icon { transform: translateX(3px) scale(1.06); }
.btn__label { display: flex; flex-direction: column; line-height: 1.05; }
.btn__label small { font-family: var(--f-body); font-weight: 800; font-size: .7rem; letter-spacing: .02em; opacity: .78; }
/* honey candy: the game's buy button, with its lip */
.btn--honey {
  background: linear-gradient(#FFD24D, var(--honey) 60%);
  color: var(--on-honey);
  box-shadow: 0 -4px 0 0 var(--honey-dark) inset, 0 2px 0 0 rgb(255 255 255 / .55) inset, 0 18px 34px -18px rgb(201 138 0 / .9);
}
.btn--honey .btn__icon { background: #22202B; color: var(--honey); }
.btn--honey:hover { box-shadow: 0 -4px 0 0 var(--honey-dark) inset, 0 2px 0 0 rgb(255 255 255 / .55) inset, 0 24px 40px -18px rgb(201 138 0 / 1); }
.btn--ghost {
  background: transparent; color: var(--ink);
  box-shadow: 0 0 0 2px var(--surface-line) inset;
  padding-right: 1.5rem;
}
.btn--ghost:hover { box-shadow: 0 0 0 2px var(--ink-faint) inset; }
.btn--sm { --h: 2.75rem; font-size: .95rem; padding: .3rem .3rem .3rem 1.1rem; gap: .6rem; }
.btn--sm .btn__icon { width: 2.15rem; height: 2.15rem; font-size: .8rem; }

/* ---------------------------------------------------------------- nav: a floating island */
.nav {
  position: fixed; z-index: var(--z-nav);
  top: max(.75rem, env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 1.5rem), 1120px);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: 4rem;
  padding: 0 .5rem 0 1.1rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--surface-line) 70%, transparent) inset, 0 18px 40px -26px rgb(120 72 0 / .45);
  transition: transform .6s var(--ease), opacity .4s var(--ease);
}
.nav.is-hidden { transform: translate(-50%, -140%); }
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); font-family: var(--f-display); font-weight: 650; font-size: 1.55rem; letter-spacing: -0.02em; }
.brand img { width: 2.6rem; height: 2.6rem; margin: -.3rem 0; }
.nav__links { display: none; gap: .2rem; list-style: none; margin: 0; padding: 0; }
.nav__links a { display: block; padding: .5rem .85rem; border-radius: 999px; text-decoration: none; font-weight: 800; font-size: .95rem; color: var(--ink-soft); transition: background-color .3s var(--ease), color .3s var(--ease); }
.nav__links a:hover { background: color-mix(in srgb, var(--honey-light) 55%, transparent); color: var(--ink); }
.nav__cta { display: none; }
.burger { position: relative; width: 3rem; height: 3rem; border-radius: 999px; border: 0; background: var(--ink); cursor: pointer; }
.burger span { position: absolute; left: 50%; width: 1.15rem; height: 2px; margin-left: -.575rem; background: var(--bg); border-radius: 2px; transition: transform .5s var(--ease), top .5s var(--ease); }
.burger span:nth-child(1) { top: calc(50% - 4px); }
.burger span:nth-child(2) { top: calc(50% + 3px); }
.burger[aria-expanded="true"] span:nth-child(1) { top: calc(50% - 1px); transform: rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { top: calc(50% - 1px); transform: rotate(-45deg); }
@media (min-width: 1000px) {
  .nav__links { display: flex; }
  .nav__cta { display: inline-flex; }
  .burger { display: none; }
}
.menu {
  position: fixed; inset: 0; z-index: var(--z-menu);
  display: flex; flex-direction: column; justify-content: center;
  padding: 6rem var(--gutter) 3rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  opacity: 0; visibility: hidden;
  transition: opacity .45s var(--ease), visibility 0s linear .45s;
}
.menu.is-open { opacity: 1; visibility: visible; transition: opacity .45s var(--ease); }
.menu ul { list-style: none; margin: 0 0 2rem; padding: 0; }
.menu li { overflow: hidden; }
.menu li a { display: block; padding: .35rem 0; font-family: var(--f-display); font-weight: 600; font-size: clamp(2.2rem, 11vw, 3.4rem); line-height: 1.05; color: var(--ink); text-decoration: none; transform: translateY(110%); transition: transform .7s var(--ease); }
.menu.is-open li a { transform: none; }
.menu.is-open li:nth-child(2) a { transition-delay: .05s; }
.menu.is-open li:nth-child(3) a { transition-delay: .1s; }
.menu.is-open li:nth-child(4) a { transition-delay: .15s; }
.menu.is-open li:nth-child(5) a { transition-delay: .2s; }
.menu.is-open li:nth-child(6) a { transition-delay: .25s; }
.menu .menu__close { position: absolute; top: max(1.25rem, env(safe-area-inset-top)); right: 1.25rem; }
body.menu-open { overflow: hidden; }
.menu > .btn { align-self: flex-start; }

/* ---------------------------------------------------------------- shared media */
.phone {
  position: relative; margin: 0;
  aspect-ratio: 720 / 1560;
  border-radius: var(--r-phone);
  padding: .5rem;
  background: #22202B;
  box-shadow: 0 0 0 1px rgb(255 255 255 / .08) inset, var(--shadow);
}
.phone > picture, .phone > img { width: 100%; height: 100%; }
.phone img { width: 100%; height: 100%; object-fit: cover; border-radius: calc(var(--r-phone) - .5rem); background: var(--grey-sky); }
.bezel { padding: .45rem; border-radius: var(--r-lg); background: color-mix(in srgb, var(--surface-line) 45%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--surface-line) 80%, transparent) inset; }
.bezel > .core { border-radius: var(--r-md); background: var(--surface); box-shadow: 0 1px 0 rgb(255 255 255 / .65) inset, var(--shadow-soft); overflow: hidden; }

/* ---------------------------------------------------------------- reveal on scroll */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(2.2rem); filter: blur(6px); transition: opacity .9s var(--ease), transform 1.1s var(--ease), filter .9s var(--ease); }
  .js .reveal.is-in { opacity: 1; transform: none; filter: none; }
  .js .reveal[data-delay="1"] { transition-delay: .08s; }
  .js .reveal[data-delay="2"] { transition-delay: .16s; }
  .js .reveal[data-delay="3"] { transition-delay: .24s; }
}

/* ---------------------------------------------------------------- section rhythm */
.section { position: relative; padding-block: clamp(5rem, 12vw, 10rem); }
.h2 { font-size: clamp(2.6rem, 7.4vw, 5.6rem); font-weight: 650; line-height: .94; letter-spacing: -0.03em; }
.lede { font-size: clamp(1.08rem, 1.5vw, 1.25rem); max-width: 34rem; color: var(--ink-soft); }
.lede strong { color: var(--ink); font-weight: 800; }
.kicker { display: inline-flex; align-items: center; gap: .5rem; font-weight: 900; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--honey-dark); }
@media (prefers-color-scheme: dark) { .kicker { color: var(--honey); } }

/* ---------------------------------------------------------------- footer */
.footer { position: relative; padding: 4rem 0 calc(2.5rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--surface-line); }
.footer__grid { display: grid; gap: 2.5rem; }
.footer__brand p { margin-top: .75rem; max-width: 22rem; }
.footer__links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem 2rem; list-style: none; margin: 0; padding: 0; }
.footer__links a { font-weight: 800; text-decoration: none; color: var(--ink); padding: .3rem 0; display: inline-block; }
.footer__links a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--honey); }
.footer__legal { margin-top: 3rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; font-size: .9rem; color: var(--ink-faint); }
@media (min-width: 800px) { .footer__grid { grid-template-columns: 1.4fr 1fr; align-items: start; } }

/* ---------------------------------------------------------------- simple content pages (privacy, press, 404) */
.page-hero { padding: clamp(8rem, 16vw, 11rem) 0 clamp(2.5rem, 6vw, 4rem); }
.page-hero h1 { font-size: clamp(2.8rem, 9vw, 6rem); font-weight: 650; letter-spacing: -0.03em; line-height: .95; }
.page-hero p { margin-top: 1.25rem; font-size: 1.15rem; max-width: 38rem; }
.prose { max-width: 44rem; padding-bottom: clamp(4rem, 10vw, 7rem); }
.prose h2 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); margin: 3rem 0 .9rem; line-height: 1.1; }
.prose h3 { font-size: 1.25rem; margin: 2rem 0 .6rem; }
.prose p, .prose ul { margin: 0 0 1rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: .35rem 0; }
.prose li::marker { color: var(--honey-dark); }
.prose a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--honey); font-weight: 800; }
.prose strong { color: var(--ink); }
.prose .fill { background: var(--honey-light); color: #22202B; padding: .05rem .4rem; border-radius: 6px; font-weight: 800; }
.callout { margin: 2rem 0; padding: 1.4rem 1.5rem; border-radius: var(--r-md); background: var(--surface); box-shadow: 0 0 0 1px var(--surface-line) inset; }
.callout p:last-child { margin: 0; }
