/* =========================================================================
   One Arm Only Guides — design system
   - Light + dark themes via CSS custom properties + [data-theme]
   - Fluid typography with clamp()
   - 8px spacing scale
   - System font stack (no web-font cost)
   ========================================================================= */

/* ---------- 1. Design tokens (light) ---------- */
:root {
  --bg:            #f4f7fb;
  --bg-grad-top:   #f9fbfe;
  --surface:       #ffffff;
  --surface-soft:  #f1f5fa;
  --surface-alt:   #eaf1f8;
  --border:        #d6dee8;
  --border-soft:   #e5ebf2;

  --text:          #1a2533;
  --text-muted:    #5a6b7e;
  --text-subtle:   #7d8da0;
  --text-inverse:  #ffffff;

  --primary:       #2f5f93;
  --primary-hover: #244c75;
  --primary-soft:  #e3eef9;
  --primary-text:  #ffffff;

  --focus:         #2f5f93;
  --mark-bg:       #fff2a8;
  --mark-fg:       #2a2300;
  --success:       #2e7d4f;
  --success-bg:    #e6f4ec;
  --danger:        #b53b3b;

  --shadow-sm: 0 1px 2px rgba(20, 40, 70, .04), 0 1px 3px rgba(20, 40, 70, .06);
  --shadow-md: 0 4px 10px rgba(20, 40, 70, .04), 0 10px 24px rgba(20, 40, 70, .08);
  --shadow-lg: 0 8px 20px rgba(20, 40, 70, .06), 0 24px 40px rgba(20, 40, 70, .10);
  --ring:      0 0 0 3px rgba(47, 95, 147, .35);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  --t-xs:    clamp(0.75rem, 0.72rem + 0.15vw, 0.82rem);
  --t-sm:    clamp(0.85rem, 0.82rem + 0.15vw, 0.92rem);
  --t-base:  clamp(1rem,    0.97rem + 0.18vw, 1.08rem);
  --t-md:    clamp(1.05rem, 0.99rem + 0.3vw,  1.18rem);
  --t-lg:    clamp(1.15rem, 1.05rem + 0.5vw,  1.32rem);
  --t-xl:    clamp(1.3rem,  1.15rem + 0.8vw,  1.55rem);
  --t-2xl:   clamp(1.5rem,  1.25rem + 1.2vw,  1.9rem);
  --t-3xl:   clamp(1.75rem, 1.35rem + 1.8vw,  2.3rem);
  --t-4xl:   clamp(2rem,    1.5rem + 2.6vw,   3rem);

  --content-w:    1100px;
  --content-pad:  20px;
  --measure:      68ch;

  --ease: cubic-bezier(.2,.7,.2,1);
  --dur-fast: 120ms;
  --dur:      200ms;
  --dur-slow: 320ms;

  --header-h: 64px;

  color-scheme: light;
}

/* ---------- 2. Dark theme (manual override) ---------- */
:root[data-theme="dark"] {
  --bg:            #0e1620;
  --bg-grad-top:   #131c28;
  --surface:       #1a232f;
  --surface-soft:  #141d28;
  --surface-alt:   #202b39;
  --border:        #2a3645;
  --border-soft:   #232f3d;

  --text:          #e6ebf1;
  --text-muted:    #a4b3c4;
  --text-subtle:   #7c8ea3;
  --text-inverse:  #0e1620;

  --primary:       #6ba3d8;
  --primary-hover: #8cb8e0;
  --primary-soft:  rgba(107, 163, 216, .14);
  --primary-text:  #0e1620;

  --focus:         #8cb8e0;
  --mark-bg:       rgba(255, 215, 80, .28);
  --mark-fg:       #fff5cc;
  --success:       #5fc187;
  --success-bg:    rgba(95, 193, 135, .15);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 20px rgba(0,0,0,.4);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
  --ring:      0 0 0 3px rgba(140, 184, 224, .4);

  color-scheme: dark;
}

/* Auto dark when user hasn't manually chosen */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg:            #0e1620;
    --bg-grad-top:   #131c28;
    --surface:       #1a232f;
    --surface-soft:  #141d28;
    --surface-alt:   #202b39;
    --border:        #2a3645;
    --border-soft:   #232f3d;
    --text:          #e6ebf1;
    --text-muted:    #a4b3c4;
    --text-subtle:   #7c8ea3;
    --text-inverse:  #0e1620;
    --primary:       #6ba3d8;
    --primary-hover: #8cb8e0;
    --primary-soft:  rgba(107, 163, 216, .14);
    --primary-text:  #0e1620;
    --focus:         #8cb8e0;
    --mark-bg:       rgba(255, 215, 80, .28);
    --mark-fg:       #fff5cc;
    --success:       #5fc187;
    --success-bg:    rgba(95, 193, 135, .15);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 8px 20px rgba(0,0,0,.4);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
    --ring:      0 0 0 3px rgba(140, 184, 224, .4);
    color-scheme: dark;
  }
}

/* ---------- 3. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@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;
  }
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif,
               "Apple Color Emoji", "Segoe UI Emoji";
  font-size: var(--t-base);
  line-height: 1.6;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-grad-top) 0%, var(--bg) 320px);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  transition: background-color var(--dur) var(--ease);
}
img, svg, video { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; transition: color var(--dur-fast) var(--ease); }
a:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--primary); color: var(--primary-text); }

/* ---------- 4. Layout ---------- */
.wrap {
  width: min(var(--content-w), calc(100% - var(--content-pad) * 2));
  margin-inline: auto;
}
.section { padding: var(--s-6) 0; }
.section-tight { padding: var(--s-5) 0; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-5);
}

main { display: block; }

/* ---------- 5. A11y helpers ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px; top: 0;
  background: var(--primary);
  color: var(--primary-text);
  padding: 10px 14px;
  z-index: 100;
  border-radius: 0 0 var(--r-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; outline: 2px solid var(--text-inverse); outline-offset: -2px; }

/* ---------- 6. Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border-soft);
  transition: box-shadow var(--dur) var(--ease);
}
.site-header.is-scrolled { box-shadow: var(--shadow-sm); }

.topbar {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: var(--header-h);
  padding: var(--s-2) 0;
}

.brand {
  display: flex; flex-direction: column; line-height: 1.1;
  color: var(--text); text-decoration: none;
  padding: 4px 0;
  flex: 0 0 auto;
}
.brand:hover { text-decoration: none; }
.brand-kicker {
  font-size: 11px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--text-subtle); font-weight: 600;
}
.brand-title {
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.35rem);
  font-weight: 800; color: var(--text);
}

.nav {
  display: flex; gap: 2px; margin-left: auto;
  align-items: center;
}
.nav a {
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--t-sm);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav a:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.nav a.is-active { color: var(--primary); background: var(--primary-soft); }

.header-tools {
  display: flex; gap: 4px; align-items: center;
  margin-left: var(--s-2);
}
.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-alt); color: var(--text); border-color: var(--border-soft); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .icon-on  { display: none; }
.icon-btn .icon-off { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-on  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-off { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-on  { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-off { display: none; }
}

.menu-toggle { display: none; }

/* Mobile menu panel */
.mobile-menu {
  border-top: 1px solid var(--border-soft);
  background: var(--surface);
}
.mobile-menu[hidden] { display: none; }
.mobile-menu nav {
  display: flex; flex-direction: column; padding: var(--s-2) 0;
}
.mobile-menu nav a {
  padding: 14px var(--content-pad);
  color: var(--text);
  font-weight: 500;
  border-left: 3px solid transparent;
  font-size: var(--t-base);
}
.mobile-menu nav a:hover,
.mobile-menu nav a.is-active {
  background: var(--surface-alt);
  text-decoration: none;
  border-left-color: var(--primary);
  color: var(--text);
}

/* Header inline search (desktop) */
.header-search {
  position: relative;
  margin-left: var(--s-2);
  flex: 0 1 280px;
  min-width: 0;
}
.header-search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-soft);
  color: var(--text);
  font-size: var(--t-sm);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.header-search input::placeholder { color: var(--text-subtle); }
.header-search input:focus { outline: none; background: var(--surface); border-color: var(--primary); box-shadow: var(--ring); }
.header-search .search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle); pointer-events: none;
  width: 16px; height: 16px;
}

/* Instant search dropdown */
.search-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 60;
  padding: 6px;
}
.search-dropdown[hidden] { display: none; }
.search-dropdown a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text);
  text-decoration: none;
}
.search-dropdown a:hover,
.search-dropdown a:focus,
.search-dropdown a.is-active {
  background: var(--surface-alt);
  color: var(--text); text-decoration: none;
}
.search-dropdown .sd-title { font-weight: 600; font-size: var(--t-sm); }
.search-dropdown .sd-meta { font-size: var(--t-xs); color: var(--text-subtle); margin-top: 2px; }
.search-dropdown .sd-footer {
  padding: 10px 12px; margin-top: 4px;
  border-top: 1px solid var(--border-soft);
  font-size: var(--t-xs); color: var(--text-muted);
}
.search-dropdown .sd-empty {
  padding: 14px 12px; font-size: var(--t-sm); color: var(--text-muted);
}

/* ---------- 7. Hero ---------- */
.hero { padding: var(--s-6) 0 var(--s-4); }
.hero-single { display: block; }
.hero-copy {
  padding: clamp(24px, 4vw, 40px);
  max-width: 820px;
  margin: 0 auto;
}
.kicker {
  display: inline-block;
  font-size: var(--t-xs);
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--primary);
  font-weight: 700;
  padding: 4px 10px;
  background: var(--primary-soft);
  border-radius: var(--r-pill);
}
.hero-copy h1 {
  font-size: var(--t-4xl);
  line-height: 1.1;
  margin: var(--s-3) 0 var(--s-3);
  letter-spacing: 0;
  color: var(--text);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.hero-copy > p {
  color: var(--text-muted);
  font-size: var(--t-md);
  line-height: 1.65;
  margin: 0 0 var(--s-4);
  max-width: 60ch;
}

.hero-search { margin: var(--s-4) 0 var(--s-3); }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 0; }
.search-row input {
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: var(--r-md) 0 0 var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--t-base);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.search-row input::placeholder { color: var(--text-subtle); }
.search-row input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); position: relative; z-index: 1; }
.search-row button {
  min-width: 120px;
  height: 52px;
  padding: 0 22px;
  border: 1px solid var(--primary);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
  font-size: var(--t-base);
}
.search-row button:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.search-row-large input { height: 56px; font-size: var(--t-md); }
.search-row-large button { height: 56px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--s-3); }
.tag {
  font-size: var(--t-xs);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  font-weight: 500;
  white-space: nowrap;
}
.tag-link:hover, .tag-link:focus {
  text-decoration: none;
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.hero-actions {
  display: flex; gap: var(--s-3); flex-wrap: wrap;
  margin: var(--s-5) 0 0;
}

/* ---------- 8. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  min-height: 46px;
  padding: 0 20px;
  border-radius: var(--r-md);
  font-weight: 700; font-size: var(--t-sm);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  cursor: pointer;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--primary); color: var(--primary-text);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text); }
.btn-secondary {
  background: var(--surface); color: var(--primary);
  border-color: var(--primary);
}
.btn-secondary:hover { background: var(--primary-soft); color: var(--primary); }
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); border-color: var(--border); }

/* ---------- 9. Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.section-head { margin-bottom: var(--s-4); display: flex; flex-direction: column; gap: 4px; }
.section-head h1,
.section-head h2 {
  margin: 0;
  font-size: var(--t-2xl);
  line-height: 1.2;
  letter-spacing: 0;
  font-weight: 800;
  color: var(--text);
}
.section-head p { margin: 0; color: var(--text-muted); font-size: var(--t-sm); }
.section-head.section-head-row {
  flex-direction: row;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-3);
}

.guide-list, .result-list { display: grid; gap: var(--s-4); }
.guide-grid {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.guide-card, .result-card {
  display: flex; flex-direction: column;
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.guide-card:hover, .result-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}
.guide-card h3, .result-card h3 {
  margin: 6px 0 var(--s-2);
  font-size: var(--t-lg);
  line-height: 1.3;
  letter-spacing: -0.005em;
  font-weight: 700;
}
.guide-card h3 a, .result-card h3 a { color: var(--text); }
.guide-card h3 a:hover, .result-card h3 a:hover { color: var(--primary); }
.guide-card p, .result-card p { color: var(--text-muted); margin: 0; font-size: var(--t-sm); line-height: 1.55; }
.guide-card .tags, .result-card .tags { margin-top: auto; padding-top: var(--s-3); }

.meta {
  color: var(--text-subtle);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}
.muted { color: var(--text-muted); }

/* Featured card */
.featured-card {
  display: grid;
  gap: var(--s-3);
  padding: clamp(20px, 3vw, 32px);
  background: linear-gradient(135deg, var(--primary-soft), var(--surface));
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
}
.featured-card .meta { color: var(--primary); }
.featured-card h3 {
  margin: 0;
  font-size: var(--t-2xl);
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 800;
}
.featured-card h3 a { color: var(--text); }
.featured-card h3 a:hover { color: var(--primary); }
.featured-card > p { color: var(--text-muted); margin: 0; font-size: var(--t-md); line-height: 1.6; }
.featured-card .featured-actions { margin-top: var(--s-2); display: flex; gap: var(--s-3); flex-wrap: wrap; }

/* Category cards */
.category-list {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
a.category-card {
  display: block;
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
a.category-card:hover,
a.category-card:focus-visible {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  background: var(--primary-soft);
  text-decoration: none;
}
a.category-card strong { display: block; font-size: var(--t-base); color: var(--text); font-weight: 700; margin-bottom: 2px; }
a.category-card p { margin: 0; font-size: var(--t-xs); color: var(--text-muted); }

/* ---------- 10. Forms / filters ---------- */
.filters {
  display: flex; gap: var(--s-2); flex-wrap: wrap;
  margin-bottom: var(--s-3);
}
.filters input, .filters select {
  padding: 0 14px;
  height: 44px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  min-width: 0;
  font-size: var(--t-sm);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.filters input { flex: 1 1 220px; }
.filters select { flex: 0 1 200px; }
.filters input:focus, .filters select:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--ring);
}
.filters button {
  height: 44px;
  padding: 0 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
  font-size: var(--t-sm);
}
.filters button:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.search-fallback { margin-top: var(--s-3); }

.search-engine-card { padding: clamp(20px, 3vw, 32px); margin-bottom: var(--s-4); }
.search-engine-card .search-row { margin-bottom: var(--s-4); }
.search-controls { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.search-controls label {
  display: flex; flex-direction: column; gap: 4px;
  color: var(--text-muted); font-size: var(--t-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.search-controls select {
  min-width: 180px; height: 42px; padding: 0 12px;
  border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: var(--t-sm); text-transform: none; letter-spacing: 0; font-weight: 400;
}
.search-controls select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }

.search-suggestions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: var(--s-4); padding-top: var(--s-4);
  border-top: 1px solid var(--border-soft);
}
.search-suggestions .muted { font-size: var(--t-sm); }

.search-summary { margin: 0 0 var(--s-3); color: var(--text-muted); font-size: var(--t-sm); }

.result-topline {
  display: flex; gap: 12px;
  align-items: center; flex-wrap: wrap;
  margin-bottom: var(--s-2);
}
.result-path {
  color: var(--text-subtle);
  font-size: var(--t-xs); word-break: break-all;
}

/* ---------- 11. Highlight ---------- */
mark {
  background: var(--mark-bg);
  color: var(--mark-fg);
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 600;
}

/* ---------- 12. Article page ---------- */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--s-6);
  padding: var(--s-5) 0 var(--s-6);
  align-items: start;
}

.read-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: transparent; z-index: 100; pointer-events: none;
}
.read-progress > span {
  display: block; height: 100%;
  background: var(--primary);
  width: var(--p, 0%);
  transition: width var(--dur-fast) linear;
}

.article-main { padding: clamp(24px, 4vw, 40px); }
.article-main h1 {
  font-size: var(--t-4xl);
  line-height: 1.15;
  margin: var(--s-3) 0 var(--s-3);
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--text);
}
.article-main > p {
  font-size: var(--t-md);
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 var(--s-4);
}
.article-main > p.muted {
  color: var(--text-muted);
  font-size: var(--t-md);
}

.article-trust {
  margin: var(--s-4) 0 var(--s-5);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--primary);
  border-radius: var(--r-md);
  background: var(--surface-soft);
}
.article-trust p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--t-sm);
  line-height: 1.55;
}
.article-trust p + p { margin-top: 6px; }
.article-trust strong { color: var(--text); }

.article-sources {
  margin: var(--s-6) 0 var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border-soft);
}
.article-sources h2 {
  margin: 0 0 var(--s-2);
  font-size: var(--t-xl);
  line-height: 1.25;
}
.article-sources p {
  margin: 0 0 var(--s-3);
  color: var(--text-muted);
  font-size: var(--t-sm);
  line-height: 1.6;
}
.article-sources ul {
  margin: 0;
  padding-left: 22px;
}
.article-sources li {
  margin: 8px 0;
  line-height: 1.45;
}

.article-forum-cta {
  margin: var(--s-5) 0 var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--surface-soft);
}
.article-forum-cta h2 {
  margin: 0 0 6px;
  font-size: var(--t-lg);
  line-height: 1.25;
}
.article-forum-cta p {
  margin: 0 0 var(--s-3);
  color: var(--text-muted);
  font-size: var(--t-sm);
  line-height: 1.6;
}

.sidebar {
  padding: var(--s-5);
  position: sticky;
  top: calc(var(--header-h) + 16px);
}
.sidebar h3 {
  margin: 0 0 var(--s-3);
  font-size: var(--t-base);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--text-muted);
}
.sidebar ul { padding: 0; margin: 0 0 var(--s-3); list-style: none; }
.sidebar li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: var(--t-sm);
  line-height: 1.4;
}
.sidebar li:last-child { border-bottom: 0; }
.sidebar li a { color: var(--text); }
.sidebar li a:hover { color: var(--primary); }

.breadcrumb {
  font-size: var(--t-xs);
  color: var(--text-subtle);
  margin-bottom: var(--s-3);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb span[aria-hidden] { color: var(--border); }
.breadcrumb-current { color: var(--text); }

.share {
  margin: var(--s-6) 0 var(--s-3);
  padding: var(--s-5) 0 0;
  border-top: 1px solid var(--border-soft);
}
.share h2 {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--s-3);
}
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--t-xs); font-weight: 600;
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.share-btn:hover, .share-btn:focus-visible {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-soft); text-decoration: none;
  transform: translateY(-1px);
}
.share-btn svg { flex-shrink: 0; }
.share-copy.is-copied {
  border-color: var(--success); color: var(--success); background: var(--success-bg);
}
.share-native {
  background: var(--primary); color: var(--primary-text); border-color: var(--primary);
}
.share-native:hover, .share-native:focus-visible {
  background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text);
}

.article-dates {
  margin: var(--s-5) 0 0;
  padding: var(--s-3) 0 0;
  border-top: 1px solid var(--border-soft);
  font-size: var(--t-xs);
  color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 6px 10px;
}
.article-dates time {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.article-dates-sep { color: var(--border); }

/* Related cards below article */
.related-section { padding: var(--s-5) 0 var(--s-6); }
.related-grid {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.topic-hub .section-head p { max-width: 72ch; }
.topic-start-head { margin: var(--s-4) 0 var(--s-3); }
.topic-start { margin-bottom: var(--s-5); }
.topic-hub-subhead { margin-top: var(--s-6); }
.topic-sources {
  margin: var(--s-5) 0;
  padding: var(--s-5);
}
.topic-sources h2 {
  margin: 0 0 var(--s-2);
  font-size: var(--t-xl);
  line-height: 1.25;
}
.topic-sources p {
  margin: 0 0 var(--s-3);
  color: var(--text-muted);
  font-size: var(--t-sm);
  line-height: 1.6;
}
.topic-sources ul { margin: 0; padding-left: 22px; }
.topic-sources li { margin: 8px 0; line-height: 1.45; }
.topic-faq {
  margin-top: var(--s-5);
  padding: var(--s-5);
}
.topic-faq h2,
.topic-forum-link h2 {
  margin: 0 0 var(--s-3);
  font-size: var(--t-xl);
  line-height: 1.2;
}
.topic-faq details {
  border-top: 1px solid var(--border-soft);
  padding: 12px 0;
}
.topic-faq details:first-of-type { border-top: 0; }
.topic-faq summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}
.topic-faq p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: var(--t-sm);
  line-height: 1.6;
}
.topic-forum-link {
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border-soft);
}
.topic-forum-link p {
  max-width: 68ch;
  color: var(--text-muted);
}

/* ---------- 13. Long-guide markdown ---------- */
.md-body {
  font-size: var(--t-md);
  line-height: 1.7;
  color: var(--text);
}
.md-body h2 {
  font-size: var(--t-2xl);
  font-weight: 800;
  margin: var(--s-6) 0 var(--s-3);
  padding-bottom: var(--s-2);
  color: var(--text);
  border-bottom: 1px solid var(--border-soft);
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.md-body h3 {
  font-size: var(--t-lg);
  font-weight: 700;
  margin: var(--s-5) 0 var(--s-2);
  color: var(--text);
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.md-body h4 {
  font-size: var(--t-base);
  font-weight: 700;
  margin: var(--s-4) 0 var(--s-2);
  color: var(--text);
}
.md-body p { margin: 0 0 var(--s-3); max-width: var(--measure); }
.md-body ul, .md-body ol { margin: var(--s-2) 0 var(--s-4); padding-left: 26px; max-width: var(--measure); }
.md-body li { margin-bottom: 8px; }
.md-body li > p { margin-bottom: 6px; }
.md-body a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.md-body a:hover { color: var(--primary-hover); text-decoration-thickness: 2px; }
.md-body strong { font-weight: 700; color: var(--text); }
.md-body em { font-style: italic; }
.md-body code {
  background: var(--surface-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  border: 1px solid var(--border-soft);
}
.md-body hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--s-6) 0;
}
.md-body blockquote {
  margin: var(--s-4) 0;
  padding: var(--s-3) var(--s-4);
  border-left: 3px solid var(--primary);
  color: var(--text-muted);
  background: var(--primary-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-style: italic;
}
.md-body blockquote p:last-child { margin-bottom: 0; }

.md-table-wrap {
  overflow-x: auto;
  margin: var(--s-4) 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  -webkit-overflow-scrolling: touch;
}
.md-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--t-sm); background: var(--surface);
}
.md-table th, .md-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left; vertical-align: top;
}
.md-table th {
  background: var(--surface-alt);
  font-weight: 700;
  color: var(--text);
}
.md-table tr:last-child td { border-bottom: 0; }
.md-table tr:nth-child(even) td { background: var(--surface-soft); }

.md-figure { margin: var(--s-5) 0; }
.md-figure img {
  display: block; width: 100%; height: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border-soft);
  background: var(--surface-alt);
}
.md-figure figcaption {
  margin-top: var(--s-2);
  font-size: var(--t-xs);
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* ---------- 14. Footer ---------- */
.site-footer {
  margin-top: var(--s-7);
  border-top: 1px solid var(--border-soft);
  background: var(--surface-soft);
}
.footer-grid {
  display: flex; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-5) 0;
  flex-wrap: wrap;
}
.footer-grid > div { min-width: 0; }
.footer-grid > div strong { color: var(--text); font-size: var(--t-base); }
.footer-grid > div p {
  color: var(--text-muted); margin: 4px 0 0;
  font-size: var(--t-sm);
}
.footer-links { display: flex; gap: var(--s-4); flex-wrap: wrap; align-content: flex-start; }
.footer-links a {
  color: var(--text-muted); font-size: var(--t-sm); font-weight: 500;
}
.footer-links a:hover { color: var(--primary); }

/* Footer meta band — copyright + disclaimer */
.footer-meta {
  padding: var(--s-4) 0 var(--s-5);
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.footer-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .04em;
}
.footer-disclaimer {
  margin: 0;
  color: var(--text-subtle);
  font-size: var(--t-xs);
  line-height: 1.55;
  max-width: 80ch;
}
.footer-disclaimer strong {
  color: var(--text-muted);
  font-weight: 700;
}

/* ---------- 15. 404 ---------- */
.error-card {
  padding: clamp(40px, 6vw, 72px) var(--s-5);
  text-align: center;
  margin-bottom: var(--s-5);
}
.error-card .kicker {
  display: inline-block;
  font-size: clamp(2.5rem, 4vw, 4rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 8px 24px;
  margin-bottom: var(--s-3);
  text-transform: none;
}
.error-card h1 {
  margin: 0 0 var(--s-2);
  font-size: var(--t-3xl);
  letter-spacing: -0.01em;
}
.error-card .hero-actions { justify-content: center; }

/* ---------- 16. Back to top ---------- */
.to-top {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--primary); color: var(--primary-text);
  border: 0;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  z-index: 40;
}
.to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { background: var(--primary-hover); }
.to-top svg { width: 20px; height: 20px; }

/* ---------- 17. Misc ---------- */
.empty-note { color: var(--text-muted); font-style: italic; }
[hidden] { display: none !important; }

/* ---------- 18. Responsive ---------- */
@media (max-width: 900px) {
  .article-layout { grid-template-columns: 1fr; gap: var(--s-4); }
  .sidebar { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
  .header-search { display: none; }
  .nav { display: none; }
  .menu-toggle { display: inline-flex; }
}

@media (max-width: 600px) {
  :root { --content-pad: 16px; --header-h: 60px; }
  html, body { overflow-x: hidden; }
  .wrap { width: 100%; max-width: 390px; margin-left: 0; margin-right: 0; padding-inline: var(--content-pad); }
  .topbar { gap: var(--s-2); }
  .brand-kicker { font-size: 10px; }
  .brand-title { font-size: 1.05rem; }
  .hero-copy { width: 100%; max-width: 100%; padding: 20px; overflow: hidden; }
  .hero-copy h1 { font-size: clamp(1.7rem, 1.45rem + 1vw, 2rem); line-height: 1.16; }
  .hero-copy > p { font-size: var(--t-base); }
  .search-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .search-row input { min-width: 0; }
  .search-row input { border-right: 1px solid var(--border); border-radius: var(--r-md); }
  .search-row button { width: 100%; border-radius: var(--r-md); min-width: 0; }
  .hero { padding: var(--s-4) 0 var(--s-3); }
  .hero-actions { flex-direction: column; gap: var(--s-2); }
  .hero-actions .btn { width: 100%; flex: 0 0 auto; }
  .section { padding: var(--s-4) 0; }
  .featured-card { padding: var(--s-4); }
  .article-main { padding: var(--s-4); }
  .filters { gap: var(--s-2); }
  .filters input, .filters select, .filters button { flex: 1 1 100%; }
  .footer-grid { flex-direction: column; gap: var(--s-3); padding: var(--s-4) 0; }
  .to-top { bottom: 16px; right: 16px; }
  .share-row { gap: 6px; }
  .share-btn { padding: 7px 12px; }
  .section-head.section-head-row { flex-direction: column; align-items: stretch; }
}

/* ---------- 19. Print ---------- */
@media print {
  .site-header, .site-footer, .share, .sidebar, .to-top, .mobile-menu, .related-section, .read-progress { display: none !important; }
  body { background: #fff; color: #000; }
  .article-main { padding: 0; box-shadow: none; border: 0; }
  a { color: inherit; text-decoration: underline; }
}
