/* ViZZ — design tokens and primitives
   Extracted from the approved prototype. Drop into static/css/ and load first.
   Values here are final; see 01-design-tokens.md for intent. */

:root {
  /* ground & ink */
  --color-bg: #ffffff;
  --color-surface: #f8f9f4;
  --color-text: #1e211a;
  /* Channel triplet for rgba() softening — see the note atop vizz-shell.css. */
  --color-text-rgb: 30, 33, 26;

  /* accent ramp — accent itself is a light yellow-green: fills only, never text */
  --color-accent: #a8c520;
  --color-accent-200: #edf4d2;
  --color-accent-300: #dcea9f;
  --color-accent-600: #93ae17;
  --color-accent-700: #5f7a09;  /* accent TEXT colour */
  --color-accent-800: #45590a;
  --color-accent-ink: #23261f;  /* ink used on accent fills */

  --color-divider: #e4e7dc;
  --color-neutral-200: #f2f3ed;
  --color-neutral-300: #e8eae1;
  --color-neutral-900: #2b2e27;

  /* reader grounds */
  --reader-bg-dark: #2b2e27;
  --reader-ink-dark: #fbfcf7;
  --reader-bg-light: #e7e8e0;
  --reader-ink-light: #23261f;

  /* content colours (home) */
  --coll-books-bg: #f0dbd1;
  --coll-books-ink: #8a4f38;
  --coll-cards-bg: #eee9cf;
  --coll-cards-ink: #6f6524;
  --hero-kicker: #5c3833;
  --card-icon: #fa8072;
  --card-icon-hover: #ff6f52;

  --font-body: "DM Sans", system-ui, sans-serif;
  --font-heading: "Inter", system-ui, sans-serif;
  --font-heading-weight: 500;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(45, 43, 43, 0.14);
  --shadow-md: 0 3px 10px rgba(45, 43, 43, 0.16);
  --shadow-lg: 0 12px 32px rgba(45, 43, 43, 0.22);

  --page-max: 1500px;
  --page-pad: clamp(18px, 4vw, 40px);
  --hairline: rgba(30, 33, 26, 0.08);
}

/* ── base ─────────────────────────────────────────────────────────── */

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  letter-spacing: -0.02em;
}
h1 { font-weight: 500; }
h2 { letter-spacing: -0.022em; }
p  { text-wrap: pretty; }

a          { color: var(--color-accent); text-decoration: none; }
a:hover    { color: var(--color-accent-700); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--color-accent-700);
  outline-offset: 2px;
}

::selection { background: var(--color-accent-200); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(30, 33, 26, 0.22); }

.vizz-container {
  max-width: var(--page-max);
  margin: 0 auto;
  padding-inline: var(--page-pad);
}

/* content photographs — list views only, never the drawer or the reader */
.grayscale { filter: grayscale(1) contrast(1.08); }

/* ── buttons ──────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2;
  color: var(--color-text);
  background: transparent;
  border: 1px solid transparent;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  transition: background .15s ease, border-color .15s ease;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary        { background: var(--color-accent); color: var(--color-accent-ink); }
.btn-primary:hover  { background: var(--color-accent-600); }
.btn-primary:active { background: var(--color-accent-700); color: #fff; }

.btn-secondary        { border-color: var(--color-divider); }
.btn-secondary:hover  { background: rgba(var(--color-text-rgb), 0.07); }

.btn-block { width: 100%; justify-content: flex-start; text-align: left; }

/* ── pills, chips, badges ─────────────────────────────────────────── */

.vizz-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.vizz-pill:hover { border-color: var(--color-accent); }
.vizz-pill[aria-pressed="true"] {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-ink);
}

.vizz-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--color-accent-200);
  color: var(--color-accent-800);
  border: 0; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
  padding: 5px 11px;
  cursor: pointer;
}

.vizz-badge {
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--color-accent); color: var(--color-accent-ink);
  font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}

.vizz-kicker {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--color-accent-700);
}

/* ── facet checkbox ───────────────────────────────────────────────── */

.vizz-check {
  flex: none; width: 16px; height: 16px;
  border-radius: 4px;
  /* Doc 02 and the prototype's own `box()` both say 22% here, which measures
     1.57:1 against the page — under WCAG 1.4.11's 3:1 for the boundary of a
     control, and in practice the box vanished on screen. 50% is the first
     step that passes, at 3.22:1. A deliberate departure from the token. */
  border: 1px solid rgba(30, 33, 26, 0.5);
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; line-height: 1;
  color: var(--color-bg);
}
:checked + .vizz-check,
.vizz-check[data-on] {
  background: var(--color-accent);
  border-color: var(--color-accent-600);
}

/* ── metadata table (drawer 12.5px / panel 14px) ──────────────────── */

.vizz-meta { width: 100%; border-collapse: collapse; font-size: 14px; }
.vizz-meta th {
  text-align: left; vertical-align: top;
  padding: 0 20px 14px 0;
  font-family: var(--font-body); font-weight: 400; font-size: 13px;
  color: rgba(var(--color-text-rgb), 0.45);
  white-space: nowrap;
}
.vizz-meta td { padding: 0 0 14px; vertical-align: top; text-wrap: pretty; }

.vizz-meta--compact { font-size: 12.5px; }
.vizz-meta--compact th { padding: 0 16px 11px 0; font-size: 12.5px; }
.vizz-meta--compact td { padding: 0 0 11px; }

/* ── drawer ───────────────────────────────────────────────────────── */

@keyframes vizzDrawerIn     { from { transform: translateX(102%); } to { transform: translateX(0); } }
@keyframes vizzScrimIn      { from { opacity: 0; } to { opacity: 1; } }
@keyframes vizzDrawerBodyIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.vizz-scrim {
  position: fixed; inset: 0;
  background: rgba(32, 30, 29, 0.24);
  z-index: 55;
  animation: vizzScrimIn .28s ease both;
}
.vizz-drawer {
  position: fixed; top: 0; right: 0;
  height: 100vh; width: min(420px, 92vw);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  z-index: 56;
  padding: 26px 28px 48px;
  animation: vizzDrawerIn .34s cubic-bezier(.22, .72, .18, 1) both;
}
.vizz-drawer__body { animation: vizzDrawerBodyIn .4s .1s cubic-bezier(.22, .72, .18, 1) both; }

@media (max-width: 899px) { .vizz-drawer { width: 100vw; } }

@media (prefers-reduced-motion: reduce) {
  .vizz-scrim, .vizz-drawer, .vizz-drawer__body { animation: none; }
}
