/* WispBooks help center — design tokens per spec/ux/design-system.md, shared with marcom/ */

:root {
  --page: #f7f3ee;
  --band: #efe7dc;
  --card: #fffdfa;

  --ink: #2a2622;
  --ink-2: #5e564e;
  --ink-3: #6b635b;
  --faint: #9a9088;

  --line: #e7ddcf;
  --line-2: #e2d8ca;
  --line-3: #f1e9dd;
  --line-dash: #d8cdbd;
  --frame-line: #ddd3c7;

  --terra: #c2611f;
  --terra-deep: #a8501a;
  --terra-lift: #d97a35;
  --terra-tint: #f6e9dd;
  --terra-tint-line: #ecd9c4;
  --terra-ink: #6b4d2a;
  --ember: #e9954f;

  --dark: #2c2723;
  --on-dark: #faf5ee;
  --on-dark-2: #c7bdb1;

  --sage: #1f5e42;
  --sage-tint: #e6f0e9;
  --amber: #8a6212;
  --amber-tint: #f7edd8;
  --purple: #7a5cc0;
  --purple-tint: #ece6f6;
  --square-tint: #f0e8dc;

  --display: 'Bricolage Grotesque', Georgia, serif;
  --body: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --gutter: 36px;
  --maxw: 1180px;
  --sidebar: 244px;
}

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

body {
  background: var(--page);
  font-family: var(--body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--terra-deep); text-decoration: none; }
a:hover { color: var(--terra); }
h1, h2, h3 { font-family: var(--display); margin: 0; font-weight: 700; letter-spacing: -0.025em; }
p { margin: 0; }
img, svg { max-width: 100%; }
figure { margin: 0; }   /* the UA default (1em 40px) insets every shot from the text column */

::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-thumb { background: var(--line-dash); border-radius: 8px; border: 3px solid var(--page); }
::selection { background: var(--terra-tint); color: var(--terra-deep); }
:focus-visible { outline: 2px solid var(--terra); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--card); color: var(--ink);
  padding: 12px 18px; border-radius: 0 0 12px 0; font-weight: 700; z-index: 100;
}
.skip:focus { left: 0; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(247, 243, 238, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { height: 68px; display: flex; align-items: center; gap: 20px; }

.brand { display: flex; align-items: center; gap: 10px; flex: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand svg { flex: none; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.brand-name b { color: var(--terra); font-weight: 700; }
.brand-tag {
  font-size: 13px; font-weight: 600; color: var(--ink-3);
  border-left: 1px solid var(--frame-line); padding-left: 11px; margin-left: 3px;
}

.search { flex: 1; display: flex; justify-content: center; }
.search-box { position: relative; width: 100%; max-width: 420px; }
.search-box svg { position: absolute; left: 13px; top: 11px; pointer-events: none; }
.search-box input {
  width: 100%; background: var(--card); border: 1.5px solid var(--line-2); border-radius: 11px;
  padding: 10px 14px 10px 38px; font-family: inherit; font-size: 14.5px; color: var(--ink); outline: none;
}
.search-box input:focus { border-color: var(--terra); }
.search-box input::placeholder { color: var(--faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 700; font-size: 15px; line-height: 1;
  border: none; border-radius: 11px; padding: 12px 18px; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--terra); color: #fff; }
.btn-primary:hover { background: var(--terra-deep); color: #fff; }
.btn-ghost {
  background: var(--card); color: var(--ink); border: 1.5px solid var(--frame-line);
  font-weight: 600; font-size: 14.5px; padding: 11px 18px;
}
.btn-ghost:hover { border-color: var(--terra); color: var(--ink); }
.topbar-cta { flex: none; font-size: 14.5px; padding: 10px 17px; }

/* ---------- layout ---------- */

.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: 44px; align-items: start; }

.sidebar { position: sticky; top: 68px; padding: 34px 0 60px; }
.side-group { margin-bottom: 22px; }
.side-group h2 {
  font-family: var(--body); font-size: 11.5px; font-weight: 700; color: var(--faint);
  letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 9px;
}
.side-links { display: flex; flex-direction: column; gap: 2px; }
.side-links a {
  font-size: 14px; line-height: 1.35; color: var(--ink-2); font-weight: 500;
  padding: 8px 11px; border-radius: 9px;
}
.side-links a:hover { background: var(--line-3); color: var(--ink-2); }
.side-links a[aria-current="page"] { background: var(--terra-tint); color: var(--terra-deep); font-weight: 700; }

.support-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 26px;
}
.support-card b { font-size: 14px; }
.support-card p { font-size: 13px; line-height: 1.55; color: var(--ink-3); margin: 6px 0 10px; }
.support-card a { font-size: 13.5px; font-weight: 700; }

.article { padding: 34px 0 80px; max-width: 720px; }
.eyebrow {
  font-size: 11.5px; font-weight: 700; color: var(--terra-deep);
  letter-spacing: 0.05em; text-transform: uppercase;
}
.article h1 { font-size: clamp(30px, 4vw, 36px); line-height: 1.1; letter-spacing: -0.03em; margin-top: 10px; }
.article h2 { font-size: 21px; letter-spacing: -0.02em; margin-top: 30px; }
.article h3 { font-family: var(--body); font-size: 16.5px; letter-spacing: 0; margin-top: 22px; }
.lede { font-size: 17.5px; line-height: 1.65; color: var(--ink-2); margin: 14px 0 26px; }
.article p { font-size: 16.5px; line-height: 1.7; color: var(--ink-2); margin-top: 10px; }
/* Inline links in prose are underlined: terracotta alone is ~1.3:1 against body text. */
.article p a, .article li a, .note a, .results-empty a { text-decoration: underline; text-underline-offset: 2px; }
.article ul, .article ol { margin: 10px 0 0; padding-left: 20px; }
.article li { font-size: 16.5px; line-height: 1.7; color: var(--ink-2); margin-bottom: 8px; }
.article strong { color: var(--ink); font-weight: 700; }
.article code {
  font-family: var(--mono); font-size: 14px; background: var(--band);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px;
}

.note {
  background: var(--terra-tint); border: 1px solid var(--terra-tint-line); border-radius: 14px;
  padding: 18px 20px; margin-top: 26px;
}
.note p { font-size: 15px; line-height: 1.6; color: var(--terra-ink); margin: 0; }
.note p + p { margin-top: 8px; }
.note strong { color: var(--terra-ink); }

.shot { margin-top: 26px; }
.shot-frame { border-radius: 14px; overflow: hidden; border: 1px solid var(--frame-line); background: var(--card); }
.shot-frame img { display: block; width: 100%; height: auto; aspect-ratio: 1300 / 880; object-fit: cover; object-position: top; }
.shot figcaption { font-size: 13px; color: var(--faint); margin-top: 8px; }
.shot-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 26px; }
.shot-pair .shot { margin-top: 0; }

.rows { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.row-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-head span { font-size: 14px; color: var(--ink-3); }
.row-card p { font-size: 15px; line-height: 1.6; margin-top: 10px; }
.role { font-size: 12px; font-weight: 700; border-radius: 20px; padding: 4px 11px; }
.role-owner { color: #f0e8dc; background: var(--dark); }
.role-admin { color: var(--terra-deep); background: var(--terra-tint); }
.role-book { color: var(--purple); background: var(--purple-tint); }
.role-capture { color: var(--sage); background: var(--sage-tint); }
.role-read { color: var(--amber); background: var(--amber-tint); }

.terms { display: flex; flex-direction: column; margin-top: 22px; }
.term { padding: 18px 0; border-top: 1px solid var(--line); }
.term:last-child { border-bottom: 1px solid var(--line); }
.term b { font-size: 16.5px; }
.term p { font-size: 15.5px; line-height: 1.65; margin-top: 5px; }

.back { padding: 0 0 60px; }

/* ---------- landing ---------- */

.home { padding: 40px 0 70px; max-width: 820px; }
.home h1 { font-size: clamp(32px, 5vw, 42px); line-height: 1.06; letter-spacing: -0.035em; }
.home .lede { font-size: 18px; line-height: 1.6; max-width: 620px; }

.start {
  background: var(--dark); border-radius: 20px; padding: 28px 30px; margin-top: 30px;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.start-kicker { font-family: var(--mono); font-size: 12px; color: var(--ember); letter-spacing: 0.04em; }
.start h2 { font-size: 25px; color: var(--on-dark); margin-top: 8px; }
.start p { font-size: 15px; line-height: 1.6; color: var(--on-dark-2); margin-top: 8px; }
.start > div { flex: 1; min-width: 260px; }

.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 18px; }
.topic {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 24px; color: var(--ink);
}
.topic:hover { border-color: var(--terra); color: var(--ink); }
.tile { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 14px; background: var(--terra-tint); }
.tile-square { background: var(--square-tint); }
.tile-sage { background: var(--sage-tint); }
.tile-purple { background: var(--purple-tint); }
.topic b { font-family: var(--display); font-weight: 700; font-size: 19px; }
.topic p { font-size: 14.5px; line-height: 1.55; color: var(--ink-3); margin-top: 6px; }

.disclaim {
  display: flex; align-items: flex-start; gap: 14px; background: var(--terra-tint);
  border: 1px solid var(--terra-tint-line); border-radius: 14px; padding: 18px 20px; margin-top: 18px;
}
.disclaim svg { flex: none; margin-top: 2px; }
.disclaim p { font-size: 14.5px; line-height: 1.55; color: var(--terra-ink); }

.all-articles { margin-top: 46px; }
.all-articles h2 { font-size: 21px; }
.hit-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.hit {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; color: var(--ink);
}
.hit:hover { border-color: var(--terra); color: var(--ink); }
.hit-cat { font-size: 11.5px; font-weight: 700; color: var(--terra-deep); letter-spacing: 0.05em; text-transform: uppercase; }
.hit b { display: block; font-family: var(--display); font-weight: 700; font-size: 18px; margin-top: 5px; }
.hit p { font-size: 14.5px; line-height: 1.55; color: var(--ink-3); margin-top: 4px; }

/* ---------- search results (JS-enhanced) ---------- */

.results { padding: 34px 0 70px; max-width: 720px; }
.results-line { font-size: 14px; color: var(--ink-3); margin-bottom: 18px; }
.results-empty {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; font-size: 15px; line-height: 1.6; color: var(--ink-3);
}
[hidden] { display: none !important; }

/* ---------- footer ---------- */

.footer { background: var(--band); border-top: 1px solid var(--line); }
.footer-inner {
  padding-top: 30px; padding-bottom: 30px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--faint);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; font-weight: 600; }

/* ---------- responsive ---------- */

@media (max-width: 1040px) {
  :root { --sidebar: 210px; }
  .shell { gap: 36px; }
}

@media (max-width: 900px) {
  :root { --gutter: 26px; }
  /* One column: the article leads, and the topic list becomes an index under it. */
  .shell { display: flex; flex-direction: column; gap: 0; }
  #main { order: 1; }
  .sidebar {
    order: 2; position: static; padding: 26px 0 40px; border-top: 1px solid var(--line);
  }
  .side-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; }
  .support-card { display: none; }
  .topbar-inner { height: auto; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
  .search { order: 3; flex-basis: 100%; justify-content: stretch; }
  .search-box { max-width: none; }
  .topbar-cta { margin-left: auto; }
  .article, .home, .results { padding-top: 26px; }
}

@media (max-width: 680px) {
  :root { --gutter: 18px; }
  .cards, .shot-pair, .side-links { grid-template-columns: 1fr; }
  .brand-tag { display: none; }
  .start { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
