:root {
  --ink: #0b0b0d;
  --paper: #f1eee5;
  --paper-bright: #fffdf6;
  --signal: #ff5630;
  --ice: #bdf8ff;
  --muted: #a9a69d;
  --line: rgba(244, 241, 232, 0.2);
  --display: "Barlow Condensed", Impact, sans-serif;
  --body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--paper);
  background:
    radial-gradient(circle at 70% -10%, rgba(189, 248, 255, 0.12), transparent 24rem),
    var(--ink);
  font-family: var(--body);
  min-width: 320px;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  color: var(--ink);
  background: var(--ice);
  padding: 0.75rem 1rem;
}
.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  padding: 0.8rem clamp(1rem, 4vw, 4.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 11, 13, 0.88);
  backdrop-filter: blur(16px);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  font-weight: 900;
  line-height: 0.8;
  letter-spacing: -0.045em;
  text-decoration: none;
}
.wordmark span:first-child { color: var(--signal); }
.wordmark span:nth-child(2) { color: var(--paper); }
.wordmark sup { margin-left: 0.25rem; color: var(--muted); font: 500 0.55rem var(--body); }

nav { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2.5rem); }
nav a, .random-button {
  color: var(--paper);
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}
nav a:hover, .random-button:hover { color: var(--ice); }

main { overflow: hidden; }
.featured {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  min-height: calc(100svh - 76px);
  border-bottom: 1px solid var(--line);
}

.featured-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2.5rem, 6vw, 7.5rem) clamp(1.25rem, 6vw, 7rem);
}
.featured-copy::after {
  content: "";
  position: absolute;
  right: -3rem;
  bottom: 10%;
  width: 13rem;
  height: 1.15rem;
  background: var(--signal);
  transform: rotate(-10deg);
  z-index: 2;
}

.eyebrow-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.eyebrow, .rotation-note, .entry-number, .entry-count, .dialog-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow { color: var(--signal); }
.eyebrow span { color: var(--muted); margin-left: 0.6rem; }
.rotation-note { color: var(--muted); }
.entry-number { margin: clamp(3rem, 8vh, 6rem) 0 0.25rem; color: var(--ice); }

h1, h2 {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: -0.055em;
  text-wrap: balance;
}
h1 {
  max-width: 10ch;
  margin: 0;
  color: var(--paper-bright);
  font-size: clamp(5rem, 11vw, 10.5rem);
  font-weight: 900;
  line-height: 0.78;
}
.pronunciation {
  margin: 1.35rem 0 0;
  color: var(--muted);
  font-family: var(--display);
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.definition {
  max-width: 42rem;
  margin: 1.5rem 0 0;
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  line-height: 1.55;
}
.featured-actions { display: flex; align-items: center; gap: 1rem; margin-top: 2.25rem; }
.primary-button {
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: var(--signal);
  padding: 0.95rem 1.15rem;
  font-weight: 800;
  cursor: pointer;
}
.primary-button:hover { background: var(--ice); }
.primary-button:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--ice);
  outline-offset: 3px;
}
.category-stamp {
  border: 1px solid var(--line);
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.featured-visual { position: relative; min-height: 34rem; margin: 0; overflow: hidden; background: #1b1b1d; }
.featured-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11,11,13,0.8), transparent 55%), linear-gradient(120deg, transparent 55%, rgba(255,86,48,0.18));
  pointer-events: none;
}
.featured-visual img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.72) contrast(1.12); }
.featured-visual figcaption {
  position: absolute;
  inset: auto 1.3rem 1.2rem;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  color: var(--paper-bright);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.featured-visual figcaption span:first-child { font: 900 clamp(2.4rem, 5vw, 5.5rem)/0.8 var(--display); letter-spacing: -0.04em; }

.manifesto {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  padding: clamp(3rem, 8vw, 7rem) clamp(1.25rem, 6vw, 7rem);
  color: var(--ink);
  background: var(--ice);
}
.manifesto p { max-width: 24ch; margin: 0; font: 700 clamp(2rem, 4vw, 4.6rem)/0.96 var(--display); text-transform: uppercase; }
.manifesto p:last-child { justify-self: end; }

.dictionary { padding: clamp(4rem, 8vw, 8rem) clamp(1.25rem, 6vw, 7rem); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.section-heading h2 { margin: 0.25rem 0 0; font-size: clamp(3rem, 6vw, 6rem); line-height: 0.9; }
.entry-count { color: var(--muted); }

.controls { display: grid; grid-template-columns: minmax(280px, 1fr) auto; gap: 1.25rem; margin: 2.5rem 0; padding: 1.2rem 0; border-block: 1px solid var(--line); }
.search-box { display: flex; align-items: center; gap: 0.75rem; }
.search-box svg { width: 1.25rem; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-box input { width: 100%; min-height: 48px; color: var(--paper); background: transparent; border: 0; font-size: 1rem; }
.search-box input::placeholder { color: #76756f; }
.search-box input:focus { outline: 0; }
.filters { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.5rem; }
.filter-button {
  min-height: 40px;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.filter-button:hover, .filter-button.active { color: var(--ink); background: var(--ice); border-color: var(--ice); }

.entry-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-left: 1px solid var(--line); }
.entry-card {
  position: relative;
  min-height: 270px;
  padding: 1.4rem;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--paper);
  background: transparent;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}
.entry-card:nth-child(-n+3) { border-top: 1px solid var(--line); }
.entry-card::after { content: "↗"; position: absolute; right: 1.2rem; bottom: 1rem; color: var(--signal); font-size: 1.5rem; transition: transform 180ms ease; }
.entry-card:hover { color: var(--ink); background: var(--paper); }
.entry-card:hover::after { transform: translate(0.2rem, -0.2rem); }
.entry-card .card-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.entry-card h3 { margin: 2.8rem 0 1rem; font: 800 clamp(2.2rem, 4vw, 4.25rem)/0.85 var(--display); letter-spacing: -0.04em; text-transform: uppercase; }
.entry-card p { max-width: 34ch; margin: 0; font-size: 0.9rem; line-height: 1.55; }
.entry-card:hover .card-meta { color: #55534e; }

.empty-state { padding: 5rem 1rem; border: 1px solid var(--line); text-align: center; }
.empty-state p { margin: 0 0 1rem; font: 800 3rem var(--display); text-transform: uppercase; }
.empty-state button { border: 0; color: var(--ink); background: var(--ice); padding: 0.8rem 1rem; font-weight: 800; cursor: pointer; }

footer { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem 2rem; align-items: end; padding: 2.5rem clamp(1.25rem, 6vw, 7rem); border-top: 1px solid var(--line); }
footer p { margin: 0; color: var(--muted); font-size: 0.8rem; }
.wordmark.compact { font-size: 1.35rem; }
.footnote { grid-column: 1 / -1; font-size: 0.68rem; }

dialog {
  width: min(880px, calc(100% - 2rem));
  max-height: calc(100svh - 2rem);
  padding: 0;
  border: 1px solid rgba(11,11,13,0.25);
  color: var(--ink);
  background: var(--paper-bright);
}
dialog::backdrop { background: rgba(0,0,0,0.78); backdrop-filter: blur(4px); }
.dialog-shell { position: relative; padding: clamp(1.5rem, 5vw, 4.5rem); }
.close-button { position: absolute; top: 1rem; right: 1rem; width: 44px; height: 44px; border: 1px solid rgba(11,11,13,0.2); background: transparent; font-size: 1.8rem; cursor: pointer; }
.dialog-kicker { color: #765f57; }
#dialogWord { max-width: 9ch; margin: 1.6rem 0 0; font-size: clamp(4.5rem, 12vw, 8.5rem); line-height: 0.78; }
.dialog-pronunciation { margin: 1.4rem 0; color: #6c6860; font: italic 600 1.25rem var(--display); }
.dialog-definition { max-width: 48rem; margin: 0; font-size: clamp(1.1rem, 2vw, 1.4rem); line-height: 1.55; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid rgba(11,11,13,0.18); }
.detail-grid h3 { margin: 0 0 0.75rem; font: 800 1.15rem var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.detail-grid p { margin: 0; line-height: 1.65; }
.related-block { margin-top: 2.5rem; }
.related-block > p { color: #6c6860; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
#dialogRelated { display: flex; flex-wrap: wrap; gap: 0.5rem; }
#dialogRelated span { padding: 0.55rem 0.7rem; border: 1px solid rgba(11,11,13,0.2); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  nav a { display: none; }
  .featured { grid-template-columns: 1fr; }
  .featured-copy { min-height: 72svh; }
  .featured-copy::after { bottom: -0.5rem; }
  .featured-visual { min-height: 70svh; }
  .manifesto { grid-template-columns: 1fr; }
  .manifesto p:last-child { justify-self: start; }
  .controls { grid-template-columns: 1fr; }
  .filters { justify-content: flex-start; }
  .entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-card:nth-child(3) { border-top: 0; }
}

@media (max-width: 600px) {
  .site-header { min-height: 64px; }
  .featured { min-height: auto; }
  .featured-copy { min-height: 650px; padding-top: 3rem; padding-bottom: 5rem; }
  .rotation-note { display: none; }
  .entry-number { margin-top: 4rem; }
  h1 { font-size: clamp(4.7rem, 23vw, 7.25rem); }
  .featured-actions { align-items: flex-start; flex-direction: column; }
  .featured-visual { min-height: 520px; }
  .featured-visual figcaption { align-items: flex-start; flex-direction: column; }
  .manifesto { gap: 2.5rem; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 0.8rem; }
  .entry-grid { grid-template-columns: 1fr; }
  .entry-card:nth-child(2) { border-top: 0; }
  .entry-card { min-height: 235px; }
  .detail-grid { grid-template-columns: 1fr; }
  footer { grid-template-columns: 1fr; }
}

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