/* "Glyph Press" — type-specimen redesign (see DESIGN.md).
 * Inspiration: PP Neue Montreal specimen site, stripped of motion, red darkened
 * to #C42021 for AA text. The glyph is the hero; red is reserved for the answer. */
:root {
  --color-bg: #FAFAF8;
  --color-surface: #FFFFFF;
  --color-text: #141414;
  --color-primary: #C42021;   /* press red — 5.6:1 on bg, 5.9:1 under white text */
  --color-muted: #56565A;     /* 7.0:1 on bg */
  --color-border: #E3E3DF;
  --color-kbd-border: #C9C9C4;
  --font-body: Archivo, "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-glyph: system-ui, -apple-system, "Segoe UI", "Segoe UI Symbol", "Apple Symbols", sans-serif; /* full 110-glyph coverage */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --space: 1rem;
  --radius: 4px;
  --max-width: 56rem; /* five-column reference table */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space);
}

h1, h2, h3 {
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
h1 { font-size: clamp(1.75rem, 5vw, 2.75rem); margin: 1.25rem 0 0; }
h2 { font-size: clamp(1.375rem, 3.5vw, 1.75rem); }
h3 { font-size: 1.125rem; }

a { color: var(--color-primary); }
a:hover { color: var(--color-text); }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.tagline { color: var(--color-muted); margin: 0.375rem 0 0; max-width: 44rem; }

/* ---- Top bar: black band, white wordmark, category links -------------------- */
.topbar { background: var(--color-text); }
.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}
.brand {
  color: #fff;
  font-weight: 900;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  padding: 0.625rem 0;           /* ≥44px tap height */
  margin-right: 0.5rem;
  white-space: nowrap;
}
.brand:hover, .brand:focus { color: #fff; }
.brand .pilcrow { color: var(--color-primary); -webkit-text-stroke: 0.5px #fff; }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
}
.site-nav a {
  color: rgba(255, 255, 255, 0.78);   /* 5.4:1 on #141414 */
  text-decoration: none;
  padding: 0.75rem 0.5rem;            /* ≥44px tap height */
  border-bottom: 3px solid transparent;
}
.site-nav a:hover, .site-nav a:focus { color: #fff; }
.site-nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--color-primary);
}

/* ---- Page head --------------------------------------------------------------- */
.page-head { padding-bottom: 0.25rem; }

/* ---- Specimen sheet (per-symbol pages) ---------------------------------------- */
.specimen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 2rem;
  padding-top: 0.75rem;
}
.specimen-glyph {
  font-family: var(--font-glyph);
  font-size: clamp(5.5rem, 26vw, 12rem);
  line-height: 1;
  color: var(--color-primary);
  flex: 0 0 auto;
}
.specimen-meta { flex: 1 1 18rem; min-width: 0; }
.specimen-meta h1 { margin-top: 0; }
.os-rows { margin-top: 0.875rem; border-top: 1px solid var(--color-border); }
.os-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}
.os-name {
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 0 0 6.5rem;
}
.os-keys { font-size: 0.9375rem; }

/* Keycap chips — new <kbd> and the existing .kbd spans in prose */
kbd, .kbd {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-surface);
  border: 1px solid var(--color-kbd-border);
  border-bottom-width: 2px;          /* keycap depth */
  border-radius: var(--radius);
  padding: 0.0625rem 0.375rem;
  white-space: nowrap;
}

/* ---- Tool section ------------------------------------------------------------- */
#tool { margin: var(--space) 0; }

label {
  display: block;
  margin: 0.75rem 0 0.25rem;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input, select, button {
  font: inherit;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--color-kbd-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  max-width: 100%;
}
input:focus-visible, select:focus-visible { border-color: var(--color-primary); }

button {
  background: var(--color-primary);
  color: #fff;
  border: none;
  cursor: pointer;
}

.search-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: end; }
.search-row .grow { flex: 1 1 14rem; }
#symbol-search { width: 100%; font-size: 1.125rem; }
#result-count { color: var(--color-muted); font-size: 0.875rem; margin: 0.5rem 0 0; }

/* ---- Reference table (JS-rendered; class contract frozen) ---------------------- */
.table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
  border-top: 2px solid var(--color-text);   /* specimen-sheet head rule */
}
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td {
  text-align: left;
  padding: 0.625rem 0.75rem 0.625rem 0;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  font-weight: 600;
}
.glyph {
  font-family: var(--font-glyph);
  font-size: 2.25rem;
  line-height: 1;
  display: inline-block;
  min-width: 2.25rem;
  vertical-align: middle;
  transition: color 120ms;
}
tbody tr:hover .glyph { color: var(--color-primary); }
.cell-symbol { white-space: nowrap; }
.cell-name .cp {
  display: block;
  color: var(--color-muted);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
}
.cell-entity code, .cell-alt { font-family: var(--font-mono); font-size: 0.875rem; }
.cell-entity code {
  display: inline-block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0 0.25rem;
  margin: 0 0.125rem 0.125rem 0;
}
.na { color: var(--color-muted); }
.legacy-mark {
  font-size: 0.6875rem;
  color: var(--color-muted);
  text-decoration: underline dotted;
  vertical-align: super;
}

/* Copy button: red pill, ≥44px tap target; JS sets "copy"/"copied" */
.copy-btn {
  margin-left: 0.625rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: capitalize;   /* renders "Copy" / "Copied" */
  background: var(--color-primary);
  color: #fff;                  /* 5.9:1 */
  border: none;
  border-radius: 999px;
  vertical-align: middle;
  transition: transform 120ms;
}
.copy-btn:hover { background: var(--color-text); }
.copy-btn:active { transform: scale(0.97); }
.no-results { color: var(--color-muted); margin-top: var(--space); }

/* ---- Glyph-tile grid (index: browse the specimen sheets) ----------------------- */
.tile-section { margin: 2rem 0; }
.tile-section h2 { margin: 0 0 0.75rem; }
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.75rem;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  aspect-ratio: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 120ms;
}
.tile-glyph {
  font-family: var(--font-glyph);
  font-size: 3rem;
  line-height: 1;
  color: var(--color-text);
  transition: color 120ms;
}
.tile-caption {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-muted);
}
.tile:hover, .tile:focus-visible {
  border-color: var(--color-primary);
}
.tile:hover .tile-glyph, .tile:focus-visible .tile-glyph {
  color: var(--color-primary);
}

/* ---- Content prose -------------------------------------------------------------- */
#content h2 { margin-top: 2.5rem; }
#content code {
  font-family: var(--font-mono);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.0625rem 0.3125rem;
  font-size: 0.875em;
}
.freshness { color: var(--color-muted); font-size: 0.8125rem; }

/* ---- Footer ------------------------------------------------------------------- */
footer {
  border-top: 1px solid var(--color-border);
  margin-top: 2rem;
  padding-top: 1rem;
  padding-bottom: 1.5rem;
  color: var(--color-muted);
  font-size: 0.875rem;
}
footer a { color: inherit; }
footer a:hover { color: var(--color-primary); }

/* ---- Motion ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .copy-btn:active { transform: none; }
}
