/* base.css: reset, typography, links, focus, skip link, Korean rules, print.
   Element selectors only (plus a few utilities), so components can override with one class. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--space-4);
}
/* The header is sticky only on wide, tall screens; keep anchors and focus clear of it there. */
@media (min-width: 48em) and (min-height: 30em) {
  html { scroll-padding-top: calc(var(--header-h) + var(--space-4)); }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: var(--leading);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

/* The hidden attribute always wins over component display rules (buttons revealed by JS ship hidden). */
[hidden] { display: none !important; }

img, svg, video { display: block; max-width: 100%; height: auto; }
svg { overflow: visible; }

/* Headings: sentence case, weight 600, tight leading. Display tracking only on big sizes. */
h1, h2, h3, h4 {
  margin: 0 0 var(--space-4);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: var(--step-4); letter-spacing: -0.02em; }
h2 { font-size: var(--step-3); letter-spacing: -0.012em; line-height: 1.2; }
h3 { font-size: var(--step-2); line-height: 1.3; }
h4 { font-size: var(--step-0); line-height: 1.4; }

p, ul, ol, dl, blockquote, figure, table, pre { margin: 0 0 var(--space-4); }
ul, ol { padding-left: 1.25em; }
li + li { margin-top: var(--space-2); }
li::marker { color: var(--muted); }
dd { margin: 0; }
strong, b { font-weight: 600; }
small { font-size: var(--step--1); }
hr { border: 0; border-top: var(--rule-w) solid var(--rule); margin: var(--space-6) 0; }

/* Numbers that line up: dates, prices, tables, counters. */
time, table, .num { font-variant-numeric: tabular-nums; }

/* Links: ledger green, thin underline that thickens on hover. Never red. */
a {
  color: var(--green);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}
a:hover { text-decoration-thickness: 2px; }

code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--green-wash);
  padding: 0.05em 0.3em;
  border-radius: 2px;
}

/* Focus: one ring everywhere, green, 3px wide, 3px away. */
:focus-visible { outline: var(--focus); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }
[tabindex="-1"]:focus { outline: none; }

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

/* Skip link */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -10rem;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--green);
  color: var(--on-green);
  font-weight: 600;
  border-radius: var(--radius-btn);
  text-decoration: none;
}
.skip-link:focus { top: var(--space-3); }

/* Korean: Plex KR, keep words whole, taller line-height. Applies to any lang="ko" subtree. */
:lang(ko) {
  word-break: keep-all;
  line-height: var(--leading-ko);
  letter-spacing: 0;
}
/* keep-all leaves long runs like 발송·결제·이체·… unbreakable. break-word lets such a run break only
   when it cannot fit on a line of its own, so "·" never starts a line early; grid and flex children
   get min-width: 0 (layout.css) so nothing is pushed wider than the screen. */
[lang="ko"] { overflow-wrap: break-word; }
:lang(ko) :is(h1, h2, h3, h4) { line-height: 1.35; letter-spacing: -0.01em; }

/* Utilities */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.h-small { font-size: var(--step-1); line-height: 1.35; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }
.small { font-size: var(--step--1); }
.lead { font-size: var(--step-1); line-height: 1.55; color: var(--ink-2); max-width: 52ch; }
.measure { max-width: var(--measure); }
.flow > * + * { margin-top: var(--flow-space, var(--space-4)); }
.flow > * { margin-bottom: 0; }

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

@media print {
  :root {
    color-scheme: light;
    --paper: #fff; --sheet: #fff; --ink: #000; --ink-2: #222; --muted: #444;
    --rule: #bbb; --rule-strong: #666; --green: #000; --green-wash: #fff;
    --seal: #C3322A; --seal-wash: #fff; --on-green: #fff; --shadow-doc: none;
  }
  body { background: #fff; font-size: 11pt; }
  .site-header, .skip-link, .nav-toggle, .copy-btn, .link-btn, .site-footer nav,
  .approval-doc__actions, .approval-doc__clock { display: none !important; }
  .btn { border: 1px solid #000; background: #fff !important; color: #000 !important; }
  a { color: inherit; }
  main a[href^="http"]::after, main a[href^="mailto:"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
  .table-wrap { overflow: visible; }
  h2, h3 { break-after: avoid; }
  table, figure, .plan, .callout, .approval-doc { break-inside: avoid; }
  .seal { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
