/* kingfish.css — the Kingfish brand layer shared by every Kingfish Data page.
   Tokens, fonts, and chrome (the "Kingfish | Data" bar and footer). Source of
   truth is .reference/BrandBook.md §3, §4, §10 and the live kingfish.la.

   Tools build on the --kf-* tokens; they do not redefine brand colors. Light is
   the default; dark follows the OS unless a page sets data-theme. */

/* ──────────────────────────────────────────────────────────
   SELF-HOSTED FONTS (OFL — licenses in /static/fonts)
   ────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Zilla Slab";
  src: url("/static/fonts/ZillaSlab-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/SourceSerif4-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/SourceSerif4-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/SourceSerif4-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/Inter-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/Inter-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ──────────────────────────────────────────────────────────
   TOKENS
   ────────────────────────────────────────────────────────── */

:root {
  color-scheme: light;

  /* Brand palette (fixed values — never themed) */
  --kf-bayou-brand: #1f3d2e;
  --kf-brass-brand: #b5894c;

  /* Themed roles */
  --kf-bayou: #1f3d2e; /* primary: links, buttons, headers */
  --kf-bayou-alt: #2a5443; /* primary hover */
  --kf-delta: #8b1f2f; /* alerts, tags, ICE / detention flags */
  --kf-brass: #b5894c; /* editorial accent & focus ring — never text */
  --kf-brass-ink: #8f6526; /* darkened brass, 4.5:1 — the only brass for text/marks */
  --kf-ink: #0e1116;
  --kf-fog: #6b7178;
  --kf-parchment: #f5efe3;
  --kf-paper: #ffffff;
  --kf-light: #edeae2;
  --kf-on-primary: #f5efe3; /* text on a Bayou fill */
  --kf-hair: rgba(31, 61, 46, 0.14);

  --kf-font-display: "Zilla Slab", "Bitter", "Roboto Slab", Georgia, serif;
  --kf-font-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --kf-font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --kf-font-mono: "JetBrains Mono", "SF Mono", Consolas, "Roboto Mono", monospace;

  --kf-text-display: 3rem;
  --kf-text-h1: 2.625rem;
  --kf-text-h2: 1.875rem;
  --kf-text-h3: 1.375rem;
  --kf-text-lede: 1.25rem;
  --kf-text-body: 1.125rem;
  --kf-text-small: 0.9375rem;
  --kf-text-micro: 0.8125rem;

  --kf-radius-sm: 4px;
  --kf-radius-md: 8px;
  --kf-measure: 68ch;
  --kf-max: 72rem;
}

/* Dark: Ink canvas, lighter Bayou for AA; Brass and Delta per BrandBook §3,
   with Delta lifted so it still reads as text on Ink. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --kf-bayou: #4f8b6c;
    --kf-bayou-alt: #5fa07d;
    --kf-delta: #e0606f;
    --kf-brass-ink: #c9a063;
    --kf-ink: rgba(245, 239, 227, 0.92);
    --kf-fog: #9ba1a8;
    --kf-parchment: #1a1d22;
    --kf-paper: #0e1116;
    --kf-light: #262a30;
    --kf-on-primary: #0e1116;
    --kf-hair: rgba(245, 239, 227, 0.12);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --kf-bayou: #4f8b6c;
  --kf-bayou-alt: #5fa07d;
  --kf-delta: #e0606f;
  --kf-brass-ink: #c9a063;
  --kf-ink: rgba(245, 239, 227, 0.92);
  --kf-fog: #9ba1a8;
  --kf-parchment: #1a1d22;
  --kf-paper: #0e1116;
  --kf-light: #262a30;
  --kf-on-primary: #0e1116;
  --kf-hair: rgba(245, 239, 227, 0.12);
}

/* ──────────────────────────────────────────────────────────
   BASE
   ────────────────────────────────────────────────────────── */

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.kf-skip {
  position: absolute;
  top: -9999px;
  left: 1rem;
  z-index: 3000;
  background: var(--kf-bayou);
  color: var(--kf-on-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--kf-radius-md);
  font: 600 var(--kf-text-small) / 1.4 var(--kf-font-sans);
  text-decoration: none;
}
.kf-skip:focus {
  top: 0.75rem;
}

/* ──────────────────────────────────────────────────────────
   BAR — "Kingfish | Data" lockup + tool nav
   ────────────────────────────────────────────────────────── */

.kf-bar {
  background: var(--kf-paper);
  border-bottom: 1px solid var(--kf-light);
  font-family: var(--kf-font-sans);
}

.kf-bar__inner {
  max-width: var(--kf-max);
  margin: 0 auto;
  padding: 0.6rem clamp(12px, 3vw, 28px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.kf-bar--full .kf-bar__inner {
  max-width: none;
}

.kf-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--kf-bayou);
  text-decoration: none;
}

/* Official Horizontal lockup (media.kingfish.la/SVG/Horizontal.svg), inlined
   so the type uses the self-hosted Zilla Slab and can reverse on dark. */
.kf-logo {
  display: block;
  flex: none;
  height: 26px;
  width: auto;
  aspect-ratio: 1378 / 278;
  color: var(--kf-bayou-brand);
  overflow: visible;
}

.kf-logo__type {
  font-family: "Zilla Slab", "Bitter", "Roboto Slab", Georgia, serif;
  font-size: 290.9px;
  font-weight: 700;
  fill: currentColor;
}

.kf-sub {
  padding-left: 0.6rem;
  border-left: 1px solid var(--kf-hair);
  font-size: var(--kf-text-micro);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--kf-ink);
}

/* Reverse lockup on dark: Parchment body and wordmark, Brass corner unchanged. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .kf-logo {
    color: #f5efe3;
  }
}
:root[data-theme="dark"] .kf-logo {
  color: #f5efe3;
}

.kf-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kf-nav a {
  display: block;
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid transparent;
  font-size: var(--kf-text-small);
  font-weight: 500;
  color: var(--kf-ink);
  text-decoration: none;
}

.kf-nav a:hover,
.kf-nav a[aria-current="page"] {
  color: var(--kf-bayou);
  border-bottom-color: var(--kf-bayou);
}

.kf-nav__out::after {
  content: " ↗";
  font-size: 0.85em;
}

/* ──────────────────────────────────────────────────────────
   COMPONENTS shared across tools
   ────────────────────────────────────────────────────────── */

/* Section tag — micro caps on Bayou (BrandBook §5) */
.kf-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--kf-radius-sm);
  background: var(--kf-bayou);
  color: var(--kf-on-primary);
  font: 600 var(--kf-text-micro) / 1.4 var(--kf-font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.kf-tag--delta {
  background: var(--kf-delta);
  color: #fff;
}

/* ──────────────────────────────────────────────────────────
   FOOTER
   ────────────────────────────────────────────────────────── */

.kf-foot {
  margin-top: 3rem;
  background: var(--kf-parchment);
  border-top: 1px solid var(--kf-light);
  color: var(--kf-ink);
  font-family: var(--kf-font-sans);
}

.kf-foot__inner {
  max-width: var(--kf-max);
  margin: 0 auto;
  padding: 2rem clamp(12px, 3vw, 28px) 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem 3rem;
}

.kf-foot__name {
  margin: 0 0 0.3rem;
  font: 700 1.1rem / 1.2 var(--kf-font-display);
  color: var(--kf-bayou);
}

.kf-foot__sub {
  margin: 0 0 0.35rem;
  font-size: var(--kf-text-small);
}

.kf-foot__principle {
  margin: 0;
  font: italic 400 var(--kf-text-small) / 1.4 var(--kf-font-serif);
  color: var(--kf-fog);
}

.kf-foot__note {
  flex-basis: 100%;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--kf-light);
  font-size: var(--kf-text-micro);
  line-height: 1.6;
  color: var(--kf-fog);
  max-width: none;
}

.kf-foot__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-content: flex-start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kf-foot a {
  color: var(--kf-bayou);
  font-size: var(--kf-text-small);
  text-decoration: none;
}

.kf-foot a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.kf-foot__note a {
  font-size: inherit;
}
