/* Daily geek facts (/geek, ADR 0095). Every color comes from the site's own
   tokens in site.css (--surface, --text, --muted, --line, --accent-*), which
   dark.css redefines, so dark mode and night vision (ADR 0086) need no rules
   here. Numbers, formulas and the telemetry use a monospace face; the rest
   uses the site font. The Classic style only changes typography. */

.gk-shell {
  --gk-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --gk-serif: "Iowan Old Style", Georgia, "Times New Roman", serif;
  --gk-accent: var(--accent-moon);
  --gk-accent-soft: var(--accent-moon-soft);
  color: var(--text);
  max-width: 1360px;
  margin: 0 auto;
  padding: 8px 12px 32px;
}

.gk-mono,
.gk-headline,
.gk-formula,
.gk-deriv,
.gk-tele-v,
.gk-num,
.gk-date-input {
  font-family: var(--gk-mono);
  font-variant-numeric: tabular-nums;
}

/* ---- Controls ---- */
.gk-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.gk-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  justify-content: space-between;
}

.gk-bar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.gk-btn,
.gk-pill,
.gk-date-input {
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.2;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.gk-date-input {
  font-family: var(--gk-mono);
  border-radius: 10px;
  padding: 5px 8px;
  cursor: text;
}

.gk-btn:hover,
.gk-pill:hover {
  border-color: var(--muted);
}

.gk-btn:focus-visible,
.gk-pill:focus-visible,
.gk-date-input:focus-visible,
.gk-copy:focus-visible,
.gk-math summary:focus-visible {
  outline: 2px solid var(--gk-accent);
  outline-offset: 2px;
}

.gk-btn.is-active,
.gk-pill.is-active {
  background: var(--gk-accent-soft);
  border-color: var(--gk-accent);
  font-weight: 600;
}

.gk-cats {
  justify-content: flex-start;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  gap: 6px;
}

.gk-pill {
  font-size: 0.8rem;
  padding: 4px 11px;
  text-transform: capitalize;
}

.gk-status {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.gk-content.is-loading {
  opacity: 0.55;
  transition: opacity 0.12s ease;
}

/* ---- Sheet ---- */
.gk-sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
}

.gk-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.gk-kicker {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nav-tint-learning);
}

.gk-title {
  margin: 4px 0;
  font-size: 1.45rem;
  line-height: 1.2;
}

.gk-shell[data-style="almanac"] .gk-title {
  font-family: var(--gk-serif);
  font-weight: 500;
  font-size: 1.65rem;
}

.gk-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.gk-head-meta {
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: right;
  color: var(--muted);
}

.gk-head-meta strong {
  color: var(--text);
  font-weight: 600;
}

/* ---- Live telemetry ---- */
.gk-telemetry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 16px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--gk-accent-soft);
  border-radius: 12px;
}

.gk-tele-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.gk-tele-k {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.gk-tele-v {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Fact cards ---- */
.gk-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.gk-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 0;
}

.gk-card.is-hidden {
  display: none;
}

.gk-card.is-spotlight {
  border-color: var(--accent-sun);
  box-shadow: 0 0 0 2px var(--accent-sun);
  background: var(--accent-sun-soft);
}

.gk-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.gk-num {
  font-weight: 700;
  color: var(--gk-accent);
}

.gk-cat {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.gk-copy {
  margin-left: auto;
  font: inherit;
  font-size: 0.75rem;
  padding: 2px 9px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
}

.gk-copy:hover {
  color: var(--text);
  border-color: var(--muted);
}

.gk-card-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.gk-shell[data-style="almanac"] .gk-card-title {
  font-family: var(--gk-serif);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.gk-headline {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.gk-shell[data-style="almanac"] .gk-headline {
  font-family: var(--gk-serif);
  font-size: 1.25rem;
  font-weight: 600;
}

.gk-summary {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  flex: 1 1 auto;
}

.gk-math {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}

.gk-math summary {
  cursor: pointer;
  color: var(--gk-accent);
  font-weight: 600;
  user-select: none;
}

.gk-formula {
  margin-top: 6px;
  padding: 4px 8px;
  background: var(--gk-accent-soft);
  border-radius: 8px;
  color: var(--text);
  overflow-x: auto;
}

.gk-deriv {
  margin-top: 4px;
  line-height: 1.4;
}

.gk-src {
  margin-top: 4px;
  font-size: 0.74rem;
}

.gk-foot {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---- Narrower screens ---- */
@media (max-width: 1120px) {
  .gk-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phones: date steps first, tools in one row, category pills on one scrolling
   row, telemetry as a compact two-column strip, no engine details. */
@media (max-width: 640px) {
  .gk-shell {
    padding: 4px 0 24px;
  }
  .gk-bar {
    padding: 10px;
    gap: 8px;
    margin-bottom: 12px;
  }
  .gk-bar-row {
    gap: 8px;
  }
  .gk-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
  .gk-tools [data-gk-print] {
    display: none;
  }
  .gk-cats {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-top: 8px;
  }
  .gk-cats::-webkit-scrollbar {
    display: none;
  }
  .gk-pill {
    flex: none;
  }
  .gk-status {
    display: none;
  }
  .gk-sheet {
    padding: 14px 12px 16px;
  }
  .gk-head {
    padding-bottom: 10px;
    margin-bottom: 10px;
  }
  .gk-title {
    font-size: 1.2rem;
  }
  .gk-head-meta {
    display: none;
  }
  .gk-telemetry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 12px;
    padding: 8px 10px;
    margin-bottom: 12px;
  }
  .gk-tele-v {
    font-size: 0.85rem;
  }
  .gk-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* ---- Print: black on white, four columns ---- */
@media print {
  @page {
    size: letter landscape;
    margin: 8mm;
  }
  header.site-header,
  nav,
  footer.site-footer,
  .circumstances,
  .gk-bar,
  .gk-copy {
    display: none !important;
  }
  .gk-shell {
    max-width: none;
    padding: 0;
    color: #000;
    --gk-accent: #000;
    --gk-accent-soft: #f2f2f2;
  }
  .gk-sheet,
  .gk-card {
    background: #fff;
    border-color: #999;
    box-shadow: none;
  }
  .gk-sheet {
    padding: 6mm;
  }
  .gk-card-title,
  .gk-sub,
  .gk-head-meta,
  .gk-math,
  .gk-foot,
  .gk-tele-k {
    color: #333;
  }
  .gk-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3mm;
  }
  .gk-card {
    padding: 2.5mm;
    break-inside: avoid;
  }
  .gk-headline {
    font-size: 9pt;
  }
  .gk-summary {
    font-size: 7pt;
    line-height: 1.28;
  }
  .gk-math {
    font-size: 6.5pt;
  }
}
