:root {
  --paper: #FAF8F4;
  --surface: #FFFFFF;
  --ink: #1B2430;
  --muted: #526071;
  --border: #E3DED4;
  --accent: #235D4E;
  --accent-hover: #1A473B;
  --accent-soft: #E7F2EE;
  --warm: #B84E32;
  --warm-soft: #FBECE7;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(27, 36, 48, 0.05);
  --shadow-md: 0 10px 30px rgba(27, 36, 48, 0.08);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  accent-color: var(--accent);
  overflow-x: clip;
}

h1, h2, h3, h4 {
  color: var(--ink);
  line-height: 1.2;
  margin-top: 0;
  text-wrap: balance;
}

p, li {
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: min(1160px, calc(100% - 32px));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 100;
  text-decoration: none;
  font-weight: 700;
}

.skip-link:focus {
  left: 16px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  padding: 10px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 0.95rem;
  font-weight: 800;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

/* Hero */
.hero {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #FFFFFF 0%, var(--paper) 100%);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(1.85rem, 3.6vw, 2.8rem);
  letter-spacing: -0.025em;
  max-width: 24ch;
  margin-bottom: 14px;
}

.hero-lead {
  font-size: 1.06rem;
  color: var(--muted);
  max-width: 64ch;
  margin: 0 0 22px;
}

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.hero-metrics span strong {
  color: var(--ink);
}

/* Filter Bar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 26px 0 20px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 40px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

.pill-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.search-box {
  position: relative;
  min-width: min(290px, 100%);
  flex: 0 1 310px;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.94rem;
}

.search-box input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Card Grid */
.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
  margin-bottom: 42px;
}

.sheet-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.sheet-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #C7C0B3;
}

.sheet-card.is-hidden {
  display: none;
}

.sheet-thumb-link {
  display: block;
  background: #F1EFE9;
  padding: 16px 16px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.sheet-thumb-frame {
  background: #fff;
  border: 1px solid #DDD8CE;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
  aspect-ratio: 850 / 1100;
  box-shadow: 0 6px 18px rgba(27, 36, 48, 0.08);
}

.sheet-thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.sheet-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.sheet-badge {
  align-self: flex-start;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.sheet-card h2,
.sheet-card h3 {
  font-size: 1.05rem;
  margin: 0;
}

.sheet-card h2 a,
.sheet-card h3 a {
  text-decoration: none;
  color: var(--ink);
}

.sheet-card h2 a:hover,
.sheet-card h3 a:hover {
  color: var(--accent);
}

.sheet-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1;
}

.sheet-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid #EFECE5;
  font-size: 0.84rem;
  font-weight: 700;
}

.sheet-card-foot a {
  text-decoration: none;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--muted);
  margin: 18px 0 14px;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Detail Layout */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  grid-template-areas:
    "preview intro"
    "preview customizer";
  gap: 20px 32px;
  align-items: start;
  margin-bottom: 36px;
}

.preview-stage {
  grid-area: preview;
  background: #ECEAE3;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

.detail-intro {
  grid-area: intro;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.customizer-card {
  grid-area: customizer;
}

.sheet-paper {
  background: #fff;
  border: 1px solid #D8D2C7;
  border-radius: 6px;
  box-shadow: 0 14px 36px rgba(27, 36, 48, 0.12);
  overflow: hidden;
  aspect-ratio: 850 / 1100;
  position: relative;
}

.sheet-paper img,
.sheet-paper svg {
  width: 100%;
  height: 100%;
  display: block;
}

.preview-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.83rem;
  color: var(--muted);
}

.detail-intro h1 {
  font-size: clamp(1.55rem, 2.7vw, 2.15rem);
  margin-bottom: 2px;
  letter-spacing: -0.02em;
}

.detail-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.96rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

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

.btn-ghost {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-ghost:hover {
  background: #D8EAE3;
}

/* Live Customizer Box */
.customizer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.customizer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.customizer-header h2 {
  font-size: 1.02rem;
  margin: 0;
}

.customizer-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--warm);
  background: var(--warm-soft);
  padding: 3px 9px;
  border-radius: 999px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.field input,
.field select {
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: #fff;
}

.palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.palette-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.palette-opt:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

@supports not (accent-color: #235D4E) {
  .palette-opt input[type="radio"] {
    position: absolute;
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
}

.customizer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #EFECE5;
}

.status-note {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--accent);
  min-height: 1.3em;
}

/* Spec Strip */
.spec-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.84rem;
}

.spec-strip dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.spec-strip dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-weight: 700;
}

/* Ad Slot Container (strict safe clearance from CTAs) */
.ad-zone {
  margin: 32px 0;
  min-height: 110px;
}

.ad-zone:empty,
.ad-zone:has(ins[data-ad-status="unfilled"]) {
  display: none;
  margin: 0;
  min-height: 0;
}

.ad-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  text-align: center;
}

/* Editorial Guide Sections */
.guide-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 28px;
}

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

.guide-section h2 {
  font-size: 1.32rem;
  margin-bottom: 12px;
}

.guide-section ol,
.guide-section ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
  color: #2B3645;
}

/* Deferred Below-the-Fold Blocks */
.deferred-section {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 420px;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-item {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
}

.faq-item summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: 10px 0 0;
  color: var(--muted);
}

/* Legal / Static Prose */
.prose-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  margin: 26px 0 44px;
  max-width: 820px;
}

.prose-card h1 {
  font-size: 2rem;
  margin-bottom: 14px;
}

.prose-card h2 {
  font-size: 1.25rem;
  margin-top: 26px;
  margin-bottom: 8px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 30px 0 38px;
  margin-top: 36px;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "preview"
      "customizer";
    gap: 20px;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .container {
    width: calc(100% - 24px);
  }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 0;
  }
  .site-nav {
    width: 100%;
    gap: 4px;
  }
  .site-nav a {
    padding: 6px 9px;
    font-size: 0.84rem;
  }
  .hero {
    padding: 26px 0 20px;
  }
  .preview-stage {
    padding: 12px;
  }
  .customizer-grid {
    grid-template-columns: 1fr;
  }
  .spec-strip {
    grid-template-columns: 1fr 1fr;
  }
  .cta-row .btn {
    width: 100%;
  }
  .guide-section,
  .prose-card {
    padding: 20px;
  }
}

/* Print-Only Sheet Mode: when printing a printable detail page, output ONLY the crisp vector worksheet */
@media print {
  @page {
    size: letter portrait;
    margin: 0.2in;
  }
  body {
    background: #fff !important;
  }
  .skip-link,
  .site-header,
  .breadcrumbs,
  .ad-zone,
  .site-footer {
    display: none !important;
  }
  body:has(.detail-layout) .detail-intro,
  body:has(.detail-layout) .customizer-card,
  body:has(.detail-layout) .preview-caption,
  body:has(.detail-layout) .guide-section,
  body:has(.detail-layout) .deferred-section {
    display: none !important;
  }
  body:has(.detail-layout) .container,
  body:has(.detail-layout) .detail-layout,
  body:has(.detail-layout) .preview-stage,
  body:has(.detail-layout) .sheet-paper {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    display: block !important;
    break-inside: avoid;
  }
  .sheet-paper svg,
  .sheet-paper img {
    width: 100% !important;
    max-height: 10.4in !important;
    height: auto !important;
    object-fit: contain;
    break-inside: avoid;
  }
}
