/* Indigenous Court Guide BC
   Editorial print direction: warm paper, ink-forward type, hairline rules,
   letterpress buttons, numbered ledger rows. Fraunces for display,
   Atkinson Hyperlegible for body. Calm, readable, phone-first. */

:root {
  --paper: #FAF6EF;
  --paper-2: #F3EDE0;
  --ink: #26221B;
  --ink-deep: #211D16;
  --ink-soft: #5A523E;
  --river: #1C4B5A;
  --river-deep: #123641;
  --cedar: #A6491F;
  --cedar-deep: #86391A;
  --sand: #E7DCC8;
  --rule: #D9CDB2;
  --sand-deep: #C9B892;
  --card: #FFFDF8;
  --cream: #F1EADB;
  --focus: #A6491F;
  --wrap: 74rem;
  --measure: 66ch;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Type ---------- */

h1, h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin: 0 0 0.55em;
}

h1 { font-size: clamp(2.4rem, 6vw, 3.8rem); max-width: 20ch; }

h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.3rem);
  line-height: 1.15;
  max-width: 30ch;
  padding-top: 1rem;
  position: relative;
}

h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0.72rem;
  height: 0.72rem;
  border: 2.5px solid var(--cedar);
  border-radius: 50%;
}

.page-head h1 + .lead, h1 + .lead { margin-top: 0.4rem; }

h3, h4 {
  font-weight: 700;
  line-height: 1.3;
  margin: 2rem 0 0.5rem;
  font-size: 1.2rem;
}

p, ul, ol { margin: 0 0 1.1rem; }

.prose { max-width: var(--measure); }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: 0.5rem; }

.lead {
  font-size: clamp(1.2rem, 2.4vw, 1.4rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 56ch;
}

.kicker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cedar);
  margin: 0 0 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.kicker::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--cedar);
  flex: none;
}

::selection { background: rgba(166, 73, 31, 0.2); }

.muted { color: var(--ink-soft); }
.small { font-size: 0.95rem; }

.edition {
  margin-top: 1.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

a {
  color: var(--river);
  text-decoration: underline;
  text-decoration-color: var(--sand-deep);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--cedar-deep);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

em, cite { font-style: italic; }

/* ---------- Layout ---------- */

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

.section { padding-block: clamp(3.25rem, 8vw, 6rem); }

.section-tint {
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 1rem; color: var(--paper); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 3px 0 -2px var(--rule);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.22rem;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--cedar-deep); }
.brand svg { flex: none; }

.site-nav ul {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 1.7rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-block;
  padding: 0.5rem 0.1rem;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover { color: var(--cedar-deep); }

.site-nav a[aria-current="page"] {
  color: var(--cedar-deep);
  border-bottom-color: var(--cedar);
}

.site-nav .mobile-extra { display: none; }

.menu-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  min-height: 44px;
}

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    display: none;
    box-shadow: 0 18px 34px rgba(38, 34, 27, 0.12);
    max-height: calc(100vh - 4.5rem);
    overflow-y: auto;
  }
  .site-nav.open { display: block; }
  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0 0.9rem;
  }
  .site-nav a {
    display: block;
    padding: 0.8rem clamp(1.25rem, 5vw, 3rem);
    border-bottom: none;
    border-left: 3px solid transparent;
    font-size: 0.85rem;
  }
  .site-nav a[aria-current="page"] { border-left-color: var(--cedar); background: var(--paper-2); }
  .site-nav .mobile-extra { display: block; }
  .site-nav li:not(.mobile-extra) + li.mobile-extra {
    border-top: 1px solid var(--rule);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }
  .site-nav .mobile-extra a {
    text-transform: none;
    letter-spacing: 0;
    font-size: 1rem;
    font-weight: 400;
    padding-block: 0.6rem;
  }
}

/* ---------- Process subnav ---------- */

.subnav {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.subnav ul {
  list-style: none;
  display: flex;
  gap: clamp(0.9rem, 2vw, 1.6rem);
  margin: 0;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.subnav ul::-webkit-scrollbar { display: none; }

.subnav a {
  display: inline-block;
  white-space: nowrap;
  padding: 0.75rem 0.1rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
}

.subnav a:hover { color: var(--cedar-deep); }

.subnav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--cedar);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(4rem, 10vw, 7.5rem);
  border-bottom: 1px solid var(--rule);
  background:
    radial-gradient(58rem 32rem at 15% -5%, rgba(166, 73, 31, 0.07), transparent 62%),
    radial-gradient(46rem 30rem at 90% 105%, rgba(28, 75, 90, 0.06), transparent 60%);
}

.hero-inner { position: relative; z-index: 1; }

.hero .lead { margin-top: 0.5rem; }

.hero-mark {
  position: absolute;
  right: clamp(-8rem, -6vw, -3rem);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(300px, 40vw, 560px);
  height: auto;
  color: var(--ink);
  opacity: 0.055;
  pointer-events: none;
  z-index: 0;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero .kicker,
.hero h1,
.hero .lead,
.hero .btn-row,
.hero .edition { animation: rise 0.6s ease both; }
.hero h1 { animation-delay: 0.07s; }
.hero .lead { animation-delay: 0.14s; }
.hero .btn-row { animation-delay: 0.21s; }
.hero .edition { animation-delay: 0.3s; }

/* ---------- Buttons ---------- */

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.7rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1.5px solid var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn:hover { background: var(--cedar-deep); border-color: var(--cedar-deep); color: var(--paper); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover { background: transparent; color: var(--cedar-deep); border-color: var(--cedar-deep); transform: translateY(-1px); }

/* ---------- Cards: editorial index panels ---------- */

.card-grid {
  display: grid;
  gap: 2rem clamp(1.2rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(15.5rem, 100%), 1fr));
  margin-top: 2.4rem;
}

.card {
  background: transparent;
  border-top: 2px solid var(--ink);
  padding: 1.1rem 0 0;
  transition: border-color 0.2s ease;
}
.card:hover { border-top-color: var(--cedar); }

.card h3 { margin-top: 0; font-size: 1.12rem; }
.card p { margin-bottom: 0.6rem; font-size: 1rem; }
.card .tel {
  display: inline-block;
  font-weight: 700;
  font-size: 1.08rem;
}
.card .btn { margin: 0.4rem 0 0.55rem; }

/* ---------- Steps: numbered ledger ---------- */

.steps {
  list-style: none;
  counter-reset: step;
  margin: 2.4rem 0 0;
  padding: 0;
  max-width: 52rem;
  border-bottom: 1px solid var(--rule);
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 3.6rem 1fr;
  gap: 0.4rem 1.2rem;
  align-items: start;
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0 1.4rem;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  grid-row: 1 / span 3;
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--cedar);
  border-radius: 50%;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: 1.02rem;
  line-height: 1;
  color: var(--cedar);
  margin-top: 0.1rem;
}

.steps h3 { margin: 0 0 0.3rem; font-size: 1.18rem; grid-column: 2; }
.steps p { margin: 0 0 0.5rem; font-size: 1.02rem; grid-column: 2; max-width: 58ch; }
.steps a { grid-column: 2; justify-self: start; font-size: 0.98rem; font-weight: 700; }

@media (max-width: 560px) {
  .steps li { grid-template-columns: 3rem 1fr; }
  .steps li::before { width: 2.3rem; height: 2.3rem; font-size: 0.88rem; }
}

/* ---------- Image placeholders: figure slots ---------- */

.image-placeholder {
  margin: 2.4rem 0;
  border: 1px solid var(--rule);
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(38, 34, 27, 0.035) 14px 15px),
    var(--paper-2);
  border-radius: 14px;
  min-height: 230px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 0.4rem;
  padding: 2.4rem 1.5rem;
  color: var(--ink-soft);
}

.image-placeholder::before {
  content: "Figure to come";
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cedar);
}

.image-placeholder p { margin: 0; font-size: 0.98rem; max-width: 46ch; }
.image-placeholder .alt-note { font-size: 0.88rem; opacity: 0.85; }
.image-placeholder svg { margin-bottom: 0.3rem; opacity: 0.65; }

/* ---------- Photo figures and the map ---------- */

.photo-figure {
  margin: 2.4rem 0;
  max-width: 46rem;
}

.photo-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 14px;
}

.photo-figure figcaption,
.map-figure figcaption {
  padding-top: 0.6rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  max-width: 60ch;
}

.map-figure {
  margin: 2.4rem 0;
  max-width: 34rem;
}

.map-figure svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- On-this-page index ---------- */

.toc {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1.2rem 0 1.3rem;
  margin: 2.2rem 0 2.6rem;
  max-width: var(--measure);
  counter-reset: tocn;
}

.toc h2 {
  font-family: "Atkinson Hyperlegible", Georgia, serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  margin: 0 0 0.7rem;
  padding-top: 0;
}
.toc h2::before { display: none; }

.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }

.toc li {
  counter-increment: tocn;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}

.toc li::before {
  content: counter(tocn, decimal-leading-zero);
  font-family: "Fraunces", Georgia, serif;
  font-size: 0.85rem;
  color: var(--cedar);
  flex: none;
}

.toc a { font-weight: 700; font-size: 1rem; text-decoration-color: transparent; }
.toc a:hover { text-decoration-color: currentColor; }

/* ---------- Callout ---------- */

.callout {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--cedar);
  border-radius: 0 14px 14px 0;
  padding: 1.3rem 1.5rem;
  margin: 2rem 0;
  max-width: var(--measure);
}
.callout p { margin-bottom: 0.5rem; }
.callout p:last-child { margin-bottom: 0; }
.callout ul { margin-bottom: 0; padding-left: 1.3rem; }

/* ---------- Page header block ---------- */

.page-head { padding-block: clamp(3.25rem, 7vw, 5rem) clamp(1.25rem, 3vw, 2rem); }
.page-head .lead { margin-top: 0.4rem; }

/* ---------- Ornament ---------- */

.dots-divider {
  display: flex;
  justify-content: center;
  padding-block: 0.5rem;
  color: var(--sand-deep);
}

/* ---------- Crisis band ---------- */

.crisis {
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
  padding-block: 2.75rem;
}

.crisis h2 { font-size: 1.35rem; margin-bottom: 0.4rem; }

.crisis p { max-width: var(--measure); margin-bottom: 1.1rem; }

.crisis ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 2.4rem;
}

.crisis li { font-size: 1rem; }
.crisis .tel { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ink-deep);
  color: var(--cream);
  padding-block: 3.25rem 2rem;
  font-size: 0.98rem;
}

.site-footer a { color: #fff; text-decoration-color: rgba(255, 255, 255, 0.35); }
.site-footer a:hover { color: #fff; text-decoration-color: #fff; }

.site-footer > .wrap > p { max-width: 76ch; }

.footer-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.7rem;
  margin: 1.4rem 0;
  padding: 1.2rem 0;
  border-top: 1px solid rgba(241, 234, 219, 0.18);
  border-bottom: 1px solid rgba(241, 234, 219, 0.18);
}

.footer-links a {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
}
.footer-links a:hover { text-decoration: underline; }

.footer-note {
  padding-top: 0.4rem;
  color: rgba(241, 234, 219, 0.75);
  font-size: 0.88rem;
}

/* legacy hook, unused */
.footer-grid { display: grid; gap: 2rem; }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; margin: 2.2rem 0; }

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 40rem;
  font-size: 1rem;
}

caption { caption-side: top; }

th, td {
  text-align: left;
  padding: 0.85rem 1rem 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

th {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--ink);
}

tr:last-child td { border-bottom: 1px solid var(--rule); }

/* ---------- Glossary ---------- */

dl.glossary { max-width: var(--measure); }
dl.glossary dt {
  font-weight: 700;
  margin-top: 1.5rem;
  font-size: 1.08rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
dl.glossary dd { margin: 0.25rem 0 0; padding-left: 0; }

/* ---------- Per-page sources ---------- */

.page-sources {
  border-top: 1px solid var(--rule);
  margin-top: 2.25rem;
  padding-top: 1.4rem;
  padding-bottom: 2.75rem;
  max-width: var(--measure);
}

.page-sources h2 {
  font-family: "Atkinson Hyperlegible", Georgia, serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
  padding-top: 0;
}
.page-sources h2::before { display: none; }

.page-sources ul { list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }
.page-sources li { margin-bottom: 0.35rem; }

/* ---------- Scroll reveal (classes added by JS only) ---------- */

.reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Print (site pages) ---------- */

@media print {
  .site-header, .subnav, .crisis, .site-footer, .btn-row, .menu-toggle, .skip-link { display: none; }
  body { background: #fff; color: #000; font-size: 12pt; }
  a { color: #000; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
