/* ============================================================================
   02-base.css  ―  素のタグに当てる下地
   ----------------------------------------------------------------------------
   ここに書くのは「タグセレクタ」だけ。class は一切使わない。
   ブラウザごとの初期値のばらつきをならし、01-tokens.css の変数を
   ページ全体の既定値として流し込む役目。
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;   /* 幅の数え方を「枠線まで込み」に統一 */
}

html {
  font-size: var(--fs-root);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 見出しは既定のマージンを消して、余白は親の gap に任せる。
   （margin を各要素に持たせると相殺・二重で必ず崩れる） */
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol {
  margin: 0;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  text-wrap: balance;
  letter-spacing: .01em;
}

ul, ol { padding: 0; list-style: none; }

a {
  color: var(--color-brand);
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: .2em;
  transition: color var(--dur-1) var(--ease-out);
}
a:hover { color: var(--color-brand-hover); }

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

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

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

table { border-collapse: collapse; width: 100%; }

/* キーボード操作の人にだけ見える枠。マウス操作では出ない */
:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

/* 動きを減らす設定の人には、動きを止める（OS の設定を尊重する） */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
