/* =========================================================
   Funnel — mobile-first purchase flow (store → fit check →
   verdict → studio → cart). All classes prefixed `fs-`.
   Reuses the style.css token set; monochrome bone/ink, hairlines,
   pill radii, --mono for numbers. No global selectors: everything
   is scoped to #fs-root or .fs-*.
   ========================================================= */

/* Tokens this file adds (style.css does not define these).
   Guarded by convention: only funnel.css sets them. */
:root {
  --text-danger: var(--danger);
  --amber: #b26a00;
}

/* =========================================================
   Hygiene — scoped to #fs-root only (never a bare `*`).
   style.css already has global border-box; this is belt and
   suspenders for the subtree the funnel JS renders.
   ========================================================= */
#fs-root, #fs-root *, #fs-root *::before, #fs-root *::after {
  box-sizing: border-box;
}
#fs-root { scroll-margin-top: calc(var(--nav-h) + 12px); }
#fs-root :where(h1, h2, h3, h4, p, ul, ol, figure) { margin: 0; }
#fs-root img, #fs-root svg, #fs-root canvas, #fs-root video {
  max-width: 100%;
}
/* 16px minimum so iOS doesn't zoom on focus. */
#fs-root input, #fs-root select, #fs-root textarea {
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
}
#fs-root button { font-family: inherit; }

/* Focus ring, scoped to funnel surfaces. */
#fs-root :focus-visible,
.fs-gaugebar :focus-visible,
.fs-studio-bar :focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* =========================================================
   Views — hidden by default, .active swaps them with no
   layout shift (display, not visibility/offsets).
   ========================================================= */
.fs-view { display: none; }
/* Keep each purchase step focused, with its choices above the fold. */
.store-page:has(#fs-store:not(.active)) > :not(#fs-root):not(.fs-site-footer) { display: none; }
.fs-view.active {
  display: block;
  padding: 20px 16px 32px;
  animation: fs-view-in 0.3s var(--ease);
}
@keyframes fs-view-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* About uses the same quiet type and hairlines as the storefront. */
#fs-about { max-width: 900px; margin: 0 auto; }
.fs-about-head { display: grid; gap: 24px; padding-bottom: 48px; }
.fs-about-head h1 { font-size: clamp(40px, 6vw, 76px); font-weight: 500; line-height: 1.05; letter-spacing: -.055em; }
.fs-about-head > p { max-width: 540px; font-size: 18px; color: var(--ink-2); }
.fs-about-details { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; border-top: var(--hair) solid var(--line); padding: 32px 0; }
.fs-about-details h2 { font-size: 20px; font-weight: 500; letter-spacing: -.02em; }
#fs-about .fs-about-details p { margin-top: 12px; color: var(--ink-2); font-size: 15px; }
.fs-text-link { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--ink); text-underline-offset: 4px; font-size: 15px; }
.fs-about-browse { width: auto; text-decoration: none; }
.fs-site-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 32px; margin-top: 56px; padding: 24px 16px 0; border-top: var(--hair) solid var(--line); color: var(--ink-3); font-size: 12px; }
.fs-site-footer p { margin: 0; }
.fs-site-footer nav { display: flex; gap: 24px; }
.fs-site-footer a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--ink-2); text-decoration: none; }
.fs-site-footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.fs-site-footer a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.fs-cart-head { margin-bottom: 24px; }
.fs-cart-head h1 { font-size: 32px; font-weight: 500; letter-spacing: -.04em; }
.fs-cart-head p { color: var(--ink-3); font-size: 14px; }
#fs-cart .fs-cart-delivery { margin-top: 24px; color: var(--ink-2); font-size: 14px; }
.fs-cart-trust { margin-top: 16px; padding-top: 16px; border-top: var(--hair) solid var(--line); color: var(--ink-3); font-size: 13px; line-height: 1.8; }
@media (max-width: 640px) {
  .fs-about-details { grid-template-columns: 1fr; gap: 28px; }
  .fs-about-head { gap: 20px; padding-bottom: 32px; }
  .fs-about-head > p { font-size: 16px; }
  .fs-about-browse { width: 100%; white-space: normal; }
  .fs-site-footer { margin-top: 32px; }
}

/* — Store — ------------------------------------------------ */

.fs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.fs-card {
  background: var(--bg-card);
  border: var(--hair) solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: border-color 0.3s var(--ease), transform 0.4s var(--ease);
}
/* Sorted mode: subtle verdict tint on the leading edge. */
.fs-card[data-verdict="green"] { border-left: 3px solid var(--ok); }
.fs-card[data-verdict="amber"] { border-left: 3px solid var(--amber); }
.fs-card[data-verdict="red"]   { border-left: 3px solid var(--danger); }

.fs-card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--bg-deep);
  overflow: hidden;
  cursor: pointer; /* clicking the preview starts designing the set */
}
/* Owner-supplied card art (/static/catalog/<id>/card.png) covers the
   fallback silhouette. */
.fs-card-img { position: absolute; inset: 0; }
/* Static STL still (store.js): transparent until painted so the silhouette
   shows during load; once __sdRenderSTLStill lands the frame it sets
   data-still="1" and the deep-bone background hides the SVG. */
.fs-card-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}
.fs-card-still[data-still="1"] { background: var(--bg-deep); }
.fs-card-media canvas,
.fs-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  /* contain: never crops a silhouette; the deep-bone backdrop makes
     letterboxing invisible when the render aspect already matches. */
  object-fit: contain;
}
.fs-card-svg {
  display: block;
  width: 100%;
  height: 100%;
}
/* Hover-spin viewer (store.js): covers silhouette/card art while hovered.
   aspect-ratio:auto beats .catalogue-canvas's 4/3 — inset:0 owns the size. */
.fs-card-live {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  background: var(--bg-deep);
  opacity: 0;
}
.fs-card-live[data-ready="1"] { opacity: 1; }

.fs-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 18px;
}
.fs-card-name {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.fs-setup-badge {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--pill);
  padding: 4px 10px;
}
.fs-card-tagline {
  font-size: 14px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fs-sys-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fs-sys-pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  border: var(--hair) solid var(--line);
  border-radius: var(--pill);
  padding: 4px 8px;
}
.fs-card-cta {
  /* full primary-button look lives in the CTA section below */
  margin-top: auto;
}

/* Set price: total + "N fins × $each" breakdown (store.js priceHtml). */
.fs-card-price {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  margin: 2px 0 12px;
}
.fs-card-price span {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

/* Free-design entry (store.js studioCardHtml): the grid's last card, framed
   in a dashed hairline like a drawing sheet; its media is the studio's
   wireframe-and-outline view of a fin where the sets show finished fins. */
.fs-card--studio { border: 1px dashed var(--line-2); }
.fs-card--studio .fs-card-tagline { white-space: normal; }

.fs-sorted-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: var(--hair) solid var(--line);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--ink-2);
}

/* — Fit check — -------------------------------------------- */

.fs-stepper {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 4px 0 8px;
}
.fs-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--line-2);
}
.fs-dot.on { background: var(--ink); }

.fs-q { padding: 20px 0 18px; }
.fs-q-title {
  font-size: 24px;
  font-weight: 550;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.fs-q-sub {
  margin-top: 6px;
  font-size: 15px;
  color: var(--ink-3);
}

/* Segmented control (iOS-style track on bone). */
.fs-seg {
  display: flex;
  gap: 2px;
  background: var(--bg-deep);
  border-radius: var(--pill);
  padding: 3px;
}
.fs-seg-btn {
  flex: 1;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--pill);
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.fs-seg-btn.on {
  background: var(--bg-card);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* Large tappable fin-system cards. */
.fs-sys-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.fs-sys-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 16px;
  background: transparent;
  border: var(--hair) solid var(--line-2);
  border-radius: var(--radius-m);
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.fs-sys-card.on {
  background: var(--bg-card);
  border-color: var(--ink);
}
.fs-sys-diagram {
  width: 64px;
  height: 64px;
  flex: none;
}

/* Numeric field + unit toggle. */
.fs-field {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.fs-field input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 10px 14px;
  background: var(--bg-card);
  border: var(--hair) solid var(--line-2);
  border-radius: var(--radius-s);
  font-family: var(--mono);
}
.fs-field input:focus {
  outline: none;
  border-color: var(--ink);
}
.fs-unit-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-deep);
  border-radius: var(--pill);
  padding: 3px;
}
.fs-unit-toggle button {
  appearance: none;
  border: none;
  background: transparent;
  border-radius: var(--pill);
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.fs-unit-toggle button.on {
  background: var(--bg-card);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.fs-inline-err {
  color: var(--text-danger);
  font-size: 13px;
  margin-top: 6px;
}

/* Skill slider — thumb styled after style.css's #ui range inputs,
   scaled up for touch; the whole strip is --tap tall so any tap lands. */
.fs-skill { padding: 8px 0; }
.fs-skill-readout {
  font-family: var(--mono);
  font-size: 24px;
  letter-spacing: -0.01em;
}
.fs-skill-label {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.fs-skill input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--tap);
  margin: 0;
  background: transparent;
  outline: none;
  cursor: pointer;
}
.fs-skill input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: rgba(10, 10, 10, 0.18);
  border-radius: 2px;
}
.fs-skill input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  /* (thumb 24 - track 2) / 2, centers the thumb on the 2px track */
  margin-top: -11px;
  cursor: grab;
  transition: transform 0.2s var(--ease);
}
.fs-skill input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.15);
}
.fs-skill input[type="range"]::-moz-range-track {
  height: 2px;
  background: rgba(10, 10, 10, 0.18);
  border-radius: 2px;
}
.fs-skill input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--bg-card);
}

.fs-helper-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0;
  appearance: none;
  background: none;
  border: none;
  color: var(--ink-2);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* — Verdict — ---------------------------------------------- */

.fs-verdict-media {
  aspect-ratio: 4 / 3;
  background: var(--bg-card);
  border: var(--hair) solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
}
.fs-verdict-media canvas,
.fs-verdict-media img,
.fs-verdict-media svg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
/* Opt-in recommendation overlay; shared store/cart stills and Studio are untouched. */
#fs-verdict .fs-fit-preview { position: relative; }
#fs-verdict .fs-fit-preview > .fs-fit-preview-overlay {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
}
#fs-verdict .fs-fit-preview-overlay > svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  max-width: none; max-height: none; overflow: hidden;
}
#fs-verdict .fs-fit-preview-overlay line { stroke: #181818; stroke-width: .7; opacity: .55; }
#fs-verdict .fs-fit-preview-overlay circle { fill: #181818; opacity: .7; }
#fs-verdict .fs-fit-preview-label {
  position: absolute; white-space: nowrap; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-card); color: var(--ink);
  font: 10px/1.2 var(--mono); letter-spacing: .08em;
  transition: border-color 120ms, background-color 120ms;
}
#fs-verdict .fs-fit-preview-overlay.active .fs-fit-preview-label { border-color: #777; background: var(--bg); }
#fs-verdict canvas[data-recommendation="1"] { outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) {
  #fs-verdict .fs-fit-preview-label { transition: none; }
}
.fs-verdict-headline {
  font-size: 26px;
  font-weight: 550;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 16px;
}

.fs-gauges {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}
/* Explicit grid placement: robust to child markup order. */
.fs-gauge {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  align-items: baseline;
  min-width: 0;
}
.fs-gauge-label {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.fs-gauge-readout {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  text-align: right;
}
.fs-gauge-track {
  grid-column: 1 / -1;
  grid-row: 2;
  position: relative;
  height: 6px;
  border-radius: var(--pill);
  background: rgba(10, 10, 10, 0.10);
}
/* End captions under the track: what the scale's extremes mean. */
.fs-gauge-end {
  grid-row: 3;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.fs-gauge-end--left  { grid-column: 1; text-align: left; }
.fs-gauge-end--right { grid-column: 2; text-align: right; }
.fs-gauge-band {
  /* left/width set inline by JS — the green target zone */
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: var(--pill);
  background: rgba(46, 125, 50, 0.22);
}
.fs-gauge-marker {
  /* left % set inline by JS */
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  border-radius: 2px;
  background: var(--ink);
  transform: translateX(-50%);
}
.fs-gauge[data-state="green"] .fs-gauge-marker { background: var(--ok); }
.fs-gauge[data-state="amber"] .fs-gauge-marker { background: var(--amber); }
.fs-gauge[data-state="red"]   .fs-gauge-marker { background: var(--danger); }

.fs-spec-rows {
  margin-top: 20px;
  border-top: var(--hair) solid var(--line);
}
.fs-spec-rows .fs-spec-row,
.fs-spec-rows > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 12px 0;
  border-bottom: var(--hair) solid var(--line);
  font-size: 15px;
}
.fs-spec-rows > * > :first-child { color: var(--ink-3); }
.fs-spec-rows > * > :last-child { font-family: var(--mono); }

.fs-profile-chip {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 16px;
  margin-top: 16px;
  appearance: none;
  background: transparent;
  border: var(--hair) solid var(--line-2);
  border-radius: var(--pill);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.fs-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-3);
}
/* Sinker-board warning — more visible than a plain note. */
.fs-note--warn {
  color: var(--ink);
  background: color-mix(in srgb, var(--amber) 14%, transparent);
  border-left: 3px solid var(--amber);
  padding: 10px 12px;
  border-radius: 6px;
}

.fs-accordion {
  margin-top: 16px;
  background: var(--bg-card);
  border: var(--hair) solid var(--line);
  border-radius: var(--radius-s);
  overflow: hidden;
}
.fs-accordion summary {
  list-style: none;
  cursor: pointer;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
}
.fs-accordion summary::-webkit-details-marker { display: none; }
.fs-accordion summary::after {
  content: "+";
  font-family: var(--mono);
  color: var(--ink-3);
  transition: transform 0.25s var(--ease);
}
.fs-accordion[open] summary::after { transform: rotate(45deg); }
.fs-accordion-body {
  padding: 12px 16px 16px;
  border-top: var(--hair) solid var(--line);
  font-size: 14px;
  color: var(--ink-2);
}

/* — CTAs — -------------------------------------------------- */

.fs-cta-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

/* Modeled on .sd-btn.primary / .ghost, sized for the funnel:
   16px label, --tap tall, full-width on mobile. */
.fs-btn-primary,
.fs-card-cta {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 12px 24px;
  background: var(--ink);
  color: var(--bg);
  border: var(--hair) solid var(--ink);
  border-radius: var(--pill);
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.fs-btn-secondary {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 12px 24px;
  background: transparent;
  color: var(--ink);
  border: var(--hair) solid var(--line-2);
  border-radius: var(--pill);
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.fs-btn-primary:disabled,
.fs-btn-secondary:disabled,
.fs-card-cta:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* — Sticky bottom bar — ------------------------------------- */

.fs-bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60; /* above the sticky tab nav (50), below panels (90) */
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(244, 243, 239, 0.85);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-top: var(--hair) solid var(--line);
}
.fs-bottombar .fs-btn-primary { flex: 1; }
.fs-bottombar .fs-btn-secondary {
  flex: none;
  width: auto;
}
/* Verdict CTAs keep their .fs-cta-col contract inside the sticky bar —
   flatten the column so the row layout still holds. */
.fs-bottombar .fs-cta-col {
  flex: 1;
  flex-direction: row;
  gap: 10px;
  margin-top: 0;
  align-items: stretch;
}

/* Pad view content so a fixed bar never covers it. */
.fs-bottombar-spacer {
  height: calc(88px + env(safe-area-inset-bottom, 0px));
}

/* — Studio additions — -------------------------------------- */

/* Slim persistent strip under the tab nav: two mini gauges + reset. */
.fs-gaugebar {
  position: sticky;
  top: var(--nav-h);
  z-index: 40; /* below the tab nav (50) it docks under */
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: rgba(244, 243, 239, 0.85);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: var(--hair) solid var(--line);
}
/* Compact horizontal gauge, inside the gaugebar only. */
.fs-gaugebar .fs-gauge {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.fs-gaugebar .fs-gauge-label { font-size: 9px; }
.fs-gaugebar .fs-gauge-track {
  flex: 1;
  height: 4px;
  margin: 0;
}
.fs-gaugebar .fs-gauge-marker {
  top: -3px;
  bottom: -3px;
  width: 2px;
}
.fs-gaugebar .fs-gauge-readout { font-size: 11px; }
.fs-reset-fit {
  appearance: none;
  flex: none;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 14px;
  background: transparent;
  border: var(--hair) solid var(--line-2);
  border-radius: var(--pill);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

/* Sticky bottom bar inside the studio tab (not fixed — sticks
   within the studio's own scroll container). */
.fs-studio-bar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(244, 243, 239, 0.85);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-top: var(--hair) solid var(--line);
}

.fs-warn {
  color: var(--text-danger);
  font-size: 13px;
  margin-top: 8px;
}

/* Mono overlay chip for the engraving preview — the studio agent
   positions it (this class is position:absolute; parent sets the
   containing rect + offsets). */
.fs-engrave-preview {
  position: absolute;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: var(--hair) solid var(--line-2);
  border-radius: var(--pill);
  padding: 6px 12px;
}

/* — Hover (pointer devices only; tap states are the base) — - */

@media (hover: hover) {
  .fs-card:hover {
    border-color: var(--line-2);
    transform: translateY(-2px);
  }
  .fs-card--studio:hover { border-color: var(--ink); }
  .fs-btn-primary:hover:not(:disabled),
  .fs-card-cta:hover:not(:disabled) { background: #1f1f1f; }
  .fs-btn-secondary:hover:not(:disabled),
  .fs-reset-fit:hover,
  .fs-profile-chip:hover {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
  }
  .fs-helper-link:hover { color: var(--ink); }
  .fs-sys-card:hover { border-color: var(--ink); }
}

/* — Reduced motion — ---------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  #fs-root *,
  .fs-gaugebar *,
  .fs-studio-bar * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* — ≥768px — ------------------------------------------------ */

@media (min-width: 768px) {
  .fs-view.active { padding: 28px 32px 40px; }

  .fs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  /* Forms and verdicts stay readable — capped, centered. */
  #fs-fitcheck.fs-view.active,
  #fs-verdict.fs-view.active {
    max-width: 640px;
    margin: 0 auto;
  }

  .fs-q-title { font-size: 28px; }
  .fs-sys-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fs-sys-card {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    min-height: 160px;
  }

  .fs-cta-col { flex-direction: row; }
  .fs-btn-primary,
  .fs-btn-secondary { width: auto; }
  /* the bar keeps its full-bleed primary even on desktop */
  .fs-bottombar .fs-btn-primary { flex: 1; }
}

/* — ≥1024px — ----------------------------------------------- */

@media (min-width: 1024px) {
  .fs-view.active {
    max-width: 1120px;
    margin: 0 auto;
  }
  /* keep the narrow measure for the form/verdict views */
  #fs-fitcheck.fs-view.active,
  #fs-verdict.fs-view.active {
    max-width: 640px;
  }

  .fs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* — Phone layouts — ---------------------------------------- */

@media (max-width: 640px) {
  .fs-card-media { aspect-ratio: 4 / 3; }
  /* Two long verdict actions cannot share a phone-width row. */
  .fs-bottombar .fs-cta-col { flex-direction: column; min-width: 0; }
  .fs-bottombar .fs-cta-col > button {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }
  #fs-verdict .fs-bottombar-spacer { height: calc(144px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 480px) {
  .fs-gauges { grid-template-columns: minmax(0, 1fr); }
}

/* Short landscape phones need the complete preview above the purchase bar. */
@media (orientation: landscape) and (max-height: 500px) {
  /* Keep answers above the fixed actions, including wide phones that otherwise
     inherit the desktop's 160px system cards and the store hero's top space. */
  .store-page:has(#fs-fitcheck.active) { padding-top: 4px; }
  #fs-fitcheck.fs-view.active { padding-top: 8px; }
  #fs-fitcheck .fs-q { padding: 6px 0 10px; }
  #fs-fitcheck .fs-q-title { font-size: 20px; }
  #fs-fitcheck .fs-q-sub { margin-top: 4px; font-size: 13px; }
  #fs-fitcheck .fs-skill { padding: 0; }
  #fs-fitcheck .fs-sys-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #fs-fitcheck .fs-sys-card {
    flex-direction: row; justify-content: flex-start; text-align: left;
    min-height: 52px; padding: 8px; gap: 8px; font-size: 14px;
  }
  #fs-fitcheck .fs-sys-diagram { width: 32px; height: 32px; }
  .store-page:has(#fs-verdict.active) { padding-top: 0; }
  #fs-verdict.fs-view.active { padding-top: 12px; }
  .fs-verdict-media {
    height: clamp(80px, calc(100svh - 200px), 180px);
    max-width: 240px;
    margin: 0 auto 12px;
  }
}
