/* ==========================================================================
   GaugePlay Design System — base.css  (v1.0 · 2026-10-04)
   Reset + Korean typesetting + focus + reduced motion. Low specificity (:where)
   so page CSS can override without !important.
   ========================================================================== */

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

/* `hidden` must win over component display values (.gp-btn is inline-flex, etc.) */
[hidden]:not([hidden="until-found"]) { display: none !important; }

:where(html) {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  color: var(--ink);
  scroll-padding-top: calc(var(--nav-h) + 16px);
  hanging-punctuation: first last;
}

@media (prefers-reduced-motion: no-preference) {
  :where(html) { scroll-behavior: smooth; }
}

:where(body) {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Korean breaks at word (eojeol) boundaries, never mid-word. */
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
}

:where(h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ol, ul) { margin: 0; }
:where(ol, ul)[role="list"], :where(ol, ul)[class] { list-style: none; padding: 0; }

:where(h1, h2, h3, h4) {
  font-weight: var(--fw-heavy);
  line-height: var(--lh-snug);
  letter-spacing: var(--tr-head);
  text-wrap: balance;
}

:where(p, li, dd, figcaption, blockquote, summary) { text-wrap: pretty; }

:where(img, picture, video, canvas, svg) { display: block; max-width: 100%; }
:where(img, video) { height: auto; }
:where(svg) { flex-shrink: 0; }

:where(input, button, textarea, select) { font: inherit; color: inherit; letter-spacing: inherit; }
:where(button) { background: none; border: 0; padding: 0; cursor: pointer; }
:where(button:disabled, [aria-disabled="true"]) { cursor: not-allowed; }
:where(textarea) { resize: vertical; }

:where(a) { color: inherit; text-decoration: none; }
:where(a:not([class])) {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

:where(a, button, input, label, select, summary, textarea, [role="button"], [role="tab"]) { touch-action: manipulation; }

:where(hr) { border: 0; border-top: 1px solid var(--line); margin: 0; }

:where(code, kbd, samp, pre) { font-family: var(--font-mono); font-size: .9em; }

:where(table) { border-collapse: collapse; width: 100%; }

:where(dialog) { color: var(--ink); }

::selection { background: var(--primary); color: var(--on-primary); }

/* ---- Focus: always visible for keyboard, invisible for mouse/touch ---- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: inherit;
}
/* Lime surfaces need a dark gap so the ring does not merge with the fill */
:where(.gp-btn:not(.gp-btn--ghost):not(.gp-btn--quiet)):focus-visible { outline-color: var(--ink); }

/* ---- Accessibility helpers ---- */
.gp-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.gp-skip {
  position: fixed;
  left: 12px; top: 12px;
  z-index: var(--z-tooltip);
  padding: 10px 14px;
  border-radius: var(--r-3);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: var(--fw-heavy);
  transform: translateY(-160%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.gp-skip:focus-visible { transform: none; }

/* Pixel art is never interpolated */
.gp-pixelated { image-rendering: pixelated; image-rendering: crisp-edges; }

/* Thin, quiet scrollbars on dark */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ---- Reduced motion: the still frame must carry the same information ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  .gp-motion-decor { display: none !important; }
}
