/* ==========================================================================
   Hide & Stitch — stylesheet
   Dark leather-brown theme: deep coffee ground, leather-brown primary,
   brass accent, cream stitching. Slab-serif headings, 14px cards.

   Two things in here are hard requirements from the design and should not be
   softened:
     §0.1  Every entry card is ONE link. The whole card is the hit area.
     §5    There is no traditional top header. Navigation is two floating
           elements: a glass toolbar at the top, a tab bar at the bottom.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ol, ul {
  margin: 0;
  padding: 0;
}

ol, ul { list-style: none; }

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}

img { height: auto; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { background: none; border: 0; cursor: pointer; }

a { color: inherit; text-decoration: none; }

table { border-collapse: collapse; border-spacing: 0; }

/* The UA stylesheet's `[hidden] { display: none }` loses to any explicit
   display value, and `.card` sets `display: flex`. Without this, filtering
   would hide nothing. Pin it once, globally. */
[hidden] { display: none !important; }

/* Set while the drawer or a pop-up panel is open. */
body.is-locked { overflow: hidden; }

/* --------------------------------------------------------------------------
   2. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* coffee — the ground */
  --coffee-950: #0F0A08;
  --coffee-900: #1F1410;
  --coffee-800: #2A1C15;
  --coffee-700: #3A281E;
  --coffee-600: #4A3428;
  --coffee-500: #5C4234;
  --coffee-400: #6E5242;

  /* leather — the primary */
  --leather-700: #5C3A20;
  --leather-600: #8A5A38;
  --leather-550: #B87A50;
  --leather-500: #C4956A;
  --leather-400: #D4AE88;
  --leather-300: #E4C8A8;
  --leather-200: #F0DCC4;

  /* brass — the accent */
  --brass-800: #6B5020;
  --brass-700: #8A6A2A;
  --brass-500: #B8935A;
  --brass-400: #D0AC70;
  --brass-300: #E0C490;
  --brass-200: #F0DCB8;
  --brass-100: #FAF0DC;

  /* stitching cream */
  --cream-100: #F2E8D5;
  --cream-200: #E8DCC4;
  --cream-300: #D8C8A8;
  --cream-400: #C4B090;
  --cream-500: #A89478;

  /* wine — warning */
  --wine-900: #5C1E18;
  --wine-700: #8B3A2E;
  --wine-500: #B04A3A;
  --wine-400: #D06858;
  --wine-300: #E8A090;
  --wine-100: #F5D0C8;

  /* semantic */
  --ok: #5A8A5A;
  --ok-dark: #3E6A3E;
  --warn: #D0AC70;
  --info: #5A7A98;

  /* surfaces — theme-dependent */
  --bg: var(--coffee-950);
  --bg-alt: var(--coffee-900);
  --surface: var(--coffee-800);
  --surface-2: var(--coffee-700);
  --surface-3: var(--coffee-600);
  --surface-deep: #0B0705;

  /* text */
  --text: var(--cream-100);
  --text-muted: var(--cream-400);
  --text-dim: #8A7860;
  --text-invert: var(--coffee-950);

  /* lines */
  --line: #3A281E;
  --line-strong: #4A3428;
  --line-brass: var(--brass-800);
  --stitch: rgba(242, 232, 213, 0.15);
  --stitch-strong: rgba(242, 232, 213, 0.28);

  /* links */
  --link: var(--leather-400);
  --link-hover: var(--brass-300);
  --link-underline: var(--brass-800);

  /* texture */
  --grain: rgba(196, 149, 106, 0.06);
  --veil: rgba(31, 20, 16, 0.72);
  --veil-solid: rgba(31, 20, 16, 0.85);

  /* radius */
  --r-xs: 6px;
  --r-card: 14px;
  --r-cta: 20px;
  --r-pill: 999px;

  /* shadow */
  --sh-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sh-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --sh-md: 0 8px 22px rgba(0, 0, 0, 0.5);
  --sh-lg: 0 18px 48px rgba(0, 0, 0, 0.6);
  --glow-leather: 0 0 18px rgba(196, 149, 106, 0.25);
  --glow-brass: 0 0 18px rgba(184, 147, 90, 0.3);

  /* motion */
  --t-fast: 0.16s ease;
  --t-card: 0.3s ease;
  --t-stitch: 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);

  /* type */
  --font-display: "Bitter", "Rockwell", "Georgia", serif;
  --font-body: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", "Menlo", monospace;

  /* metrics */
  --gutter: 22px;
  --toolbar-h: 72px;
  --tabbar-h: 80px;
}

/* Light leather theme — the second stop on the theme toggle. */
html[data-theme="light"] {
  --bg: #EFE4D4;
  --bg-alt: #E7DAC6;
  --surface: #FAF3E7;
  --surface-2: #F1E7D6;
  --surface-3: #E4D6C0;
  --surface-deep: #DCCDB4;

  --text: #2A1C15;
  --text-muted: #6B5642;
  --text-dim: #8A7860;
  --text-invert: #FBF5E9;

  --line: #D2BFA4;
  --line-strong: #C0A98A;
  --line-brass: #B8935A;
  --stitch: rgba(90, 62, 40, 0.22);
  --stitch-strong: rgba(90, 62, 40, 0.4);

  --link: #8A5A38;
  --link-hover: #6B5020;
  --link-underline: #B8935A;

  --grain: rgba(92, 58, 32, 0.05);
  --veil: rgba(250, 243, 231, 0.8);
  --veil-solid: rgba(250, 243, 231, 0.92);

  --sh-xs: 0 1px 2px rgba(90, 62, 40, 0.14);
  --sh-sm: 0 2px 8px rgba(90, 62, 40, 0.16);
  --sh-md: 0 8px 22px rgba(90, 62, 40, 0.18);
  --sh-lg: 0 18px 48px rgba(90, 62, 40, 0.22);
  --glow-leather: 0 0 18px rgba(138, 90, 56, 0.2);
  --glow-brass: 0 0 18px rgba(184, 147, 90, 0.28);
}

/* --------------------------------------------------------------------------
   3. Base type
   -------------------------------------------------------------------------- */

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.72;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* clearance for the two floating bars */
  padding-top: var(--toolbar-h);
  padding-bottom: calc(var(--tabbar-h) + 16px);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Leather grain over the whole page. Purely decorative. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    radial-gradient(circle at 18% 22%, var(--grain) 0 1px, transparent 1px),
    radial-gradient(circle at 62% 71%, var(--grain) 0 1px, transparent 1px),
    radial-gradient(circle at 87% 38%, var(--grain) 0 1px, transparent 1px),
    radial-gradient(circle at 35% 88%, var(--grain) 0 1px, transparent 1px);
  background-size: 37px 37px, 53px 53px, 71px 71px, 89px 89px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.005em;
  color: var(--text);
}

h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); }
h3 { font-size: clamp(1.18rem, 2vw, 1.4rem); }
h4 { font-size: 1.08rem; }

p { margin-bottom: 1.1em; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 700; color: var(--text); }
em { font-style: italic; }

a {
  color: var(--link);
  transition: color var(--t-fast);
}
a:hover { color: var(--link-hover); }

.prose a,
.tip-box a,
.notice a,
.step-body a,
.lede a {
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

hr {
  border: 0;
  border-top: 1px dashed var(--stitch);
  margin: 2rem 0;
}

::selection {
  background: var(--leather-500);
  color: var(--coffee-950);
}

/* Focus ring — brass, on everything, never removed. */
:focus-visible {
  outline: 3px solid var(--brass-500);
  outline-offset: 2px;
  box-shadow: 0 0 12px rgba(184, 147, 90, 0.35);
  border-radius: var(--r-xs);
}

/* Fixed, not absolute: an absolutely positioned skip link is placed against
   the document, so on a scrolled page it "appears" above the viewport and the
   user never sees it. */
.skip-link {
  position: fixed;
  left: 50%;
  top: -100px;
  transform: translateX(-50%);
  z-index: 400;
  background: var(--leather-500);
  color: var(--coffee-950);
  padding: 10px 20px;
  border-radius: var(--r-pill);
  font-weight: 700;
  /* No transition: a skip link must be visible the instant it takes focus.
     Animating it in makes it measurable as "off-screen" for the first frames,
     which is both a flaky test and a real delay for the person using it. */
}
.skip-link:focus {
  top: 10px;
  color: var(--coffee-950);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  /* Auto offsets keep the static position, which extends the scroll width of
     any wide ancestor (a table, say). Pin them. */
  left: 0;
  top: 0;
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap-narrow { max-width: 820px; }
.wrap-wide { max-width: 1360px; }

.section { padding-block: 60px; }
.section-sm { padding-block: 38px; }
.section-tight { padding: 42px 0 60px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.section-head h2 { max-width: 22ch; }
.section-head p {
  color: var(--text-muted);
  max-width: 56ch;
  margin-bottom: 0;
}

.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

.stack > * + * { margin-top: 1.1em; }

/* Eyebrow label */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass-500);
  margin-bottom: 10px;
}
.eyebrow::before {
  content: "\2307"; /* ⌇ stitching symbol */
  font-size: 1rem;
  line-height: 1;
}

.lede {
  font-size: 1.06rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   5. Top floating glass toolbar
   -------------------------------------------------------------------------- */

.topbar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  width: 100%;
  max-width: 1160px;
  padding-inline: 0;
}

.topbar-inner {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px;
  height: 56px;
  padding: 0 10px 0 14px;
  border-radius: var(--r-pill);
  background: var(--veil);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--line-brass);
  box-shadow: var(--sh-md);
  transition: height var(--t-card);
}

/* Scroll behaviour: shrink past 120px, restore immediately on scroll up. */
.topbar.is-compact .topbar-inner { height: 48px; }
.topbar.is-compact .brand-tagline { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
}
.brand-mark {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--leather-600);
  display: grid;
  place-items: center;
  box-shadow: var(--sh-xs);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-text { min-width: 0; }
.brand-name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  white-space: nowrap;
}
.brand-tagline {
  display: block;
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass-500);
  line-height: 1.3;
  white-space: nowrap;
}

.topbar-search {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
}
.search-form {
  position: relative;
  width: 100%;
  max-width: 220px;
  transition: max-width var(--t-card);
}
.search-form:focus-within { max-width: 300px; }
.search-form input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-form input::placeholder { color: var(--text-dim); }
.search-form input:focus {
  outline: none;
  border-color: var(--brass-500);
  box-shadow: var(--glow-brass);
}
.search-form .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--brass-500);
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--cream-300);
  border: 1px solid transparent;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover {
  background: rgba(196, 149, 106, 0.12);
  color: var(--brass-300);
}
.icon-btn svg { width: 18px; height: 18px; }

.burger { display: none; width: 38px; height: 38px; }

/* --------------------------------------------------------------------------
   6. Bottom floating tab bar
   -------------------------------------------------------------------------- */

.tabbar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  width: 100%;
  max-width: 640px;
  padding-inline: 0;
}

.tabbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  height: 64px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--veil-solid);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--line-brass);
  box-shadow: var(--sh-lg);
}

.tab {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  min-height: 44px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  transition: background var(--t-fast), color var(--t-fast);
}
.tab svg { width: 22px; height: 22px; }
.tab:hover {
  background: rgba(196, 149, 106, 0.12);
  color: var(--brass-300);
}
.tab[aria-current="page"] {
  background: rgba(184, 147, 90, 0.16);
  color: var(--brass-300);
  box-shadow: var(--glow-brass);
}
.tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--brass-500);
}
.tab-label { line-height: 1; }

/* Pop-up panel raised from a tab */
.tab-panel {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 22px);
  transform: translateX(-50%) translateY(10px);
  z-index: 210;
  width: min(560px, calc(100vw - 32px));
  max-height: min(66vh, 520px);
  overflow-y: auto;
  padding: 18px;
  border-radius: var(--r-cta);
  background: var(--surface);
  border: 1px solid var(--line-brass);
  box-shadow: var(--sh-lg);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-card), transform var(--t-card), visibility var(--t-card);
}
.tab-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.tab-panel h2 {
  font-size: 1.05rem;
  margin-bottom: 12px;
}
.tab-panel-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.tab-panel-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 12px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.tab-panel-item:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.tab-panel-item .tp-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  color: var(--leather-400);
}
.tab-panel-item .tp-icon svg { width: 17px; height: 17px; }
.tab-panel-item strong {
  display: block;
  font-size: 0.92rem;
  font-family: var(--font-display);
  line-height: 1.3;
}
.tab-panel-item span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 205;
  background: rgba(15, 10, 8, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-card), visibility var(--t-card);
}
.scrim.is-open { opacity: 1; visibility: visible; }

/* --------------------------------------------------------------------------
   7. Hamburger drawer
   -------------------------------------------------------------------------- */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 300;
  width: min(400px, 92vw);
  height: 100%;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-alt);
  border-left: 1px solid var(--line-brass);
  box-shadow: var(--sh-lg);
  transform: translateX(100%);
  transition: transform var(--t-card);
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
.drawer.is-open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.drawer-acc { border-top: 1px dashed var(--stitch); }
.drawer-acc-item { border-bottom: 1px dashed var(--stitch); }
.drawer-acc-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 13px 2px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}
.drawer-acc-btn svg {
  width: 16px;
  height: 16px;
  color: var(--brass-500);
  transition: transform var(--t-fast);
}
.drawer-acc-btn[aria-expanded="true"] svg { transform: rotate(90deg); }
.drawer-acc-panel {
  display: none;
  padding: 0 0 12px 12px;
}
.drawer-acc-panel.is-open { display: block; }
.drawer-acc-panel a {
  display: block;
  padding: 7px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.drawer-acc-panel a:hover { color: var(--brass-300); }
.drawer-links { margin-top: 16px; }
.drawer-links a {
  display: block;
  padding: 10px 2px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
}
.drawer-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--stitch);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  font-size: 0.93rem;
  font-weight: 700;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--leather-500);
  color: var(--coffee-950);
}
.btn-primary:hover {
  background: var(--brass-400);
  color: var(--coffee-950);
  box-shadow: var(--glow-brass);
}

.btn-brass {
  background: var(--brass-500);
  color: var(--coffee-950);
}
.btn-brass:hover {
  background: var(--brass-400);
  color: var(--coffee-950);
  box-shadow: var(--glow-brass);
}

.btn-outline {
  background: transparent;
  border-color: var(--leather-600);
  color: var(--leather-400);
}
.btn-outline:hover {
  border-color: var(--brass-500);
  color: var(--brass-300);
  background: rgba(184, 147, 90, 0.1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--brass-300); background: var(--surface-2); }

.btn-danger {
  background: var(--wine-500);
  color: #FFF6F3;
}
.btn-danger:hover { background: var(--wine-400); color: #2A0F0A; }

.btn-sm { padding: 7px 14px; font-size: 0.83rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* CTA with a stitched underline that animates on hover */
.btn-stitch {
  position: relative;
  padding-bottom: 13px;
}
.btn-stitch::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 7px;
  height: 0;
  border-top: 2px dashed var(--brass-500);
  transition: transform var(--t-stitch), opacity var(--t-fast);
}
.btn-stitch:hover::after {
  transform: translateY(-2px);
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   9. Cards — §0.1 whole card is the link
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  cursor: pointer;
  color: var(--text);
  transition: transform var(--t-card), box-shadow var(--t-card),
              border-color var(--t-card), background var(--t-card);
}
.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--sh-lg);
  border-color: var(--leather-550);
  color: var(--text);
}
.card:focus-visible {
  outline: 3px solid var(--brass-500);
  outline-offset: 2px;
}
.card:active { transform: translateY(-1px); }

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-deep);
  overflow: hidden;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-card);
}
.card:hover .card-media img { transform: scale(1.04); }

.card-body {
  flex: 1 1 auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.3;
}
.card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding: 12px 18px;
  border-top: 1px dashed var(--stitch);
}
.card-arrow {
  color: var(--brass-500);
  font-size: 1rem;
  transition: transform var(--t-card);
}
.card:hover .card-arrow { transform: translateX(4px); }

/* Category card — no image, round icon */
.cat-card .cat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--leather-600);
  display: grid;
  place-items: center;
  color: var(--coffee-950);
  margin-bottom: 4px;
}
.cat-card .cat-icon svg { width: 26px; height: 26px; }
.cat-card .cat-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Tool card — line drawing on a deep ground */
.tool-card .card-media {
  background: var(--surface-deep);
  display: grid;
  place-items: center;
  padding: 12px;
}
.tool-card .card-media img {
  object-fit: contain;
  width: 100%;
  height: 100%;
}

/* Blog card */
.blog-card .card-media { aspect-ratio: 16 / 9; }
.blog-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: var(--text-dim);
}
.blog-meta .dot { color: var(--brass-800); }

/* Calculator card */
.calc-card .card-media {
  aspect-ratio: 16 / 9;
  background: var(--surface-deep);
  display: grid;
  place-items: center;
  padding: 10px;
}
.calc-card .card-media img { object-fit: contain; }

/* Studio card — deeper ground, glow edge */
.studio-card {
  background: var(--surface-deep);
  border-color: var(--line-brass);
}
.studio-card:hover {
  border-color: var(--brass-500);
  box-shadow: var(--sh-lg), var(--glow-brass);
}
.studio-card .card-media {
  background: var(--surface-deep);
  display: grid;
  place-items: center;
  padding: 10px;
}
.studio-card .card-media img { object-fit: contain; }

/* Swatch card — leather / thread colour chip */
.swatch-card { cursor: default; }
.swatch-card:hover { transform: none; }
.swatch-card .swatch-chip {
  height: 64px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 -8px 18px rgba(0, 0, 0, 0.28);
}

/* Whole-card overlay link, for cards that must wrap a real <article> */
.card-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* --------------------------------------------------------------------------
   10. Tags, chips, badges
   -------------------------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--leather-700);
  color: var(--leather-200);
  white-space: nowrap;
}
.tag-brass { background: var(--brass-800); color: var(--brass-200); }
.tag-wine { background: var(--wine-900); color: var(--wine-300); }
.tag-cream { background: var(--cream-200); color: var(--coffee-900); }
.tag-outline {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text-muted);
}
.tag-ok { background: var(--ok-dark); color: #E6F2E6; }
.tag-info { background: #23415C; color: #C6DCEF; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.chip:hover { border-color: var(--leather-550); color: var(--text); }
.chip.is-active {
  background: var(--leather-500);
  border-color: var(--leather-500);
  color: var(--coffee-950);
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.param-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--coffee-900);
  border: 1px solid var(--leather-700);
  color: var(--leather-300);
  white-space: nowrap;
}

.badge-3d {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--brass-500);
  color: var(--coffee-950);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.badge-3d svg { width: 12px; height: 12px; }

.leather-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--line-strong);
}
.leather-badge.veg { background: var(--leather-300); color: var(--coffee-900); }
.leather-badge.chrome { background: var(--leather-600); color: var(--leather-200); }
.leather-badge.oil { background: var(--leather-700); color: var(--leather-300); }

.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: var(--r-pill);
  border: 1px dashed var(--line-brass);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brass-400);
}

/* --------------------------------------------------------------------------
   11. Page hero / breadcrumbs
   -------------------------------------------------------------------------- */

.page-hero {
  position: relative;
  padding: 42px 0 34px;
  background: var(--bg-alt);
  border-bottom: 3px solid var(--leather-600);
  margin-bottom: 34px;
}
.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 22% 40%, var(--grain) 0 1px, transparent 1px),
    radial-gradient(circle at 71% 62%, var(--grain) 0 1px, transparent 1px);
  background-size: 43px 43px, 61px 61px;
}
.page-hero .wrap { position: relative; }
.page-hero h1 { margin-bottom: 10px; }
.page-hero .lede { max-width: 68ch; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--brass-300); }
.breadcrumb .sep { color: var(--brass-800); }

/* --------------------------------------------------------------------------
   12. Hero carousel
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  height: 480px;
  border-radius: var(--r-cta);
  overflow: hidden;
  background: var(--coffee-950);
  border: 1px solid var(--line);
  box-shadow: var(--sh-md);
}
.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}
.hero-slide.is-active { opacity: 1; pointer-events: auto; }
.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg,
    #0F0A08 0%,
    rgba(31, 20, 16, 0.88) 46%,
    rgba(196, 149, 106, 0.18) 100%);
}
.hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 14px;
  padding: 40px clamp(22px, 5vw, 60px);
  max-width: 640px;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: rgba(184, 147, 90, 0.16);
  border: 1px solid var(--line-brass);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--brass-300);
}
.hero-content h1,
.hero-content h2 {
  font-size: clamp(1.95rem, 4.2vw, 2.9rem);
  color: var(--cream-100);
}
.hero-content p {
  color: var(--cream-300);
  font-size: 1.02rem;
  margin: 0;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }

.hero-dots {
  position: absolute;
  left: clamp(22px, 5vw, 60px);
  bottom: 24px;
  display: flex;
  gap: 9px;
  z-index: 3;
}
.hero-dot {
  width: 28px;
  height: 5px;
  border-radius: var(--r-pill);
  background: rgba(242, 232, 213, 0.34);
  transition: width var(--t-card), background var(--t-card), box-shadow var(--t-card);
}
.hero-dot.is-active {
  width: 44px;
  background: var(--leather-500);
  box-shadow: var(--glow-leather);
}
.hero-arrows {
  position: absolute;
  right: clamp(18px, 4vw, 40px);
  bottom: 20px;
  display: flex;
  gap: 8px;
  z-index: 3;
}
.hero-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(15, 10, 8, 0.6);
  border: 1px solid var(--line-brass);
  color: var(--cream-200);
  backdrop-filter: blur(8px);
  transition: background var(--t-fast), color var(--t-fast);
}
.hero-arrow:hover { background: var(--leather-500); color: var(--coffee-950); }
.hero-arrow svg { width: 16px; height: 16px; }

/* --------------------------------------------------------------------------
   13. Trust strip
   -------------------------------------------------------------------------- */

.trust-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  padding: 26px;
  border-radius: var(--r-card);
  background: var(--bg-alt);
  border: 1px dashed var(--stitch-strong);
}
.trust-item { display: flex; gap: 12px; align-items: flex-start; }
.trust-item .ti-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(184, 147, 90, 0.16);
  display: grid;
  place-items: center;
  color: var(--brass-400);
}
.trust-item .ti-icon svg { width: 19px; height: 19px; }
.trust-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.96rem;
  margin-bottom: 2px;
}
.trust-item span {
  display: block;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   14. Four-step flow
   -------------------------------------------------------------------------- */

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  counter-reset: step;
}
.step {
  position: relative;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.step-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-deep);
}
.step-media img { width: 100%; height: 100%; object-fit: cover; }
.step-num-lg {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--leather-500);
  color: var(--coffee-950);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--sh-sm);
}
.step-body-lg { padding: 16px 18px 18px; }
.step-body-lg h3 { font-size: 1.02rem; margin-bottom: 5px; }
.step-body-lg p {
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}
.step-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-500);
  margin-bottom: 6px;
}

/* --------------------------------------------------------------------------
   15. Studio preview band
   -------------------------------------------------------------------------- */

.studio-band {
  position: relative;
  border-radius: var(--r-cta);
  background: var(--surface-deep);
  border: 1px solid var(--line-brass);
  box-shadow: var(--sh-lg);
  overflow: hidden;
}
.studio-band-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 0;
}
.studio-band-canvas {
  position: relative;
  min-height: 380px;
  background: var(--surface-deep);
}
.studio-band-canvas canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.studio-band-side {
  padding: 30px 28px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.studio-band-side h2 { font-size: 1.5rem; }
.studio-band-side p {
  color: var(--text-muted);
  font-size: 0.94rem;
  margin: 0;
}
.studio-band-links {
  display: grid;
  gap: 8px;
  margin-top: auto;
}
.studio-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.studio-link:hover {
  border-color: var(--brass-500);
  background: var(--surface-2);
  transform: translateX(3px);
  color: var(--text);
}
.studio-link .sl-arrow { color: var(--brass-500); }

/* --------------------------------------------------------------------------
   16. CTA band
   -------------------------------------------------------------------------- */

.cta-band {
  position: relative;
  padding: 44px 40px;
  border-radius: var(--r-cta);
  background: linear-gradient(120deg, var(--leather-700), var(--leather-600));
  border: 2px dashed rgba(242, 232, 213, 0.28);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  flex-wrap: wrap;
}
.cta-band h2 { color: var(--cream-100); margin-bottom: 6px; }
.cta-band p {
  color: var(--cream-200);
  max-width: 56ch;
  margin: 0;
}
.cta-band-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   17. Tool detail page
   -------------------------------------------------------------------------- */

.split-wide {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}

.exhibit {
  border-radius: var(--r-card);
  background: var(--surface-deep);
  border: 1px dashed var(--stitch-strong);
  padding: 18px;
  margin-bottom: 16px;
}
.exhibit img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}
.exhibit-caption {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--stitch);
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.thumb-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.thumb {
  border-radius: var(--r-xs);
  background: var(--surface-deep);
  border: 1px solid var(--line);
  padding: 5px;
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.thumb img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}
.thumb:hover { border-color: var(--leather-550); }
.thumb.is-active {
  border-color: var(--brass-500);
  box-shadow: var(--glow-brass);
}

.spec-table {
  width: 100%;
  font-size: 0.86rem;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  overflow: hidden;
}
.spec-table caption {
  caption-side: top;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.96rem;
  padding: 0 0 8px;
  color: var(--text);
}
.spec-table th,
.spec-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.spec-table thead th {
  background: var(--surface-2);
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--brass-500);
}
.spec-table tbody tr:last-child th,
.spec-table tbody tr:last-child td { border-bottom: 0; }
.spec-table tbody th {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--text-muted);
  width: 46%;
}
.spec-table tbody td { color: var(--text); }
.spec-table.mono-all tbody td { font-family: var(--font-mono); font-size: 0.82rem; }

.detail-block { margin-bottom: 30px; }
.detail-block > h2 {
  font-size: 1.24rem;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--stitch);
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.tip-list { display: grid; gap: 10px; }
.tip-list li {
  position: relative;
  padding-left: 26px;
  font-size: 0.93rem;
  color: var(--text-muted);
}
.tip-list li::before {
  content: "\2307";
  position: absolute;
  left: 0;
  top: -1px;
  color: var(--brass-500);
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   18. Filter bar, results, pagination
   -------------------------------------------------------------------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  margin-bottom: 26px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px dashed var(--stitch-strong);
}
.filter-bar .fb-search {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
}
.filter-bar .fb-search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
}
.filter-bar .fb-search input:focus {
  outline: none;
  border-color: var(--brass-500);
  box-shadow: var(--glow-brass);
}
.filter-bar .fb-search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--brass-500);
  pointer-events: none;
}
.filter-bar select {
  height: 40px;
  padding: 0 32px 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--brass-500) 50%),
    linear-gradient(135deg, var(--brass-500) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.filter-bar select:focus {
  outline: none;
  border-color: var(--brass-500);
}
.filter-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-left: auto;
  white-space: nowrap;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  display: grid;
  place-items: center;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.page-btn:hover:not(:disabled) {
  border-color: var(--brass-500);
  color: var(--brass-300);
}
.page-btn.is-active {
  background: var(--leather-500);
  border-color: var(--leather-500);
  color: var(--coffee-950);
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   19. Calculator
   -------------------------------------------------------------------------- */

.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  align-items: start;
}

.calc-form {
  padding: 24px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--line);
}
.calc-form h2 { font-size: 1.14rem; margin-bottom: 16px; }
.calc-field { margin-bottom: 15px; }
.calc-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.calc-field .cf-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.calc-field input[type="number"],
.calc-field select {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  padding: 0 13px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.calc-field input[type="number"]:focus,
.calc-field select:focus {
  outline: none;
  border-color: var(--brass-500);
  box-shadow: var(--glow-brass);
}
.calc-field .cf-unit {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  min-width: 34px;
}

.calc-result {
  padding: 26px;
  border-radius: var(--r-card);
  background: linear-gradient(150deg, var(--leather-700), var(--leather-600));
  border: 1px solid var(--leather-550);
  box-shadow: var(--sh-md);
  position: sticky;
  top: calc(var(--toolbar-h) + 10px);
}
.calc-result .cr-label {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-200);
  margin-bottom: 4px;
}
.calc-headline {
  font-family: var(--font-mono);
  font-size: clamp(2.4rem, 6vw, 3.2rem);
  font-weight: 700;
  line-height: 1.05;
  color: var(--brass-200);
  margin-bottom: 4px;
  word-break: break-word;
}
.calc-headline-unit {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--cream-200);
  margin-bottom: 18px;
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.calc-cell {
  padding: 11px 13px;
  border-radius: var(--r-xs);
  background: rgba(15, 10, 8, 0.34);
  border: 1px solid rgba(242, 232, 213, 0.16);
}
.calc-cell .cc-label {
  display: block;
  font-size: 0.72rem;
  color: var(--cream-300);
  margin-bottom: 3px;
}
.calc-cell .cc-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--cream-100);
  word-break: break-word;
}
.calc-gauge {
  margin-top: 18px;
  height: 9px;
  border-radius: var(--r-pill);
  background: rgba(15, 10, 8, 0.4);
  overflow: hidden;
}
.calc-gauge-fill {
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  background: var(--brass-400);
  transition: width var(--t-card);
}
.calc-gauge-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--cream-300);
  margin-top: 6px;
}
.calc-formula {
  margin-top: 18px;
  padding: 13px 15px;
  border-radius: var(--r-xs);
  background: rgba(15, 10, 8, 0.34);
  border-left: 4px solid var(--brass-500);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--cream-200);
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   20. Database table
   -------------------------------------------------------------------------- */

.db-table-wrap {
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  overflow-x: auto;
  background: var(--surface);
}
.db-table {
  width: 100%;
  min-width: 760px;
  font-size: 0.88rem;
}
.db-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px 14px;
  text-align: left;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--brass-500);
  white-space: nowrap;
}
.db-table th[data-sort] { cursor: pointer; user-select: none; }
.db-table th[data-sort]:hover { color: var(--brass-300); }
.db-table th .sort-caret {
  display: inline-block;
  margin-left: 5px;
  color: var(--brass-800);
  font-size: 0.7rem;
}
.db-table th[aria-sort="ascending"] .sort-caret,
.db-table th[aria-sort="descending"] .sort-caret { color: var(--brass-400); }
.db-table tbody tr { border-bottom: 1px dashed var(--stitch); }
.db-table tbody tr:hover { background: var(--surface-2); }
.db-table td {
  padding: 12px 14px;
  vertical-align: top;
  color: var(--text-muted);
}
.db-table td:first-child { color: var(--text); font-weight: 600; }
.db-table .mono { font-family: var(--font-mono); font-size: 0.82rem; }
.db-detail td {
  background: var(--bg-alt);
  padding: 16px 14px;
  font-size: 0.87rem;
  line-height: 1.65;
  color: var(--text-muted);
}
.db-detail td strong { color: var(--text); }
.db-toggle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--brass-500);
  display: grid;
  place-items: center;
  transition: background var(--t-fast), transform var(--t-fast);
}
.db-toggle:hover { background: var(--surface-3); }
.db-toggle[aria-expanded="true"] { transform: rotate(90deg); }

.compare-tray {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 18px);
  z-index: 190;
  width: min(880px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--line-brass);
  box-shadow: var(--sh-lg);
  display: none;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.compare-tray.is-open { display: flex; }
.compare-tray .ct-items { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 auto; }
.compare-tray .ct-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  font-size: 0.8rem;
}
.compare-tray .ct-item button {
  color: var(--wine-300);
  font-size: 1rem;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   21. Notices, tips, legal, safety
   -------------------------------------------------------------------------- */

.notice {
  padding: 14px 17px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 1.1em;
}
.notice:last-child { margin-bottom: 0; }
.notice.safety {
  background: #2E1410;
  border-color: var(--wine-700);
  color: var(--wine-300);
}
.notice.info {
  background: #152530;
  border-color: #3A5A78;
  color: #A8C4D9;
}
.notice.warn {
  background: #2E2410;
  border-color: var(--brass-700);
  color: var(--brass-300);
}
.notice.neutral { background: var(--surface-2); color: var(--text-muted); }
.notice strong { color: inherit; }
.notice p:last-child { margin-bottom: 0; }

.tip-box {
  padding: 14px 18px;
  border-radius: var(--r-xs);
  border-left: 4px solid var(--brass-500);
  background: var(--surface-2);
  margin-bottom: 1.2em;
  font-size: 0.92rem;
}
.tip-box .tip-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass-500);
  margin-bottom: 5px;
}
.tip-box.warn { border-left-color: var(--wine-500); background: #2A1512; }
.tip-box.warn .tip-title { color: var(--wine-300); }
.tip-box.note { border-left-color: var(--info); background: #152530; }
.tip-box.note .tip-title { color: #A8C4D9; }
.tip-box.ok { border-left-color: var(--ok); background: #16261A; }
.tip-box.ok .tip-title { color: #A8CEA8; }
.tip-box p:last-child { margin-bottom: 0; }

.legal-note {
  padding: 15px 18px;
  border-radius: var(--r-xs);
  background: var(--bg-alt);
  border-left: 4px solid var(--leather-600);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-top: 28px;
}
.legal-note strong { color: var(--text); }

.safety-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  margin-bottom: 26px;
  border-radius: var(--r-xs);
  background: #2E1410;
  border: 1px solid var(--wine-700);
  color: var(--wine-300);
  font-size: 0.85rem;
}
.safety-strip .ss-icons { display: flex; gap: 10px; }
.safety-strip .ss-icons svg { width: 20px; height: 20px; }
.safety-strip .ss-text {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-state {
  padding: 44px 26px;
  border-radius: var(--r-card);
  border: 2px dashed var(--stitch-strong);
  text-align: center;
  color: var(--text-muted);
}
.empty-state h3 { margin-bottom: 6px; }

.grain-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-xs);
  border: 1px dashed var(--line-brass);
  background: var(--surface);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.grain-indicator .gi-lines {
  flex: 0 0 auto;
  width: 60px;
  height: 26px;
  border-radius: 3px;
  background-image: repeating-linear-gradient(
    90deg,
    var(--leather-550) 0 1px,
    transparent 1px 6px
  );
  opacity: 0.7;
}

.webgl-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.webgl-status .ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.webgl-status[data-state="loading"] { color: var(--text-dim); }
.webgl-status[data-state="ready"] { color: #8FBF8F; border-color: var(--ok-dark); }
.webgl-status[data-state="fallback"] { color: var(--brass-300); border-color: var(--brass-700); }
.webgl-status[data-state="error"] { color: var(--wine-300); border-color: var(--wine-700); }

/* --------------------------------------------------------------------------
   22. Studio (3D) page layout
   -------------------------------------------------------------------------- */

.studio-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}
.studio-stage {
  position: relative;
  border-radius: var(--r-card);
  background: var(--surface-deep);
  border: 1px solid var(--line-brass);
  overflow: hidden;
}
.studio-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.studio-toolbar .st-spacer { margin-left: auto; }
.studio-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 340px;
  background: var(--surface-deep);
}
.studio-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.studio-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 26px;
  background: var(--surface-deep);
}
.studio-overlay[hidden] { display: none; }
.studio-overlay .so-card { max-width: 420px; }
.studio-overlay h3 { margin-bottom: 8px; }
.studio-overlay p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.studio-progress {
  width: 190px;
  height: 6px;
  margin: 14px auto 0;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.studio-progress span {
  display: block;
  height: 100%;
  width: 20%;
  border-radius: var(--r-pill);
  background: var(--leather-500);
  transition: width var(--t-card);
}
.studio-hint {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--surface);
}

.studio-panel {
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 18px;
  position: sticky;
  top: calc(var(--toolbar-h) + 10px);
}
.studio-panel h2 {
  font-size: 1.02rem;
  margin-bottom: 14px;
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--stitch);
}
.studio-control { margin-bottom: 14px; }
.studio-control label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.studio-control output {
  color: var(--brass-400);
  font-weight: 700;
}
.studio-control input[type="range"] {
  width: 100%;
  height: 22px;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.studio-control input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
}
.studio-control input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
}
.studio-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 17px;
  height: 17px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--leather-500);
  border: 2px solid var(--coffee-900);
  box-shadow: var(--sh-xs);
}
.studio-control input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--leather-500);
  border: 2px solid var(--coffee-900);
}
.studio-control select {
  width: 100%;
  height: 38px;
  padding: 0 30px 0 12px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.87rem;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--brass-500) 50%),
    linear-gradient(135deg, var(--brass-500) 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.studio-readouts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 16px;
}
.readout {
  padding: 10px 12px;
  border-radius: var(--r-xs);
  background: var(--surface-deep);
  border: 1px dashed var(--line-strong);
}
.readout .ro-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 3px;
}
.readout .ro-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--brass-300);
  word-break: break-word;
}

.studio-steps {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.studio-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  border: 1px dashed var(--line-strong);
  font-size: 0.78rem;
  color: var(--text-dim);
  transition: all var(--t-fast);
}
.studio-step.is-done {
  border-style: solid;
  border-color: var(--ok-dark);
  background: rgba(90, 138, 90, 0.16);
  color: #A8CEA8;
}
.studio-step.is-active {
  border-style: solid;
  border-color: var(--brass-500);
  background: rgba(184, 147, 90, 0.16);
  color: var(--brass-300);
}

/* 2D fallback, shown when WebGL is unavailable or the reader opts out */
.studio-fallback {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  background: var(--surface-deep);
  overflow: auto;
}
.studio-fallback.is-shown { display: flex; }
.studio-fallback img {
  width: 100%;
  height: auto;
  flex: 0 0 auto;
}
.studio-fallback .sf-note {
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px dashed var(--stitch);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   23. Blog
   -------------------------------------------------------------------------- */

.featured-post {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-sm);
  margin-bottom: 34px;
  cursor: pointer;
  transition: transform var(--t-card), box-shadow var(--t-card), border-color var(--t-card);
  color: var(--text);
}
.featured-post:hover,
.featured-post:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--sh-lg);
  border-color: var(--leather-550);
  color: var(--text);
}
.featured-post .fp-media {
  background: var(--surface-deep);
  aspect-ratio: 16 / 10;
  min-height: 100%;
}
.featured-post .fp-media img { width: 100%; height: 100%; object-fit: cover; }
.featured-post .fp-body {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}
.featured-post h2 { font-size: 1.5rem; }

.post-hero {
  padding: 40px 0 30px;
  background: var(--bg-alt);
  border-bottom: 3px solid var(--leather-600);
  margin-bottom: 32px;
}
.post-hero .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.post-hero h1 { max-width: 24ch; margin-bottom: 12px; }
.post-hero .lede { max-width: 70ch; }

.split-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 38px;
  align-items: start;
}

.post-aside {
  position: sticky;
  top: calc(var(--toolbar-h) + 10px);
  display: grid;
  gap: 20px;
}
.aside-card {
  padding: 18px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--line);
}
.aside-card h2 {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-500);
  margin-bottom: 12px;
}

.toc ol { counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: block;
  padding: 6px 0 6px 26px;
  position: relative;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-bottom: 1px dashed var(--stitch);
}
.toc li:last-child a { border-bottom: 0; }
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--brass-800);
}
.toc a:hover { color: var(--brass-300); }
.toc a.is-current { color: var(--brass-300); font-weight: 600; }

.author-box {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}
.author-box .ab-avatar {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--leather-600);
  color: var(--coffee-950);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}
.author-box strong { display: block; font-family: var(--font-display); }
.author-box span { display: block; font-size: 0.82rem; color: var(--text-muted); }

.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 40px;
  padding-top: 26px;
  border-top: 1px dashed var(--stitch);
}
.post-nav a {
  padding: 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.post-nav a:hover { border-color: var(--leather-550); transform: translateY(-3px); }
.post-nav .pn-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-500);
  margin-bottom: 5px;
}
.post-nav .pn-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.35;
  color: var(--text);
}
.post-nav .pn-next { text-align: right; }

.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 250;
  background: var(--brass-500);
  box-shadow: var(--glow-brass);
  transition: width 0.1s linear;
}

.to-top {
  position: fixed;
  right: 20px;
  bottom: calc(var(--tabbar-h) + 20px);
  z-index: 190;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line-brass);
  color: var(--brass-400);
  display: grid;
  place-items: center;
  box-shadow: var(--sh-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-card), visibility var(--t-card), background var(--t-fast);
}
.to-top.is-shown { opacity: 1; visibility: visible; }
.to-top:hover { background: var(--leather-500); color: var(--coffee-950); }
.to-top svg { width: 19px; height: 19px; }

/* Prose rhythm inside articles */
.prose { font-size: 1.02rem; }
.prose h3 {
  margin: 2em 0 0.6em;
  font-size: 1.22rem;
}
.prose h3:first-child { margin-top: 0; }
.prose h4 { margin: 1.4em 0 0.5em; }
.prose ul, .prose ol { margin-bottom: 1.1em; }
.prose blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 20px;
  border-left: 4px solid var(--leather-600);
  font-family: var(--font-display);
  font-size: 1.06rem;
  color: var(--text-muted);
}

.key-list { display: grid; gap: 8px; }
.key-list li {
  position: relative;
  padding-left: 24px;
  color: var(--text-muted);
}
.key-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.66em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--leather-550);
}
.key-list li strong { color: var(--text); }

.step-list { counter-reset: sl; display: grid; gap: 10px; }
.step-list li {
  counter-increment: sl;
  position: relative;
  padding-left: 32px;
  color: var(--text-muted);
}
.step-list li::before {
  content: counter(sl);
  position: absolute;
  left: 0;
  top: 2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--leather-700);
  color: var(--leather-200);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  display: grid;
  place-items: center;
}

.step-block {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin: 1.5em 0;
}
.step-block .step-num {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--leather-600);
  color: var(--coffee-950);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.24rem;
  font-weight: 700;
  box-shadow: var(--sh-sm);
}
.step-block .step-body { flex: 1 1 auto; min-width: 0; }
.step-block .step-body h4 {
  margin: 0 0 6px;
  font-size: 1.04rem;
  padding-top: 8px;
}

.figure { margin: 1.8em 0; }
.figure img {
  width: 100%;
  height: auto;
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: var(--surface-deep);
}
.figure figcaption {
  margin-top: 9px;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.55;
}

.spec-table + * { margin-top: 1.2em; }

/* --------------------------------------------------------------------------
   24. Content pages and forms
   -------------------------------------------------------------------------- */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}
.prose-block {
  padding: 24px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--line);
}
.prose-block h2 { font-size: 1.24rem; margin-bottom: 10px; }

.form-card {
  padding: 26px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--line);
}
.form-field { margin-bottom: 16px; }
.form-field label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-field label .req { color: var(--wine-400); }
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.92rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-field textarea { min-height: 140px; resize: vertical; }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--brass-500);
  box-shadow: var(--glow-brass);
}
.form-field.has-error input,
.form-field.has-error select,
.form-field.has-error textarea {
  border-color: var(--wine-500);
}
.field-error {
  display: none;
  margin-top: 5px;
  font-size: 0.79rem;
  color: var(--wine-300);
}
.form-field.has-error .field-error { display: block; }
.form-status {
  margin-top: 16px;
  padding: 13px 16px;
  border-radius: var(--r-xs);
  border-left: 4px solid var(--ok);
  background: #16261A;
  color: #A8CEA8;
  font-size: 0.9rem;
  display: none;
}
.form-status.is-shown { display: block; }
.form-status.is-error {
  border-left-color: var(--wine-500);
  background: #2A1512;
  color: var(--wine-300);
}
.check-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.check-row input { margin-top: 5px; flex: 0 0 auto; width: auto; }

/* --------------------------------------------------------------------------
   25. Footer
   -------------------------------------------------------------------------- */

.footer {
  margin-top: 60px;
  padding: 50px 0 26px;
  background: var(--coffee-950);
  border-top: 3px solid var(--leather-700);
  color: var(--cream-300);
}
html[data-theme="light"] .footer {
  background: var(--surface-2);
  color: var(--text-muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
  gap: 34px;
  margin-bottom: 34px;
}
.footer h2 {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--brass-500);
  margin-bottom: 14px;
}
.footer p { font-size: 0.87rem; line-height: 1.65; }
.footer a { color: var(--cream-300); font-size: 0.88rem; }
html[data-theme="light"] .footer a { color: var(--text-muted); }
.footer a:hover { color: var(--brass-300); }
.footer-links { display: grid; gap: 9px; }
.footer-brand .brand-name { color: var(--cream-100); }
html[data-theme="light"] .footer-brand .brand-name { color: var(--text); }
.footer-social {
  display: flex;
  gap: 9px;
  margin: 14px 0;
}
.footer-social a {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: var(--cream-400);
}
.footer-social a:hover { border-color: var(--brass-500); color: var(--brass-300); }
.footer-social svg { width: 16px; height: 16px; }
.footer-version {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--cream-500);
}
.subscribe-form { display: flex; gap: 8px; margin-top: 12px; }
.subscribe-form input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--coffee-900);
  color: var(--cream-100);
  font-size: 0.86rem;
}
html[data-theme="light"] .subscribe-form input {
  background: var(--surface);
  color: var(--text);
}
.subscribe-form input::placeholder { color: var(--cream-500); }
.subscribe-form input:focus {
  outline: none;
  border-color: var(--brass-500);
}

.footer-disclaimer {
  padding: 22px 24px;
  border-radius: var(--r-card);
  border: 1px solid var(--leather-700);
  background: rgba(92, 58, 32, 0.16);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}
html[data-theme="light"] .footer-disclaimer {
  background: var(--surface);
  border-color: var(--line-strong);
}
.footer-disclaimer .fd-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--leather-700);
  display: grid;
  place-items: center;
  color: var(--leather-200);
}
.footer-disclaimer .fd-icon svg { width: 21px; height: 21px; }
.footer-disclaimer h2 { margin-bottom: 7px; }
.footer-disclaimer p { font-size: 0.85rem; line-height: 1.7; }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px dashed var(--stitch);
  font-size: 0.82rem;
}
.footer-bottom .fb-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-bottom .fb-links a { font-size: 0.82rem; }

/* --------------------------------------------------------------------------
   26. Search results
   -------------------------------------------------------------------------- */

.search-hero { padding: 36px 0 26px; }
.search-big {
  position: relative;
  max-width: 620px;
  margin-top: 16px;
}
.search-big input {
  width: 100%;
  height: 54px;
  padding: 0 18px 0 48px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 1.02rem;
}
.search-big input:focus {
  outline: none;
  border-color: var(--brass-500);
  box-shadow: var(--glow-brass);
}
.search-big svg {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  width: 19px;
  height: 19px;
  color: var(--brass-500);
  pointer-events: none;
}
.result-group { margin-bottom: 34px; }
.result-group h2 {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--brass-500);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--stitch);
}
.result-list { display: grid; gap: 10px; }
.result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color var(--t-fast), transform var(--t-fast), background var(--t-fast);
}
.result-item:hover {
  border-color: var(--leather-550);
  transform: translateX(4px);
  background: var(--surface-2);
}
.result-item .ri-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  color: var(--leather-400);
}
.result-item .ri-icon svg { width: 19px; height: 19px; }
.result-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text);
}
.result-item span {
  display: block;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.result-item .ri-kind {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--brass-800);
}

/* --------------------------------------------------------------------------
   27. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trust-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .topbar { max-width: calc(100% - 24px); }
  .search-form { max-width: 170px; }
  .search-form:focus-within { max-width: 220px; }
  .studio-shell { grid-template-columns: minmax(0, 1fr); }
  .studio-panel { position: static; }
  .split-side { grid-template-columns: minmax(0, 1fr); }
  .post-aside { position: static; }
  .calc-result { position: static; }
}

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .burger { display: grid; }
  .topbar-search { display: none; }
  .topbar-search.is-expanded {
    display: flex;
    position: absolute;
    left: 8px;
    right: 8px;
    top: 4px;
    background: var(--surface);
    border-radius: var(--r-pill);
    padding: 4px;
    z-index: 5;
  }
  .topbar-search.is-expanded .search-form { max-width: none; }
  .topbar-search.is-expanded .search-form input { background: var(--surface-2); }
  .split-wide { grid-template-columns: minmax(0, 1fr); }
  .studio-band-grid { grid-template-columns: minmax(0, 1fr); }
  .studio-band-side { border-left: 0; border-top: 1px solid var(--line); }
  .featured-post { grid-template-columns: minmax(0, 1fr); }
  .calc-layout { grid-template-columns: minmax(0, 1fr); }
  .cta-band { padding: 32px 26px; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }

  body { padding-bottom: calc(var(--tabbar-h) + 12px); }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .trust-strip { grid-template-columns: minmax(0, 1fr); padding: 20px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 26px; }

  .hero { height: 460px; }
  .hero-content { padding: 26px 20px; }
  .hero-arrows { display: none; }

  .tabbar { max-width: calc(100% - 24px); }
  .tabbar-inner { padding: 0 4px; }
  .tab-label { display: none; }
  .tab { padding: 8px 6px; }

  .tab-panel { bottom: calc(var(--tabbar-h) + 14px); }
  .tab-panel-list { grid-template-columns: minmax(0, 1fr); }

  .thumb-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-nav { grid-template-columns: minmax(0, 1fr); }
  .post-nav .pn-next { text-align: left; }
  .calc-grid { grid-template-columns: minmax(0, 1fr); }
  .studio-readouts { grid-template-columns: minmax(0, 1fr); }

  .step-block { gap: 12px; }
  .step-block .step-num { width: 42px; height: 42px; font-size: 1.05rem; }

  .filter-count { margin-left: 0; width: 100%; }
  .to-top { right: 12px; bottom: calc(var(--tabbar-h) + 14px); }

  .cta-band { flex-direction: column; align-items: flex-start; }
  .section-head { flex-direction: column; align-items: flex-start; }
}

/* --------------------------------------------------------------------------
   28. Motion preferences and print
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .card:hover,
  .card:focus-visible,
  .featured-post:hover,
  .featured-post:focus-visible { transform: none; }
  .card:hover .card-media img { transform: none; }
  .hero-slide { transition: none; }
}

@media print {
  .topbar, .tabbar, .scrim, .drawer, .to-top, .read-progress,
  .compare-tray, .tab-panel, .hero-arrows, .hero-dots { display: none !important; }
  body { padding: 0; background: #FFF; color: #000; }
  body::before { display: none; }
  .card, .page-hero, .post-hero { box-shadow: none; border-color: #CCC; }
}
