@charset "UTF-8";

/* ============================================================
   hpc.in.th
   Design tokens — built on the Terminal Kit v3.0 brand palette.
   The identity is monospaced ink + amber; the interface is not.
   ============================================================ */

:root {
  /* --- Brand palette, verbatim from the kit ------------------ */
  --hpc-ink:           #14161A;  /* primary text on light · the cursor */
  --hpc-ink-2:         #4A4F58;
  --hpc-muted:         #69727E;
  --hpc-amber:         #FF8A1F;  /* `hpc` in the wordmark · graphics only */
  --hpc-amber-light:   #FFA94D;  /* the accent on dark surfaces */
  --hpc-action:        #9E4E00;  /* links & buttons on light (5.9:1) */
  --hpc-surface:       #F4F5F7;
  --hpc-line:          #DDE0E6;
  --hpc-dark:          #16181C;
  --hpc-dark-raised:   #22252B;
  --hpc-on-dark-muted: #A0A8B4;

  /* --- Type ------------------------------------------------- */
  --font-sans: "IBM Plex Sans Thai", -apple-system, BlinkMacSystemFont,
               "Segoe UI", "Noto Sans Thai", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* --- Surfaces --------------------------------------------- */
  --bg: #ffffff;
  --bg-alt: var(--hpc-surface);
  --surface: #ffffff;
  --surface-2: var(--hpc-surface);
  --ink: var(--hpc-ink);
  --ink-2: var(--hpc-ink-2);
  --muted: var(--hpc-muted);
  --line: var(--hpc-line);
  --line-strong: #c8cdd6;

  /* --- Interactive ramp, drawn from Action ------------------- */
  --brand: var(--hpc-amber);   /* solid fills, always with ink on top (7.5:1) */
  --brand-hover: var(--hpc-amber-light);
  --brand-600: var(--hpc-action);  /* coloured *text*: links, figures, labels */
  --brand-400: #c26a10;
  --brand-200: #f0cfab;
  --brand-50: #fdf4eb;

  /* Pure Amber is the graphic accent: rules, dots, edges — never text.
     `--accent-ink` is the readable stand-in wherever the accent has to
     carry words. */
  --accent: var(--hpc-amber);
  --accent-ink: var(--hpc-action);
  --accent-50: #fff4e8;

  /* The wordmark alone is exempt from text contrast (WCAG logo exemption). */
  --wordmark-accent: var(--hpc-amber);

  --danger: #b3261e;
  --ok: #146b52;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(20, 22, 26, .05), 0 1px 3px rgba(20, 22, 26, .04);
  --shadow: 0 2px 6px rgba(20, 22, 26, .06), 0 12px 28px -14px rgba(20, 22, 26, .18);
  --shadow-lg: 0 4px 12px rgba(20, 22, 26, .08), 0 28px 60px -28px rgba(20, 22, 26, .3);

  --container: 1180px;
  --header-h: 64px;
  --rail-x: 72px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: var(--hpc-dark);
  --bg-alt: #1b1e23;
  --surface: var(--hpc-dark-raised);
  --surface-2: #1b1e23;
  --ink: #ffffff;
  --ink-2: #d2d7de;
  --muted: var(--hpc-on-dark-muted);
  --line: #2a2e35;
  --line-strong: #3a3f48;

  --brand: var(--hpc-amber-light);
  --brand-hover: #ffc07a;
  --brand-600: #ffc07a;
  --brand-400: #c97a2a;
  --brand-200: #4a3418;
  --brand-50: #2a2116;

  --accent: var(--hpc-amber);
  --accent-ink: var(--hpc-amber-light);
  --accent-50: #2c2113;

  --wordmark-accent: var(--hpc-amber-light);

  --danger: #f08a7e;
  --ok: #5fc4a2;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 12px 28px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, .4), 0 28px 60px -28px rgba(0, 0, 0, .85);
  color-scheme: dark;
}

/* ============================================================
   Reset & base
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; display: block; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  margin: 0 0 .5em;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
}
h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.1rem); font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
ul { margin: 0 0 1em; padding-inline-start: 1.2em; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

.skip-link {
  position: fixed;
  top: 8px;
  inset-inline-start: 16px;
  z-index: 200;
  background: var(--brand);
  color: var(--hpc-ink);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  /* Hidden without pushing the scroll area sideways. */
  clip-path: inset(50%);
  opacity: 0;
}
:root[data-theme="dark"] .skip-link { color: var(--hpc-ink); }
.skip-link:focus { clip-path: none; opacity: 1; }

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

/* ============================================================
   Header
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* The logo is the domain name itself — set in IBM Plex Mono with a block
   cursor, always lowercase, amber on `hpc` only. Nothing goes beside it and
   nothing goes under it: the name already reads "HPC in TH".
   Clear space is one mono cell (0.6em) on every side. */
.brand {
  display: inline-flex;
  align-items: center;
  padding: 0 .6em 0 0;
  color: var(--ink);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.wordmark {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.16rem;
  letter-spacing: -.01em;
  line-height: 1;
  text-transform: lowercase;
  color: var(--ink);
}
.wordmark .wm-accent { color: var(--wordmark-accent); }
.wordmark .caret {
  display: inline-block;
  width: .55em;
  height: .7em;              /* cap height */
  margin-inline-start: .1em;
  background: currentColor;
  vertical-align: -.02em;
  animation: caret-blink 1.06s steps(1, end) infinite;
}
@keyframes caret-blink { 0%, 49% { opacity: 1 } 50%, 100% { opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .wordmark .caret { animation: none } }

/* Below ~20px the full name stops being legible; the favicon carries the
   identity there instead, so the header never goes smaller than this. */
@media (max-width: 380px) { .wordmark { font-size: 1.02rem; } }

.site-nav { margin-inline-start: auto; }
.site-nav ul {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0; padding: 0;
}
.site-nav a {
  display: block;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: .93rem;
  color: var(--ink-2);
  transition: background .18s var(--ease), color .18s var(--ease);
}
.site-nav a:hover { background: var(--brand-50); color: var(--brand-600); text-decoration: none; }
.site-nav a[aria-current="page"] { background: var(--brand-50); color: var(--brand-600); font-weight: 500; }
/* Shown only in the mobile menu — on desktop the header icon covers it. */
.nav-repo { display: none; }

.header-tools { display: flex; align-items: center; gap: 8px; }

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
}
.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
  padding: 3px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.lang-switch button[aria-pressed="true"] {
  background: var(--brand);
  color: var(--hpc-ink);
}

.icon-btn {
  appearance: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.icon-btn:hover { background: var(--brand-50); color: var(--brand-600); text-decoration: none; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn-repo svg { width: 16px; height: 16px; }

.nav-toggle { display: none; }

@media (max-width: 900px) {
  .nav-toggle { display: grid; }
  .icon-btn-repo { display: none; }
  .nav-repo { display: block; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
  .site-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 8px 20px 16px;
    display: none;
  }
  .site-nav[data-open="true"] { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 2px; }
  .site-nav a { padding: 11px 12px; border-radius: var(--radius-sm); }
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 420px at 82% -12%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 68%),
    radial-gradient(700px 380px at 8% 6%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 64%),
    var(--bg-alt);
  border-bottom: 1px solid var(--line);
  padding: clamp(48px, 6vw, 86px) 0 clamp(40px, 5vw, 66px);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
}
@media (max-width: 940px) { .hero-grid { grid-template-columns: 1fr; } }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brand-600);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--brand-200);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.lead {
  font-size: clamp(1rem, .95rem + .3vw, 1.14rem);
  color: var(--ink-2);
  max-width: 62ch;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: .95rem;
  font-weight: 500;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: var(--hpc-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-hover); box-shadow: var(--shadow); }
.btn-ghost {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--surface); }
.btn svg { width: 16px; height: 16px; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.stat-card {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card b {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2.1rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--brand-600);
  font-variant-numeric: tabular-nums;
}
.stat-card span { font-size: .84rem; color: var(--muted); line-height: 1.45; display: block; }

/* ============================================================
   Sections
   ============================================================ */

.section { padding: clamp(44px, 5vw, 76px) 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section-head { max-width: 70ch; margin-bottom: 30px; }
.section-head p { color: var(--ink-2); margin-bottom: 0; }

/* ============================================================
   Timeline controls
   ============================================================ */

.tl-controls {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  margin-bottom: 34px;
}
.tl-controls-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  appearance: none;
  font: inherit;
  font-size: .85rem;
  padding: 6px 15px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.chip:hover { border-color: var(--brand-400); color: var(--brand-600); }
.chip[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--hpc-ink);
  font-weight: 500;
}
.chip small { opacity: .7; font-size: .92em; margin-inline-start: 5px; }

.search-field { position: relative; margin-inline-start: auto; min-width: 240px; flex: 1 1 240px; max-width: 340px; }
.search-field svg {
  position: absolute; inset-inline-start: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
.search-field input {
  width: 100%;
  font: inherit;
  font-size: .9rem;
  padding: 8px 14px 8px 36px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}
.search-field input::placeholder { color: var(--muted); }

.result-count { font-size: .85rem; color: var(--muted); margin-bottom: 20px; }
@media (max-width: 700px) {
  /* Keep the filter bar to two compact rows: chips scroll sideways, search below. */
  .tl-controls-inner { gap: 8px; }
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
    margin-inline: -20px;
    padding-inline: 20px;
    width: calc(100% + 40px);
  }
  .chips::-webkit-scrollbar { display: none; }
  .search-field { margin-inline-start: 0; max-width: none; }
}


/* ============================================================
   Timeline
   ============================================================ */

.timeline {
  position: relative;
  padding-inline-start: var(--rail-x);
}
.timeline::before {
  content: "";
  position: absolute;
  inset-block: 6px;
  inset-inline-start: 27px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--line-strong), var(--line) 12%, var(--line) 88%, transparent);
}

.tl-item { position: relative; margin-bottom: 22px; }
.tl-item:last-child { margin-bottom: 0; }

.tl-node {
  position: absolute;
  inset-inline-start: calc(var(--rail-x) * -1);
  top: 14px;
  width: 58px;
  display: grid;
  place-items: center;
  z-index: 2;
}
.tl-dot {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--brand-200);
}
.tl-year {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--line-strong);
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.05;
  box-shadow: var(--shadow-sm);
}
.tl-year b {
  font-family: var(--font-mono);
  font-size: .96rem;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tl-year span { font-size: .56rem; color: var(--muted); white-space: nowrap; }

.tl-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .22s var(--ease), border-color .22s var(--ease), transform .22s var(--ease);
}
.tl-item:hover > .tl-card { box-shadow: var(--shadow); border-color: var(--line-strong); }

.tl-card h3 { margin-bottom: 2px; font-size: 1.08rem; }
.tl-sub {
  font-size: .93rem;
  color: var(--brand-600);
  font-weight: 500;
  margin-bottom: 6px;
}
.tl-org {
  font-size: .87rem;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  gap: 7px;
}
.tl-org::before { content: "▸"; color: var(--line-strong); flex: none; }
.tl-body { font-size: .94rem; color: var(--ink-2); margin-bottom: 0; }
.tl-body + .tl-bullets, .tl-body + .tl-stats { margin-top: 12px; }

.tl-bullets { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; }
.tl-bullets li {
  font-size: .91rem;
  color: var(--ink-2);
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 8px;
  align-items: start;
}
.tl-bullets li::before { content: "–"; color: var(--muted); text-align: center; }
.tl-bullets li[data-tone="plus"]::before { content: "+"; color: var(--ok); font-weight: 600; }
.tl-bullets li[data-tone="minus"]::before { content: "−"; color: var(--danger); font-weight: 600; }

.tl-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.tl-stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  line-height: 1.3;
}
.tl-stat b {
  display: block;
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tl-stat span { font-size: .72rem; color: var(--muted); }

.tl-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.tag {
  font-size: .73rem;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge {
  font-size: .73rem;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-50);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent-ink);
  white-space: nowrap;
}
.tl-source {
  margin-inline-start: auto;
  font-size: .78rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tl-source svg { width: 13px; height: 13px; }

/* highlight variant */
.tl-item[data-kind="highlight"] > .tl-card {
  border-inline-start: 3px solid var(--accent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 5%, var(--surface)), var(--surface) 30%);
}
.tl-item[data-kind="highlight"] .tl-year { border-color: var(--brand-400); }

/* era banner */
.tl-item[data-kind="era"] { margin-block: 40px 30px; }
.tl-item[data-kind="era"] .tl-node { top: 6px; }
.tl-item[data-kind="era"] .tl-year {
  width: 78px; height: 78px;
  inset-inline-start: -10px;
  position: relative;
  border-width: 4px;
  border-color: var(--brand-400);
  background: var(--surface);
}
.tl-item[data-kind="era"] .tl-year b { font-size: 1.22rem; }
.tl-item[data-kind="era"] .tl-year span { font-size: .6rem; }
.tl-era-card {
  background: linear-gradient(100deg, var(--brand-50), color-mix(in srgb, var(--brand-50) 20%, var(--surface)));
  border: 1px solid var(--brand-200);
  border-radius: var(--radius-lg);
  padding: 22px 28px;
  margin-inline-start: 12px;
}
.tl-era-card .tl-era-label {
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand-600);
  font-weight: 600;
  margin-bottom: 4px;
}
.tl-era-card h2 { font-size: clamp(1.2rem, 1.05rem + .7vw, 1.65rem); margin-bottom: 2px; }
.tl-era-card p { color: var(--brand-600); margin: 0; font-size: .96rem; }

/* open / next question */
.tl-item[data-kind="open"] .tl-year {
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent-ink);
}
.tl-item[data-kind="open"] .tl-year b { font-size: 1.5rem; color: var(--accent-ink); }
.tl-item[data-kind="open"] > .tl-card {
  border-style: dashed;
  border-color: var(--accent);
  background: var(--accent-50);
}

@media (max-width: 700px) {
  :root { --rail-x: 50px; }
  .timeline::before { inset-inline-start: 18px; }
  .tl-node { width: 40px; top: 12px; }
  .tl-year { width: 40px; height: 40px; border-width: 2px; }
  .tl-year b { font-size: .76rem; }
  .tl-year span { display: none; }
  .tl-item[data-kind="era"] .tl-year { width: 54px; height: 54px; inset-inline-start: -7px; }
  .tl-item[data-kind="era"] .tl-year b { font-size: .92rem; }
  .tl-card { padding: 16px 17px; }
  .tl-era-card { padding: 18px 19px; margin-inline-start: 6px; }
}

/* ============================================================
   Slides gallery
   ============================================================ */

.slide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.slide-thumb {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  padding: 0;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.slide-thumb:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.slide-thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top left; }
.slide-thumb figcaption {
  font-size: .8rem;
  color: var(--muted);
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  text-align: start;
}

.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 96vw;
  max-height: 94vh;
  width: min(1500px, 96vw);
}
.lightbox::backdrop { background: rgba(10, 11, 13, .9); backdrop-filter: blur(3px); }
.lightbox img {
  width: 100%;
  height: auto;
  max-height: 84vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: #fff;
}
.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  color: #fff;
  font-size: .88rem;
}
.lightbox-bar button {
  appearance: none;
  font: inherit;
  font-size: .85rem;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
}
.lightbox-bar button:hover { background: rgba(255, 255, 255, .24); }

/* ============================================================
   Cards / systems
   ============================================================ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}
.sys-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.sys-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.sys-head { display: flex; align-items: start; gap: 10px; }
.sys-head h3 { margin: 0; font-size: 1.1rem; }
.sys-head .year {
  margin-inline-start: auto;
  font-size: .78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
  padding-top: 3px;
}
.sys-org { font-size: .86rem; color: var(--muted); margin: -8px 0 0; }
.sys-specs { display: grid; gap: 8px; margin: 0; }
.sys-spec {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  font-size: .87rem;
  align-items: baseline;
}
.sys-spec dt { color: var(--muted); font-size: .78rem; letter-spacing: .02em; }
.sys-spec dd { margin: 0; color: var(--ink-2); }
.sys-spec dd b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.sys-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.badge-warn {
  font-size: .72rem;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-50);
  color: var(--accent-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

#map {
  height: 520px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  z-index: 1;
}
.leaflet-popup-content-wrapper { border-radius: var(--radius-sm); font-family: var(--font-sans); }
.leaflet-popup-content { margin: 12px 14px; font-size: .88rem; line-height: 1.55; }
.leaflet-popup-content h4 { margin: 0 0 4px; font-size: .98rem; }

/* ============================================================
   Charts / stats
   ============================================================ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 18px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.chart-card h3 { font-size: 1rem; margin-bottom: 14px; }
.chart-box { position: relative; height: 300px; }

/* ============================================================
   Forms
   ============================================================ */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
}
.form-grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } }

.field label {
  display: block;
  font-size: .87rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.field label .req { color: var(--danger); font-size: .78rem; font-weight: 400; margin-inline-start: 4px; }
.field label .field-key { color: var(--muted); font-size: .78rem; font-weight: 400; margin-inline-start: 6px; }
.field-section {
  margin: 22px 0 2px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.field-section:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.field input, .field select, .field textarea {
  width: 100%;
  font: inherit;
  font-size: .93rem;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
}
.field textarea { min-height: 170px; resize: vertical; line-height: 1.6; }
.field .hint { font-size: .8rem; color: var(--muted); margin: 5px 0 0; }
.field input[readonly] { color: var(--muted); background: color-mix(in srgb, var(--surface-2) 70%, transparent); }

.field-table .table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.input-table { width: 100%; border-collapse: collapse; min-width: 480px; }
.input-table th {
  font-size: .74rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--muted); text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.input-table td { padding: 6px; border-bottom: 1px solid var(--line); }
.input-table tr:last-child td { border-bottom: none; }
.input-table input {
  width: 100%; min-width: 88px; font: inherit; font-size: .88rem;
  padding: 7px 9px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink);
}
.btn-row-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: .95rem; line-height: 1;
}
.btn-row-remove:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 7px 14px; font-size: .82rem; margin-top: 10px; }

.notice {
  display: flex;
  gap: 11px;
  padding: 14px 17px;
  border-radius: var(--radius-sm);
  background: var(--accent-50);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  font-size: .88rem;
  color: var(--ink-2);
  line-height: 1.6;
}
.notice svg { width: 18px; height: 18px; flex: none; color: var(--accent-ink); margin-top: 3px; }
.notice-info { background: var(--brand-50); border-color: var(--brand-200); }
.notice-info svg { color: var(--brand-600); }

pre.code {
  margin: 0;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.65;
  color: var(--ink-2);
}

.steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 14px; }
/* The counter is positioned rather than laid out as a grid track, so a step's
   body stays ordinary inline flow — `<code>` inside a step would otherwise be
   blockified into a grid item and land in the counter column. */
.steps li {
  counter-increment: step;
  position: relative;
  padding-inline-start: 43px;
  min-height: 26px;
  font-size: .93rem;
  color: var(--ink-2);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-600);
  border: 1px solid var(--brand-200);
  display: grid; place-items: center;
  font-size: .82rem; font-weight: 600;
}
.steps li code { word-break: break-word; }

/* ============================================================
   Reference archive
   ============================================================ */

.doc-group { margin-bottom: 42px; }
.doc-group:last-child { margin-bottom: 0; }
.doc-group-head { margin-bottom: 16px; }
.doc-group-head h2 {
  font-size: clamp(1.15rem, 1.05rem + .5vw, 1.45rem);
  margin-bottom: 2px;
}
.doc-group-head p { color: var(--muted); font-size: .9rem; margin: 0; max-width: 70ch; }

.doc-list { display: grid; gap: 10px; }

.doc-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  color: inherit;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.doc-card:hover {
  text-decoration: none;
  box-shadow: var(--shadow);
  border-color: var(--brand-200);
  transform: translateY(-2px);
}
.doc-card.is-featured {
  border-inline-start: 3px solid var(--accent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 5%, var(--surface)), var(--surface) 26%);
}

.doc-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--brand-50);
  color: var(--brand-600);
  border: 1px solid var(--brand-200);
}
.doc-icon svg { width: 21px; height: 21px; }
.doc-icon[data-format="image"] { background: var(--accent-50); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 38%, transparent); }
.doc-icon[data-format="link"] { background: var(--surface-2); color: var(--muted); border-color: var(--line-strong); }

.doc-body { display: grid; gap: 3px; min-width: 0; }
.doc-title { font-weight: 500; color: var(--ink); line-height: 1.45; }
.doc-desc { font-size: .89rem; color: var(--ink-2); line-height: 1.55; }
.doc-meta { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.doc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }

.doc-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: .82rem;
  font-weight: 500;
  color: var(--brand-600);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 14px;
  align-self: center;
}
.doc-action svg { width: 14px; height: 14px; }
.doc-card:hover .doc-action { background: var(--brand-50); border-color: var(--brand-200); }

@media (max-width: 640px) {
  .doc-card { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 14px 16px; }
  .doc-icon { width: 36px; height: 36px; }
  .doc-icon svg { width: 18px; height: 18px; }
  .doc-action { grid-column: 2; justify-self: start; margin-top: 4px; }
}

/* Document viewer ------------------------------------------------ */

.viewer {
  width: min(1280px, 95vw);
  max-width: 95vw;
  height: min(92vh, 1100px);
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.viewer::backdrop { background: rgba(10, 11, 13, .82); backdrop-filter: blur(3px); }
.viewer[open] { display: flex; flex-direction: column; }

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  flex: none;
}
.viewer-heading { min-width: 0; margin-inline-end: auto; }
.viewer-heading strong {
  display: block;
  font-size: .95rem;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-heading span { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.viewer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font: inherit;
  font-size: .82rem;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.viewer-btn:hover {
  text-decoration: none;
  background: var(--brand-50);
  color: var(--brand-600);
  border-color: var(--brand-200);
}
.viewer-btn svg { width: 15px; height: 15px; }
.viewer-close { background: var(--brand); color: var(--hpc-ink); border-color: var(--brand); }
.viewer-close:hover {
  background: var(--brand-hover);
  color: var(--hpc-ink);
  border-color: var(--brand-hover);
}

.viewer-paging {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
}
.viewer-icon {
  appearance: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.viewer-icon:hover { background: var(--brand-50); color: var(--brand-600); }
.viewer-icon svg { width: 15px; height: 15px; }
.viewer-page {
  font-size: .78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 52px;
  text-align: center;
}
.viewer-sep { width: 1px; height: 18px; background: var(--line); margin-inline: 4px; }

.viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--bg-alt);
  display: grid;
}
.viewer-stage > * { grid-area: 1 / 1; }
.viewer-stage > iframe,
.viewer-stage > img {
  width: 100%;
  height: 100%;
  border: 0;
}
.viewer-stage > img { object-fit: contain; background: #fff; }

.pdf-stage {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.pdf-page {
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 8px 24px -12px rgba(0, 0, 0, .3);
  flex: none;
  /* Centres while it fits, and stays fully reachable once zoomed past the
     stage width — `align-items: center` would clip the left edge instead. */
  margin-inline: auto;
}
.pdf-page canvas { display: block; border-radius: 3px; }

.viewer-status {
  align-self: center;
  justify-self: center;
  margin: 0;
  padding: 0 32px;
  max-width: 46ch;
  text-align: center;
  font-size: .9rem;
  color: var(--muted);
  z-index: 2;
}

@media (max-width: 860px) {
  .viewer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .viewer-bar { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px; }
  /* Title on its own row, every control on the next one. */
  .viewer-heading { flex: 1 0 100%; order: -1; }
  .viewer-heading strong { font-size: .88rem; white-space: normal; }
  .viewer-btn span { display: none; }
  .viewer-btn { padding: 7px 10px; }
  .viewer-close { margin-inline-start: auto; }
  .viewer-page { min-width: 44px; font-size: .74rem; }
  .pdf-stage { padding: 10px 0 18px; gap: 10px; }
}

@media (max-width: 560px) {
  /* The reader and the download button already cover this. */
  #viewer-tab { display: none; }
}

/* ============================================================
   Events
   ============================================================ */

.event-list { display: grid; gap: 18px; }

.event-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.event-card:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
.event-card.is-featured { border-color: var(--brand-200); }

.event-banner {
  display: block;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.event-banner img {
  width: 100%;
  height: auto;
  aspect-ratio: 1400 / 734;
  object-fit: cover;
}

.event-main {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 20px 24px;
}

.event-date {
  text-align: center;
  border-inline-end: 1px solid var(--line);
  padding-inline-end: 16px;
  line-height: 1.15;
}
.event-date b {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--brand-600);
  font-variant-numeric: tabular-nums;
}
.event-date span { font-size: .78rem; color: var(--muted); letter-spacing: .04em; }

.event-body { min-width: 0; }
.event-body h3 { margin: 0 0 2px; font-size: 1.1rem; line-height: 1.4; }
.event-sub { margin: 0 0 6px; font-size: .9rem; color: var(--brand-600); font-weight: 500; }
.event-desc {
  margin: 0 0 8px;
  font-size: .9rem;
  color: var(--ink-2);
  line-height: 1.6;
  max-width: 78ch;
}
.event-meta { font-size: .84rem; color: var(--muted); margin: 0; line-height: 1.55; }
.event-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }

.event-cta { flex: none; align-self: center; }
.event-cta svg { width: 15px; height: 15px; }

@media (max-width: 820px) {
  /* Single column: the date reads as a header line rather than floating
     halfway down a side rail. */
  .event-main { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px 18px; }
  .event-date {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-align: start;
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 10px;
  }
  .event-date b { font-size: 1.4rem; }
  .event-cta { justify-self: start; }
}

.empty-state {
  text-align: center;
  padding: 56px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
}
.empty-state p { margin-bottom: 18px; }

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 46px 0 28px;
  margin-top: 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
  gap: 34px;
}
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }
.site-footer h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.site-footer a { font-size: .91rem; color: var(--ink-2); }
.site-footer a:hover { color: var(--brand-600); }
.footer-about p { font-size: .9rem; color: var(--muted); max-width: 46ch; margin-bottom: 0; }
.footer-bottom {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-size: .82rem;
  color: var(--muted);
}
.footer-bottom .spacer { margin-inline-start: auto; }

/* ============================================================
   Utilities
   ============================================================ */

.reveal { opacity: 0; transform: translateY(14px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .55s var(--ease), transform .55s var(--ease); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); font-size: .88em; }
.nowrap { white-space: nowrap; }
.text-muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* Data table — the crawlable, screen-readable twin of the charts. */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  margin-top: 6px;
}
.data-table th, .data-table td {
  text-align: start;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table thead th {
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.data-table tbody th { font-weight: 500; color: var(--ink); }
.data-table td { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover th,
.data-table tbody tr:hover td { background: var(--surface-2); }
