/* Shared styling for the application pages (/, /login, /account, /thanks,
   /404). The legal pages keep legal.css — long-form reading wants different
   type decisions — but both sheets share the palette below, so the site
   reads as one thing.

   Structure borrowed deliberately from frusal.com: near-neutral grounds,
   one accent used sparingly, mono uppercase section labels, thin rules.
   The palette is Bare Compare's own — the amber and navy the app and the
   bear mark already carry — with a light scheme derived from it rather
   than inverted, and the amber darkened where it carries text on the
   light ground (frusal.com's --accent/--accent-ink lesson: brand colour
   at logo contrast is not body-text contrast). */

:root {
  color-scheme: light dark;
  --bg: #faf8f4;
  --panel: #ffffff;
  --ink: #232a38;
  --muted: #626c7d;
  --line: #e5e0d5;
  --line-strong: #d4cdbd;
  /* Amber as a *fill* keeps the brand hue; amber as *text* is darkened. */
  --accent: #e8b86a;
  --accent-text: #8a6420;
  --accent-ink: #2b3446;
  --accent-hover: #f0c883;
  --danger: #a03d3d;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a2233;
    --panel: #222c42;
    --ink: #e8ecf4;
    --muted: #9aa6bf;
    --line: #2c3a58;
    --line-strong: #33456b;
    --accent: #e8b86a;
    --accent-text: #e8b86a;
    --accent-ink: #2b3446;
    --accent-hover: #f0c883;
    --danger: #e89a9a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

.wrap { width: 100%; max-width: 52rem; margin: 0 auto; padding: 0 1.5rem; }

/* ---------- masthead: the bear is the way home ---------- */
header.site { border-bottom: 1px solid var(--line); }
header.site .wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}
header.site img { width: 32px; height: 32px; display: block; }
a.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
header.site nav { margin-left: auto; display: flex; gap: 1.25rem; align-items: center; }
header.site nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
}
header.site nav a:hover { color: var(--ink); }

main { flex: 1 0 auto; }

/* ---------- hero ---------- */
.curtains { line-height: 0; padding-top: 2rem; }
.curtains img {
  display: block;
  width: 100%;
  height: auto;
}

/* Longhands, not the `padding` shorthand: these are `.wrap` elements, and the
   shorthand would reset the 1.5rem side padding `.wrap` gives them — which is
   what made the hero and the screenshot run edge to edge on a phone while
   every band below them stayed inset. `footer.site .wrap` sets its vertical
   padding the same way, for the same reason. */
.hero { padding-top: 2rem; padding-bottom: 2.5rem; }
.hero h1 {
  margin: 0 0 1rem;
  font-weight: 650;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  letter-spacing: -0.025em;
  line-height: 1.12;
  text-wrap: balance;
}
.hero .lede { margin: 0 0 1.75rem; color: var(--muted); font-size: 1.08rem; max-width: 38rem; }
.hero .actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }

/* The hero's price line. Quiet by design — it answers the question without
   competing with the two buttons directly above it. */
.hero .price-note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}
.hero .price-note strong { color: var(--ink); font-weight: 600; }
.price-tax { white-space: nowrap; }

/* ---------- the screenshot, in the viewer's own theme ---------- */
.shot { padding-bottom: 1rem; }
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 18px 45px -28px rgba(10, 16, 30, 0.45);
}
.shot figcaption { margin-top: 0.6rem; color: var(--muted); font-size: 0.85rem; text-align: center; }
/* The zoom button wraps the picture (see the figure in /index.html). A
   button rather than a click handler on the image so it is reachable from
   the keyboard and announced as something that does something; the
   defaults are stripped so it is invisible around the image. */
.shot .zoom {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.shot .zoom:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 14px; }
/* Zoomed: the button becomes the backdrop over the whole viewport and the
   picture is fitted inside it. The state lives on <html> (set by /zoom.js)
   because the page scroll has to lock at the same time. The picture's width
   is spelled out — the smaller of the viewport width and the width that
   makes its height fit — rather than left to max-width/max-height on the
   image, because the picture is a size container (below) and a container
   cannot take its width from its contents. --shot-aspect is the image's
   width/height, read off its attributes by /zoom.js so it has one source. */
html[data-shot-zoomed] { overflow: hidden; }
html[data-shot-zoomed] .shot .zoom {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 16, 30, 0.85);
  cursor: zoom-out;
}
html[data-shot-zoomed] .shot .zoom:focus-visible { outline: none; }
html[data-shot-zoomed] .shot picture {
  width: min(100vw - 2rem, (100vh - 2rem) * var(--shot-aspect));
  width: min(100dvw - 2rem, (100dvh - 2rem) * var(--shot-aspect));
}
/* Traffic lights, macOS visitors only. The capture is chrome-less (the app
   draws its own title strip, and the jig records only the app's own pixels),
   which leaves the top-left corner empty exactly where the system would
   paint the three buttons. They are drawn here rather than baked into the
   image so the file stays a real capture and a Windows or Linux visitor sees
   a platform-neutral window. Sized in container units so they scale with the
   image: 12pt buttons at 13/33/53pt on a 1200pt-wide window, centred in its
   33pt strip. One dot plus two shadows is the usual three-circles trick.
   The container is the picture itself, not the figure, so the units follow
   the image into the zoomed state — and the containment must not sit on the
   button or figure, because layout containment would make that element the
   containing block for the zoom's position: fixed. */
.shot picture { position: relative; display: block; container-type: inline-size; }
html[data-os="mac"] .shot picture::before {
  content: "";
  position: absolute;
  left: 1.083cqw;
  top: 0.875cqw;
  width: 1cqw;
  height: 1cqw;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: 1.667cqw 0 0 #febc2e, 3.333cqw 0 0 #28c840;
}

/* ---------- sections ---------- */
section.band { padding: 2.5rem 0; border-top: 1px solid var(--line); }
.label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

/* ---------- feature grid ---------- */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14.5rem, 1fr));
  gap: 1.5rem 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.features h3 { margin: 0 0 0.3rem; font-size: 1rem; font-weight: 600; }
.features p { margin: 0; color: var(--muted); font-size: 0.9375rem; }

/* ---------- cards, buttons, forms ---------- */
.card {
  padding: 1.6rem 1.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
  text-align: left;
}
.card + .card { margin-top: 1.25rem; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.button,
button.button {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--accent-hover); }
.button:disabled { opacity: 0.6; cursor: wait; }
.button.quiet {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line-strong);
}
.button.quiet:hover { color: var(--ink); background: transparent; }

label { display: block; margin-bottom: 0.5rem; color: var(--muted); font-size: 0.875rem; }
input {
  width: 100%;
  padding: 0.7rem 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* The buy card's price. This is the one place the number should be
   unmissable, so it is set large and in --ink while the terms beside it stay
   muted — the amount and its conditions read as one line, not two claims. */
.card .price {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0 0 1.1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}
.price-amount { font-size: 2rem; font-weight: 600; line-height: 1; color: var(--ink); }
.price-terms { color: var(--muted); font-size: 0.9375rem; }

.error { margin: 1rem 0 0; font-size: 0.875rem; color: var(--danger); display: none; }
.hint { margin: 1rem 0 0; font-size: 0.875rem; color: var(--muted); }

/* ---------- the OS download tabs ---------- */
.os-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.os-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.os-tab svg { width: 18px; height: 18px; }
.os-tab:hover { color: var(--ink); }
.os-tab[aria-selected="true"] {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--accent);
}
.os-pane { display: none; }
.os-pane[data-active] { display: block; }
.os-pane .row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.os-pane p.what { margin: 1rem 0 0; color: var(--muted); font-size: 0.9rem; }

details.advanced { margin-top: 1.1rem; }
details.advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  user-select: none;
}
details.advanced summary:hover { color: var(--ink); }
details.advanced div { margin-top: 0.75rem; color: var(--muted); font-size: 0.9rem; }

/* ---------- account page pieces ---------- */
.key {
  display: block;
  padding: 0.875rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 0.8125rem;
  word-break: break-all;
  user-select: all;
}
.licence-meta { margin: 0 0 1rem; font-size: 0.875rem; color: var(--muted); }
.copied { font-size: 0.875rem; color: var(--muted); }
.pending { color: var(--muted); font-style: italic; }
.row { margin-top: 1rem; display: flex; gap: 0.75rem; align-items: center; }

/* ---------- narrow pages (login, thanks, 404) ---------- */
.narrow { max-width: 27rem; margin: 0 auto; padding: 3rem 1.5rem; width: 100%; }
.narrow h1 { font-size: 1.9rem; letter-spacing: -0.02em; margin: 0 0 1.25rem; text-align: center; }
.centered { max-width: 42rem; margin: 0 auto; padding: 3rem 1.5rem; width: 100%; }
.centered h1 { font-size: 1.9rem; letter-spacing: -0.02em; margin: 0 0 0.5rem; text-align: center; }
.who { margin: 0 0 1.75rem; color: var(--muted); text-align: center; }

/* ---------- footer ---------- */
footer.site {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
}
footer.site .wrap { padding-top: 1.5rem; padding-bottom: 1.75rem; }
footer.site a { color: var(--muted); }
footer.site nav { margin-bottom: 0.6rem; display: flex; gap: 1.1rem; flex-wrap: wrap; }
footer.site nav a { text-decoration: none; }
footer.site nav a:hover { color: var(--ink); text-decoration: underline; }

/* The six-digit code input: read out of an email, so wide spacing makes a
   typo visible before submit. */
input.code {
  letter-spacing: 0.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.card h2 { margin: 0 0 0.25rem; font-size: 1.125rem; }

/* ---------- the account page's two views ---------- */
/* Same shape as .os-pane above: an attribute the script sets, not inline
   display juggling. Only one is ever active. */
.view { display: none; }
.view[data-active] { display: block; }
.back { margin: 1.75rem 0 0; text-align: center; font-size: 0.9375rem; }
.back a { color: var(--muted); text-decoration: none; }
.back a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- passkeys ---------- */
/* The "or" between the code form and the passkey button on the login page. */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: 0.8125rem;
}
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.passkey-list { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.passkey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}
.passkey-row:last-child { border-bottom: 1px solid var(--line); }
.passkey-meta { font-size: 0.8125rem; color: var(--muted); }
.passkey-none { color: var(--muted); font-style: italic; }
