/* Minibyte — shared styles for the site at minibyte.app.
 *
 * The palette is copied verbatim from the app's own DesignSystem.swift rather than invented,
 * so the page and the product read as one thing. Terracotta means "act on this" here exactly
 * as it does in the app; green is reserved for bytes that have actually gone, never a
 * forecast. If a token moves in Swift, move it here.
 *
 * Three surfaces, same as the app: ground (the page) → sunken (chips, tracks, passive notes)
 * → surface (raised cards), plus the accent card, which appears once on the whole site.
 *
 * Type is the system stack on purpose. The app ships SF Pro, and -apple-system renders real
 * SF on every device a visitor is likely to be holding — a closer match than any webfont,
 * and nothing to download.
 */

:root {
  --ground:      #EDEBE8;  /* Colors.ground */
  --surface:     #FFFFFF;  /* Colors.surface */
  --sunken:      #E2DFDB;  /* Colors.sunken */
  --ink:         #16130F;  /* Colors.ink */
  --ink-soft:    #6B6560;  /* Colors.inkSoft */
  --ink-faint:   #9C948C;  /* Colors.inkFaint — rules and tracks, never text */
  --hairline:    #DCD8D3;  /* Colors.hairline */
  --accent:      #D2542F;  /* Colors.accent — fills and controls */
  --accent-ink:  #AE4023;  /* Colors.accentInk — the value that carries text */
  --accent-wash: #F6E3DB;  /* Colors.accentWash */
  --done:        #2F7D4F;  /* Colors.positive */
  --on-accent:   #FFFFFF;  /* Colors.onAccent */
  --bezel:       #23201D;
  --glow:        rgba(210,84,47,.16);
  --card-line:   transparent;

  /* Every filled control on the site. White on the #D2542F fill is 4.16:1 and dark ink on
     the dark-mode fill is what clears it there — there is no button exemption in 1.4.3, and
     no type size in this design reaches the large-text threshold (1.1rem is 17.6px, not the
     18.66px the exemption needs). So controls take the deeper terracotta in light, and the
     fill with dark ink in dark: 5.9:1 and 5.44:1. */
  --control-fill: #AE4023;
  --control-ink:  #FFFFFF;

  /* Ink for body text on a sunken surface. inkSoft clears 4.5:1 on ground and on surface,
     but lands at 4.33:1 on sunken, which is where the free-plan list and the hero chips
     live. */
  --ink-on-sunken: #635E58;

  /* The accent *card* is fixed in both appearances, as it is in the app: it is a light
     surface either way. It carries paragraphs, so it takes accentInk — white on it is
     5.9:1. */
  --accent-card: #AE4023;

  /* Depth is two shadows, never one: a tight contact shadow plus a wide faint one. */
  --shadow-card: 0 1px 2px rgba(22,19,15,.05), 0 14px 34px -18px rgba(22,19,15,.18);
  --shadow-lift: 0 2px 4px rgba(22,19,15,.06), 0 30px 60px -28px rgba(22,19,15,.30);
  --shadow-hero: 0 2px 6px rgba(174,64,35,.24), 0 22px 48px -22px rgba(210,84,47,.50);
  --shadow-phone: 0 2px 8px rgba(22,19,15,.14), 0 40px 80px -32px rgba(22,19,15,.45);

  --radius-hero: 30px;
  --radius:      26px;
  --radius-sm:   14px;

  --gutter:      1.25rem;
  --section:     clamp(4rem, 8vw, 6.5rem);
  --stack:       clamp(1.75rem, 3.5vw, 2.25rem);
}

/* Shadows do nothing on a near-black ground, so cards take a hairline instead — the same
   swap .cardStyle() makes in the app. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:      #121110;
    --surface:     #1F1D1B;
    --sunken:      #1A1917;
    --ink:         #F5F2EE;
    --ink-soft:    #9C948C;
    --ink-faint:   #6B6560;
    --hairline:    #2C2A27;
    --accent:      #E0673C;
    --accent-ink:  #F2916D;
    --accent-wash: #33211A;
    --done:        #5CC98A;
    --on-accent:   #FFFFFF;
    --bezel:       #000000;
    --glow:        rgba(224,103,60,.14);
    --card-line:   var(--hairline);
    --control-fill: var(--accent);
    --control-ink:  #16130F;
    --ink-on-sunken: var(--ink-soft);
    --shadow-card: none;
    --shadow-lift: 0 2px 4px rgba(0,0,0,.5), 0 30px 60px -28px rgba(0,0,0,.8);
    --shadow-hero: 0 2px 6px rgba(0,0,0,.5), 0 22px 48px -22px rgba(0,0,0,.7);
    --shadow-phone: 0 2px 8px rgba(0,0,0,.6), 0 40px 80px -32px rgba(0,0,0,.85);
  }
}

:root[data-theme="dark"] {
  --ground:      #121110;
  --surface:     #1F1D1B;
  --sunken:      #1A1917;
  --ink:         #F5F2EE;
  --ink-soft:    #9C948C;
  --ink-faint:   #6B6560;
  --hairline:    #2C2A27;
  --accent:      #E0673C;
  --accent-ink:  #F2916D;
  --accent-wash: #33211A;
  --done:        #5CC98A;
  --on-accent:   #FFFFFF;
  --bezel:       #000000;
  --glow:        rgba(224,103,60,.14);
  --card-line:   var(--hairline);
  --control-fill: var(--accent);
  --control-ink:  #16130F;
  --ink-on-sunken: var(--ink-soft);
  --shadow-card: none;
  --shadow-lift: 0 2px 4px rgba(0,0,0,.5), 0 30px 60px -28px rgba(0,0,0,.8);
  --shadow-hero: 0 2px 6px rgba(0,0,0,.5), 0 22px 48px -22px rgba(0,0,0,.7);
  --shadow-phone: 0 2px 8px rgba(0,0,0,.6), 0 40px 80px -32px rgba(0,0,0,.85);
}

* { box-sizing: border-box; }

/* overflow-x lives on <html>, never on <body>: a scroll container on <body> silently
   breaks position:sticky and IntersectionObserver for everything inside it. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap { max-width: 66rem; margin: 0 auto; padding: 0 var(--gutter); }
.wrap--prose { max-width: 44rem; }

.section { margin-top: var(--section); }
.measure { max-width: 34rem; }
.center  { text-align: center; }
.stack   { margin-top: var(--stack); }

/* ---------- masthead ---------- */
.masthead {
  /* Transparent until something scrolls under it. A translucent panel sitting over the hero's
     warm bloom draws a visible seam across the top of the page, and at the top of the page
     there is nothing to blur anyway. */
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, background-color .2s ease;
}
.masthead.is-stuck, .masthead--flat {
  background: color-mix(in srgb, var(--ground) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom-color: var(--hairline);
}
/* The gutter is set here, not inherited from .wrap: .wrap's own padding shorthand loses to
   any later padding declaration, and the wordmark ends up 20px off the page grid. */
.masthead__inner {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem var(--gutter);
}
.wordmark {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink); text-decoration: none;
  margin-right: auto; padding: .6rem 0;
}
.wordmark svg { display: block; flex: none; color: var(--accent-ink); }
.masthead nav { display: flex; align-items: center; gap: .35rem; }
.masthead nav a {
  font-size: .92rem; color: var(--ink-soft); text-decoration: none;
  padding: .65rem; border-radius: var(--radius-sm);
}
.masthead nav a:hover, .masthead nav a[aria-current="page"] { color: var(--accent-ink); }
/* The download pill is a filled control, not a nav link — it keeps its own ink. */
.masthead nav a.cta, .masthead nav a.cta:hover { color: var(--control-ink); }

/* One accent surface per viewport: above the fold that is the hero button, so the pill in
   the masthead only arrives once the hero has scrolled past. */
.masthead .cta--small {
  display: none; margin-left: .4rem;
  opacity: 0; transform: translateY(-2px); transition: opacity .25s ease, transform .25s ease;
}
@media (min-width: 34rem) { .masthead .cta--small { display: inline-flex; } }
.masthead.is-stuck .cta--small { opacity: 1; transform: none; }
/* The subpages have no hero to scroll past, so their pill is there from the start. */
.masthead--flat .cta--small { opacity: 1; transform: none; }

/* ---------- type ---------- */
.eyebrow {
  font-size: .74rem; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-soft); margin: 0 0 .85rem;
}
.display {
  font-size: clamp(2.9rem, 8.4vw, 4.6rem); font-weight: 800;
  letter-spacing: -.038em; line-height: .96; margin: 0 0 1.25rem;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 6vw, 2.9rem); font-weight: 800; letter-spacing: -.03em;
     line-height: 1.05; margin: 0 0 1rem; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.1rem); font-weight: 750; letter-spacing: -.025em;
     line-height: 1.12; margin: 0 0 .75rem; text-wrap: balance; }
h3 { font-size: 1.08rem; font-weight: 700; letter-spacing: -.012em; margin: 0 0 .35rem; }
p  { margin: 0 0 1rem; }
.lede { font-size: clamp(1.1rem, 2.2vw, 1.28rem); color: var(--ink-soft); text-wrap: pretty;
        line-height: 1.5; max-width: 34rem; }
.soft { color: var(--ink-soft); }
.fine { color: var(--ink-soft); font-size: .86rem; line-height: 1.5; }
.num  { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
a { color: var(--accent-ink); text-underline-offset: 3px; }

/* ---------- hero ---------- */
.hero { position: relative; padding-top: clamp(2rem, 5vw, 3.5rem); }
.hero::before {
  /* One warm bloom behind the phone. The page's only gradient, and it must not widen the
     document — a percentage inset reaching past the viewport gives mobile a horizontal
     scrollbar and shrinks the layout viewport. */
  content: ""; position: absolute; inset: -12% 0 auto; height: 40rem;
  background: radial-gradient(72% 48% at 76% 26%, var(--glow), transparent 72%);
  pointer-events: none; z-index: -1;
}
.hero__grid { display: grid; gap: clamp(2.5rem, 6vw, 4rem); align-items: center; }
@media (min-width: 60rem) {
  .hero__grid { grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr); }
}
.hero__claims {
  display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 1.75rem; padding: 0; list-style: none;
}
.hero__claims li {
  background: var(--sunken); color: var(--ink-on-sunken);
  font-size: .82rem; font-weight: 600; padding: .3rem .75rem; border-radius: 999px;
}

/* ---------- phone ---------- */
.phone {
  position: relative; width: 100%; max-width: 19rem; margin: 0 auto;
  border-radius: 13.5%/6.4%; padding: .55rem;
  background: linear-gradient(160deg, #3A3630, var(--bezel) 42%, #100E0C);
  box-shadow: var(--shadow-phone);
}
.phone img {
  display: block; width: 100%; height: auto;
  border-radius: 11%/5.2%;
  background: var(--sunken);
}

/* The stage is exactly as wide as the phone, so anything pinned to its edge stays pinned to
   the phone at every width instead of drifting off into the gutter. */
.hero__stage { position: relative; max-width: 20.5rem; margin: 0 auto; }
.hero__stage .phone { max-width: none; }

.hero__chip {
  background: var(--surface); border: 1px solid var(--card-line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem; box-shadow: var(--shadow-lift);
  margin: 1.25rem auto 0; max-width: 20.5rem;
}
@media (min-width: 62rem) {
  .hero__chip { position: absolute; left: -4rem; bottom: 6.5rem; z-index: 2;
                width: 16rem; margin: 0; }
}
.hero__chip .chip-title {
  margin: 0 0 .9rem; color: var(--ink); font-weight: 650; font-size: .92rem; line-height: 1.35;
}

/* Two bars against the 25 MB line: why the result on the phone matters, rather than a second
   printing of what it says. The "before" bar is a track, not a control, so it takes no
   accent — the same way SavingsBar draws the original as a ghost. */
.gauge { position: relative; display: grid; gap: .5rem; padding-top: 1.15rem; }
.gauge-row { display: grid; grid-template-columns: 1fr 3.9rem; gap: .5rem; align-items: center; }
.gauge-bar { background: var(--sunken); border-radius: 999px; height: 11px; overflow: hidden; }
.gauge-label { font-size: .76rem; font-weight: 650; color: var(--ink-soft); }
.gauge-label.now { color: var(--done); }
.gauge-bar i {
  display: block; height: 100%; border-radius: 999px; background: var(--ink-soft);
  transform-origin: left center; transform: scaleX(var(--to, 1));
}
.gauge-bar i.is-result { background: var(--done); }
.gauge-bar i.is-animated { animation: contract 1.1s cubic-bezier(.22,.61,.36,1) both; }
.gauge-line {
  position: absolute; top: .95rem; bottom: -.2rem; width: 0;
  border-left: 1.5px dashed var(--ink-faint);
}
.gauge-line b {
  position: absolute; top: -1.2rem; left: .35rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; color: var(--ink-soft);
  white-space: nowrap;
}
@keyframes contract { from { transform: scaleX(var(--from, 1)); } to { transform: scaleX(var(--to, 1)); } }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 3vw, 2.1rem); box-shadow: var(--shadow-card);
}
.card--accent {
  position: relative; overflow: hidden; border: 0;
  padding: clamp(1.6rem, 3.4vw, 2.4rem);
  background: var(--accent-card); color: var(--on-accent);
  border-radius: var(--radius-hero); box-shadow: var(--shadow-hero);
}
.card--accent .eyebrow,
.card--accent h2,
.card--accent p { color: var(--on-accent); }
.card--accent .eyebrow { opacity: .84; }
.card--accent .mark-watermark {
  /* In the flow, not absolutely placed: the copy pushes the stamp down instead of running
     through it, whatever anyone writes here later. */
  display: none; width: 4.75rem; opacity: .2;
  margin: .35rem 0 0 auto; pointer-events: none;
}
@media (min-width: 58rem) { .card--accent .mark-watermark { display: block; } }

/* ---------- split rows: copy beside a phone ---------- */
.split { display: grid; gap: clamp(2rem, 5vw, 3.5rem); align-items: center; }
.split .phone { max-width: 17rem; }
@media (min-width: 58rem) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); }
  .split--flip > :first-child { order: 2; }
}

/* ---------- feature grid ---------- */
.features { display: grid; gap: .9rem; }
@media (min-width: 40rem) { .features { grid-template-columns: 1fr 1fr; } }
@media (min-width: 62rem) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature {
  background: var(--surface); border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow-card);
}
.feature p { margin: 0; color: var(--ink-soft); font-size: .95rem; line-height: 1.55; }
.icon-chip {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border-radius: 999px; background: var(--sunken); color: var(--ink);
  margin-bottom: .95rem;
}
.icon-chip svg { display: block; }

/* ---------- screenshot rail ---------- */
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: 14rem;
  gap: 1.5rem; overflow-x: auto; scroll-snap-type: x proximity;
  scroll-padding-left: var(--gutter);
  padding: .5rem var(--gutter) 1.5rem; margin: 0 calc(var(--gutter) * -1);
  scrollbar-width: thin;
}
@media (min-width: 46rem) { .rail { grid-auto-columns: 16rem; } }
.rail > figure { scroll-snap-align: start; margin: 0; }
.rail .phone { max-width: none; }
.rail figcaption {
  margin-top: 1rem; color: var(--ink-soft); font-size: .9rem; line-height: 1.5;
  text-wrap: pretty;
}
.rail figcaption b { color: var(--ink); font-weight: 650; display: block; }

/* ---------- facts list ---------- */
.facts { margin: 1.5rem 0 0; padding: 0; list-style: none; display: grid; gap: .75rem; }
.facts li {
  display: grid; grid-template-columns: 1.35rem 1fr; gap: .7rem;
  color: var(--ink-soft); font-size: .97rem; line-height: 1.5;
}
.facts svg { margin-top: .35rem; color: var(--ink-soft); }

/* ---------- pricing ---------- */
.plans { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 46rem) { .plans { grid-template-columns: 1fr 1fr; } }
.plan { background: var(--surface); border: 1px solid var(--card-line);
        border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow-card); }
.plan--sunken { background: var(--sunken); box-shadow: none; border-color: transparent; }
.plan ul { margin: 1rem 0 0; padding: 0; list-style: none; display: grid; gap: .55rem; }
.plan li { display: grid; grid-template-columns: 1.1rem 1fr; gap: .6rem;
           color: var(--ink-soft); font-size: .95rem; line-height: 1.5; }
.plan li svg { margin-top: .38rem; color: var(--ink-soft); }
/* Doubled class, and after the rule it overrides: .plan--sunken li ties with .plan li on
   specificity, so written above it the softer ink would simply lose. */
.plan.plan--sunken li,
.plan.plan--sunken li svg { color: var(--ink-on-sunken); }
.plan .price { font-weight: 700; color: var(--ink); font-size: 1rem; margin: .8rem 0 0; }

/* ---------- pill / cta ---------- */
.cta {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--control-fill); color: var(--control-ink);
  font-size: 1.1rem; font-weight: 700; text-decoration: none;
  padding: .85rem 1.7rem; border-radius: 999px; box-shadow: var(--shadow-hero);
  transition: transform .18s cubic-bezier(.22,.61,.36,1), filter .18s ease;
}
.cta:hover { filter: brightness(1.06); transform: translateY(-1px); }
.cta:active { transform: translateY(0) scale(.985); }
.cta--small { font-size: .95rem; padding: .6rem 1.1rem; box-shadow: none; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.cta-row .quiet { color: var(--ink-soft); text-decoration: none; font-weight: 600;
                  font-size: .95rem; padding: .55rem 0;
                  border-bottom: 1px solid var(--hairline); }
.cta-row .quiet:hover { color: var(--accent-ink); border-bottom-color: currentColor; }
.pill {
  display: inline-block; background: var(--accent-wash); color: var(--accent-ink);
  font-size: .78rem; font-weight: 700; padding: .25rem .65rem; border-radius: 999px;
}
.pill--neutral { background: var(--sunken); color: var(--ink-soft); }
.plan--sunken .pill--neutral { background: var(--surface); }

/* ---------- numbered policy sections ---------- */
.clause { border-top: 1px solid var(--hairline); padding-top: 1.6rem; margin-top: 2.1rem; }
.clause .clause-num {
  display: block; font-size: .72rem; font-weight: 700; letter-spacing: .16em;
  color: var(--accent-ink); margin-bottom: .55rem; font-variant-numeric: tabular-nums;
}
.clause h2 { font-size: 1.35rem; }
.clause p { color: var(--ink-soft); margin: 0; }

/* ---------- support Q&A ---------- */
.qa { margin: 1.5rem 0 0; }
.qa details { border-top: 1px solid var(--hairline); padding: .35rem 0; }
.qa summary {
  cursor: pointer; font-weight: 650; list-style: none; padding: .75rem 0;
  display: flex; justify-content: space-between; gap: 1rem;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: "+"; color: var(--accent-ink); font-weight: 400; flex: none; }
.qa details[open] summary::after { content: "–"; }
.qa details p { color: var(--ink-soft); margin: 0 0 .9rem; }

/* ---------- contact block ---------- */
.contact {
  background: var(--surface); border: 1px solid var(--card-line);
  border-radius: var(--radius-sm);
  padding: 1.4rem; box-shadow: var(--shadow-card); margin: 2rem 0;
}
.contact a { font-weight: 700; font-size: 1.05rem; }
.contact p:last-child { margin: .5rem 0 0; color: var(--ink-soft); font-size: .92rem; }

/* ---------- footer ---------- */
footer {
  margin-top: var(--section); padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--hairline);
  color: var(--ink-soft); font-size: .88rem;
  display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; align-items: center;
}
footer a { color: var(--ink-soft); text-decoration: none; padding: .7rem 0; }
footer a:hover { color: var(--accent-ink); }
footer .wordmark { margin-right: 1rem; padding: .7rem 0; }
footer .spacer { margin-left: auto; }

/* Anchor targets clear the sticky masthead, which otherwise eats the eyebrow and half the
   heading of whatever was linked to. */
main [id] { scroll-margin-top: 5rem; }

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

/* ---------- reveal on scroll ---------- */
/* The hiding rule is scoped to .js, which the same script sets — so a script that never
   runs can't leave half the page invisible. Children stagger, so a grid arrives as items
   rather than as one slab. */
.js .reveal > * { opacity: 0; transform: translateY(14px); }
.js .reveal.is-in > * {
  opacity: 1; transform: none;
  transition: opacity .55s cubic-bezier(.22,.61,.36,1) var(--d, 0ms),
              transform .55s cubic-bezier(.22,.61,.36,1) var(--d, 0ms);
}
.js .reveal > :nth-child(2) { --d: 60ms; }
/* order: 2 moves the phone visually but not in the DOM, so the delays would run right to
   left in a flipped row. */
.js .split--flip > :nth-child(1) { --d: 60ms; }
.js .split--flip > :nth-child(2) { --d: 0ms; }
.js .reveal > :nth-child(3) { --d: 120ms; }
.js .reveal > :nth-child(4) { --d: 180ms; }
.js .reveal > :nth-child(5) { --d: 240ms; }
.js .reveal > :nth-child(6) { --d: 300ms; }

/* prose subpages start below the sticky masthead */
.page { padding-top: clamp(2rem, 5vw, 3.25rem); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .gauge-bar i { transform: scaleX(var(--to, 1)); }
  .js .reveal > * { opacity: 1; transform: none; }
}
