/* ============================================================
   base.css — リセット + 要素の基本スタイル
   ★共通。プロジェクトごとに編集しない。色やサイズは必ずトークン経由。
   ============================================================ */

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

* { margin: 0; }

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

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

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-weight: var(--weight-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
  word-break: normal;
  line-break: strict;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-bold);
  text-wrap: pretty;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p, ul, ol, dl, table, figure, blockquote, pre { margin-block: var(--space-4); }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

/* フォーカスリングを消さない（アクセシビリティ要件） */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

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

ul, ol { padding-inline-start: 1.5em; }
li { margin-block: var(--space-2); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
th, td {
  padding: var(--space-3);
  border: var(--border-width) solid var(--color-border);
  text-align: left;
  vertical-align: top;
}
th { background: var(--color-surface); font-weight: var(--weight-bold); }

blockquote {
  padding-inline-start: var(--space-4);
  border-inline-start: 3px solid var(--color-border);
  color: var(--color-text-muted);
}

hr {
  border: 0;
  border-top: var(--border-width) solid var(--color-border);
  margin-block: var(--space-12);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--color-surface);
  padding: 0.1em 0.35em;
  border-radius: var(--radius);
}

small { font-size: var(--text-xs); }

button { font: inherit; cursor: pointer; }

/* --- レイアウトユーティリティ（最小限） --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.measure { max-width: var(--measure); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  background: var(--color-accent);
  color: #fff;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  transition: top var(--transition);
}
.skip-link:focus { top: var(--space-4); }
