/* ============================================================
   AUGUST — refine layer
   Loaded after every other stylesheet, on every page except /links.

   It finishes what august.css (and the homepage's own copy of the chrome)
   already does rather than adding anything new: the same windows, the same
   Signal Blue, the same blur-in the hero titles use. Kept in its own file so
   /links — the social-bio page, deliberately frozen — keeps loading exactly
   the bytes it loads today. The build enforces both directions.
   ============================================================ */

:root {
  /* the two curves everything below moves on: a settle for things that
     travel, a small overshoot for things that are nudged */
  --ease-settle: cubic-bezier(.32,.72,0,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

/* ---------- the page gutter, kept ---------- */
/* .shell gives every section its side margin, and then .section, .phero,
   .hero and .legal-doc each set `padding: <top> 0 <bottom>` — the 0 wiping
   that margin out. Above ~1100px nobody sees it, because the windows are
   narrower than the screen and centered; between 761px and there (a tablet,
   a small laptop) every window ran into the edge of the screen and lost its
   rounded corners to it. Phones are untouched: below 761px the gutter comes
   from the mobile rule in august.css, which is !important and wins. */
@media (min-width: 761px) {
  html .shell { padding-left: clamp(1.25rem, 4vw, 4rem); padding-right: clamp(1.25rem, 4vw, 4rem); }
}

/* ---------- typography ---------- */
/* Headlines break into even lines instead of leaving one word on its own;
   running copy avoids a lonely last word. Browsers without either ignore
   them and wrap as before. */
.section-title, .ph-title { text-wrap: balance; }
.section-sub, .ph-desc, .faq-a { text-wrap: pretty; }
/* a price that changes with the currency switch should not change width */
.ph-price { font-variant-numeric: tabular-nums; }

/* ---------- a sale ---------- */
/* The regular price struck through, and the line under it. The clock is
   tabular so the digits stay still while it counts. */
.ph-was, .ed-was { color: var(--text-faint); font-weight: 400; }
.ph-was { font-size: 1rem; }
.ed-was { font-size: .55em; letter-spacing: -.01em; }
.ph-note.ph-sale-note { margin-top: .55rem; color: var(--accent); font-weight: 600; }
.sale-clock { font-variant-numeric: tabular-nums; }

/* ---------- segmented control: the selection slides ---------- */
/* refine.js adds .has-pill and one .seg-pill per menu bar. The pill is the
   active button's old background, lifted out so it can travel between
   sections the way a macOS segmented control does, instead of blinking. */
.seg.has-pill { position: relative; }
.seg.has-pill .seg-btn { position: relative; z-index: 1; }
.seg.has-pill .seg-btn.active { background: transparent; box-shadow: none; }
.seg-pill {
  position: absolute; top: 0; left: 0; z-index: 0;
  border-radius: 9px; background: var(--surface);
  box-shadow: 0 1px 2px rgba(23,24,28,.08), 0 3px 8px -2px rgba(23,24,28,.10);
  pointer-events: none; opacity: 0;
  transition: transform .42s var(--ease-settle), width .42s var(--ease-settle), opacity .2s ease, background-color .35s ease;
}
.seg-pill.on { opacity: 1; }
html[data-theme="dark"] .seg-pill { box-shadow: 0 1px 2px rgba(0,0,0,.4); }

/* ---------- section titles arrive word by word ---------- */
/* The hero title already blurs in letter by letter. A section title is
   longer, so it comes in a word at a time on the same curve — one family
   of motion, not a second effect. Only applied once refine.js has split the
   words, so without JavaScript the titles are simply there. */
.st-words .st-w { display: inline-block; opacity: 0; transform: translateY(.22em); filter: blur(8px); }
.st-words.st-in .st-w { animation: stWordIn .7s cubic-bezier(.22,.61,.36,1) forwards; }
@keyframes stWordIn { to { opacity: 1; transform: none; filter: blur(0); } }

/* ---------- scroll reveals ---------- */
/* Same rise as before, with the faint focus-pull the hero uses. refine.js
   staggers pieces that share a row so a row of cards deals in from the left
   instead of appearing as one slab. */
.reveal {
  filter: blur(4px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.22,.61,.36,1), filter .7s ease;
}
.reveal.in { filter: none; }

/* ---------- buttons ---------- */
/* A soft light that follows the pointer across the button, so it answers
   the hand before the click does. refine.js feeds --px / --py; without a
   pointer the light simply never shows. */
.btn { position: relative; isolation: isolate; }
.btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(140px circle at var(--px, 50%) var(--py, 50%), rgba(255,255,255,.26), transparent 70%);
  transition: opacity .3s ease;
}
.btn-ghost::after { background: radial-gradient(140px circle at var(--px, 50%) var(--py, 50%), var(--accent-soft), transparent 70%); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover::after { opacity: 1; }
}

/* The arrow inside a button leans the way it points. */
.btn .nudge { display: inline-block; transition: transform .4s var(--ease-spring); }
.btn:hover .nudge-r, .btn:focus-visible .nudge-r { transform: translateX(3px); }
.btn:hover .nudge-d, .btn:focus-visible .nudge-d { transform: translateY(2px); }

/* Keyboard parity: what the pointer gets on hover, the Tab key gets on
   focus. Until now a focused button only drew its outline. */
.btn-fill:focus-visible { transform: translateY(-2px); box-shadow: 0 12px 24px -8px var(--accent-ring); }
.btn-ghost:focus-visible { transform: translateY(-2px); border-color: var(--accent-ring); color: var(--accent); }
.icon-btn:focus-visible, .social-icon:focus-visible { color: var(--accent); border-color: var(--accent-ring); }

/* ---------- the price in the menu bar ---------- */
/* refine.js adds it on product pages once the hero's buy button has
   scrolled away. It opens from zero width, so the menu slides over to
   make room rather than jumping; phones, where the bar has no room to
   give, never show it. */
.mb-buy {
  appearance: none; border: 0; cursor: pointer; flex: none;
  display: inline-flex; align-items: center; gap: .55rem; height: 34px;
  max-width: 0; padding: 0; margin-right: 0; overflow: hidden; white-space: nowrap;
  border-radius: 10px; background: var(--accent); color: #fff;
  font: 600 .78rem/1 "Inter", ui-sans-serif, system-ui, sans-serif;
  box-shadow: 0 6px 14px -6px var(--accent-ring);
  opacity: 0; pointer-events: none;
  transition: max-width .45s var(--ease-settle), padding .45s var(--ease-settle), margin .45s var(--ease-settle), opacity .25s ease, box-shadow .22s ease;
}
.mb-buy.on { max-width: 14rem; padding: 0 .85rem; margin-right: .2rem; opacity: 1; pointer-events: auto; }
.mb-buy:hover, .mb-buy:focus-visible { box-shadow: 0 10px 20px -8px var(--accent-ring); }
.mb-price { font-variant-numeric: tabular-nums; text-transform: capitalize; padding-right: .55rem; border-right: 1px solid rgba(255,255,255,.35); }
@media (max-width: 760px) { .mb-buy { display: none; } }

/* ---------- the promise under the last buy button ---------- */
/* One sentence, the same on every product page, taken from the refund
   policy: what is broken, missing or misdescribed is always put right. */
.buy-promise { flex-basis: 100%; max-width: 46ch; margin: .9rem auto 0; font-size: .76rem; line-height: 1.55; color: var(--text-muted); text-wrap: pretty; }
.ed-cta .buy-promise { margin: .2rem 0 0; }
.buy-promise a { color: var(--accent); font-weight: 600; }

/* ---------- questions open, they do not jump ---------- */
/* Browsers that can animate to height:auto get a short slide; the rest
   open instantly, exactly as before. */
@supports (interpolate-size: allow-keywords) {
  .faq-item { interpolate-size: allow-keywords; }
  .faq-item::details-content {
    height: 0; overflow: clip;
    transition: height .38s var(--ease-settle), content-visibility .38s allow-discrete;
  }
  .faq-item[open]::details-content { height: auto; }
}
.faq-item[open] .faq-a { animation: faqIn .38s ease both; }
@keyframes faqIn { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- between pages ---------- */
/* Leaving already fades out (body.launching). Arriving now fades in, in
   browsers that support cross-document view transitions — both pages have
   to opt in, so /links, which does not load this file, is never part of it. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .32s; }
}

/* ---------- motion safety ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal { filter: none; }
  .st-words .st-w { opacity: 1; transform: none; filter: none; animation: none; }
  .btn .nudge, .seg-pill { transition: none; }
  .faq-item[open] .faq-a { animation: none; }
}
