/* Tokens live in assets/theme.css, loaded before this file. */

/* HANARO shared tokens and primitives. Mirrors design.md §3, §4, §5, §8.
   Used by archive.html and admin.html. index.html carries its own copy inline. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.grain {
  position: fixed; inset: 0; z-index: 55; pointer-events: none;
  /* the fallbacks belong here, at the file boundary: if theme.css fails to load,
     opacity would otherwise reset to its initial value of 1 — a full-screen
     opaque noise rectangle */
  opacity: var(--grain-op, 0.05); mix-blend-mode: var(--grain-mode, normal);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E");
}

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

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(72px, 9vh, 140px); }

.eyebrow {
  font-family: var(--util); font-size: 0.75rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-3);
  margin: 0 0 var(--s-5); display: flex; align-items: center; gap: var(--s-3);
}
.eyebrow::before { content: ""; width: 8px; height: 1px; background: var(--accent); flex: none; }

.h-section {
  font-family: var(--display); font-variation-settings: 'wdth' 118;
  font-weight: 700; font-size: clamp(2.1rem, 4vw, 3.3rem);
  line-height: 1.02; letter-spacing: -0.015em; color: var(--ink);
  margin: 0 0 var(--s-6); max-width: 20ch; text-wrap: balance;
}
.h-sub {
  font-family: var(--display); font-variation-settings: 'wdth' 112;
  font-weight: 700; font-size: clamp(1.3rem, 2vw, 1.75rem);
  line-height: 1.15; letter-spacing: -0.01em; color: var(--ink); margin: 0;
}
.prose { max-width: 68ch; text-wrap: pretty; margin: 0; }

/* operator-authored text reaches these pages; an unbroken token must not
   push the document sideways */
p, li, dd, address, .prose, .role-remit, .rec-name { overflow-wrap: break-word; }

/* skip link: was on index only */
.skip {
  position: absolute; left: var(--s-4); top: var(--s-4); z-index: 100;
  transform: translateY(-200%);
  background: var(--accent); color: var(--bg); text-decoration: none;
  font-family: var(--util); font-size: 0.75rem; letter-spacing: 0.16em;
  text-transform: uppercase; padding: 10px 16px; border-radius: 2px;
}
.skip:focus { transform: translateY(0); }

/* anchors and sequential focus must clear the sticky bar (WCAG 2.4.11) */
html { scroll-padding-top: 5.5rem; scroll-padding-bottom: 5rem; }

/* touch targets live in theme.css; the mobile block is at the END of this
   file, because a media query adds no specificity and these rules were being
   overridden by the base rules that follow them. */

.label {
  font-family: var(--util); font-size: 0.6875rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3); margin: 0 0 var(--s-2);
}

.btn {
  display: inline-block; font-family: var(--util); font-size: 0.75rem;
  letter-spacing: 0.16em; text-transform: uppercase; text-decoration: none;
  padding: 14px 28px; border-radius: 2px; border: 1px solid transparent;
  cursor: pointer; transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.btn.btn--primary { background: var(--accent); color: var(--bg); }
.btn.btn--primary:hover { background: var(--ink); }
.btn.btn--secondary { background: transparent; border-color: var(--edge); color: var(--ink); }
.btn.btn--secondary:hover { background: var(--bg-rise); }
.btn.btn--sm { padding: 9px 18px; font-size: 0.6875rem; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.lnk {
  color: var(--ink); text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat; background-position: 0 100%;
  background-size: 0% 1px; padding-bottom: 0.15em;
  transition: background-size 160ms var(--ease);
}
/* a selector list is not forgiving: on a browser without :focus-visible the
   :hover half died too. Split them. */
/* the underline was hover-only, so on a phone a link was distinguished from
   body text by colour alone at 1.6:1 — below the 3:1 WCAG 1.4.1 floor */
.lnk { background-size: 100% 1px; }
.lnk:hover { background-size: 100% 2px; }
.lnk:focus-visible { background-size: 100% 1px; }

.tag {
  display: inline-block; font-family: var(--util); font-size: 0.75rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  padding: 5px 10px 4px; border-radius: 2px; border: 1px solid transparent;
}
.tag.tag--verified { background: var(--accent); color: var(--bg); }
.tag.tag--partial  { background: var(--bg-rise); color: var(--ink-2); }
.tag.tag--lost     { background: transparent; border-color: var(--rule); color: var(--ink-3); }
.tag.tag--in-build { background: transparent; border-color: var(--rule); color: var(--ink-3); }
.tag.tag--unknown  { background: transparent; border-color: var(--rule); color: var(--ink-3); }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg); border-bottom: 1px solid var(--rule);
}
.topbar-in {
  max-width: var(--wrap); margin-inline: auto;
  padding: var(--s-3) var(--gutter);
  display: flex; align-items: center; gap: var(--s-5); flex-wrap: wrap;
}
.topbar-mark {
  font-family: var(--display); font-variation-settings: 'wdth' 118;
  font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; margin-right: auto;
  display: inline-flex; align-items: baseline; gap: var(--s-3);
}
/* the team's name in the reader's language, beside the Latin wordmark */
.topbar-sub {
  font-family: var(--body); font-variation-settings: normal; font-weight: 500;
  font-size: 0.8125rem; letter-spacing: 0; color: var(--ink-3);
}
@media (max-width: 900px) { .topbar-sub { display: none; } }
/* outbound links (Instagram, YouTube) carry an arrow so they read as leaving the site */
.topbar-nav a[rel~="noopener"]::after { content: "\2197"; margin-left: 0.3em; font-size: 0.85em; }
.topbar-nav { display: flex; gap: var(--s-5); }
.topbar-nav a {
  font-family: var(--util); font-size: 0.75rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3); text-decoration: none;
  padding-bottom: 3px;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1px;
  transition: color 160ms var(--ease), background-size 160ms var(--ease);
}
.topbar-nav a:hover { color: var(--ink); background-size: 100% 1px; }
.topbar-nav a[aria-current="page"] { color: var(--ink); background-size: 100% 1px; }

.field { display: grid; gap: var(--s-2); }
.field label {
  font-family: var(--util); font-size: 0.6875rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3);
}
/* Safari keeps the native menu chrome and drops the box unless appearance is reset */
.field select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; }
.field input, .field textarea, .field select {
  font-family: var(--body); font-size: 1rem; color: var(--ink);
  background: var(--bg-rise); border: 1px solid var(--edge); border-radius: 2px;
  padding: 10px 12px; width: 100%; min-width: 0;
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease);
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--ink-3); }
.field input:focus, .field textarea:focus { background: var(--bg-lift); }
.field textarea { min-height: 92px; resize: vertical; }

.footer { background: var(--bg-lift); border-top: 1px solid var(--rule); }
.footer-in {
  padding-block: var(--s-8) var(--s-7);
  font-family: var(--util); font-size: 0.75rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6); align-items: center;
}
.footer-in .btn { margin-left: auto; }

/* a full-viewport blend forces a readback every scroll frame; at 3-5% it is
   not worth the jank on small devices */
@media (max-width: 900px) { .grain { display: none; } }

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

/* ==========================================================================
   MOBILE — must stay last. @media adds no specificity, so these have to come
   after .topbar-nav, .topbar-in, .topbar-mark and .btn--sm or they lose.
   ========================================================================== */
@media (max-width: 720px) { .topbar-nav { display: none; } }
@media (max-width: 560px) {
  .topbar .btn { padding: 9px 14px; letter-spacing: 0.12em; }
  .topbar-in { gap: var(--s-3); }
  .topbar-mark { font-size: 0.95rem; }
}
/* landscape phones are 568-932px WIDE, so a width query never reaches them,
   and 12vh of a 320px viewport falls back to the desktop floor */
@media (max-height: 500px) {
  .section { padding-block: clamp(32px, 8vh, 56px); }
}

/* ---------- 404 (was an inline <style> block on both 404 pages) ---------- */
.lost { min-height: 70svh; display: flex; align-items: center; }
.lost .wrap { padding-block: var(--s-9); }
.code { font-family: var(--util); font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin: 0 0 var(--s-5); }
.links { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-7); align-items: center; }
