/* ── Fonts (self-hosted for offline/PWA use — see pwa/feature.md) ── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* ── Tokens ────────────────────────────────────────────── */
:root {
  --paper:         #FAFAF8;
  --surface:       #FFFFFF;
  --surface-sunk:  #F2F1ED;

  --ink:           #16181D;
  --ink-body:      #2A2C33;
  --ink-muted:     #6B6F76;
  --ink-faint:     #9CA0A8;

  --hairline:      #E6E5E1;
  --hairline-2:    #D5D4CF;

  --fill-ink:      #16181D;
  --on-ink:        #FAFAF8;
  --focus:         #16181D;
  --hover-tint:    rgba(22,24,29,.035);

  --header-h: 64px;
  --page-max: 1120px;
  --read-max:  680px;
  --gutter:     48px;
  --radius:     10px;
  --card-radius: 10px;
}

/* ── Base ──────────────────────────────────────────────── */
html, body { height: 100%; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── Header ────────────────────────────────────────────── */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  z-index: 100;
}

#header-left {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

#app-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

/* ── Back button ───────────────────────────────────────── */
.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 10px 16px 10px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  min-height: 44px;
  transition: color .15s;
  white-space: nowrap;
  margin-right: 8px;
}

.back-btn:hover { color: var(--ink); }
.back-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

#header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Header search button ──────────────────────────────── */
.search-icon-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 1px solid var(--hairline-2);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-muted);
  transition: color .15s, border-color .15s, background .15s;
}

.search-icon-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--hover-tint);
}

.search-icon-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── Main ──────────────────────────────────────────────── */
#app-main {
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ── Page container ────────────────────────────────────── */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 56px var(--gutter) 96px;
}

.page-header {
  margin-bottom: 40px;
}

.page-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.page-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}

.page-meta {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  margin-top: 8px;
}

/* ── Landing hero ──────────────────────────────────────── */
.landing-hero {
  margin-bottom: 48px;
}

.landing-hero .page-title {
  font-size: 42px;
}

.landing-subtitle {
  font-size: 15px;
  color: var(--ink-muted);
  margin-top: 6px;
}

/* ── Landing search ────────────────────────────────────── */
.landing-search-wrap {
  margin-top: 28px;
  position: relative;
}

.landing-search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}

#landing-search-input {
  width: 100%;
  height: 54px;
  padding: 0 20px 0 52px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

#landing-search-input::placeholder { color: var(--ink-faint); }

#landing-search-input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(22,24,29,.07);
}

.landing-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(22,24,29,.10);
  max-height: 380px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.landing-search-results.open { display: block; }

/* ── Section label (cards) ─────────────────────────────── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 16px;
  padding-top: 4px;
}

/* ── Card grid ─────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

/* ── Card ──────────────────────────────────────────────── */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--card-radius);
  padding: 20px;
  min-height: 128px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s ease, box-shadow .15s;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
  position: relative;
}

.card:hover {
  border-color: var(--hairline-2);
  background: var(--hover-tint);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(22,24,29,.06);
}

.card:active {
  background: var(--fill-ink);
  color: var(--on-ink);
  border-color: var(--fill-ink);
  transform: translateY(0);
  box-shadow: none;
}

.card:active .card-eyebrow,
.card:active .card-meta { color: rgba(250,250,248,.55); }

.card:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.card-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
  transition: color .15s;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-faint);
  margin-top: 14px;
  transition: color .15s;
}

/* ── Appendix section ──────────────────────────────────── */
.appendix-section {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
}

.appendix-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 16px;
}

.appendix-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 24px;
}

.appendix-link {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 0;
  font-size: 14px;
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 1px solid var(--hairline);
  transition: color .15s;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  font-family: inherit;
  text-align: left;
}

.appendix-link:hover { color: var(--ink); }
.appendix-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.appendix-letter {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.appendix-title {
  font-weight: 500;
  font-size: 13px;
}

/* ── Article page ──────────────────────────────────────── */
.article-page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 56px var(--gutter) 96px;
}

.article-header {
  max-width: var(--read-max);
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--hairline);
}

.article-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.article-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

.article-body {
  max-width: var(--read-max);
}

.section-block {
  margin-bottom: 36px;
  scroll-margin-top: 80px;
}

.section-heading {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}

.section-number {
  color: var(--ink-muted);
  margin-right: 8px;
  font-weight: 600;
}

.section-body {
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-body);
  white-space: pre-wrap;
}

.subsection-block {
  margin-bottom: 16px;
  padding-left: 24px;
  scroll-margin-top: 80px;
}

.subsection-body {
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-body);
  white-space: pre-wrap;
}

.subsection-number {
  font-weight: 600;
  color: var(--ink);
  margin-right: 6px;
}

/* ── Body lists ────────────────────────────────────────── */
.body-list {
  list-style: disc;
  padding-left: 2em;
  margin: 6px 0 12px;
}

.body-list--sub {
  list-style: circle;
  padding-left: 2em;
  margin: 4px 0 4px;
}

.body-list-item {
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-body);
  margin-bottom: 2px;
}

/* Search result-list and overlay styles live in search/search.css
   (the search feature folder). Only the header trigger (.search-icon-btn)
   and the landing wrapper (.landing-search-*) are styled here. */

/* ── Motion preferences ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 1099px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 759px) {
  :root { --gutter: 24px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .appendix-grid { grid-template-columns: 1fr 1fr; }
  .landing-hero .page-title { font-size: 32px; }
  .page-title { font-size: 28px; }
  .article-title { font-size: 24px; }
  .search-icon-btn span { display: none; }
  #app-title { font-size: 11px; }
}

@media (max-width: 499px) {
  .card-grid { grid-template-columns: 1fr; }
  .appendix-grid { grid-template-columns: 1fr; }
}

/* ── Interpretations: landing entry (second-tier) ──────── */
.interp-entry {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
}

.interp-entry-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--surface-sunk);
  border: 1px solid var(--hairline);
  border-radius: var(--card-radius);
  padding: 24px 28px;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s ease, box-shadow .15s;
}

.interp-entry-card:hover {
  border-color: var(--hairline-2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(22,24,29,.06);
}

.interp-entry-card:active {
  background: var(--fill-ink);
  color: var(--on-ink);
  border-color: var(--fill-ink);
  transform: translateY(0);
  box-shadow: none;
}

.interp-entry-card:active .interp-entry-eyebrow,
.interp-entry-card:active .interp-entry-meta { color: rgba(250,250,248,.6); }

.interp-entry-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.interp-entry-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.interp-entry-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.interp-entry-meta {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  margin-top: 8px;
}

/* ── Interpretations: article page ─────────────────────── */
.interp-page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 56px var(--gutter) 96px;
}

.interp-header {
  max-width: var(--read-max);
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--hairline);
}

.interp-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.interp-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

.interp-body {
  max-width: var(--read-max);
}

.interp-section-heading {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 40px 0 20px;
}

.interp-section-key {
  color: var(--ink-muted);
  margin-right: 10px;
  font-weight: 700;
}

/* ── Interpretation item ───────────────────────────────── */
.interp-item {
  padding: 20px 0 24px;
  border-bottom: 1px solid var(--hairline);
}

.interp-item:last-child { border-bottom: none; }

.interp-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.interp-item-key {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.interp-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--surface-sunk);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 2px 7px;
}

.interp-item--example .interp-badge {
  color: var(--ink);
  border-color: var(--hairline-2);
}

/* Statement items: authoritative rule declarations — bold in the PDF. */
.interp-item--statement {
  padding: 24px 0 28px;
}

.interp-item--statement .interp-badge {
  background: var(--ink);
  color: var(--on-ink);
  border-color: var(--ink);
}

.interp-item--statement .interp-situation {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.6;
}

.interp-situation {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-body);
  white-space: pre-wrap;
}

.interp-options {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.interp-options .interp-option {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-body);
  padding-left: 28px;
  text-indent: -28px;
  margin-bottom: 4px;
}

.interp-option-label {
  font-weight: 700;
  color: var(--ink);
  margin-right: 2px;
}

/* Ruling (folded interpretation of an example) — inline, no toggle. */
.interp-ruling {
  margin-top: 14px;
  padding: 14px 18px;
  background: var(--surface-sunk);
  border-left: 3px solid var(--ink);
  border-radius: 0 8px 8px 0;
}

.interp-ruling-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.interp-ruling-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-body);
  white-space: pre-wrap;
}

.interp-options--ruling { margin-top: 8px; }

/* Diagram caption placeholder (image t.b.d.). */
.interp-diagram {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 20px 0;
  padding: 28px 20px;
  background: var(--surface-sunk);
  border: 1px dashed var(--hairline-2);
  border-radius: var(--radius);
  text-align: center;
}

.interp-diagram-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.interp-diagram-caption {
  font-size: 14px;
  color: var(--ink-faint);
}

@media (prefers-reduced-motion: reduce) {
  .interp-entry-card { transition: none; }
}

@media (max-width: 759px) {
  .interp-title { font-size: 24px; }
}
