/* Hallmark · pre-emit critique: P5 H4 E5 S4 R5 V5 */
/* Hallmark · genre: modern-minimal · macrostructure: Index-First · theme: Terminal · enrichment: none · nav: N9 · footer: Ft2 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: clip; }

:root {
  --color-paper:      oklch(11%  0.018 145);
  --color-paper-2:    oklch(15%  0.022 145);
  --color-paper-3:    oklch(19%  0.024 145);
  --color-rule:       oklch(28%  0.030 140);
  --color-rule-2:     oklch(40%  0.050 140);
  --color-muted:      oklch(58%  0.090 140);
  --color-neutral:    oklch(68%  0.120 140);
  --color-ink-2:      oklch(78%  0.140 138);
  --color-ink:        oklch(86%  0.160 138);
  --color-accent:     oklch(78%  0.190 138);
  --color-accent-ink: oklch(11%  0.018 145);
  --color-focus:      oklch(86%  0.190 138);

  --font-display: "JetBrains Mono", "IBM Plex Mono", "Geist Mono", ui-monospace, monospace;
  --font-body:    "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  --font-label:   "JetBrains Mono", ui-monospace, monospace;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  --display-weight: 500;
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-md:   1.125rem;
  --text-lg:   1.375rem;
  --text-xl:   1.5rem;
  --text-2xl:  1.875rem;
  --text-display-s: clamp(1.5rem, 2vw + 1rem, 2.25rem);

  --tracking-display: 0.01em;
  --tracking-tight:   0;
  --tracking-label:   0.18em;

  --lh-tight: 1.2;
  --lh-snug:  1.35;
  --lh-normal: 1.55;

  --space-3xs: 0.125rem;
  --space-2xs: 0.25rem;
  --space-xs:  0.5rem;
  --space-sm:  0.75rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;
  --space-3xl: 5rem;

  --page-max:  84rem;
  --page-gutter: clamp(1rem, 3vw, 2rem);
  --measure: 70ch;

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --dur-micro: 120ms;
  --dur-short: 220ms;

  --radius-sm: 0;
  --radius-md: 0;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  color: var(--color-ink);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-gutter);
}

/* ─── Header ─── */
.header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-rule);
  margin-bottom: var(--space-md);
}

.header__title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-display);
  line-height: var(--lh-tight);
  color: var(--color-ink);
}

.header__title {
  text-decoration: none;
  color: inherit;
}
.header__title span { color: var(--color-accent); }

.burger { display: none; }

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-left: auto;
}

/* ─── Toggle ─── */
.toggle {
  display: flex;
  gap: var(--space-2xs);
  background: var(--color-paper-2);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.toggle__btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: var(--space-2xs) var(--space-sm);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: background var(--dur-micro) var(--ease-out),
              color var(--dur-micro) var(--ease-out);
}

.toggle__btn:hover { color: var(--color-neutral); }
.toggle__btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ─── Period ─── */
.period {
  display: flex;
  gap: var(--space-2xs);
  background: var(--color-paper-2);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.period__btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: var(--space-2xs) var(--space-xs);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: background var(--dur-micro) var(--ease-out),
              color var(--dur-micro) var(--ease-out);
}

.period__btn:hover { color: var(--color-neutral); }
.period__btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.period__btn--active {
  background: var(--color-paper);
  color: var(--color-ink);
  box-shadow: 0 1px 3px oklch(0% 0 0 / 0.5);
}

.toggle__btn--active {
  background: var(--color-paper);
  color: var(--color-ink);
  box-shadow: 0 1px 3px oklch(0% 0 0 / 0.5);
}

/* ─── Table ─── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead th {
  font-family: var(--font-label);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-muted);
  font-weight: 500;
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-rule);
  white-space: nowrap;
  user-select: none;
}

tbody tr {
  border-bottom: 1px solid var(--color-rule);
  transition: background var(--dur-micro) var(--ease-out);
}

tbody tr:hover { background: var(--color-paper-2); }
tbody tr:focus-within { background: var(--color-paper-3); }

tbody td {
  padding: var(--space-sm) var(--space-md);
  vertical-align: middle;
  line-height: var(--lh-snug);
}

td.title {
  max-width: 0;
  width: 100%;
}

td.title a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
  color: var(--color-ink);
  text-decoration: none;
  font-weight: 600;
}

td.title a:hover { color: var(--color-accent); }
td.title a:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: 2px; }

td.meta {
  white-space: nowrap;
  color: var(--color-muted);
  font-size: var(--text-xs);
}

td.meta span { margin: 0 var(--space-2xs); }
td.meta .num { font-family: var(--font-mono); color: var(--color-neutral); }
td.meta .sep { color: var(--color-rule); }

/* ─── Pagination ─── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: var(--space-md) 0;
  margin-top: var(--space-md);
}

.page-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  min-width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-neutral);
  cursor: pointer;
  transition: background var(--dur-micro) var(--ease-out),
              color var(--dur-micro) var(--ease-out),
              border-color var(--dur-micro) var(--ease-out);
}

.page-btn:hover { background: var(--color-paper-2); color: var(--color-ink); }
.page-btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.page-btn--active {
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border-color: var(--color-accent);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ─── Footer ─── */
.footer {
  padding: var(--space-md) 0;
  border-top: 1px solid var(--color-rule);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.footer a {
  color: var(--color-neutral);
  text-decoration: none;
}

.footer a:hover { color: var(--color-accent); }

/* ─── Loading / Error ─── */
.state-msg {
  text-align: center;
  padding: var(--space-3xl) var(--space-md);
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.state-msg__spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--color-rule);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-bottom: var(--space-sm);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── GitHub-specific cell ─── */
td.lang-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  display: inline-block;
  margin-right: var(--space-2xs);
  vertical-align: middle;
  flex-shrink: 0;
}

.meta-wrap { display: flex; align-items: center; gap: var(--space-xs); }

.period__label--short { display: none; }

/* ─── Responsive ─── */
@media (max-width: 40rem) {
  .burger {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: var(--space-xs);
    border: none;
    background: transparent;
    cursor: pointer;
    margin-left: auto;
  }
  .burger__line {
    display: block;
    width: 1.25rem;
    height: 2px;
    background: var(--color-neutral);
    border-radius: 1px;
    transition: transform var(--dur-micro) var(--ease-out), opacity var(--dur-micro) var(--ease-out);
  }
  .burger--open .burger__line:nth-child(1) { transform: translateY(5px) rotate(45deg); }
  .burger--open .burger__line:nth-child(2) { opacity: 0; }
  .burger--open .burger__line:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }
  .header-nav {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--color-paper);
    border-bottom: 1px solid var(--color-rule);
    z-index: 20;
  }
  .header-nav--open { display: flex; }
  .header {
    position: relative;
    flex-wrap: wrap;
  }
  .header-nav .toggle,
  .header-nav .period,
  .header-nav .theme-picker { width: 100%; }
  .header-nav .toggle { flex-direction: column; }
  .header-nav .period { flex-direction: column; margin-left: 0; }
.header-nav .theme-trigger { width: 100%; padding: var(--space-2xs) var(--space-sm); justify-content: center; }
  thead th:nth-child(4), thead th:nth-child(5),
  tbody td:nth-child(4), tbody td:nth-child(5) { display: none; }
  td.meta { font-size: var(--text-xs); }
  tbody td:nth-child(1), tbody td:nth-child(3) { padding: var(--space-2xs) 0; width: 0; text-align: center; }
  thead th:nth-child(1), thead th:nth-child(3) { padding: var(--space-2xs) 0; width: 0; text-align: center; }
}

/* ─── Theme picker ─── */
.theme-picker {
  position: relative;
}
.theme-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-2xs) var(--space-xs);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  background: var(--color-paper-2);
  cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease-out), background var(--dur-micro) var(--ease-out);
}
.theme-trigger:hover { border-color: var(--color-rule-2); background: var(--color-paper-3); }
.theme-trigger:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.theme-trigger::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid var(--color-muted);
  transition: transform var(--dur-micro) var(--ease-out);
}
.theme-trigger[aria-expanded="true"]::after {
  transform: rotate(180deg);
}
.theme-swatch { display: flex; gap: 2px; }
.theme-swatch span {
  width: 0.5rem;
  height: 0.625rem;
  border-radius: 1px;
}
.theme-swatch span:first-child { border-radius: 2px 0 0 2px; }
.theme-swatch span:last-child { border-radius: 0 2px 2px 0; }
.theme-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 12rem;
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  padding: var(--space-2xs);
  display: none;
  z-index: 10;
  box-shadow: 0 4px 12px oklch(0% 0 0 / 0.4);
}
.theme-menu--open { display: block; }
.theme-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-neutral);
  transition: background var(--dur-micro) var(--ease-out);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}
.theme-option:hover { background: var(--color-paper-3); }
.theme-option:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.theme-option--active { color: var(--color-accent); }
.theme-option__name { flex: 1; }

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