/* The Unofficial Hive — paper white, ink black, the Bee's own yellow. */

:root {
  --yellow: #f7da21;
  --yellow-soft: #fdf3b4;
  --ink: #121212;
  --gray: #6b6b6b;
  --cell: #e6e6e6;
  --hairline: #e2e2e2;
  --honey: #8a6d00;
  --measure: 72rem;
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
  max-width: var(--measure);
  font-family: "Libre Franklin", -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: #fff;
}

a { color: var(--honey); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* Masthead */
.masthead { text-align: center; padding: 2.2rem 0 0.4rem; }
.masthead-brand {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  margin: 0;
  letter-spacing: -0.01em;
}
.masthead-sub {
  margin: 0.15rem 0 0;
  color: var(--gray);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

/* Day navigation */
.day-nav {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  margin-top: 1.4rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}
.day-nav a { text-decoration: none; font-weight: 600; }

/* Hero */
.hero {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  padding: 2.4rem 0 1.6rem;
}
.hero-hive { flex: 0 0 auto; }
.hero-text { flex: 1 1 20rem; }
.hero-date {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  margin: 0 0 0.2rem;
  line-height: 1.15;
}
.hero-editor { color: var(--gray); margin: 0 0 1.2rem; font-size: 0.95rem; }

.scorecard {
  display: flex;
  gap: 0;
  margin: 1rem 0 0;
  border: 1px solid var(--ink);
  width: fit-content;
}
.scorecard div { padding: 0.55rem 1.3rem; border-right: 1px solid var(--ink); }
.scorecard div:last-child { border-right: 0; }
.scorecard dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray);
}
.scorecard dd {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 1.5rem;
}

/* Section TOC */
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  border-top: 3px solid var(--ink);
  padding: 0.7rem 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.toc a { text-decoration: none; font-weight: 700; color: var(--ink); }
.toc a:hover { color: var(--honey); }

/* Sections */
section { padding: 2.2rem 0 0.6rem; }
h2 {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 1.6rem;
  margin: 0 0 0.4rem;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 0.3rem;
}
h3 { font-size: 1.02rem; font-weight: 800; margin: 1.6rem 0 0.5rem; }
.section-note { color: var(--gray); font-size: 0.9rem; margin: 0.1rem 0 1rem; }

/* Answers spoiler toggle */
.spoiler-button {
  display: inline-block;
  cursor: pointer;
  list-style: none;
  margin: 0.6rem 0 0.4rem;
  padding: 0.5rem 1.4rem;
  background: var(--yellow);
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  user-select: none;
}
.spoiler-button::-webkit-details-marker { display: none; }
.spoiler-button:hover { background: var(--yellow-soft); }
.spoiler .when-open, .spoiler[open] .when-closed { display: none; }
.spoiler[open] .when-open { display: inline; }

/* Answer list */
.answer-list {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  columns: 4 11rem;
  column-gap: 2rem;
}
.answer-list li { break-inside: avoid; }
.answer-list .word-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  cursor: pointer;
  padding: 0.22rem 0.3rem;
  border: 0;
  border-radius: 3px;
  background: none;
  font: inherit;
  text-align: left;
}
.answer-list .word-row:hover,
.answer-list li:has(.definition:popover-open) .word-row { background: var(--yellow-soft); }
.answer-list .word { font-weight: 600; font-size: 1.05rem; }
.answer-list .word.pangram {
  background: var(--yellow);
  font-weight: 800;
  padding: 0 0.3rem;
  box-decoration-break: clone;
}
.answer-list .pts {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--gray);
}
/* Definition popover bubble; light-dismiss (click outside / Esc) is native
   to popover="auto". Without anchor-positioning support it centers in the
   viewport, so the bubble names its word. */
.definition {
  font-size: 0.88rem;
  padding: 0.55rem 0.9rem 0.65rem;
  border: 1px solid var(--ink);
  border-left: 4px solid var(--yellow);
  border-radius: 6px;
  max-width: 24rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
}
@supports (position-area: block-end) {
  .definition {
    position: fixed;
    inset: auto;
    margin: 0.25rem 0 0;
    position-area: block-end span-inline-end;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  }
}
.definition .def-word {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.15rem;
}
.definition p { margin: 0.25rem 0; }
.definition .etymology { color: var(--gray); font-style: italic; }
.definition .seen-count { color: var(--gray); font-size: 0.8rem; }
.callout {
  background: var(--yellow-soft);
  border-left: 4px solid var(--yellow);
  padding: 0.7rem 1rem;
  margin: 1.2rem 0 0;
}
.word-inline { font-weight: 600; }

/* Hints */
.hints-wrap { display: flex; gap: 3rem; flex-wrap: wrap; align-items: flex-start; }
.two-letter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr));
  gap: 0.3rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
  min-width: 16rem;
  flex: 1 1 16rem;
}
.two-letter-list .pair { font-weight: 600; text-transform: uppercase; }
.hint-grid { border-collapse: collapse; font-family: "IBM Plex Mono", monospace; font-size: 0.9rem; }
.hint-grid th, .hint-grid td { padding: 0.28rem 0.65rem; text-align: center; }
.hint-grid thead th { border-bottom: 2px solid var(--ink); }
.hint-grid tbody th { text-transform: uppercase; border-right: 2px solid var(--ink); }
.hint-grid td { color: var(--ink); }
.hint-grid tr.tot td, .hint-grid .tot { font-weight: 600; background: var(--yellow-soft); }
.hint-grid tr.tot { border-top: 2px solid var(--ink); }

/* Numbers */
.percentiles { margin: 1.4rem 0; display: grid; gap: 0.9rem; max-width: 34rem; }
.pct-row { display: grid; gap: 0.2rem; }
.pct-label { font-size: 0.85rem; color: var(--gray); }
.pct-bar { height: 0.9rem; background: var(--cell); }
.pct-fill { height: 100%; background: var(--yellow); border-right: 2px solid var(--ink); }
.pct-num { font-family: "IBM Plex Mono", monospace; font-size: 0.85rem; font-weight: 600; }
.length-chart { max-width: 34rem; width: 100%; height: auto; }
.length-chart .ch-lbl { font: 600 14px "IBM Plex Mono", monospace; }
.length-chart .ch-val { font: 11px "IBM Plex Mono", monospace; fill: var(--gray); }

/* History */
.letter-history { border-collapse: collapse; font-size: 0.92rem; }
.letter-history th, .letter-history td { text-align: left; padding: 0.35rem 1.1rem 0.35rem 0; border-bottom: 1px solid var(--hairline); }
.letter-history tbody th { text-transform: uppercase; font-family: "IBM Plex Mono", monospace; }
.letter-history .center-row { background: var(--yellow-soft); }
.plain-list { padding-left: 1.2rem; }
.common-words {
  columns: 3 12rem;
  column-gap: 2rem;
  padding-left: 1.4rem;
  font-size: 0.95rem;
}
.common-words .count { font-family: "IBM Plex Mono", monospace; color: var(--gray); font-size: 0.8rem; }

/* Rejected words */
.rejected-list {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 1rem;
  columns: 5 9rem;
  column-gap: 1.6rem;
  font-size: 0.92rem;
}
.rejected-list li { break-inside: avoid; padding: 0.08rem 0; }

footer {
  margin-top: 3rem;
  border-top: 3px solid var(--ink);
  padding-top: 0.8rem;
  font-size: 0.8rem;
  color: var(--gray);
}

@media (max-width: 640px) {
  .hero { gap: 1.2rem; padding-top: 1.4rem; }
  .scorecard div { padding: 0.45rem 0.8rem; }
  .scorecard dd { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .answer-list .word-row { transition: background 120ms ease; }
}
