/* ============================================================================
   BUYA — Rail & Return design system
   One neutral engine under the store. isiZulu: buya, "to come back."
   Offline-safe: system font stacks only, no external assets.
   ========================================================================== */

/* ---- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---- Tokens --------------------------------------------------------------- */
:root {
  /* Rail & Return palette */
  --ink:      #17120E;   /* warm near-black ground */
  --ink-2:    #201911;   /* raised surface */
  --ink-3:    #2B2118;   /* hairlines / raised-raised */
  --bone:     #F0E9DB;   /* warm paper */
  --bone-dim: #C7BCA6;   /* muted paper text */
  --return:   #FF5A36;   /* ember — the one bold accent, CTAs, the arc */
  --return-2: #FF7A5C;
  --rail:     #34A79E;   /* deep teal — the neutral rail, links, nodes */
  --rail-2:   #4FC4BA;
  --gold:     #E9B23C;   /* points / money — incrementality proof only */

  /* Semantic (dark is the default identity) */
  --ground:      var(--ink);
  --surface:     var(--ink-2);
  --surface-2:   var(--ink-3);
  --line:        rgba(240,233,219,.12);
  --line-strong: rgba(240,233,219,.22);
  --text:        var(--bone);
  --text-dim:    var(--bone-dim);
  --text-faint:  rgba(240,233,219,.45);
  --accent:      var(--return);
  --accent-ink:  #1a0d07;         /* text on ember */
  --receipt-bg:  #F4EEDF;         /* thermal paper */
  --receipt-ink: #2a2118;

  /* Type */
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;

  --step--1: clamp(.78rem, .76rem + .1vw, .84rem);
  --step-0:  clamp(.95rem, .92rem + .15vw, 1.02rem);
  --step-1:  clamp(1.12rem, 1.05rem + .35vw, 1.35rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --step-3:  clamp(2.1rem, 1.6rem + 2.4vw, 3.4rem);
  --step-4:  clamp(2.9rem, 1.9rem + 4.6vw, 5.6rem);

  /* Space + shape */
  --gutter: clamp(1.2rem, 4vw, 3rem);
  --maxw: 1180px;
  --r-sm: 8px; --r-md: 14px; --r-lg: 22px;
  --shadow: 0 24px 60px -28px rgba(0,0,0,.7);
  --ease: cubic-bezier(.2,.7,.2,1);
}

:root[data-theme="light"] {
  --ground:      #EFE7D6;
  --surface:     #F7F1E4;
  --surface-2:   #FBF6EC;
  --line:        rgba(28,20,12,.14);
  --line-strong: rgba(28,20,12,.26);
  --text:        #1E170F;
  --text-dim:    #6A5C48;
  --text-faint:  rgba(30,23,15,.5);
  --accent:      #E8481F;
  --accent-ink:  #fff4ee;
  --rail:        #157C74;
  --rail-2:      #0F6A63;
  --gold:        #A9741A;
  --receipt-bg:  #FBF7EE;
  --receipt-ink: #201a12;
  --shadow: 0 24px 60px -30px rgba(60,40,20,.32);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground:#EFE7D6; --surface:#F7F1E4; --surface-2:#FBF6EC;
    --line:rgba(28,20,12,.14); --line-strong:rgba(28,20,12,.26);
    --text:#1E170F; --text-dim:#6A5C48; --text-faint:rgba(30,23,15,.5);
    --accent:#E8481F; --accent-ink:#fff4ee; --rail:#157C74; --rail-2:#0F6A63;
    --gold:#A9741A; --receipt-bg:#FBF7EE; --receipt-ink:#201a12;
    --shadow:0 24px 60px -30px rgba(60,40,20,.32);
  }
}

/* ---- Base ----------------------------------------------------------------- */
body {
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--text);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--rail-2);
  outline-offset: 3px;
  border-radius: 3px;
}

.wrap { width: min(100% - var(--gutter) * 2, var(--maxw)); margin-inline: auto; }
.wrap--wide { --maxw: 1320px; }

.eyebrow {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.eyebrow b { color: var(--accent); font-weight: 600; }

.mono { font-family: var(--mono); }
.accent { color: var(--accent); }
.rail-c { color: var(--rail); }

/* Section rhythm */
.section { padding-block: clamp(3.5rem, 8vw, 7rem); position: relative; }
.section-head { max-width: 46ch; margin-bottom: clamp(2rem, 4vw, 3.2rem); }
.section-head h2 {
  font-size: var(--step-3);
  line-height: 1.03;
  letter-spacing: -.02em;
  font-weight: 800;
  margin-top: .7rem;
}
.section-head p { color: var(--text-dim); font-size: var(--step-1); margin-top: 1rem; }

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .55em;
  padding: .85em 1.35em;
  border-radius: 999px;
  font-weight: 650;
  font-size: var(--step-0);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s var(--ease), background .2s, border-color .2s, color .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px -12px var(--accent); }
.btn--primary:hover { background: var(--return-2); }
.btn--ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--text); background: color-mix(in oklab, var(--text) 6%, transparent); }
.btn--rail { background: var(--rail); color: #06110f; }
.btn--rail:hover { background: var(--rail-2); }
.btn .arw { transition: transform .2s var(--ease); }
.btn:hover .arw { transform: translateX(3px); }
.btn--lg { padding: 1.05em 1.7em; font-size: var(--step-1); }

/* ---- Site nav ------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: color-mix(in oklab, var(--ground) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav__in { display: flex; align-items: center; gap: 1.5rem; padding-block: .8rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; letter-spacing: -.02em; font-size: 1.28rem; }
.brand__mark { width: 30px; height: 30px; flex: none; }
.brand small { font-family: var(--mono); font-size: .58rem; letter-spacing: .16em; color: var(--text-dim); text-transform: uppercase; font-weight: 500; margin-left: .1rem; align-self: flex-start; margin-top: .1rem; }
.nav__links { display: flex; gap: 1.4rem; margin-left: auto; align-items: center; }
.nav__links a.navlink { color: var(--text-dim); font-size: var(--step-0); transition: color .2s; }
.nav__links a.navlink:hover { color: var(--text); }
.nav__cta { display: flex; align-items: center; gap: .6rem; }
.nav__links .nav__cta { display: none; } /* mobile-dropdown CTAs; shown only when .open (see @media) */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-dim);
  transition: color .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text); }
.nav__burger { display: none; }
@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__links.open {
    display: flex; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: .5rem var(--gutter) 1.2rem;
  }
  .nav__links.open a.navlink { padding: .7rem 0; width: 100%; border-bottom: 1px solid var(--line); }
  .nav__links.open .nav__cta { display: flex; margin-top: .9rem; }
  .nav__burger {
    display: grid; place-items: center; width: 40px; height: 40px; margin-left: auto;
    background: transparent; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; color: var(--text);
  }
  .nav__cta--desktop { display: none; }
}

/* ---- Footer --------------------------------------------------------------- */
.footer { border-top: 1px solid var(--line); padding-block: clamp(2.5rem,5vw,4rem) 2rem; }
.footer__grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 2rem; }
.footer h4 { font-family: var(--mono); font-size: var(--step--1); letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 1rem; }
.footer a { color: var(--text-dim); display: block; padding: .28rem 0; transition: color .2s; }
.footer a:hover { color: var(--text); }
.footer__meta { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--text-faint); font-size: var(--step--1); }
.popia { font-family: var(--mono); font-size: var(--step--1); color: var(--text-dim); max-width: 60ch; line-height: 1.7; }
.popia b { color: var(--text); }
@media (max-width: 760px) { .footer__grid { grid-template-columns: 1fr 1fr; } }

/* ---- Utility -------------------------------------------------------------- */
.tag {
  display: inline-flex; align-items: center; gap: .4em;
  font-family: var(--mono); font-size: var(--step--1); letter-spacing: .04em;
  padding: .3em .7em; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-dim);
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rail); }
.tag .dot--live { background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 color-mix(in oklab,var(--accent) 70%,transparent);} 70%{box-shadow:0 0 0 7px transparent;} 100%{box-shadow:0 0 0 0 transparent;} }

.divider-lbl { display: flex; align-items: center; gap: 1rem; color: var(--text-faint); font-family: var(--mono); font-size: var(--step--1); letter-spacing: .12em; text-transform: uppercase; }
.divider-lbl::before, .divider-lbl::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
