/*
 * The shared shell for hydrasolver.com — top bar, background, bands, footer,
 * cards, buttons — plus the storefront that sims.html, thanks.html and
 * btc.html all draw on.
 *
 * It is a file rather than a <style> block in each page because there are now
 * four pages that must be indistinguishable above the fold, and the header had
 * already drifted once when it lived in two copies. index.html keeps its own
 * inline copy: it is the landing page and its first paint should not wait on a
 * second request.
 *
 * The storefront half is HydraViewer's packs page, ported from Svelte. The
 * class names are deliberately the same (`promises`, `sections`, `browse`,
 * `chip`, `tag`, `act`, `cartbar`) so the two shops can be diffed against each
 * other when either changes.
 */

@font-face {
  font-family: "Figtree Fallback";
  src: local("Arial"), local("Arial MT"), local("Helvetica Neue"), local("Helvetica");
  size-adjust: 114.8776%;
  ascent-override: 82.6967%;
  descent-override: 21.7623%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Figtree Fallback";
  src: local("Arial Bold"), local("Arial"), local("Helvetica Neue Bold"),
    local("Helvetica Neue");
  font-weight: 700;
  size-adjust: 119.6700%;
  ascent-override: 79.3850%;
  descent-override: 20.8908%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/Figtree-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/Figtree-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/Figtree-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/Figtree-Bold.woff2") format("woff2");
}

:root {
  --window-bg: #e8eef4;
  --panel: #fcfdfe;
  --panel-muted: #f0f4f8;
  --text: #121a22;
  --text-secondary: #556170;
  --text-muted: #5f6b77;
  --accent: #0a7a8a;
  --accent-bright: #3bb8c6;
  --accent-deep: #075c68;
  --border: #c5ced8;
  --border-soft: #d8e0e8;
  --selection-soft: #d8f0f3;
  --success: #28794c;
  --warning: #9c5b0f;
  --danger: #a3341f;
  --btc: #955d13;
  --font: "Figtree", "Figtree Fallback", ui-sans-serif, system-ui, sans-serif;
  --shadow-sm: 0 1px 2px rgba(12, 34, 44, 0.12);
  /*
   * Website type scale — same names and values as HydraViewer `theme.css`.
   * Keep this block in step with index.html's inline `:root` (landing first
   * paint must not wait on this file).
   */
  --fs-nav: 0.9375rem;
  --fs-kicker: 0.8rem;
  --fs-lede: 1.02rem;
  --fs-page-title: clamp(1.8rem, 4vw, 2.6rem);
  --fs-section-title: clamp(1.5rem, 3vw, 2.1rem);
  --fs-hero: clamp(2.75rem, 8vw, 5.5rem);
  --fs-hero-lede: clamp(1.02rem, 1.5vw, 1.15rem);
  --fs-lead: 1rem;
  --fs-card-title: 1.08rem;
  --fs-label: 0.85rem;
  --fs-foot: 0.88rem;
}

* {
  box-sizing: border-box;
}

/*
 * The `hidden` attribute has to win.
 *
 * The UA sheet's `[hidden] { display: none }` is the weakest rule there is, so
 * ANY author `display` on the same element beats it — and most of the things
 * this page hides carry one (`.testmode` is block, `.grid` and `.browse` are
 * grid). The offline banner showed while the shop was up, and switching to the
 * free tab left the paid browser on screen underneath it.
 */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(59, 184, 198, 0.28), transparent 55%),
    radial-gradient(900px 600px at 88% 8%, rgba(31, 107, 92, 0.18), transparent 50%),
    linear-gradient(165deg, #dfe8f0 0%, var(--window-bg) 42%, #d6e4e8 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 3rem);
  padding-left: max(clamp(1.5rem, 5vw, 3rem), env(safe-area-inset-left));
  padding-right: max(clamp(1.5rem, 5vw, 3rem), env(safe-area-inset-right));
  width: 100%;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}

.skip:focus {
  left: 0;
}

/* ---------------------------------------------------------------- header */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  isolation: isolate;
  background: rgba(232, 238, 244, 0.72);
  border-bottom: 1px solid rgba(197, 206, 216, 0.6);
}

/*
 * Glass on a pseudo, not on `.topbar`. `backdrop-filter` is a containing
 * block for `position: fixed`, so when it lived on the sticky header the
 * mobile drawer was 68px tall and stuck to the bar instead of a sheet.
 */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: calc(68px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  flex-wrap: wrap;
}

/*
 * Official brand mark: /logo-hydra.svg (pixel H). The PNG already includes
 * the rounded plate — no CSS markbox.
 *
 * The mark does NOT follow prefers-color-scheme, and that is the point: this
 * site has one palette. The tokens above define light only, so a visitor whose
 * OS is set to dark still gets a light page.
 *
 * If this site ever gains a dark palette, a swap can come back with it — tied
 * to the palette, not to the preference.
 */
.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
}

.mark .logo {
  /* 32×32 — same as the favicon, scaled from the original H mark. */
  width: 32px;
  height: 32px;
  flex: none;
  display: block;
  /* Pixel-H mark is a rounded square; the PNG already carries the corners. */
  border-radius: 0;
}

.mark .logo-dark {
  display: none;
}

/* One flex item, not two: the `gap` above otherwise falls between "Hydra"
   and "Solver" and splits the wordmark down the middle. Sized to weigh the
   same as the 30px mark beside it. */
.mark .name {
  white-space: nowrap;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.mark .name span {
  color: var(--accent);
}

#site-nav {
  display: flex;
  gap: 1.15rem;
  align-items: center;
  flex-wrap: wrap;
}

#site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--fs-nav);
  font-weight: 500;
}

#site-nav a:hover,
#site-nav a[aria-current="page"] {
  color: var(--accent);
}

#site-nav a.buy {
  color: #fff;
  background: var(--accent);
  padding: 0.42rem 0.85rem;
  border-radius: 8px;
  font-weight: 600;
}

#site-nav a.buy:hover {
  background: var(--accent-bright);
  color: #06222a;
}

#site-nav a.shop {
  color: var(--accent-deep);
  background: rgba(10, 122, 138, 0.1);
  border: 1px solid rgba(10, 122, 138, 0.35);
  padding: 0.38rem 0.75rem;
  border-radius: 8px;
}

#site-nav a.shop:hover {
  background: rgba(10, 122, 138, 0.18);
  border-color: var(--accent);
  color: var(--accent-deep);
}

.nav-toggle {
  display: none;
  font: inherit;
  font-weight: 500;
  font-size: var(--fs-nav);
  color: var(--accent-deep);
  background: rgba(10, 122, 138, 0.1);
  border: 1px solid rgba(10, 122, 138, 0.35);
  border-radius: 8px;
  padding: 0.38rem 0.75rem;
  min-height: 44px;
  cursor: pointer;
}

/* Drawer chrome is mobile-only; desktop keeps the inline topbar links. */
.nav-drawer-head,
.nav-note,
.nav-backdrop,
.nav-close {
  display: none;
}

#site-nav a strong {
  font-weight: inherit;
}

body.nav-open {
  overflow: hidden;
}

/* ----------------------------------------------------------------- bands */

main {
  flex: 1;
  overflow-x: clip;
}

.page-head {
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(1.5rem, 3vw, 2rem);
}

/*
 * Green because it is good news, and quiet because it is not a control. It sits
 * beside the count of what is listed, because that is what it is about — how
 * often that number goes up. `--success` is the token the rest of the shop uses
 * for this, so it follows the theme rather than naming a colour of its own.
 */
.cadence {
  margin: 0;
  padding: 0.28rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 34%, transparent);
  border-radius: 999px;
  white-space: nowrap;
}

/*
 * Red because it is the one thing on this page that stops somebody buying the
 * wrong file. An .hds is a HydraSolver save and HydraViewer will not open it;
 * that has already cost one customer the price of a pack. Built like the
 * cadence pill beside it so the two read as one line of small print rather
 * than as an alarm — the warning has to be noticed, not shouted.
 */
.caution {
  margin: 0;
  padding: 0.28rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 34%, transparent);
  border-radius: 999px;
  white-space: nowrap;
}

.kicker {
  display: block;
  margin: 0 0 0.5rem;
  font-size: var(--fs-kicker);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: var(--fs-page-title);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.lede {
  margin: 0.9rem 0 0;
  max-width: 62ch;
  color: var(--text-secondary);
  line-height: 1.65;
  font-size: var(--fs-lede);
}

.lede a,
a.plain {
  color: var(--accent);
}

.muted {
  color: var(--text-muted);
}

.error {
  color: var(--danger);
}

/* Everything below the heading sits on the site's own glass, exactly as the
   viewer does it — without the band the same page reads a visibly different
   color on the two domains. */
.band {
  padding: clamp(1.5rem, 3vw, 2rem) 0 clamp(3rem, 7vw, 5rem);
  border-top: 1px solid rgba(197, 206, 216, 0.7);
  background: rgba(252, 253, 254, 0.48);
  backdrop-filter: blur(8px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* ------------------------------------------------------------- storefront */

.promises {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 0.85rem;
}

.promises li {
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.promises strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* Its own row: as an inline-block it flows onto the line the free/paid switch
   is on and reads as a third tab. */
/* Bottom margin as well as top: the free/paid switch used to sit under this
   and provide the gap, and with the free tier gone the banner butted straight
   into the filter panel. */
.testmode {
  display: block;
  width: fit-content;
  margin: 1.25rem 0 1.5rem;
  font-size: 0.9rem;
  color: var(--warning);
  border: 1px solid rgba(156, 91, 15, 0.45);
  background: rgba(156, 91, 15, 0.1);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
}

.testmode.bad {
  color: var(--danger);
  border-color: rgba(163, 52, 31, 0.45);
  background: rgba(163, 52, 31, 0.1);
}

.sections {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  margin: 1.5rem 0 1.25rem;
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.section-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
}

.section-btn .count {
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.section-btn.on {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.section-btn.on .count {
  background: var(--selection-soft);
  color: var(--accent);
}

.browse {
  margin-top: 1.75rem;
  display: grid;
  grid-template-columns: minmax(170px, 210px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.filters {
  padding: 0.9rem;
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.filters h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0;
}

.clear {
  font: inherit;
  font-size: 0.82rem;
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
}

.filters h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0.9rem 0 0.25rem;
}

.search {
  min-height: 30px;
  padding: 0.35rem 0.6rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  font: inherit;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  padding: 0.15rem 0;
  cursor: pointer;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.chip {
  padding: 0.15rem 0.7rem;
  font: inherit;
  font-size: var(--fs-foot);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  cursor: pointer;
}

.chip.on {
  border-color: var(--accent);
  color: var(--text);
  background: var(--selection-soft);
}

.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
  font-size: 0.95rem;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Beside the count, not between the count and the sort: `space-between` would
   centre a third child, and these belong to the number on their left. The auto
   margin is on the group rather than on a pill, so adding or removing one
   cannot leave the sort control stranded in the middle of the bar. */
.results-bar .bar-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-inline-end: auto;
}

.results-bar select {
  min-height: 32px;
  padding: 0.2rem 0.6rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  font: inherit;
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 0.9rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.9rem;
}

.card.bundle {
  border-color: #5a9aa6;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  /* Stated, because the two shops sit on different sheets and inherited
     different body leading — same padding, same size, 16px tall here and 19px
     there. */
  line-height: 1.45;
  padding: 1px 0.45rem;
  border-radius: 999px;
  background: var(--panel-muted);
  color: var(--text-secondary);
}

.tag.hot {
  background: var(--accent);
  color: #fff;
}

.tag.mtt {
  background: #f4ead9;
  color: var(--warning);
}

/* Title above price. Side by side, a three-word title and a five-character
   price share a 300px card, so every title wraps against a price that does
   not and the baselines never line up.

   The three sizes below are HydraViewer's HDV Shop exactly — 16, 20 and 16 —
   rather than the 16.8 / 20.8 / 15.2 they were. The two shops are one design
   sold on two domains, and a reader who opens both in a row sees the drift
   before they read a word of either. */
.card-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.card h3 {
  font-size: var(--fs-lead);
  letter-spacing: -0.01em;
  margin: 0;
}

.price {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.was {
  margin-inline-start: 0.3rem;
  font-weight: 400;
  font-size: var(--fs-lead);
  color: var(--text-muted);
  text-decoration: line-through;
}

.saving {
  margin: 0.15rem 0 0;
  width: fit-content;
  padding: 1px 0.55rem;
  border-radius: 999px;
  background: rgba(40, 121, 76, 0.12);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--success);
}

.revision {
  margin: 0.3rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.free-tag {
  color: var(--success);
}

.blurb {
  font-size: var(--fs-foot);
  margin: 0;
  flex: 1 0 auto;
  color: var(--text-secondary);
  line-height: 1.5;
}

/*
 * The spec sheet — the same two-column shape the HDV shop uses. A pack's facts
 * are a list, and a list lines up: label left, value right, one row each, so
 * "Rake" can be found without reading a sentence to the end.
 */
.spec {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 1.1rem;
  row-gap: 0.45rem;
  margin: 0.25rem 0 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-muted, transparent);
  font-size: var(--fs-foot);
  line-height: 1.45;
}

.spec dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-top: 0.15rem;
}

.spec dd {
  margin: 0;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.contents {
  font-size: 0.88rem;
}

.contents summary {
  cursor: pointer;
  color: var(--text-secondary);
}

.contents ul {
  margin: 0.3rem 0 0;
  padding-inline-start: 1.2rem;
  max-height: 140px;
  overflow-y: auto;
  color: var(--text-muted);
}

/* The one thing a card is for. 1rem, matching the same button in HydraViewer's
   shop — it was 0.95rem here and 1rem there, on cards that are otherwise pixel
   for pixel the same. */
.act {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-lead);
  cursor: pointer;
}

.act:hover:not(:disabled) {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  color: #06222a;
}

.act.added {
  background: rgba(40, 121, 76, 0.12);
  border-color: var(--success);
  color: var(--success);
}

/* A pack with no solves in it names its own reason rather than carrying a
   paragraph of gray text nobody reads. */
.act:disabled {
  cursor: not-allowed;
  background: var(--panel-muted);
  border: 1px dashed var(--border);
  color: var(--text-muted);
}

/* ------------------------------------------------------------------ cart */

.cart-dock {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  max-width: calc(100vw - 2rem);
  pointer-events: none;
}

.cart-dock > * {
  pointer-events: auto;
}

.cart-deal {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: min(220px, 42vw);
  padding: 0.5rem 0.85rem;
  background: color-mix(in srgb, var(--panel) 92%, var(--accent));
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.cart-deal.on {
  border-color: var(--success);
  background: color-mix(in srgb, var(--panel) 88%, var(--success));
}

.cart-deal.max {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--panel) 82%, var(--accent));
}

.deal-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.deal-label {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.cart-deal.on .deal-label {
  color: var(--success);
}

.cart-deal.max .deal-label {
  color: var(--accent);
}

.deal-detail {
  font-size: 0.78rem;
  line-height: 1.25;
  color: var(--text-muted);
}

.deal-meter {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 70%, transparent);
  overflow: hidden;
}

.deal-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.cart-deal.on .deal-fill {
  background: var(--success);
}

.cart-deal.max .deal-fill {
  background: var(--accent);
}

.deal-marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.deal-marks i {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 100%;
  transform: translate(-50%, -50%);
  background: color-mix(in srgb, var(--text) 35%, transparent);
}

.deal-marks i.hit {
  background: var(--text);
}

.cartbar {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.5rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  max-width: none;
  flex: 1 1 auto;
  min-width: 0;
}

.cart-count {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

/* A heading rather than a list of names: it does not shrink and is not clipped. */
.cart-count.cart-lead {
  flex: 0 0 auto;
  max-width: none;
  overflow: visible;
}

.cart-total {
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  white-space: nowrap;
}

.cart-total .was {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: line-through;
}

.cart-clear {
  background: none;
  border: none;
  font: inherit;
  font-size: var(--fs-foot);
  color: var(--text-muted);
  cursor: pointer;
}

.cart-clear:hover {
  color: var(--danger);
}

.cart-btc {
  padding: 0.4rem 1.1rem;
  background: transparent;
  color: var(--btc);
  border: 1px solid var(--btc);
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  cursor: pointer;
}

.cart-btc:hover {
  background: rgba(149, 93, 19, 0.14);
}

.btc-email {
  flex: 1 1 180px;
  min-width: 0;
  padding: 0.4rem 0.8rem;
  font: inherit;
  font-size: 0.95rem;
  background: var(--panel-muted);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.cart-buy {
  padding: 0.4rem 1.4rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
}

.cart-buy:hover:not(:disabled) {
  filter: brightness(1.08);
}

.cart-buy:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* --------------------------------------------------------------- enquire */

.enquire {
  margin-top: 3rem;
  padding: 1.25rem;
  max-width: 62ch;
}

.enquire h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.enquire-line {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.enquire-line:last-child {
  margin-bottom: 0;
}

.enquire-line strong {
  color: var(--text);
}

.enquire-line a {
  color: var(--accent);
  white-space: nowrap;
}

.fineprint {
  margin-top: 3rem;
  font-size: var(--fs-label);
  max-width: 640px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ---------------------------------------------------------------- footer */

footer {
  padding: 1.5rem 0 2rem;
  color: var(--text-muted);
  font-size: var(--fs-foot);
  border-top: 1px solid rgba(197, 206, 216, 0.7);
}

footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

footer a {
  color: var(--accent);
}

@media (max-width: 860px) {
  .topbar .wrap {
    flex-wrap: nowrap;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(8, 18, 24, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  /*
   * Sticky + z-index on `.topbar` is a stacking context, so the drawer's
   * z-index: 45 cannot climb over this sibling overlay. Lift the bar (and
   * the sheet inside it) above the dim when open.
   */
  body.nav-open .topbar {
    z-index: 50;
  }

  .nav-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  /*
   * Same <nav> as the desktop bar, parked as a right-hand sheet. Fixed takes
   * it out of the sticky header flow so the bar stays one row tall.
   */
  #site-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(22rem, 88vw);
    z-index: 45;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 0.85rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
    background: var(--panel);
    border-left: 1px solid var(--border);
    box-shadow: -12px 0 40px rgba(12, 34, 44, 0.18);
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.22s ease, visibility 0.22s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #site-nav.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .nav-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-soft);
  }

  .nav-drawer-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
  }

  .nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-muted);
    color: var(--text-secondary);
    font: inherit;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
  }

  .nav-close:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  #site-nav a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.85rem 0.35rem;
    min-height: 3rem;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text);
  }

  #site-nav a:hover,
  #site-nav a[aria-current="page"] {
    color: var(--accent);
  }

  #site-nav a strong {
    font-size: var(--fs-lead);
    font-weight: 600;
  }

  .nav-note {
    display: block;
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.35;
  }

  #site-nav a.buy,
  #site-nav a.shop {
    margin-top: 0.55rem;
    text-align: left;
    border-bottom: none;
    padding: 0.85rem 0.9rem;
  }

  #site-nav a.shop .nav-note {
    color: var(--accent-deep);
    opacity: 0.85;
  }

  #site-nav a.buy .nav-note {
    color: #fff;
    opacity: 0.85;
  }
}

@media (max-width: 860px) and (prefers-reduced-motion: reduce) {
  #site-nav,
  .nav-backdrop {
    transition: none;
  }
}

@media (max-width: 720px) {
  .browse {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
  }

  .mark .name {
    font-size: 1.35rem;
  }

  footer {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }

  .cart-dock {
    flex-direction: column-reverse;
    align-items: stretch;
    left: max(1rem, env(safe-area-inset-left));
    right: max(1rem, env(safe-area-inset-right));
    width: auto;
    max-width: none;
    transform: none;
  }

  .cart-deal {
    min-width: 0;
    border-radius: 14px;
  }

  .cartbar {
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 18px;
  }

  .cart-count {
    max-width: 160px;
  }
}

@media (pointer: coarse) {
  body {
    background-attachment: scroll;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.coming {
  margin-top: 1rem;
}

.pack-browser {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 1rem;
  align-items: start;
}

/*
 * A `hidden` panel stops being a grid item; its column track does not stop
 * being a column. The sheet is closed until somebody asks for it, so on a wide
 * screen the list sat in two thirds of the width with 280px reserved beside it
 * for nothing — and paid for that reservation by clipping the very file names
 * the reservation was meant to explain. Collapse to one column until there is
 * something to show.
 */
.pack-browser:has(> .detail[hidden]) {
  grid-template-columns: minmax(0, 1fr);
}

.pack-browser .tree {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow: auto;
}

.pack-browser .detail {
  position: sticky;
  top: 1rem;
  padding: 1rem;
}

.pack-browser .detail h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.pack-browser ul.folders {
  list-style: none;
  margin: 0;
  padding: 0;
}

.folder.in-cart,
.file.in-cart {
  background: color-mix(in srgb, var(--success, #2a7a4b) 6%, transparent);
}

.folder.placeholder,
.file.placeholder {
  opacity: 0.78;
}

.folder-row,
/*
 * One rule, not two. There were two `.file-row` blocks and the second silently
 * won on the columns — invisible until a sixth child was added and landed
 * outside the grid.
 *
 * Four columns, in the order the row builds them: the cart tick, the name, the
 * price, and the Details button.
 */
.file-row {
  display: grid;
  /* Five: the cart tick, the name, the price, the format badge, and Details. */
  grid-template-columns: 28px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 0.35rem 0.4rem;
  padding: 0.2rem 0.55rem;
  padding-inline-start: calc(0.55rem + var(--depth, 0) * 0.85rem);
  min-height: 40px;
}

/* The format, so a row says whether it is an HDS before it is in the cart. */
.ext {
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  background: var(--panel-muted);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Beside the price, at the end of the row — the same control in the same place
   as the HDV shop's. */
.folder-acts {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  justify-self: end;
}

.details-btn {
  min-height: 30px;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.details-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.expand {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
}

.expand:hover:not(:disabled) {
  background: var(--panel-muted);
}

.expand:disabled {
  opacity: 0.25;
  cursor: default;
}

.expand.spacer {
  visibility: hidden;
}

.chev {
  display: inline-block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent currentColor;
  transform: rotate(0deg);
  transition: transform 120ms ease;
}

.chev.open {
  transform: rotate(90deg);
}

.pick {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  cursor: pointer;
}

.pick.compact {
  width: 22px;
  height: 22px;
}

.pick input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.folder-main,
.file-name {
  display: flex;
  /* A name that takes two lines must not drag what sits beside it to the
     middle of them. */
  align-items: start;
  gap: 0.4rem;
  min-width: 0;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  padding: 0.1rem 0;
}

.folder-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 11px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--text-muted));
  border-radius: 2px 2px 3px 3px;
  position: relative;
}

.folder-icon::before {
  content: '';
  position: absolute;
  left: -1.5px;
  top: -4px;
  width: 6px;
  height: 3px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--text-muted));
  border-bottom: none;
  border-radius: 2px 2px 0 0;
}

.file-icon {
  flex: 0 0 auto;
  width: 10px;
  height: 12px;
  border: 1.5px solid var(--text-muted);
  border-radius: 1px 3px 1px 1px;
  position: relative;
  opacity: 0.75;
}

/*
 * Names wrap; they are never cut.
 *
 * Ellipsis looks tidy and costs the reader the end of the line, which in this
 * shop is where the meaning lives: every title is game, table, depth and ante
 * in that order, so two solves agree for twenty characters and differ in the
 * last ten. At 768px — a tablet, not a phone — seven of ten rows were being
 * truncated, and the seven all began "PLO5 6-max ·".
 */
.folder-id,
.file-name {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.folder-meta {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.folder-price {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.pill {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--panel-muted);
  font-size: 0.75rem;
}

.pill.soon {
  color: var(--warning);
}

.pill.dim {
  opacity: 0.75;
}

.empty-list {
  padding: 1.2rem;
}

@media (min-width: 900px) {
  .folder-meta {
    display: flex;
  }
}

@media (max-width: 860px) {
  .pack-browser {
    grid-template-columns: 1fr;
  }

  .pack-browser .detail {
    position: static;
  }
}

/*
 * Below about 680px the row runs out of line.
 *
 * The longest title here is 47 characters — roughly 355px at this size and
 * weight — and it shares one line with the tick, the price, the format badge
 * and the Details button, which together want some 220px whatever the screen
 * does. On a phone the name lost, and lost badly: `text-overflow` cut titles
 * to about a dozen characters, so a list of ten solves read "PLO5 6-max ·",
 * "PLO5 heads-u", "PLO6 heads-u" — the part that distinguishes one from
 * another being exactly the part that was thrown away.
 *
 * So stop making them compete. The name takes the full width on its own line
 * and wraps; everything else moves underneath it, in the same order, still
 * aligned to the same tick column.
 */
@media (max-width: 680px) {
  .folder-row,
  .file-row {
    grid-template-columns: 28px auto auto minmax(0, 1fr);
    grid-template-areas:
      'tick name name name'
      'tick price ext acts';
    row-gap: 0.2rem;
    padding-block: 0.45rem;
  }

  .file-row > .pick {
    grid-area: tick;
  }

  .file-row > .file-name {
    grid-area: name;
  }

  .file-row > .folder-price {
    grid-area: price;
  }

  .file-row > .ext {
    grid-area: ext;
  }

  .file-row > .folder-acts {
    grid-area: acts;
  }

  /* The tick belongs beside the name, not floating between the two lines it
     now spans. */
  .file-row > .pick {
    align-self: start;
    padding-top: 0.2rem;
  }

  .file-name {
    line-height: 1.32;
  }
}
