/*
 * Shared chrome that used to live in home.css.
 *
 * Why the split: home.css was linked from default.hbs, so every /support/ or
 * /privacy/ reader downloaded and render-blocked on 89 KB of zen layout to get the
 * button, the store buttons, the footer curtain and the FAQ stack, none of which
 * are home-only. These load everywhere; home.css now loads from the three home
 * templates only, in the same cascade position (shared.css first).
 *
 * While editing: a class a non-home template prints belongs here; a class only the
 * homepage prints belongs in home.css.
 */

/* Cron-owned metrics shared by the homepage and the /users/ page. */
.numbers-strip {
  margin-bottom: 0;
}

.numbers-row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-around;
  gap: var(--space-xl);
  width: 100%;
}

.number-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}

/* A stat is display text, not a heading (markup: `.t-display`). The role owns
   weight, leading and tracking; the size belongs here, on the numbers' own step. */
.number-value {
  display: block;
  position: relative;
  font-size: var(--fs-h1);
  /* A band that re-inks the strip sets --stat-ink; nothing colours the figure
     itself, or it stops inheriting the link's ink and its hover knockout dies
     (`.number-link .number-value` inherits and outranks this). */
  color: var(--stat-ink, var(--color-heading));
  font-variant-numeric: tabular-nums;
}

.number-sizer {
  visibility: hidden;
}

.number-live {
  position: absolute;
  inset: 0;
}

.number-label {
  font-size: var(--fs-base);
  color: var(--stat-ink, var(--color-muted));
  line-height: var(--lh-ui);
  text-wrap: balance;
}

.number-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  text-align: center;
  /* The text-link dots are a background layer pinned to the box's bottom edge, so
     at display size they land on the figures' baseline. The padding is the air
     between the dots and the type; on the hover fill it also keeps the chip from
     hugging the glyphs. */  padding-bottom: var(--space-2xs);
}

/* A stat is a link, so its figure and label ARE the link's text: they take the
   paint's ink and its hover knockout by inheritance. Nothing re-inks them per
   surface — a section that did made one stat answer the pointer differently
   from a link in prose (DESIGN.md → Links). The base rules above still own the
   sizes and the unlinked stat's own ink; /users/ renders the strip without
   anchors, so it keeps heading and muted. */
.number-link .number-value,
.number-link .number-label {
  color: inherit;
}

.number-link:focus-visible {
  outline: var(--focus-w) solid var(--focus-color);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-xs);
}

/* ── Text links (DESIGN.md → Links) ──────────────────────────────────────
   ONE paint for every inline text link. Sources opt in with `.link-text`;
   Ghost content is authored HTML and cannot carry a class, so `.gh-content a`
   joins here instead of keeping a paint of its own. The fill and dots live on
   the anchor so a wrapped link stays complete. */
/* Text links that sit on the page surface itself. The bright brand green is a
   fill, not ink: measured 2.52:1 on the doc cream and 2.70:1 on white, against
   4.66 and 5.00 for --kind-feature — same hue, one step down. Dark surfaces keep
   the bright green, and the two dark chapter cards re-point their own links in
   home.css. */
.doc-page a.link-text,
.doc-section a.link-text,
.doc-page .gh-content a,
.faq-contact-title,
.faq-back,
.fe-plan-link {
  color: var(--kind-feature);
}

a.link-text,
.gh-content a {
  color: var(--color-link);
  text-decoration: none;
  background-image:
    linear-gradient(var(--color-link), var(--color-link)),
    radial-gradient(circle, var(--color-link) 1.5px, transparent 1.6px);
  background-position: left bottom, left bottom;
  background-repeat: no-repeat, repeat-x;
  background-size: 100% 0, 6px 4px;
  transition:
    color var(--dur-fast) var(--ease-out),
    background-size var(--dur-fast) var(--ease-out);
    padding-inline: var(--space-2xs);
}

a.link-text:hover,
a.link-text:focus-visible,
.gh-content a:hover,
.gh-content a:focus-visible {
  color: var(--color-on-link);
  background-size: 100% 100%, 6px 4px;
}

@media (prefers-reduced-motion: reduce) {
  a.link-text,
  .gh-content a {
    transition: none;
  }
}

@media (max-width: 640px) {
  .numbers-row {
    gap: var(--space-md);
  }
}

@media (max-width: 420px) {
  .numbers-row {
    flex-wrap: wrap;
  }

  .number-item {
    flex-basis: calc(33.333% - var(--space-md));
  }
}

@media (max-width: 360px) {
  .number-item {
    flex-basis: calc(50% - var(--space-xs));
  }
}

.hero-stores {
  display: grid;
  grid-template-columns: repeat(
      2,
      minmax(0, 1fr)
    ); /* minmax(0,1fr): equal tracks whatever the label */
  gap: var(--space-sm);
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .hero-stores {
    grid-template-columns: 1fr;
    max-width: 12.5rem;
    margin: 0;
  }
}

@media (min-width: 768px) {
  .hero-stores {
    align-self: flex-start;
  }
}

/* Typography comes from typography.css (`.t-title`); this rule owns box and colour. */
.section-title {
  margin: 0 0 var(--space-xl);
  color: var(--color-heading);
}

.faq {
  margin-bottom: var(--space-2xl);
}

/* Rail left, stack right; below this the rail is the section head it always was. */
@media (min-width: 900px) {
  .faq-layout {
    display: grid;
    /* 32.6% of the cap — the golden minor; never below 20rem. */
    grid-template-columns: minmax(0, clamp(20rem, 32.6%, 23.5rem)) minmax(0, 1fr);
    gap: var(--space-5xl);
    /* align-items:start — a stretched grid item leaves sticky no travel at all. */
    align-items: start;
  }

  .faq-rail {
    position: sticky;
    /* --chrome-offset (screen.css) carries the bar's own progress. Pair it with
       the 7rem top padding so the rail pins when the boundary reaches the chrome,
       not after its heading scrolled past. No transition of its own, ever. */
    top: calc(var(--chrome-offset) + 7rem);
  }
}

.faq-rail .section-title {
  text-wrap: balance;
}

a.faq-all {
  /* The bright brand green is a surface colour: at label size it measured 2.49:1
     on the cream card. --kind-feature is the same hue one step down (5:1). */
  color: var(--kind-feature);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding-inline: var(--space-xs);
  font-weight: var(--fw-bold);
}

/* Both rail links ride the one text paint (DESIGN.md → Links); the box is the
   rail's, the ink and the hover belong to `a.link-text`. */
.faq-contact {
  /* Block-level so it keeps its own line, but shrink-to-fit: the text paint draws
     its dots at 100% of the box, so a full-width anchor would run the baseline past
     the words. */
  display: flex;
  flex-direction: column;
  width: fit-content;
  gap: 0.15rem;
  margin-top: var(--space-2xs);
}

.faq-contact-title {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: var(--fw-bold);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Connected stack: the wrapper is the ring, the <details> is its face. State
   comes through :has() — [open] native, .is-closing from the JS — so the face
   derives every corner one ring-width in and both curves stay concentric. */
.faq-frame {
  --faq-tl: 0px;
  --faq-tr: 0px;
  --faq-br: 0px;
  --faq-bl: 0px;
  --ring-r: 0px;
  --ring-color: var(--color-border);
  --ring-face: var(--color-card);
  /* Per-corner markers come first, so --r stays 0 (a square item) and only a
     group's ends carry a corner. */
  --r-tl: var(--faq-tl);
  --r-tr: var(--faq-tr);
  --r-br: var(--faq-br);
  --r-bl: var(--faq-bl);
  border-top-left-radius: var(--faq-tl);
  border-top-right-radius: var(--faq-tr);
  border-bottom-right-radius: var(--faq-br);
  border-bottom-left-radius: var(--faq-bl);
  /* Shared edge: the rings overlap by exactly one --ring-w, so the seam is one
     frame, not two. */
  margin-top: calc(-1 * var(--ring-w));
  /* no corner-shape: the clip must follow the radius curve */
  transition:
    margin-top 420ms cubic-bezier(0.22, 1.16, 0.36, 1),
    border-radius 420ms cubic-bezier(0.22, 1.16, 0.36, 1),
    clip-path 420ms cubic-bezier(0.22, 1.16, 0.36, 1);
}

.faq-frame > .faq-item {
  overflow: hidden;
  --r-tl: max(0px, calc(var(--faq-tl) - var(--ring-w)));
  --r-tr: max(0px, calc(var(--faq-tr) - var(--ring-w)));
  --r-br: max(0px, calc(var(--faq-br) - var(--ring-w)));
  --r-bl: max(0px, calc(var(--faq-bl) - var(--ring-w)));
  border-top-left-radius: max(0px, calc(var(--faq-tl) - var(--ring-w)));
  border-top-right-radius: max(0px, calc(var(--faq-tr) - var(--ring-w)));
  border-bottom-right-radius: max(0px, calc(var(--faq-br) - var(--ring-w)));
  border-bottom-left-radius: max(0px, calc(var(--faq-bl) - var(--ring-w)));
  transition: border-radius 420ms cubic-bezier(0.22, 1.16, 0.36, 1);
}

.faq-frame:first-child {
  margin-top: 0;
  --faq-tl: var(--radius-bar);
  --faq-tr: var(--radius-bar);
}

/* Last FRAME, not :last-child: a page that trails its stack with its own
   block still gets the bottom pair. */
.faq-frame:not(:has(+ .faq-frame)) {
  --faq-bl: var(--radius-bar);
  --faq-br: var(--radius-bar);
}

/* Open item detaches: 12px gap, all four corners. */
.faq-frame:has(> .faq-item[open]) {
  margin-top: var(--space-sm);
  --faq-tl: var(--radius-bar);
  --faq-tr: var(--radius-bar);
  --faq-br: var(--radius-bar);
  --faq-bl: var(--radius-bar);
}

.faq-frame:first-child:has(> .faq-item[open]) {
  margin-top: 0;
}

.faq-frame:has(> .faq-item[open]) + .faq-frame {
  margin-top: var(--space-sm);
  --faq-tl: var(--radius-bar);
  --faq-tr: var(--radius-bar);
}

.faq-frame:has(+ .faq-frame > .faq-item[open]) {
  --faq-bl: var(--radius-bar);
  --faq-br: var(--radius-bar);
}

/* Close re-merges at close START (.is-closing) so the geometry runs with the
   height collapse. These mirror the closed rules and MUST stay ordered after
   every [open] rule above. */
.faq-frame:has(> .faq-item.is-closing) {
  margin-top: calc(-1 * var(--ring-w));
  --faq-tl: 0px;
  --faq-tr: 0px;
  --faq-br: 0px;
  --faq-bl: 0px;
}

.faq-frame:first-child:has(> .faq-item.is-closing) {
  margin-top: 0;
  --faq-tl: var(--radius-bar);
  --faq-tr: var(--radius-bar);
}

.faq-frame:not(:has(+ .faq-frame)):has(> .faq-item.is-closing) {
  --faq-bl: var(--radius-bar);
  --faq-br: var(--radius-bar);
}

.faq-frame:has(> .faq-item.is-closing) + .faq-frame {
  margin-top: calc(-1 * var(--ring-w));
  --faq-tl: 0px;
  --faq-tr: 0px;
}

/* ...unless the neighbour is the one opening: same specificity, so the
   closing rule would win and the open item snaps late — the visible bounce. */
.faq-frame:has(> .faq-item.is-closing) + .faq-frame:has(> .faq-item[open]) {
  margin-top: var(--space-sm);
  --faq-tl: var(--radius-bar);
  --faq-tr: var(--radius-bar);
}

.faq-frame:has(+ .faq-frame > .faq-item.is-closing) {
  --faq-bl: 0px;
  --faq-br: 0px;
}

/* ...unless this item is the one opening: its closing neighbour stays
   detached at 12px, so these corners separate two cards and keep their radius. */
.faq-frame:has(> .faq-item[open]):has(+ .faq-frame > .faq-item.is-closing) {
  --faq-bl: var(--radius-bar);
  --faq-br: var(--radius-bar);
}

.faq-item summary {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 4.25rem;
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  list-style: none;
  font-weight: var(--fw-bold);
  font-size: var(--fs-lead);
  color: var(--color-heading);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

/* Focus inside the face: the frame clips anything outside it. Re-point the
   token, never re-colour the ring (DESIGN.md → focus). */
.faq-item summary:focus-visible {
  --focus-color: currentColor;
  outline: var(--focus-w) solid var(--focus-color);
  outline-offset: -6px;
}

/* Takes the row so the chevron pins to the right edge; without it it jumps
   between one-line and two-line titles. */
.faq-title-wrap {
  flex: 1;
  min-width: 0;
}

.faq-title {
  min-width: 0;
}

.faq-chevron {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--color-muted);
  transition: transform 420ms cubic-bezier(0.22, 1.5, 0.36, 1);
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
}

/* JS adds .is-closing on close start: the chevron turns at once. */
.faq-item.is-closing .faq-chevron {
  transform: rotate(0deg);
}

.faq-answer {
  overflow: hidden;
}

.faq-answer-inner {
  padding: 0 var(--space-lg) var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.faq-answer p {
  margin: var(--space-md) 0 0;
  line-height: var(--lh-prose);
  color: var(--color-body);
}

@media (prefers-reduced-motion: reduce) {
  .faq-frame,
  .faq-frame > .faq-item,
  .faq-chevron {
    transition: none;
  }
}

.section-title--center {
  text-align: center;
}

/* see DESIGN.md → Shapes · The ring surface — .btn is not one. --r stays
   unset: a pill cannot be a shape(), squircle-fallback.js measures it. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.6rem var(--space-lg);
  --r: initial;
  border-radius: var(--radius-pill);
  /* <button class="btn"> would otherwise paint the UA's 2px outset frame. */
  border: 0;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  text-decoration: none;
}

.btn-primary {
  background: var(--color-heading);
  color: var(--color-on-accent);
}

.btn-primary:hover {
  color: var(
    --color-on-accent
  ); /* a:hover in screen.css wins specificity: re-assert the text colour here. */
  opacity: 0.9;
}

/* Same 2.75rem box as the row's other controls, so the inset matches.
   The caption role owns the type; the rules below own the box and the muted ink. */
.site-nav-cta {
  min-height: 2.75rem;
  padding: 0.4rem var(--space-md);
}

/* Header CTA concentricity: the glass paints at inset -2px and the browser
   folds the declared 40px to 38px, so the ideal is 38 − 12 = 26px. A 999px
   radius renders as half the height (22px / 23.7px) — the closest one token
   gets at both CTA heights, so it IS the concentric value here. */

/* see DESIGN.md → Elevation & Depth · Named Rules (Rise-Not-Scale) — the bar's
   one press exception (0.92); the row's links and triggers hold their place. */
.site-nav-cta,
.site-nav-accordion-cta {
  transition: transform 0.15s ease-out;
}

.site-nav-cta:active,
.site-nav-accordion-cta:active {
  transform: scale(0.92); /* same tap scale as .fab (floating-bar.css) */
}

@media (prefers-reduced-motion: reduce) {
  .site-nav-cta,
  .site-nav-accordion-cta {
    transition: none;
  }
}

/* ── The device frame ──────────────────────────────────────────────────────
   ONE device for every screen capture: how chapters, nav how panel, reels.
   The raster (assets/images/frame-iphone.webp, 1129x2329, its screen a hole of
   1035x2251 at 47,39 with the Dynamic Island painted inside it) is painted over
   the capture, so the bezel hides the seam. Never a
   marketing poster — a capture that already carries a phone reads as a phone
   inside a phone (docs/agents/ui.md). Stills: `npm run screens`. The host owns
   the width; the shell only owns the ratio. */
.device {
  position: relative;
  aspect-ratio: 1129 / 2329;
}

.device::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: url("../images/frame-iphone.webp") center / 100% 100% no-repeat;
  pointer-events: none;
}

/* The hole exactly (47,39 → 1035x2251): 1.67% off the raster's own top and bottom
   edges, 4.16% left and right. Insetting the top by the island's bottom (7.2%)
   left the section's field showing above the capture, under the notch; the island
   is painted inside the hole, so the screen reaches the frame's top edge and the
   island rides over it. */
.device-screen {
  position: absolute;
  inset: 1.67% 4.16%;
  overflow: hidden;
  border-radius: var(--radius-device-screen);
  background: var(--band-footer);
}

.device-screen > img,
.device-screen > video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* The ruled label — the eyebrow of every band head: pricing, the comparison and
   the closing CTA. Shared, because the footer's copy rides on every page while
   home.css loads on the three home templates only. currentColor + opacity:
   one rule that reads on the white surface and on the forest band. A whisper —
   it frames the label, it does not compete. */
.ruled-eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin: 0 0 0.9rem;
}

.ruled-eyebrow-rule {
  display: block;
  width: 2.25rem;
  height: 1px;
  background: currentColor;
  opacity: 0.45;
}

/* see DESIGN.md → Colors · Bands and glass — the band follows the theme.
   Full-bleed bg, container-capped copy; z-index 2 sits it over the desktop footer curtain. */
.footer-cta-wrap {
  padding-bottom: 0;
}

.footer-cta {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 100dvh;
  background: var(--band-forest);
}

.footer-cta-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  padding: 4.5rem 0;
  text-align: center;
}

/* The head is the comparison band's own (`home.css` → `.compare-head`): the same
   ruled label, title and lead on the same forest surface, so the closing CTA
   opens the way the section above the FAQ does. The three values are one set. */
.footer-cta-head {
  width: 100%;
  text-align: center;
}

.footer-cta-eyebrow {
  color: rgba(247, 250, 240, 0.7); /* 6.5:1 on #283b2f, as .compare-eyebrow */
}

.footer-cta-title {
  margin: 0 0 var(--space-md);
  color: #ffffff;
  text-wrap: balance;
}

.footer-cta-sub {
  margin: 0 auto;
  max-width: 52ch;
  color: rgba(247, 250, 240, 0.78); /* 7.3:1, as .compare-lead */
  text-wrap: pretty;
}

.footer-cta-note {
  margin: var(--space-2xs) 0 0;
  font-size: var(--fs-label);
  color: rgba(
    247,
    250,
    240,
    0.65
  ); /* 0.5 alpha computes to 4.14:1 on the #283b2f band — below AA. */
}

.footer-cta-stores {
  width: 100%; /* Stretch so the 23.25rem grid engages like the hero's. */
}

.footer-cta-stores .hero-stores {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
  width: 100%;
  max-width: 23.25rem; /* 2 × 180px + the 12px gap: no dead right side. */
  margin: 0 auto;
}

@media (max-width: 479px) {
  /* Two 162px tracks at 360px wrap "Google Play", growing the pill past 72px and
     breaking the shared squircle. Stack, like the hero. */
  .footer-cta-stores .hero-stores {
    grid-template-columns: 1fr;
  }

  .footer-cta-stores .store-btn {
    max-width: none;
  }
}
