/* ==========================================================================
   Cayman Islands Legislation & Treaties — single hand-written stylesheet.

   Design brief: a refined, modern legal-research tool. Quality serif for
   legislation BODY text; clean sans for UI/nav; generous whitespace; strong
   hierarchy; a restrained palette (ink / warm "paper" / one burgundy accent);
   subtle dark mode. NO webfont download — a high-quality system font stack
   keeps first paint instant. One file, no framework.
   ========================================================================== */

:root {
  /* Light "paper" theme ---------------------------------------------------- */
  --ink:         #1c1a17;   /* near-black warm text  */
  --ink-soft:    #423d36;
  --muted:       #6f685d;
  --faint:       #958f83;
  --paper:       #f7f4ee;   /* warm off-white page   */
  --surface:     #fffdf9;   /* cards / reader        */
  --surface-2:   #f1ece3;   /* sunken / sidebars     */
  --rule:        #e4ddd0;
  --rule-soft:   #efe9dd;
  --accent:      #7a1f2b;   /* deep burgundy         */
  --accent-2:    #9a3340;
  --accent-tint: #f6e9eb;
  --link:        #7a1f2b;
  --link-hover:  #a52a39;
  --shadow:      0 1px 2px rgba(28,26,23,.04), 0 8px 24px rgba(28,26,23,.05);
  --shadow-soft: 0 1px 2px rgba(28,26,23,.04);

  /* Status system (Precept #1 — current vs non-current must never confuse) */
  --ok:        #1d6f3b;   --ok-tint:      #e6f2ea;   --ok-line:   #bbe0c7;
  --warn:      #a23012;   --warn-tint:    #fbeae2;   --warn-line: #f0c6b1;
  --pending:   #8a6410;   --pending-tint: #f8efd6;   --pending-line:#e7d29a;
  --neutral:   #6f685d;   --neutral-tint: #ede8df;   --neutral-line:#dcd5c8;

  /* Type */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Source Serif 4",
           "Charter", Georgia, Cambria, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
           Arial, "Inter", system-ui, sans-serif;
  --mono:  ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, monospace;

  --maxw: 1180px;
  --reader-measure: 38rem;
  --radius: 8px;
  --radius-sm: 5px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:         #ece6db;
    --ink-soft:    #cfc8bb;
    --muted:       #9c9486;
    --faint:       #7c7568;
    --paper:       #16140f;
    --surface:     #201d17;
    --surface-2:   #1a1812;
    --rule:        #33302a;
    --rule-soft:   #2a2722;
    --accent:      #e3909a;
    --accent-2:    #eaa3ac;
    --accent-tint: #2c1f22;
    --link:        #e7a0a9;
    --link-hover:  #f0b6bd;
    --shadow:      0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    --shadow-soft: 0 1px 2px rgba(0,0,0,.3);
    --ok:        #6cc389;   --ok-tint:      #16241a;   --ok-line:   #2f5138;
    --warn:      #e88a63;   --warn-tint:    #2a1a12;   --warn-line: #5a3322;
    --pending:   #d6b65a;   --pending-tint: #271f0e;   --pending-line:#574818;
    --neutral:   #9c9486;   --neutral-tint: #221f19;   --neutral-line:#3a362f;
  }
}

/* Reset ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.ui { font-family: var(--sans); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
@media (max-width: 640px) { .wrap { padding: 0 18px; } }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 28px 0; }
::selection { background: var(--accent-tint); }

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-head {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 50;
}
.site-head .wrap { display: flex; align-items: center; gap: 30px; height: 62px; }
.brand { display: flex; flex-direction: column; line-height: 1.05; text-decoration: none; }
.brand .brand-name {
  font-family: var(--serif); font-weight: 700; font-size: 19px;
  color: var(--ink); letter-spacing: .005em;
}
.brand .brand-sub {
  font-family: var(--sans); font-weight: 600; font-size: 9.5px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
  margin-top: 3px;
}
.nav-links { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav-links a {
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  text-decoration: none; color: var(--ink-soft);
  padding: 7px 13px; border-radius: 6px; transition: background .12s, color .12s;
}
.nav-links a:hover { background: var(--surface-2); color: var(--ink); }
.nav-links a.active { color: var(--accent); font-weight: 600; }
.nav-links a.active:hover { background: var(--accent-tint); }
@media (max-width: 760px) {
  .site-head .wrap { gap: 14px; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 7px 9px; font-size: 13px; }
  .brand .brand-name { font-size: 17px; }
}

main { padding: 40px 0 72px; }

/* ==========================================================================
   Typographic primitives
   ========================================================================== */
h1.page-title { font-family: var(--serif); font-size: 2.05rem; line-height: 1.12; letter-spacing: -.01em; margin: 0 0 10px; font-weight: 700; }
.lead { font-family: var(--sans); font-size: 15px; color: var(--muted); margin: 0 0 4px; max-width: 64ch; }
.eyebrow { font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.count { font-family: var(--sans); font-size: 13px; color: var(--muted); }

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  text-decoration: none; padding: 9px 18px; border-radius: 7px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  cursor: pointer; transition: background .12s, border-color .12s, transform .04s;
}
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary:hover { background: var(--accent-tint); color: var(--accent); }
.btn.ghost { background: var(--surface); color: var(--ink-soft); border-color: var(--rule); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--rule); }
.btn.sm { padding: 6px 12px; font-size: 13px; }

input[type=text], input[type=search], input[type=date], select, textarea {
  font-family: var(--sans); font-size: 14px; padding: 9px 12px; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 7px; background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
a:focus-visible { border-radius: 3px; }
::placeholder { color: var(--faint); }

/* ==========================================================================
   Status badges & banners (Precept #1)
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 9px 3px 8px; border-radius: 100px; border: 1px solid transparent;
  vertical-align: middle; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.status-in_force     { background: var(--ok-tint);      color: var(--ok);      border-color: var(--ok-line); }
.badge.status-repealed,
.badge.status-revoked      { background: var(--warn-tint);    color: var(--warn);    border-color: var(--warn-line); }
.badge.status-not_in_force,
.badge.status-bill         { background: var(--pending-tint); color: var(--pending); border-color: var(--pending-line); }
.badge.status-spent        { background: var(--neutral-tint); color: var(--neutral); border-color: var(--neutral-line); }
.badge.status-unknown      { background: var(--neutral-tint); color: var(--neutral); border-color: var(--neutral-line); }
.badge.quality-verified    { background: var(--surface-2);    color: var(--ok);      border-color: var(--ok-line); }
.badge.quality-review      { background: var(--pending-tint); color: var(--pending); border-color: var(--pending-line); }
.badge.quality-issue       { background: var(--warn-tint);    color: var(--warn);    border-color: var(--warn-line); }
.badge.quality-pending,
.badge.quality-unknown     { background: var(--neutral-tint); color: var(--neutral); border-color: var(--neutral-line); }

.chip {
  display: inline-block; font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--rule); border-radius: 5px; padding: 2px 8px; vertical-align: middle;
}

.banner {
  font-family: var(--sans); font-size: 14.5px; line-height: 1.5;
  padding: 13px 16px; border-radius: var(--radius-sm); margin: 16px 0;
  display: flex; gap: 11px; align-items: flex-start;
  border: 1px solid transparent;
}
.banner .ico { font-size: 16px; line-height: 1.3; flex: none; }
.banner.current { background: var(--ok-tint);      border-color: var(--ok-line);      color: var(--ok); }
.banner.warn    { background: var(--warn-tint);    border-color: var(--warn-line);    color: var(--warn);    font-weight: 600; }
.banner.pending { background: var(--pending-tint); border-color: var(--pending-line); color: var(--pending); }
.banner.asof    { background: var(--accent-tint);  border-color: color-mix(in srgb,var(--accent) 35%, transparent); color: var(--accent); font-weight: 600; }
.banner.info    { background: var(--surface-2);    border-color: var(--rule);         color: var(--ink-soft); }
.banner strong { font-weight: 700; }

/* ==========================================================================
   Cards & list rows
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--shadow-soft);
}
.card.pad { padding: 22px 24px; }

.doc-list { margin-top: 8px; }
.doc-row {
  padding: 15px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; transition: background .12s, border-color .12s;
}
.doc-row + .doc-row { border-top: 1px solid var(--rule-soft); }
.doc-row:hover { background: var(--surface); border-color: var(--rule); }
.doc-row .row-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.doc-row a.title {
  font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.25;
  text-decoration: none; color: var(--ink);
}
.doc-row a.title:hover { color: var(--accent); }
.doc-row .meta { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-top: 5px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.doc-row .meta .dot { color: var(--faint); }
.doc-row.child { margin-left: 18px; border-left: 2px solid var(--rule); padding-left: 18px; }
.doc-row.child.depth-2 { margin-left: 34px; }
.doc-row.child.depth-3 { margin-left: 50px; }
.doc-row.child a.title { font-size: 16.5px; font-weight: 500; font-style: italic; }
.relation-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--muted);
}
.child-wrap { margin: 2px 0 6px; }
.child-disclosure {
  margin: -2px 0 8px 16px;
  font-family: var(--sans);
}
.child-disclosure.depth-1 { margin-left: 34px; }
.child-disclosure.depth-2 { margin-left: 50px; }
.child-disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  list-style: none;
}
.child-disclosure > summary::-webkit-details-marker { display: none; }
.child-disclosure > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .12s ease;
}
.child-disclosure[open] > summary::before { transform: rotate(45deg); }
.child-disclosure > summary:hover {
  color: var(--accent);
  background: var(--surface-2);
  border-color: var(--rule-soft);
}
.child-disclosure > summary:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.child-disclosure-label { white-space: nowrap; }

/* ==========================================================================
   Browse layout
   ========================================================================== */
.split { display: grid; grid-template-columns: 232px 1fr; gap: 44px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 26px; } }

.filters { font-family: var(--sans); position: sticky; top: 82px; }
.filters .group { margin-bottom: 22px; }
.filters h4 { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 0 0 9px; font-weight: 700; }
.filters a { display: flex; justify-content: space-between; gap: 8px; text-decoration: none; padding: 4px 8px; margin: 0 -8px; border-radius: 6px; color: var(--ink-soft); font-size: 13.5px; }
.filters a:hover { background: var(--surface-2); color: var(--ink); }
.filters a.sel { color: var(--accent); font-weight: 600; background: var(--accent-tint); }
.filters a .n { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 12px; }

.typeahead { position: relative; }
.typeahead input { width: 100%; }
.typeahead .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--faint); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px; display: none; }

/* Preloaded "Find any title" dropdown (app.js initFindBox). Anchored to the
   .typeahead form (position:relative); appears just below the input. */
.find-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 60;
  margin-top: 6px; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 5px; font-family: var(--sans);
}
.find-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 7px 9px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink); line-height: 1.35;
}
.find-item:hover, .find-item.active { background: var(--accent-tint); }
.find-item.active { outline: 1px solid var(--accent); outline-offset: -1px; }
.find-title { font-size: 13.5px; font-weight: 500; }
.find-tag {
  flex: 0 0 auto; font-size: 11px; letter-spacing: .02em; color: var(--faint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* Corpus separation: treaties get a distinct accent so they're easy to tell
   apart from legislation in a merged list (and easy to drop later). */
.find-item.is-treaty .find-tag { color: var(--accent-2); font-weight: 600; }
/* Core Precept #1: never let non-current material pass as current law. */
.find-item.is-noncurrent .find-title { color: var(--muted); }
.find-item.is-noncurrent .find-title::after {
  content: " · not current"; color: var(--faint); font-size: 11px; font-weight: 400;
}
.find-empty { padding: 10px 11px; color: var(--muted); font-size: 13px; font-family: var(--sans); }

.toggle-row { display: flex; gap: 6px; flex-wrap: wrap; font-family: var(--sans); }
.seg {
  display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--surface);
}
.seg a { font-family: var(--sans); font-size: 13px; font-weight: 500; text-decoration: none; color: var(--ink-soft); padding: 7px 14px; border-right: 1px solid var(--rule); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--accent); color: #fff; }
.seg a:not(.on):hover { background: var(--surface-2); }

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination { font-family: var(--sans); font-size: 13.5px; display: flex; gap: 6px; align-items: center; margin-top: 30px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 7px 12px; border: 1px solid var(--rule); border-radius: 7px; text-decoration: none; color: var(--ink-soft); min-width: 38px; text-align: center; }
.pagination a:hover { background: var(--surface-2); color: var(--ink); }
.pagination .cur { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

/* ==========================================================================
   Document reader
   ========================================================================== */
.doc-head { margin-bottom: 6px; }
.breadcrumb { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-bottom: 18px; display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.breadcrumb a { text-decoration: none; color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--faint); }

.doc-title-row { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.doc-title-row h1 { flex: 1 1 auto; margin-bottom: 6px; }
.doc-meta { font-family: var(--sans); font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.doc-meta .dot { color: var(--faint); }

.reader-grid { display: grid; grid-template-columns: 264px 1fr; gap: 48px; align-items: start; margin-top: 26px; }
@media (max-width: 940px) { .reader-grid { grid-template-columns: 1fr; gap: 24px; } }

/* Sticky table of contents */
.toc { position: sticky; top: 82px; font-family: var(--sans); max-height: calc(100vh - 104px); overflow-y: auto; padding-right: 6px; }
.toc h4 { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 0 0 10px; font-weight: 700; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { line-height: 1.3; }
.toc a {
  display: block; text-decoration: none; color: var(--muted);
  font-size: 13px; padding: 5px 10px; border-left: 2px solid var(--rule-soft);
  border-radius: 0 4px 4px 0; transition: color .12s, border-color .12s, background .12s;
}
.toc a:hover { color: var(--ink); background: var(--surface-2); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; background: var(--accent-tint); }
.toc a .tn { font-variant-numeric: tabular-nums; color: var(--faint); margin-right: 7px; }
.toc a.active .tn { color: var(--accent); }
.toc a.is-part { font-weight: 700; color: var(--ink-soft); margin-top: 8px; border-left-color: transparent; text-transform: uppercase; font-size: 11px; letter-spacing: .07em; }
.toc a.is-part:first-child { margin-top: 0; }
@media (max-width: 940px) {
  .toc { position: static; max-height: none; border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; background: var(--surface); }
  details.toc-mobile > summary { cursor: pointer; font-family: var(--sans); font-weight: 600; }
}

/* Reader body */
.reader { min-width: 0; }
.akn-doc { font-family: var(--serif); font-size: 1.075rem; line-height: 1.72; color: var(--ink-soft); }
.akn-doc .akn-part { margin: 40px 0 8px; }
.akn-doc .akn-part:first-child { margin-top: 0; }
.akn-part-head {
  font-family: var(--sans); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); padding-bottom: 8px; border-bottom: 2px solid var(--accent-tint); margin: 0 0 14px;
}
.akn-part-head .akn-heading { text-transform: none; letter-spacing: 0; font-weight: 700; color: var(--ink); }
.akn-sec { scroll-margin-top: 78px; padding: 8px 0 4px; }
.akn-sec + .akn-sec { border-top: 1px solid var(--rule-soft); margin-top: 18px; padding-top: 22px; }
.akn-sec-head { font-family: var(--serif); font-size: 1.18rem; font-weight: 700; line-height: 1.3; color: var(--ink); margin: 0 0 10px; }
.akn-sec-head .akn-num { color: var(--accent); font-variant-numeric: tabular-nums; }
.akn-anchor { font-family: var(--sans); color: var(--faint); text-decoration: none; opacity: 0; margin-left: -22px; padding-right: 8px; font-weight: 400; }
.akn-sec:hover .akn-anchor, .akn-sec:focus-within .akn-anchor { opacity: 1; }
.akn-anchor:hover { color: var(--accent); }
.akn-sec-body .akn-p { margin: 0 0 13px; max-width: 40rem; }
.akn-sec-body .akn-clause { padding-left: 1.6em; text-indent: -1.6em; }
.akn-schedule .akn-sec-head { color: var(--muted); text-transform: uppercase; font-size: 1rem; letter-spacing: .06em; }
.akn-intro .akn-p { color: var(--muted); font-size: .98rem; }

.placeholder { font-family: var(--sans); color: var(--muted); background: var(--surface-2); border: 1px dashed var(--rule); border-radius: var(--radius); padding: 22px 24px; font-style: normal; }

/* Aside: PDF + timeline + asof */
.aside-block { margin-bottom: 30px; }
.aside-label { font-family: var(--sans); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: 11px; font-weight: 700; }

.asof-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-family: var(--sans); font-size: 13.5px; }
.asof-form label { font-weight: 600; color: var(--ink-soft); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; font-family: var(--sans); }
.timeline li { position: relative; padding: 11px 0 11px 22px; border-left: 2px solid var(--rule); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li.current { border-left-color: var(--ok); }
.timeline li.sel { background: var(--accent-tint); border-radius: 0 6px 6px 0; border-left-color: var(--accent); }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--rule); border: 2px solid var(--surface); }
.timeline li.current::before { background: var(--ok); }
.timeline li.sel::before { background: var(--accent); }
.timeline .tl-label { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.timeline .tl-dates { font-size: 12px; color: var(--muted); margin-top: 2px; }
.timeline .now-tag { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ok); border: 1px solid var(--ok-line); background: var(--ok-tint); border-radius: 100px; padding: 1px 7px; margin-left: 6px; }

.pdf-card { display: block; }
.pdf-card .fname { font-family: var(--sans); font-size: 12px; color: var(--muted); margin-top: 7px; word-break: break-word; }

/* ==========================================================================
   Search
   ========================================================================== */
.search-hero { max-width: 760px; }
.search-bar { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin: 4px 0 8px; }
.search-bar input[type=search] { flex: 1 1 320px; font-size: 16px; padding: 12px 16px; }
.search-modes { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; font-family: var(--sans); margin-bottom: 14px; }
.search-modes button, .search-modes a { font-family: var(--sans); font-size: 13px; font-weight: 500; border: 0; background: var(--surface); color: var(--ink-soft); padding: 8px 16px; cursor: pointer; text-decoration: none; border-right: 1px solid var(--rule); display: inline-flex; align-items: center; gap: 6px; }
.search-modes button:last-child, .search-modes a:last-child { border-right: 0; }
.search-modes .on { background: var(--accent); color: #fff; }
.search-modes .soon { font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pending); background: var(--pending-tint); border: 1px solid var(--pending-line); border-radius: 100px; padding: 0 6px; }

.search-result { padding: 18px 0; border-bottom: 1px solid var(--rule-soft); }
.search-result .snippet { font-family: var(--serif); font-size: 15.5px; line-height: 1.6; color: var(--ink-soft); margin: 9px 0 0; max-width: 68ch; }
.search-result .snippet mark { background: var(--pending-tint); color: var(--ink); padding: 0 3px; border-radius: 3px; font-weight: 600; box-decoration-break: clone; }

/* ==========================================================================
   Home landing
   ========================================================================== */
.hero { padding: 18px 0 8px; }
.hero h1 { font-family: var(--serif); font-size: clamp(2.1rem, 5vw, 3.1rem); line-height: 1.06; letter-spacing: -.018em; margin: 0 0 16px; font-weight: 700; max-width: 16ch; }
.hero .hero-sub { font-family: var(--sans); font-size: 17px; color: var(--muted); max-width: 54ch; margin: 0 0 26px; line-height: 1.55; }
.hero-search { display: flex; gap: 10px; max-width: 560px; flex-wrap: wrap; }
.hero-search input { flex: 1 1 260px; font-size: 16px; padding: 13px 16px; }
.stat-strip { display: flex; gap: 34px; flex-wrap: wrap; margin: 30px 0 6px; padding: 20px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.stat .n { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; color: var(--ink); line-height: 1; }
.stat .l { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-top: 6px; letter-spacing: .02em; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-top: 28px; }
.tile {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 22px 22px 20px; box-shadow: var(--shadow-soft); transition: transform .12s, box-shadow .12s, border-color .12s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--rule); }
.tile .tile-k { font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.tile h3 { font-family: var(--serif); font-size: 1.25rem; margin: 9px 0 6px; color: var(--ink); font-weight: 700; }
.tile p { font-family: var(--sans); font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.5; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 44px 0 14px; }
.section-head h2 { font-family: var(--serif); font-size: 1.5rem; margin: 0; font-weight: 700; }
.section-head a { font-family: var(--sans); font-size: 13.5px; text-decoration: none; }

/* ==========================================================================
   Tables (treaty)
   ========================================================================== */
.kv { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 14.5px; }
.kv th { text-align: left; padding: 11px 18px 11px 0; color: var(--muted); font-weight: 600; white-space: nowrap; vertical-align: top; width: 1%; }
.kv td { padding: 11px 0; border-bottom: 1px solid var(--rule-soft); color: var(--ink-soft); }
.kv tr:last-child th, .kv tr:last-child td { border-bottom: 0; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-foot { border-top: 1px solid var(--rule); padding: 32px 0 44px; margin-top: 36px; font-family: var(--sans); font-size: 12.5px; color: var(--muted); background: var(--surface-2); }
.site-foot .foot-grid { display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.site-foot .rights { max-width: 62ch; line-height: 1.6; }
.site-foot strong { color: var(--ink-soft); font-weight: 600; }
.site-foot .foot-brand { font-family: var(--serif); font-weight: 700; color: var(--ink-soft); font-size: 14px; }

.notice { font-family: var(--sans); font-size: 12px; color: var(--muted); border-top: 1px solid var(--rule); margin-top: 30px; padding-top: 14px; line-height: 1.55; }

/* Utilities */
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.muted { color: var(--muted); } .nowrap { white-space: nowrap; }
.empty-state { font-family: var(--sans); color: var(--muted); text-align: center; padding: 48px 24px; }
.empty-state .big { font-size: 17px; color: var(--ink-soft); margin-bottom: 6px; }
