/* ==========================================================================
   base.css — リセット / タイポグラフィ / レイアウト基盤 / ユーティリティ
   ========================================================================== */

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

* { margin: 0; }

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

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: var(--lh-body);
  line-break: strict;
  text-align: left;
  font-feature-settings: "palt" 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  padding-bottom: env(safe-area-inset-bottom);
}

/* モバイル固定CTAバーの高さ分を確保 */
@media (max-width: 1023px) {
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}

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

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

a {
  color: inherit;
  text-decoration-color: var(--color-border-strong);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color var(--dur-fast) var(--ease-inout),
              text-decoration-color var(--dur-fast) var(--ease-inout);
}

a:hover { text-decoration-color: var(--mustard-500); }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* --- 見出し ---------------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-feature-settings: "palt" 1;
  letter-spacing: .01em;
  text-wrap: pretty;
}

h1 { font-size: var(--fs-display); line-height: var(--lh-display); }
h2 { font-size: var(--fs-h2);      line-height: var(--lh-h2); }

h3 {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
}

/* --- 本文 ------------------------------------------------------------------ */

p { text-wrap: pretty; }

.lede {
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  font-weight: 500;
}

.muted  { color: var(--color-text-muted); }
.small  { font-size: var(--fs-small); }
.note-s {
  font-size: var(--fs-caption);
  color: var(--color-text-faint);
  line-height: 1.7;
}

.label {
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: .08em;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.emphasis {
  background-image: linear-gradient(transparent 62%, var(--mustard-300) 62%);
  background-repeat: no-repeat;
  padding-bottom: .05em;
}

/* --- レイアウト -------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--text { max-width: calc(var(--container-text) + var(--gutter) * 2); }

.section {
  padding-block: var(--section-py);
  position: relative;
}

.section--alt    { background-color: var(--color-bg-alt); }

.section--invert {
  background-color: var(--sage-700);
  color: var(--color-text-invert);
}

.section--invert .muted,
.section--invert .note-s { color: rgba(251, 246, 234, .86); }

.section--invert a { text-decoration-color: rgba(251, 246, 234, .5); }

.section__head { margin-bottom: var(--space-10); }

.section__lede {
  margin-top: var(--space-5);
  color: var(--color-text-muted);
  max-width: 32em;
}

.section--invert .section__lede { color: rgba(251, 246, 234, .9); }

/* 文章カラムの行長制限（日本語 約32〜34文字） */
.prose { max-width: 32em; }

.prose > * + * { margin-top: 1.5em; }

.stack-2  > * + * { margin-top: var(--space-2); }
.stack-4  > * + * { margin-top: var(--space-4); }
.stack-6  > * + * { margin-top: var(--space-6); }
.stack-8  > * + * { margin-top: var(--space-8); }
.stack-10 > * + * { margin-top: var(--space-10); }

.divider {
  height: 1px;
  background-color: var(--color-border);
  border: 0;
}

/* --- アクセシビリティ --------------------------------------------------------- */

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

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 200;
  padding: var(--space-3) var(--space-5);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus { transform: translateY(0); }

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

.section--invert :focus-visible { outline-color: var(--mustard-300); }

/* --- 改行制御 ---------------------------------------------------------------- */

.br-pc { display: none; }

@media (min-width: 768px) {
  .br-sp { display: none; }
  .br-pc { display: inline; }
}

/* --- 出現アニメーション -------------------------------------------------------- */

/* JSが有効なときだけ隠す。JS無効・エラー時は常に表示される */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .js .reveal { opacity: 1; transform: none; transition: none; }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
