/* =================================================================
   BetterReviews Brand Guideline · Site chrome
   Imports the brand tokens, then layers the guideline-specific shell.
   ================================================================= */

@import url('./colors_and_type.css');

/* Brand direction: pure-black ink surface (no warm-brown).
   Each step ABOVE --br-ink must be lighter, so inner cards stay visible. */
:root {
  --br-ink:   #050810;
  --br-ink-2: #1F1B17;
  --br-ink-3: #2C2823;
  --br-ink-line: rgba(240, 239, 235, 0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  background: var(--br-paper);
  color: var(--br-ink);
  font-family: var(--br-font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  font-family: var(--br-font-sans);
  font-weight: 500;
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--br-ink);
  background: var(--br-paper);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* Film grain · subtle texture, overlay blend on all pages */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
@media (hover: none) { .grain { display: none; } }

/* =================================================================
   Page shell · TopMark + Sidebar + Content
   ================================================================= */

.shell {
  display: grid;
  grid-template-columns: 288px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ---------- TopMark · slim header above the grid ---------- */

.topmark {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px 14px 32px;
  border-bottom: 1px solid var(--br-rule);
  background: var(--br-paper);
  position: sticky; top: 0; z-index: 20;
}

.topmark-left, .topmark-right {
  display: flex; align-items: center; gap: 18px;
}
.topmark-meta {
  font-family: var(--br-font-chrome);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--br-paper-text-3);
  font-feature-settings: 'tnum', 'cpsp';
}
.topmark-meta b {
  color: var(--br-ink); font-weight: 500;
}

/* ---------- Sidebar ---------- */

.sidebar {
  border-right: 1px solid var(--br-rule);
  padding: 36px 28px 64px 32px;
  position: sticky; top: 53px;
  height: calc(100vh - 53px);
  overflow-y: auto;
  background: var(--br-paper);
}

.side-group {
  margin-bottom: 28px;
}
.side-group-label {
  font-family: var(--br-font-chrome);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--br-paper-text-4);
  margin-bottom: 10px;
  display: flex; align-items: baseline; gap: 8px;
}
.side-group-label .num {
  color: var(--br-clay);
  font-feature-settings: 'tnum';
}

.side-link {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  font-family: var(--br-font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--br-paper-text-2);
  border-bottom: 1px solid transparent;
  transition: color 0.4s var(--ease-silk);
  cursor: pointer;
}
.side-link:hover { color: var(--br-ink); }
.side-link.active { color: var(--br-ink); font-weight: 600; }
.side-link .num {
  font-family: var(--br-font-chrome);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--br-paper-text-4);
  min-width: 22px;
  font-feature-settings: 'tnum';
}
.side-link.active .num { color: var(--br-clay); }

/* ---------- Main column ---------- */

.main {
  padding: 0;
  min-width: 0;
  position: relative;
}

/* =================================================================
   Editorial primitives · used across every page
   ================================================================= */

/* Section wrapper, single column reading width */
.section {
  padding: 56px 64px 72px 64px;
  max-width: 1280px;
  border-bottom: 1px solid var(--br-rule);
}
.section:last-of-type { border-bottom: none; }
.section.tight   { padding: 40px 64px 48px; }
.section.anchor  { padding: var(--pad-section-anchor) 64px; }

@media (max-width: 760px) {
  .section { padding: 40px 24px 48px; }
}

/* Kicker · section number + label */
.kicker {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--br-font-chrome);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--br-paper-text-3);
  margin-bottom: 28px;
  font-feature-settings: 'tnum', 'cpsp';
}
.kicker .roman {
  color: var(--br-clay);
}
.kicker::before {
  content: ""; display: inline-block;
  width: 32px; height: 1px;
  background: var(--br-paper-text-4);
}

/* Page header · big title + lede */
.page-head {
  padding: 88px 64px 64px 64px;
  border-bottom: 1px solid var(--br-rule);
}
.page-head h1 {
  font-family: var(--br-font-display);
  font-weight: 500;
  font-size: var(--t-h1);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-variation-settings: 'opsz' 96;
  text-wrap: balance;
  color: var(--br-ink);
  margin: 0 0 24px 0;
  max-width: 22ch;
}
.page-head .lede {
  max-width: 60ch;
  color: var(--br-paper-text-2);
  margin: 0;
}
.page-head .meta {
  display: flex; gap: 24px; flex-wrap: wrap;
  margin-top: 40px;
  font-family: var(--br-font-chrome);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--br-paper-text-3);
  font-feature-settings: 'tnum', 'cpsp';
}
.page-head .meta b { color: var(--br-ink); font-weight: 500; }

@media (max-width: 760px) {
  .page-head { padding: 56px 24px 40px; }
}

/* H2 · section heads */
h2.h {
  font-family: var(--br-font-display);
  font-weight: 500;
  font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-variation-settings: 'opsz' 96;
  text-wrap: balance;
  color: var(--br-ink);
  margin: 0 0 16px 0;
}

/* H3 · sub heads */
h3.sub {
  font-family: var(--br-font-display);
  font-weight: 600;
  font-size: clamp(1.125rem, 0.95rem + 0.7vw, 1.5rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 36;
  color: var(--br-ink);
  margin: 0 0 12px 0;
}

/* Body paragraphs */
.p {
  font-family: var(--br-font-sans);
  font-weight: 500;
  font-size: var(--t-base);
  line-height: 1.6;
  letter-spacing: -0.005em;
  color: var(--br-paper-text-2);
  max-width: 64ch;
  margin: 0 0 18px 0;
  text-wrap: pretty;
}
.p:last-child { margin-bottom: 0; }

.p-serif {
  font-family: var(--br-font-display);
  font-weight: 400;
  font-size: var(--t-base-lg);
  line-height: 1.7;
  letter-spacing: -0.005em;
  font-variation-settings: 'opsz' 9;
  color: var(--br-ink);
  max-width: 64ch;
  margin: 0 0 18px 0;
  text-wrap: pretty;
}

/* Inline accent · clay */
.clay { color: var(--br-clay); font-weight: 700; }
.surface-ink .clay { color: var(--br-clay); font-weight: 600; }

/* Smallcaps token label */
.tok {
  font-family: var(--br-font-chrome);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--br-paper-text-3);
  font-feature-settings: 'tnum', 'cpsp';
}
.surface-ink .tok { color: var(--br-ink-text-3); }

/* Card · paper-on-paper, hairline, no rounded by default */
.card {
  background: var(--br-paper);
  border: 1px solid var(--br-rule);
  padding: 24px;
  position: relative;
}
.card.elev { box-shadow: var(--sh-card); }

/* Two-column / grid helpers */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--br-rule); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--br-rule); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--br-rule); }
.grid-2 > *, .grid-3 > *, .grid-4 > * { background: var(--br-paper); padding: 20px; }
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Do / Don't */
.do-dont { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--br-rule); }
.do-dont > div { padding: 28px; background: var(--br-paper); position: relative; }
.do-dont .do::before,
.do-dont .dont::before {
  content: "DO"; position: absolute; top: 16px; right: 20px;
  font-family: var(--br-font-chrome);
  font-size: 10px; font-weight: 600; letter-spacing: 0.28em;
  color: var(--br-moss);
}
.do-dont .dont::before { content: "DON'T"; color: var(--br-clay); }
@media (max-width: 760px) { .do-dont { grid-template-columns: 1fr; } }

/* Ink surface */
.surface-ink {
  background: var(--br-ink);
  color: var(--br-paper);
}
.surface-ink h2.h, .surface-ink h3.sub { color: var(--br-paper); }
.surface-ink .p { color: var(--br-ink-text-2); }
.surface-ink .p-serif { color: var(--br-paper); }
.surface-ink .card {
  background: var(--br-ink-2);
  border-color: var(--br-ink-line);
}

/* Peacock drenched band */
.surface-peacock {
  background: var(--br-peacock);
  color: var(--br-paper);
}
.surface-peacock h2.h, .surface-peacock h3.sub { color: var(--br-paper); }

/* =================================================================
   Wordmark · stacked lockup
   ================================================================= */

.wordmark {
  display: inline-block;
  font-size: 56px;
  line-height: 1;
}
.wordmark > span { display: block; }
:root {
  --wm-top-size: 0.47em;
  --wm-top-tuck: -0.63em;
}

.wordmark .top {
  font-family: var(--br-font-sans);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--br-grey);
  font-size: var(--wm-top-size);
  line-height: 0.7;
  padding-left: 0.04em;
  margin-bottom: var(--wm-top-tuck);
}
.wordmark .bot {
  font-family: var(--br-font-display);
  font-weight: 900;
  font-variation-settings: 'opsz' 144;
  letter-spacing: -0.005em;
  color: var(--br-ink);
  line-height: 0.92;
}
.wordmark .bot .accent { color: var(--br-clay); }
.surface-ink .wordmark .top { color: rgba(240, 239, 235, 0.55); }
.surface-ink .wordmark .bot { color: var(--br-paper); }

/* Brand mark, typed prose form · “BetterReviews” · the only acceptable
   inline form when the stacked wordmark cannot be used. Never lowercase. */
.brand-typed {
  font-family: var(--br-font-display);
  font-weight: 600;
  font-variation-settings: 'opsz' 36;
  letter-spacing: -0.015em;
  color: var(--br-ink);
  font-size: 18px;
  line-height: 1;
}
.brand-typed .accent { color: var(--br-clay); }
.surface-ink .brand-typed { color: var(--br-paper); }
.surface-ink .brand-typed .accent { color: var(--br-clay); }

/* Monogram */
.monogram {
  font-family: var(--br-font-display);
  font-weight: 900;
  font-variation-settings: 'opsz' 144;
  letter-spacing: -0.12em;
  line-height: 0.85;
  color: var(--br-ink);
}
.monogram .accent { color: var(--br-clay); }
.surface-ink .monogram { color: var(--br-paper); }

/* =================================================================
   Pill button (BR canonical)
   ================================================================= */

.btn-pill {
  display: inline-flex; align-items: center; gap: 0.85em;
  font-family: var(--br-font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--br-ink);
  background: transparent;
  border: 1px solid var(--br-paper-line);
  border-radius: 999px;
  padding: 14px 22px;
  min-height: 44px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.4s var(--ease-silk),
              background-color 0.4s var(--ease-silk),
              border-color 0.4s var(--ease-silk);
}
.btn-pill:hover { background: var(--br-ink); color: var(--br-paper); border-color: var(--br-ink); }
.btn-pill:hover .arrow { transform: translateX(4px); }
.btn-pill .arrow { display: inline-block; transition: transform 0.4s var(--ease-silk); }
.surface-ink .btn-pill { color: var(--br-paper); border-color: var(--br-ink-line); }
.surface-ink .btn-pill:hover { background: var(--br-paper); color: var(--br-ink); border-color: var(--br-paper); }

/* =================================================================
   Tweaks panel
   ================================================================= */

#tweaks {
  position: fixed; right: 24px; bottom: 24px; z-index: 100;
  width: 320px;
  background: var(--br-paper);
  border: 1px solid var(--br-ink);
  box-shadow: var(--sh-soft);
  padding: 20px 22px 22px;
  font-family: var(--br-font-sans);
  display: none;
}
#tweaks.open { display: block; }
#tweaks h4 {
  font-family: var(--br-font-chrome);
  font-size: 10px; font-weight: 600; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--br-ink);
  margin: 0 0 14px 0;
  display: flex; justify-content: space-between; align-items: center;
}
#tweaks h4 button {
  background: none; border: 0; color: var(--br-paper-text-3); cursor: pointer;
  font-family: inherit; font-size: 14px; padding: 0 4px;
}
#tweaks .row-t {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--br-rule);
}
#tweaks .row-t:first-of-type { border-top: 0; padding-top: 4px; }
#tweaks label {
  font-family: var(--br-font-chrome);
  font-size: 10px; font-weight: 500; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--br-paper-text-3);
}
#tweaks .swatches { display: flex; gap: 6px; }
#tweaks .sw {
  width: 22px; height: 22px; border: 1px solid var(--br-paper-line);
  cursor: pointer; border-radius: 999px;
}
#tweaks .sw.active { outline: 1px solid var(--br-ink); outline-offset: 2px; }
#tweaks .seg {
  display: flex; border: 1px solid var(--br-rule); border-radius: 999px; overflow: hidden;
}
#tweaks .seg button {
  background: transparent; border: 0;
  font-family: var(--br-font-chrome); font-size: 10px; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase;
  padding: 6px 10px; cursor: pointer; color: var(--br-paper-text-3);
}
#tweaks .seg button.active { background: var(--br-ink); color: var(--br-paper); }

#tweaks input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 140px; height: 2px; background: var(--br-rule);
  outline: none; cursor: pointer; margin: 0;
}
#tweaks input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 999px;
  background: var(--br-ink); cursor: pointer; border: 0;
}
#tweaks input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 999px;
  background: var(--br-ink); cursor: pointer; border: 0;
}
#tweaks .slider-val {
  font-family: var(--br-font-chrome);
  font-size: 10px; font-weight: 500; letter-spacing: 0.18em;
  color: var(--br-paper-text-3);
  font-feature-settings: 'tnum';
  min-width: 36px; text-align: right;
}

#tweaks-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 99;
  width: 48px; height: 48px;
  background: var(--br-ink); color: var(--br-paper);
  border: 0; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--sh-card);
  font-family: var(--br-font-display); font-size: 18px; font-weight: 900;
}
#tweaks-fab.hidden { display: none; }

/* =================================================================
   Density modes (applied via [data-density] on <html>)
   ================================================================= */

html[data-density="compact"]     { --section-pad-multiplier: 0.7; }
html[data-density="comfortable"] { --section-pad-multiplier: 1; }
html[data-density="airy"]        { --section-pad-multiplier: 1.4; }

html[data-density="compact"]     .section { padding-block: calc(56px * 0.7); }
html[data-density="airy"]        .section { padding-block: calc(56px * 1.4); }
html[data-density="compact"]     .page-head { padding-block: calc(88px * 0.7) calc(64px * 0.7); }
html[data-density="airy"]        .page-head { padding-block: calc(88px * 1.4) calc(64px * 1.4); }

/* =================================================================
   Motion off (applied via [data-motion="off"] on <html>)
   ================================================================= */

html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
}

/* =================================================================
   In-page section progress · thin clay bar at top of main column
   ================================================================= */

.progress-rail {
  position: fixed;
  top: 53px; left: 288px; right: 0;
  height: 2px;
  background: var(--br-rule);
  z-index: 15;
  pointer-events: none;
}
.progress-rail .fill {
  height: 100%;
  background: var(--br-clay);
  width: 0;
  transition: width 0.2s linear;
  transform-origin: left;
}
@media (max-width: 900px) {
  .progress-rail { left: 0; }
}

/* =================================================================
   Mobile pass · 760px and below get a different shell entirely
   ================================================================= */

/* Show / hide the hamburger toggle by viewport */
#nav-toggle { display: none; }
@media (max-width: 900px) {
  #nav-toggle {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: transparent; border: 0; padding: 0;
    color: var(--br-ink); cursor: pointer;
    margin-right: -8px;
  }
  #nav-toggle svg { width: 22px; height: 22px; }
  .topmark { padding: 14px 20px 12px 20px; gap: 12px; }
  .topmark-left .topmark-meta { display: none; }  /* keep the chapter chrome but drop the long meta */
  .topmark-right .topmark-meta { font-size: 9px; letter-spacing: 0.18em; max-width: 28ch; text-align: right; }
}
@media (max-width: 480px) {
  .topmark-right .topmark-meta { display: none; }  /* below 480, only wordmark + hamburger */
}

/* Mobile drawer · sidebar slides in from the left as a sheet */
@media (max-width: 900px) {
  .sidebar {
    display: block !important;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(320px, 86vw);
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.4s var(--ease-silk);
    box-shadow: var(--sh-deep);
    padding: 32px 24px 64px 28px;
    overflow-y: auto;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  /* .shell (z-index:1) is a stacking context that would otherwise trap the
     fixed sidebar beneath the backdrop; drop it while the drawer is open. */
  body.nav-open .shell { z-index: auto; }
  /* Backdrop */
  body.nav-open::before {
    content: ""; position: fixed; inset: 0; z-index: 40;
    background: rgba(11, 16, 24, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  body.nav-open { overflow: hidden; }
}

/* Section / page-head padding tightens further on small screens */
@media (max-width: 600px) {
  .section { padding: 32px 20px 36px; }
  .section.anchor { padding: clamp(56px, 11vh, 96px) 20px; }
  .page-head { padding: 40px 20px 28px; }
  .page-head h1 { font-size: clamp(2rem, 1.4rem + 4vw, 3.25rem); margin-bottom: 18px; }
  .page-head .lede { font-size: 16px; line-height: 1.5; }
  .page-head .meta { gap: 14px 18px; margin-top: 24px; font-size: 10px; letter-spacing: 0.16em; }
}

/* Editorial grids · staged collapse 4 → 2 → 1 instead of jump-cut */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Inline 3-up / 4-up grids declared via style= on individual sections */
@media (max-width: 900px) {
  [style*="grid-template-columns: repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 760px) {
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: 1fr 1fr 1fr"] { grid-template-columns: repeat(2, 1fr) !important; }
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}
@media (max-width: 520px) {
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns: repeat(8"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns: repeat(6"] { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Mobile: TOC rows on cover index, library rows, journal index · single column */
@media (max-width: 600px) {
  .toc-row:nth-child(odd) { border-right: 0 !important; padding-right: 0 !important; }
  .toc-row { padding-right: 0 !important; }
}

/* Wordmark large-font specimens reduce on mobile */
@media (max-width: 600px) {
  .wordmark[style*="font-size: 144px"],
  .wordmark[style*="font-size: 120px"] { font-size: 64px !important; }
  .wordmark[style*="font-size: 96px"]  { font-size: 56px !important; }
  .wordmark[style*="font-size: 80px"]  { font-size: 48px !important; }
  .monogram[style*="font-size: 144px"],
  .monogram[style*="font-size: 120px"] { font-size: 80px !important; }
}

/* Magritte frame eats too much padding on tiny screens */
@media (max-width: 600px) {
  [style*="padding: 36px"][style*="sh-frame"],
  .art-figure .frame { padding: 22px !important; }
  [style*="padding: 80px 64px"] { padding: 40px 24px !important; }
  [style*="padding: 96px"] { padding: 48px 24px !important; }
  [style*="padding: 48px"] { padding: 28px 20px !important; }
  [style*="padding: 64px"] { padding: 32px 20px !important; }
}

/* Component galleries with row layouts */
@media (max-width: 760px) {
  /* Data tables get horizontal scroll on mobile */
  table { font-size: 13px; }
  table th, table td { padding: 12px 14px !important; }
}

/* Tweaks panel · bottom-sheet on mobile */
@media (max-width: 600px) {
  #tweaks {
    right: 0; left: 0; bottom: 0;
    width: auto; max-width: 100vw;
    border-radius: 16px 16px 0 0;
    border: 0; border-top: 1px solid var(--br-ink);
    padding: 18px 22px 28px;
    max-height: 80vh;
    overflow-y: auto;
  }
  #tweaks::before {
    content: ""; display: block;
    width: 36px; height: 3px; border-radius: 999px;
    background: var(--br-rule);
    margin: 0 auto 14px;
  }
  #tweaks .swatches { gap: 10px; }
  #tweaks .sw { width: 28px; height: 28px; }   /* hit-target floor */
  #tweaks input[type="range"] { width: 100%; }
  #tweaks .seg button { padding: 10px 14px; font-size: 11px; }
  #tweaks-fab { right: 16px; bottom: 16px; }
}

/* Hit-target minimums on small screens */
@media (max-width: 760px) {
  .side-link { padding: 12px 4px; }
  .toc-row { padding: 18px 16px 18px 0; }
  .btn-pill { min-height: 48px; padding: 14px 22px; }
}

/* Sidebar progress rail on mobile sits below sticky topmark */
@media (max-width: 900px) {
  .progress-rail { top: 49px; }
}

/* Pull quotes, drop caps, large display in long-form mobile */
@media (max-width: 600px) {
  .art-pull { font-size: clamp(1.25rem, 1rem + 2.4vw, 1.75rem) !important; padding: 24px 0 !important; margin: 36px 0 !important; }
  .art-figure { margin: 32px 0 !important; }
  .art-toc ol { grid-template-columns: 1fr !important; }
  .art-byline { flex-wrap: wrap; gap: 12px; }
  .art-byline .meta { width: 100%; justify-content: flex-start; }
  .art-h1 { font-size: clamp(2rem, 1.4rem + 4vw, 2.75rem) !important; }
}

/* Misuse galleries · tighten labels on mobile */
@media (max-width: 480px) {
  .mis::before { font-size: 9px; letter-spacing: 0.2em; top: 10px; right: 12px; }
  .mis .label { font-size: 16px; }
}

/* When viewport is super narrow, the float CTA mock breaks; constrain it */
@media (max-width: 600px) {
  [style*="transform: translateX(-50%)"][style*="position: absolute; bottom"] {
    left: 16px !important; right: 16px !important; bottom: 16px !important;
    transform: none !important; flex-wrap: wrap; gap: 10px !important;
  }
}

/* Print stylesheet trumps mobile rules · keep at the end */

@page {
  size: A4;
  margin: 22mm 18mm 24mm 18mm;
}

@media print {
  html, body {
    background: #ffffff !important;
    color: #1a1a1a !important;
    font-size: 10.5pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Strip chrome */
  .topmark,
  .sidebar,
  .grain,
  #tweaks, #tweaks-fab,
  .progress-rail {
    display: none !important;
  }
  .shell { display: block !important; }
  .main  { padding: 0 !important; }

  /* Page numbering + brand mark on every page */
  @page {
    @bottom-left {
      content: "BetterReviews · Brand Guideline · v1.0";
      font-family: 'Euclid Flex', sans-serif;
      font-size: 7pt;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: #6B6B6B;
    }
    @bottom-right {
      content: "· " counter(page) " ·";
      font-family: 'Euclid Flex', sans-serif;
      font-size: 7pt;
      letter-spacing: 0.18em;
      color: #6B6B6B;
    }
  }

  /* Each chapter starts on a fresh page */
  .page-head {
    page-break-before: always;
    padding: 0 0 24pt 0 !important;
    border-bottom: 1pt solid #B3AAA0;
  }
  .page-head h1 {
    font-size: 36pt; line-height: 1; margin-bottom: 12pt; color: #1a1a1a !important;
  }
  .page-head .lede { font-size: 11pt; color: #2a2a2a !important; max-width: none; }

  .section {
    page-break-inside: avoid;
    padding: 18pt 0 !important;
    max-width: none !important;
    border-color: #B3AAA0 !important;
  }

  /* Headings */
  h2.h { font-size: 20pt; line-height: 1.1; color: #1a1a1a !important; margin-bottom: 8pt; }
  h3.sub { font-size: 13pt; line-height: 1.2; color: #1a1a1a !important; margin-bottom: 6pt; }
  .p, .p-serif { font-size: 10.5pt; line-height: 1.55; color: #2a2a2a !important; max-width: none; }

  /* Ink-on-dark surfaces · invert back to paper-on-light for print */
  .surface-ink, .surface-peacock {
    background: #ffffff !important;
    color: #1a1a1a !important;
    border: 1pt solid #1a1a1a !important;
    padding: 18pt !important;
  }
  .surface-ink *, .surface-peacock * {
    color: #1a1a1a !important;
  }
  .surface-ink .clay, .surface-peacock .clay,
  .surface-ink *[class*="clay"], .surface-peacock *[class*="clay"] {
    color: #A8551F !important;
  }

  /* Show link URLs after the link text */
  a[href^="http"]::after,
  a[href$=".html"]::after {
    content: " (" attr(href) ")";
    font-family: 'Euclid Flex', sans-serif;
    font-size: 8pt;
    color: #6B6B6B;
    letter-spacing: 0.02em;
  }
  /* But not for nav / footer / inline-token links */
  .topmark a::after, .sidebar a::after, footer a::after, .toc-row::after,
  .lib-row::after { content: ""; }

  /* Force smallcaps to render solid */
  .tok, .kicker, .smallcaps {
    color: #6B6B6B !important;
  }

  /* Buttons · drop them visually as pills with a hairline */
  .btn-pill {
    border: 1pt solid #1a1a1a !important;
    background: #ffffff !important;
    color: #1a1a1a !important;
  }

  /* Page breaks between chapters as logical units */
  main.main > section + section { page-break-before: auto; }

  /* Hide footer prev/next nav in print */
  main.main > footer { display: none !important; }
}
