/* ==========================================
 * Base Styles
 * Modern CSS Reset + 基本スタイル
 * ========================================== */

/* --- Reset --- */

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

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* --- 横スクロール防止（html, body 両方に適用必須） --- */
html {
  overflow-x: hidden;
}

html:focus-within {
  scroll-behavior: smooth;
}

/* ローディング中のスクロール防止 */
body:not(.is-loaded) {
  overflow: hidden;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  text-rendering: optimizeSpeed;
  font-family: var(--font-body-ja);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.8;
  color: var(--color-text-body);
  background-color: var(--color-light-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Links --- */

a {
  color: inherit;
  text-decoration: none;
}

a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* --- Images --- */

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

/* --- Form Elements --- */

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

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

/* --- Typography --- */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.3;
}

h1 {
  font-size: var(--text-h1);
}

h2 {
  font-size: var(--text-h2);
}

h3 {
  font-size: var(--text-h3);
}

h4 {
  font-size: var(--text-h4);
}

p {
  line-height: 1.8;
}

/* --- dl/dd のブラウザデフォルト対策 --- */

dl {
  display: grid;
  grid-template-columns: 1fr;
}

dd {
  margin-inline-start: 0;
}

/* --- View Transitions --- */
@view-transition {
  navigation: auto;
}
::view-transition-old(root) {
  animation: fade-out 0.2s ease-in;
}
::view-transition-new(root) {
  animation: fade-in 0.3s ease-out;
}
@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- prefers-reduced-motion --- */

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

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