/* Benefits Guide Builder — site stylesheet. Design system: DESIGN.md.
   White system, evergreen accent, Source Serif 4 display over Public Sans.
   One layout primitive (the paper sheet), asymmetric splits, no gradients.
   Variable names predate the white revamp: --paper is white, --spruce is
   evergreen. Every consumer stylesheet reads these tokens. */

@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-var.woff2') format('woff2-variations');
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: 'Public Sans';
  src: url('/fonts/public-sans-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #FFFFFF;
  --paper-soft: #F6F8F7;
  --ink: #161B18;
  --muted: #5B655E;
  --spruce: #146B45;
  --spruce-dark: #0D5434;
  --spruce-tint: #E8F3EC;
  --brass: #77571A;
  --brass-tint: #F5EEDF;
  --hairline: #E4E8E5;
  --input-border: #D8DEDA;
  --panel: #F6F8F7;
  --error: #B3402F;
  --error-tint: #FBEFEC;
  --sheet-shadow: 0 1px 2px rgba(22,27,24,.06), 0 12px 32px rgba(22,27,24,.08);
  --card-hover: 0 1px 2px rgba(22,27,24,.05), 0 8px 24px rgba(22,27,24,.09);
  --font-display: 'Source Serif 4', Georgia, serif;
  --font-body: 'Public Sans', -apple-system, 'Segoe UI', sans-serif;
  --ease: 150ms ease;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}
::selection { background: var(--spruce-tint); }

h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
h1 { font-family: var(--font-display); font-weight: 650; font-size: clamp(2rem, 4.5vw, 3.2rem); letter-spacing: -0.018em; }
h2 { font-family: var(--font-display); font-weight: 650; font-size: clamp(1.35rem, 2.6vw, 1.85rem); letter-spacing: -0.01em; }
h3 { font-weight: 700; font-size: 1.02rem; }
p { margin: 0 0 1em; }
a { color: var(--spruce); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--spruce-dark); }
code { background: var(--panel); border: 1px solid var(--hairline); padding: 2px 6px; border-radius: 5px; font-size: .85em; word-break: break-all; }

.lede { font-size: 1.15rem; color: var(--muted); max-width: 44rem; }
.fine { font-size: .85rem; color: var(--muted); }
.crumb { font-size: .9rem; margin-bottom: 8px; }
.crumb a { text-decoration: none; }

/* ---------- Header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark .mark { color: var(--spruce); flex: none; }
.site-nav { display: flex; align-items: center; gap: clamp(12px, 2vw, 26px); flex-wrap: wrap; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem; transition: color var(--ease); }
.site-nav a:hover { color: var(--spruce); }
.site-nav .nav-signin { color: var(--muted); }
.site-nav a.btn { color: #fff; }
.site-nav a.btn:hover { color: #fff; }
@media (max-width: 720px) {
  .site-head { position: static; flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px 16px; }
  .site-nav { gap: 14px 18px; }
  .site-nav .btn-small { padding: 6px 12px; }
}

.site-main { min-height: 60vh; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-block;
  background: var(--spruce);
  color: #fff;
  border: 1px solid var(--spruce);
  border-radius: 8px;
  padding: 10px 20px;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease), transform var(--ease), box-shadow var(--ease);
}
.btn:hover { background: var(--spruce-dark); border-color: var(--spruce-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--spruce); border-color: var(--input-border); }
.btn-ghost:hover { background: var(--spruce-tint); color: var(--spruce-dark); border-color: var(--spruce); }
.btn-big { padding: 13px 26px; font-size: 1.02rem; }
.btn-big.btn:not(.btn-ghost):hover { box-shadow: var(--card-hover); transform: translateY(-1px); }
.btn-small { padding: 6px 13px; font-size: .85rem; }
.btn-danger { background: transparent; color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error-tint); border-color: var(--error); color: var(--error); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 9px 12px;
  width: 100%;
  transition: border-color var(--ease), box-shadow var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: #B9C4BD; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--spruce);
  outline-offset: 2px;
}
label { display: block; font-weight: 600; font-size: .9rem; }
label input, label select, label textarea { margin-top: 4px; font-weight: 400; }

.hp-wrap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.notice {
  padding: 12px 16px;
  border-radius: 10px;
  margin: 0 0 18px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--muted);
}
.notice-ok { background: var(--spruce-tint); border-color: #D3E8DC; border-left-color: var(--spruce); }
.notice-warn { background: var(--error-tint); border-color: #F0DAD4; border-left-color: var(--error); }

.pill {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 3px 10px;
  border-radius: 999px;
  vertical-align: middle;
}
.pill-draft { background: var(--panel); color: var(--muted); }
.pill-paid { background: var(--spruce-tint); color: var(--spruce-dark); }
.pill-busy { background: var(--brass-tint); color: var(--brass); }
.pill-warn { background: var(--error-tint); color: var(--error); }

/* ---------- Paper sheets ---------- */
.paper-sheet { margin: 0; flex: none; }
.sheet-clip {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  box-shadow: var(--sheet-shadow);
  transition: box-shadow var(--ease), transform var(--ease);
}
a:hover > .paper-sheet .sheet-clip, a:focus-visible > .paper-sheet .sheet-clip {
  box-shadow: 0 2px 4px rgba(22,27,24,.07), 0 18px 44px rgba(22,27,24,.12);
  transform: translateY(-2px);
}
.sheet-clip iframe { border: 0; pointer-events: none; display: block; background: #fff; }
.paper-sheet figcaption { font-size: .82rem; color: var(--muted); margin-top: 10px; }
a:has(.paper-sheet) { text-decoration: none; }
.sheet-row { display: flex; gap: clamp(16px, 3vw, 36px); flex-wrap: wrap; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding: clamp(48px, 7vw, 96px) clamp(16px, 4vw, 48px);
  max-width: 1280px;
  margin: 0 auto;
}
.hero-fine { font-size: .88rem; color: var(--muted); margin-top: 16px; max-width: 34rem; }
.hero-sheets {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  min-width: 0;
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 18px;
}
.hero-sheets a:nth-child(2) { margin-top: 40px; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-sheets { justify-content: flex-start; }
}

/* ---------- Splits & bands ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 5vw, 80px);
  padding: clamp(40px, 6vw, 88px) clamp(16px, 4vw, 48px);
  max-width: 1180px;
  margin: 0 auto;
}
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }
.split-copy p { max-width: 38rem; }

.themes-band {
  background: var(--paper-soft);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: clamp(40px, 6vw, 88px) clamp(16px, 4vw, 48px);
}
.themes-band > * { max-width: 1180px; margin-left: auto; margin-right: auto; }
.band-lede { color: var(--muted); max-width: 44rem; margin-bottom: 28px; }
.band-more { margin-top: 24px; font-weight: 600; }
.themes-band .sheet-row { justify-content: flex-start; }

.fences { padding: clamp(40px, 6vw, 88px) clamp(16px, 4vw, 48px); max-width: 1180px; margin: 0 auto; }
.fence-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px 40px; }
.fence-grid h3 { color: var(--spruce-dark); }
.fence-grid p { color: var(--muted); font-size: .95rem; }

.final-cta {
  text-align: center;
  padding: clamp(48px, 7vw, 96px) 16px;
  background: var(--paper-soft);
  border-top: 1px solid var(--hairline);
}
.final-cta .btn-row { justify-content: center; }

/* ---------- Pricing ---------- */
.pricing, .examples, .template-page, .resources-hub, .prose {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 64px) clamp(16px, 4vw, 48px);
}
.price-table { width: 100%; border-collapse: collapse; margin: 32px 0; }
.price-table tr { border-top: 1px solid var(--hairline); }
.price-table th, .price-table td { padding: 26px 18px; text-align: left; vertical-align: top; }
.price-table th { width: 220px; }
.price-table h2 { font-size: 1.2rem; margin-bottom: 2px; }
.price { font-family: var(--font-display); font-size: 1.9rem; font-weight: 650; display: block; color: var(--spruce-dark); }
.price-note { color: var(--muted); font-size: .85rem; }
.price-cta { width: 230px; }
.price-cta form { margin-bottom: 8px; }
@media (max-width: 760px) {
  .price-table, .price-table tbody, .price-table tr, .price-table th, .price-table td { display: block; width: auto; }
  .price-table td { padding-top: 0; }
}

.market-position { margin: 56px 0 24px; }
.position-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; background: #fff; border: 1px solid var(--hairline); border-radius: 12px; overflow: hidden; }
.position-table th, .position-table td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--hairline); }
.position-table tbody tr:last-child th, .position-table tbody tr:last-child td { border-bottom: none; }
.position-table thead th { font-size: .8rem; color: var(--muted); background: var(--paper-soft); }
.position-table thead th:nth-child(3) { color: var(--spruce-dark); }
.position-table tbody th[scope="row"] { font-weight: 700; width: 150px; }
.position-table td:nth-child(3) { background: var(--spruce-tint); font-weight: 500; }
@media (max-width: 720px) {
  .position-table { display: block; overflow-x: auto; }
}

.faq dl > div { border-top: 1px solid var(--hairline); padding: 18px 0; }
.faq dt { font-weight: 700; margin-bottom: 6px; }
.faq dd { margin: 0; color: var(--muted); max-width: 46rem; }

/* ---------- Examples ---------- */
.example-block { margin: 48px 0; }
.example-block > p { max-width: 44rem; color: var(--muted); }

/* ---------- Template page ---------- */
.check-list { padding-left: 1.3em; max-width: 44rem; }
.check-list li { margin: 8px 0; }
.template-what { margin: 40px 0; }
.lead-box {
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 28px;
  max-width: 40rem;
  margin-top: 40px;
}
.lead-form { display: flex; gap: 10px; flex-wrap: wrap; }
.lead-form input[type="email"] { flex: 1 1 240px; }

/* ---------- Resources ---------- */
.article-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 28px; }
.article-card {
  display: block;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 22px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.article-card:hover { border-color: var(--spruce); box-shadow: var(--card-hover); transform: translateY(-1px); color: var(--ink); }
.article-card h2 { font-size: 1.08rem; }
.article-card p { color: var(--muted); font-size: .9rem; margin: 0; }

.prose { max-width: 760px; }
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.3em; }
.article-cta {
  border-top: 1px solid var(--hairline);
  margin-top: 40px;
  padding-top: 20px;
  color: var(--muted);
}

/* ---------- Auth ---------- */
.auth-card {
  max-width: 430px;
  margin: clamp(40px, 8vw, 96px) auto;
  padding: 0 16px;
}
.auth-form { display: grid; gap: 14px; margin-top: 18px; }

/* ---------- Console (dashboard/detail/account/admin) ---------- */
.console { max-width: 1020px; margin: 0 auto; padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 48px); }
.console.narrow { max-width: 640px; }
.console-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.console-head h1 { margin: 0; font-size: 1.7rem; }
.console h2 { font-size: 1.1rem; margin-top: 1.6em; }

.guide-list { margin-bottom: 36px; }
.client-head { font-size: .95rem; color: var(--muted); margin: 24px 0 8px; }
.guide-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 10px 0;
  flex-wrap: wrap;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.guide-card:hover { border-color: var(--input-border); box-shadow: var(--card-hover); }
.gc-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gc-title { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.gc-title:hover { color: var(--spruce); }
.gc-year { color: var(--muted); font-size: .85rem; }
.gc-actions { display: flex; gap: 8px; }

.empty-state { background: var(--paper-soft); border: 1px dashed var(--input-border); border-radius: 12px; padding: 36px; max-width: 44rem; }
.empty-state p { color: var(--muted); margin: 0; }

.new-guide-form { background: var(--paper-soft); border: 1px solid var(--hairline); border-radius: 12px; padding: 24px; max-width: 44rem; }
.new-guide-form h2 { margin-top: 0; }
.new-guide-form input { background: #fff; }
.form-row { display: grid; grid-template-columns: 2fr 100px 1.4fr; gap: 14px; margin-bottom: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.sample-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 400;
  font-size: .9rem;
  color: var(--muted);
  margin: 0 0 16px;
  cursor: pointer;
}
.sample-toggle input { width: 18px; height: 18px; accent-color: var(--spruce); margin-top: 2px; flex: none; }

.broker-box, .buy-box {
  background: #fff;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--brass);
  border-radius: 0 12px 12px 0;
  padding: 24px;
  margin-top: 32px;
  max-width: 46rem;
}
.broker-box h2, .buy-box h2 { margin-top: 0; }
.buy-options { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 18px 0 8px; }
@media (max-width: 640px) { .buy-options { grid-template-columns: 1fr; } }
.buy-note { font-size: .82rem; color: var(--muted); margin: 8px 0 0; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 4vw, 56px); }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-col h2:first-child { margin-top: 0; }
.share-url { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pdf-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.pdf-row-actions { display: flex; gap: 8px; }
.danger-row { display: flex; gap: 12px; margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--hairline); flex-wrap: wrap; }

.share-kit-wrap { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--hairline); }
.share-kit { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 4vw, 56px); }
@media (max-width: 760px) { .share-kit { grid-template-columns: 1fr; } }
.share-col h3:first-child { margin-top: 0; }
.share-text {
  font-family: var(--font-body);
  font-size: .85rem;
  line-height: 1.5;
  background: var(--paper-soft);
  margin-bottom: 8px;
  resize: vertical;
}

.account-block { background: #fff; border: 1px solid var(--hairline); border-radius: 12px; padding: 22px; margin: 18px 0; }
.account-block h2 { margin-top: 0; }
.account-block.danger { border-color: #EFD4CC; }
.stack-form { display: grid; gap: 12px; max-width: 26rem; }

/* ---------- Admin ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 18px 0 8px; }
.stat-card { background: #fff; border: 1px solid var(--hairline); border-radius: 12px; padding: 14px; }
.stat-n { font-family: var(--font-display); font-size: 1.5rem; font-weight: 650; }
.stat-l { font-size: .78rem; color: var(--muted); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .87rem; background: #fff; border: 1px solid var(--hairline); border-radius: 12px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--hairline); }
.admin-table thead th { font-size: .78rem; color: var(--muted); background: var(--paper-soft); }
.admin-actions { display: flex; gap: 10px; align-items: center; }
.admin-actions form { display: inline; }
.admin-actions button { background: none; border: none; color: var(--spruce); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

/* ---------- Footer ---------- */
.site-foot {
  border-top: 1px solid var(--hairline);
  padding: 48px clamp(16px, 4vw, 48px) 64px;
  background: var(--paper-soft);
}
.foot-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; max-width: 1180px; margin: 0 auto; }
@media (max-width: 760px) { .foot-cols { grid-template-columns: 1fr; } }
.foot-brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 650; }
.foot-brand .mark { color: var(--spruce); }
.foot-about p { color: var(--muted); font-size: .9rem; max-width: 34rem; }
.foot-fine { font-size: .8rem; }
.foot-links { display: grid; gap: 10px; align-content: start; }
.foot-links a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.foot-links a:hover { color: var(--spruce); }
