@font-face {
  font-family: "Sohne";
  src: url("assets/fonts/Sohne-Leicht.otf") format("opentype");
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Sohne";
  src: url("assets/fonts/Sohne-Halbfett.otf") format("opentype");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Tiempos";
  src: url("assets/fonts/TiemposText-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --onyx: #000;
  --ink: #101010;
  --paper: #f2f2f1;
  --paper-deep: #e4e4e1;
  --gold: #ffa400;
  --sapphire: #0047bb;
  --muted: #69665e;
  --line: rgba(16, 16, 16, 0.18);
  --header-height: 88px;
  --page-pad: clamp(20px, 4vw, 64px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: url("assets/images/academy-paper.jpg");
  background-size: 1400px auto;
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Sohne", sans-serif;
  font-weight: 300;
}

button, input { font: inherit; }

button { color: inherit; }

::selection { background: var(--gold); color: var(--onyx); }

.skip-link {
  position: fixed;
  z-index: 1000;
  left: 16px;
  top: -80px;
  padding: 12px 16px;
  background: var(--gold);
  color: var(--onyx);
  font-weight: 600;
}

.skip-link:focus { top: 12px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--page-pad);
  background: var(--onyx);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.brand {
  display: block;
  width: min(300px, 54vw);
  height: 64px;
  overflow: hidden;
}

.brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 28px;
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-meta span:first-child { color: var(--gold); }

.hero {
  position: relative;
  min-height: min(720px, calc(100svh - var(--header-height)));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.34fr);
  grid-template-rows: 1fr auto;
  overflow: hidden;
  padding: clamp(80px, 10vw, 150px) var(--page-pad) 48px;
  background:
    radial-gradient(circle at 82% 18%, rgba(0, 71, 187, 0.38), transparent 30%),
    linear-gradient(135deg, #000 0 68%, #0c0c0c 68% 100%);
  color: #fff;
}

.hero::after {
  content: "A—Z";
  position: absolute;
  right: -0.04em;
  bottom: -0.2em;
  color: rgba(255, 255, 255, 0.035);
  font-size: clamp(220px, 34vw, 600px);
  font-weight: 600;
  line-height: 0.8;
  letter-spacing: -0.09em;
  pointer-events: none;
}

.hero-diagonal {
  position: absolute;
  top: -24%;
  right: 23%;
  width: 84px;
  height: 155%;
  background: var(--gold);
  transform: rotate(22deg);
  transform-origin: center;
  opacity: 0.96;
}

.hero-copy { position: relative; z-index: 2; max-width: 980px; }

.eyebrow, .panel-kicker {
  margin: 0 0 28px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow span { color: var(--gold); }

.hero h1 {
  max-width: 980px;
  margin: 0;
  font-size: clamp(58px, 8vw, 136px);
  font-weight: 600;
  line-height: 0.88;
  letter-spacing: -0.055em;
}

.hero-intro {
  max-width: 680px;
  margin: 48px 0 0;
  font-family: "Tiempos", serif;
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.76);
}

.hero-stats {
  position: relative;
  z-index: 2;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 72px;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: brightness(0.64);
}

.hero-stats div { padding: 26px 24px 0 0; }

.hero-stats strong {
  display: block;
  font-size: clamp(38px, 5vw, 72px);
  line-height: 1;
  font-weight: 600;
}

.hero-stats span {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.paper-bg {
  background-color: var(--paper);
  background-image: url("assets/images/academy-paper.jpg");
  background-size: 1400px auto;
  background-attachment: fixed;
}

.dictionary { position: relative; }

/* Sticky index: search, categories, A-Z in one bar under the header */
.dict-toolbar {
  position: sticky;
  top: var(--header-height);
  z-index: 40;
  padding: 18px var(--page-pad) 0;
  border-bottom: 2px solid var(--ink);
  background-color: var(--paper);
  background-image: url("assets/images/academy-paper.jpg");
  background-size: 1400px auto;
  background-attachment: fixed;
}

.toolbar-row { display: flex; align-items: center; gap: 24px; }

.search-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 760px;
  padding: 0 16px;
  height: 56px;
  border: 1.5px solid var(--ink);
  background: #fff;
  cursor: text;
  transition: box-shadow 160ms ease;
}

.search-field:focus-within { box-shadow: 6px 6px 0 var(--gold); }

.search-icon { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; }

.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 19px;
}

.search-field input::placeholder { color: #8b8b86; }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }

.search-field kbd {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
}

.result-status { margin: 0 0 0 auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.result-status strong { color: var(--ink); font-weight: 600; }

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.category-tabs::-webkit-scrollbar { display: none; }

.category-tab {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  scroll-snap-align: start;
  transition: background 140ms ease, color 140ms ease;
}

.category-tab small { color: var(--muted); font-size: 12px; font-weight: 300; }
.category-tab:hover { border-color: var(--ink); }
.category-tab:focus-visible { outline: 2px solid var(--sapphire); outline-offset: 2px; }
.category-tab.is-active { background: var(--onyx); color: #fff; }
.category-tab.is-active small { color: var(--gold); }

.alphabet {
  display: grid;
  grid-template-columns: repeat(26, minmax(0, 1fr));
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.letter-button {
  position: relative;
  padding: 10px 0 11px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.letter-button::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: -2px;
  height: 4px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 160ms ease;
}

.letter-button:disabled { color: rgba(16, 16, 16, 0.22); cursor: default; }
.letter-button:not(:disabled):hover { color: var(--sapphire); }
.letter-button:focus-visible { outline: 2px solid var(--sapphire); outline-offset: -2px; }
.letter-button.is-current::after { transform: scaleX(1); }

.terms-panel { min-width: 0; padding: 58px var(--page-pad) 110px; }

.terms-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 28px;
  border-bottom: 2px solid var(--ink);
}

.terms-heading .panel-kicker { margin-bottom: 10px; color: var(--sapphire); }

.terms-heading h2 {
  margin: 0;
  font-size: clamp(52px, 7vw, 110px);
  line-height: 0.86;
  letter-spacing: -0.06em;
}

.source-note { max-width: 380px; margin: 0; color: var(--muted); font-family: "Tiempos", serif; font-size: 15px; line-height: 1.5; }

.letter-group { display: grid; grid-template-columns: 110px 1fr; border-bottom: 2px solid var(--ink); scroll-margin-top: calc(var(--header-height) + var(--toolbar-height, 170px)); }

.group-letter {
  position: sticky;
  top: calc(var(--header-height) + var(--toolbar-height, 170px) + 18px);
  align-self: start;
  margin: 0;
  padding: 24px 0;
  color: var(--sapphire);
  font-size: 72px;
  line-height: 1;
  font-weight: 600;
}

.group-terms { min-width: 0; border-left: 1px solid var(--line); }
a.term-row { color: inherit; text-decoration: none; }

.term-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(190px, 0.65fr) minmax(240px, 1fr) auto;
  gap: 28px;
  align-items: start;
  padding: 24px 0 26px 28px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.term-row:last-child { border-bottom: 0; }

.term-row:hover, .term-row:focus-visible { background: #fff; outline: none; }

.term-row:hover .term-arrow, .term-row:focus-visible .term-arrow {
  transform: translate(4px, -4px);
  color: var(--sapphire);
}

.term-name { font-size: clamp(18px, 1.8vw, 26px); font-weight: 600; line-height: 1.08; }

.term-preview {
  margin: 0;
  font-family: "Tiempos", serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--muted);
}

.term-preview.is-missing { color: #8a3d00; font-family: "Sohne", sans-serif; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }

.term-tail { display: flex; align-items: center; gap: 10px; padding-right: 6px; }

.term-chip {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--paper-deep);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.term-chip.review { background: var(--gold); color: var(--onyx); }

.term-arrow { font-size: 24px; transition: transform 180ms ease, color 180ms ease; }

.empty-state { padding: 90px 0; text-align: center; }
.empty-state span { color: var(--sapphire); font-size: 80px; font-weight: 600; }
.empty-state h3 { margin: 10px 0; font-size: 34px; }
.empty-state p { font-family: "Tiempos", serif; color: var(--muted); }
.empty-state button, .dialog-footer button {
  padding: 11px 16px;
  border: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
}

.site-footer {
  min-height: 220px;
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  align-items: end;
  gap: 30px;
  padding: 52px var(--page-pad);
  background: var(--onyx);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
}

.site-footer p:last-child { text-align: right; color: rgba(255,255,255,.55); }
.footer-slash { color: var(--gold); font-size: 88px; font-weight: 600; line-height: 0.7; }

.term-dialog {
  width: min(920px, 96vw);
  max-height: 92svh;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

.term-dialog::backdrop { background: rgba(0, 0, 0, 0.78); backdrop-filter: blur(6px); }

.dialog-frame { min-height: min(720px, 88svh); display: grid; grid-template-rows: auto 1fr auto; }

.dialog-topbar, .dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dialog-footer { border-top: 1px solid var(--line); border-bottom: 0; text-transform: none; letter-spacing: 0; }
.dialog-footer p { margin: 0; color: var(--muted); }

.dialog-close { border: 0; background: transparent; cursor: pointer; }
.dialog-close span { margin-left: 6px; font-size: 26px; vertical-align: -2px; }

.dialog-content { display: grid; grid-template-columns: 0.28fr 1fr; min-height: 0; overflow: auto; }

.dialog-letter {
  margin: 0;
  padding: 44px 28px;
  background: var(--sapphire);
  color: #fff;
  font-size: clamp(100px, 20vw, 220px);
  line-height: 0.75;
  font-weight: 600;
  overflow: hidden;
}

.dialog-main { padding: clamp(36px, 6vw, 72px); }
.dialog-flags { display: flex; flex-wrap: wrap; gap: 8px; min-height: 25px; }
.dialog-main h2 { margin: 22px 0 28px; font-size: clamp(42px, 6vw, 84px); line-height: 0.94; letter-spacing: -0.055em; }
.dialog-definition { margin: 0; font-family: "Tiempos", serif; font-size: clamp(20px, 2.3vw, 30px); line-height: 1.42; }
.dialog-definition.is-missing { color: #8a3d00; }
.dialog-details { display: grid; gap: 24px; margin-top: 42px; padding-top: 34px; border-top: 1px solid var(--line); }
.detail-block h3 { margin: 0 0 8px; color: var(--sapphire); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.detail-block p { margin: 0; white-space: pre-line; line-height: 1.55; }
.detail-block a { color: var(--sapphire); text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 980px) {
  :root { --header-height: 74px; }
  .header-meta span:last-child { display: none; }
  .hero { grid-template-columns: 1fr; min-height: 680px; }
  .hero-diagonal { right: 8%; width: 58px; opacity: 0.82; }
  .category-tabs { flex-wrap: nowrap; margin-right: calc(-1 * var(--page-pad)); padding-right: 40px; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .alphabet { display: flex; overflow-x: auto; scrollbar-width: none; }
  .alphabet::-webkit-scrollbar { display: none; }
  .letter-button { flex: 0 0 38px; }
}

@media (max-width: 680px) {
  .site-header { padding-inline: 14px; }
  .brand { width: 220px; height: 54px; }
  .header-meta { display: none; }
  .hero { min-height: 650px; padding-top: 72px; }
  .hero h1 { font-size: clamp(52px, 16vw, 78px); }
  .hero-intro { margin-top: 34px; font-size: 20px; }
  .hero-diagonal { right: -8%; width: 46px; }
  .hero-stats { margin-top: 50px; gap: 10px; }
  .hero-stats div { padding-right: 0; }
  .hero-stats span { font-size: 9px; }
  .dict-toolbar { padding: 12px 14px 0; }
  .toolbar-row { gap: 10px; }
  .search-field { height: 48px; padding: 0 12px; }
  .search-field input { font-size: 16px; }
  .search-field kbd { display: none; }
  .result-status { display: none; }
  .category-tabs { margin-top: 10px; }
  .category-tab { padding: 7px 11px 8px; font-size: 13px; }
  .alphabet { margin-top: 8px; }
  .letter-button { flex: 0 0 34px; padding: 8px 0 9px; font-size: 13px; }
  .source-note { margin-top: 16px; }
  .terms-panel { padding: 44px 20px 80px; }
  .terms-heading { display: block; }
  #result-status { margin-top: 22px; }
  .letter-group { grid-template-columns: 48px 1fr; }
  .group-letter { top: calc(var(--header-height) + var(--toolbar-height, 150px) + 6px); padding-top: 18px; font-size: 38px; }
  .term-row { grid-template-columns: 1fr auto; gap: 10px; padding: 20px 0 22px 16px; }
  .term-preview { grid-column: 1 / -1; font-size: 15px; }
  .term-tail { grid-column: 2; grid-row: 1; }
  .term-chip:not(.review) { display: none; }
  .site-footer { grid-template-columns: 46px 1fr; min-height: 180px; }
  .site-footer p:last-child { display: none; }
  .footer-slash { font-size: 64px; }
  .dialog-content { grid-template-columns: 58px 1fr; }
  .dialog-letter { padding: 28px 8px; font-size: 72px; }
  .dialog-main { padding: 34px 24px; }
  .dialog-main h2 { font-size: 44px; }
  .dialog-footer { align-items: flex-start; }
  .dialog-footer p { max-width: 50%; }
}

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

/* Static term pages (generated by tools/build_public.py) */
.term-page { max-width: 980px; margin: 0 auto; padding: 64px var(--page-pad) 110px; }
.term-page .crumb { display: inline-block; margin-bottom: 40px; color: var(--sapphire); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-decoration: none; text-transform: uppercase; }
.term-page .crumb:hover { text-decoration: underline; }
.term-page h1 { margin: 18px 0 30px; font-size: clamp(44px, 7vw, 92px); line-height: 0.95; letter-spacing: -0.055em; }
.term-page .lede { margin: 0; font-family: "Tiempos", serif; font-size: clamp(21px, 2.4vw, 30px); line-height: 1.42; }
.term-page .dialog-details { margin-top: 48px; }
.term-page .source-line { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.term-page .source-line a { color: var(--sapphire); word-break: break-all; }

/* Term of the week */
.term-of-week { background: var(--onyx); color: #fff; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.tow-inner { max-width: 1180px; padding: clamp(40px, 6vw, 72px) var(--page-pad); }
.term-of-week .eyebrow { color: var(--gold); }
.term-of-week h2 { margin: 14px 0 18px; font-size: clamp(44px, 7vw, 96px); line-height: 0.92; letter-spacing: -0.055em; }
.term-of-week h2 a { color: inherit; text-decoration: none; background: linear-gradient(var(--gold), var(--gold)) 0 100% / 0 6px no-repeat; transition: background-size 220ms ease; }
.term-of-week h2 a:hover, .term-of-week h2 a:focus-visible { background-size: 100% 6px; }
.tow-definition { max-width: 820px; margin: 0; font-family: "Tiempos", serif; font-size: clamp(19px, 2.1vw, 26px); line-height: 1.45; }
.tow-hook { max-width: 820px; margin: 18px 0 0; padding-left: 16px; border-left: 3px solid var(--gold); color: rgba(255, 255, 255, 0.78); font-size: 15px; line-height: 1.55; }
.tow-past { margin: 28px 0 0; color: rgba(255, 255, 255, 0.55); font-size: 13px; }
.tow-past a { color: #fff; }
