/* ==========================================================================
   base.css — リセットと基本スタイル
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { flex: 1; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.02em;
}
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }

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

::selection { background: var(--accent); color: var(--accent-ink); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -5rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
}
.skip-link:focus { top: 0.75rem; }

/* --- 日本語・英語の対等な並び -------------------------------------------- */
.bi > [lang] { display: block; }
.bi--inline > [lang] { display: inline; }
.bi--inline > [lang="en"]::before {
  content: "/";
  margin-inline: 0.6em;
  color: var(--text-faint);
  font-style: normal;
}
[lang="en"] { font-feature-settings: "kern", "liga"; }
.is-italic { font-style: italic; }

/* --- テーマ切り替え中だけ、色を滑らかに変える ------------------------------ */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition:
    background-color var(--dur-slow) var(--ease),
    color var(--dur-slow) var(--ease),
    border-color var(--dur-slow) var(--ease),
    fill var(--dur-slow) var(--ease),
    stroke var(--dur-slow) var(--ease) !important;
}

/* --- 動きを減らす設定を尊重 ------------------------------------------------ */
@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;
  }
}

/* --- 日本語の折り返し（1文字だけ次の行に残らないように） ------------------- */
:lang(ja) { word-break: auto-phrase; line-break: strict; }
p, li { text-wrap: pretty; }
h1, h2, h3, .hero__copy, .lost__msg { text-wrap: balance; }
