/* ==========================================================
   Global Settings
   ========================================================== */
:root {
  --font-body: "Noto Serif JP", "Noto Serif", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --font-sans: "Noto Sans JP", "Noto Sans", "Hiragino Sans", "Yu Gothic", sans-serif;
  --max-width: 1200px;

  --bg-color: #ffffff;
  --text-color: #222222;
  --muted-text: #555555;
  --link-color: #3367d6;
  --divider-color: rgba(0, 0, 0, 0.06);
}

/* ==========================================================
   Dark Mode (automatic)
   ========================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --text-color: #e7e7e7;
    --muted-text: #aaaaaa;
    --link-color: #40c4ff;
    --divider-color: rgba(255, 255, 255, 0.08);
  }

  /* Accessible links */
  a {
    color: var(--link-color);
    text-decoration: underline;
    text-decoration-color: rgba(64, 196, 255, 0.6);
    text-underline-offset: 2px;
    text-decoration-thickness: 1.5px;
    font-weight: 500;
  }

  a:visited {
    color: #80cbc4;
  }

  a:hover,
  a:focus {
    color: #82e9ff;
    text-decoration-thickness: 2px;
  }

  a:active {
    color: #ffd54f;
  }

  /* Navigation links */
  nav a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.25s ease, text-decoration-thickness 0.2s ease;
  }

  nav a:hover,
  nav a:focus {
    color: #82e9ff;
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  nav a:active {
    color: #ffd54f;
  }
}

/* ==========================================================
   Base Layout
   ========================================================== */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  line-height: 1.75;
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
}

header,
main,
footer {
  max-width: var(--max-width);
  margin: auto;
  padding: 2rem 1.5rem;
}

/* ==========================================================
   Header
   ========================================================== */
header h1 {
  font-family: var(--font-sans);
  font-size: 2rem;
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.subtitle {
  color: var(--muted-text);
  margin-bottom: 1.4rem;
  font-size: 1rem;
  line-height: 1.6;
}

/* Navigation */
nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
}

/* Light-mode nav links */
nav a {
  text-decoration: none;
  color: var(--link-color);
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.25s ease;
}

nav a:hover {
  color: #1e4eb7;
}

/* ==========================================================
   Main Content
   ========================================================== */
main {
  padding-top: 1rem;
}

main section {
  margin-top: 3rem;
  padding-top: 0.5rem;
}

main section:first-of-type {
  margin-top: 1.5rem;
}

main section + section {
  border-top: 1px solid var(--divider-color);
  padding-top: 2.5rem;
  margin-top: 3rem;
}

main h2 {
  font-family: var(--font-sans);
  font-size: 1.3rem;
  margin-bottom: 0.6rem;
  font-weight: 600;
}

main h3 {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  margin-top: 1.2rem;
  margin-bottom: 0.4rem;
  font-weight: 500;
}

main p {
  margin-bottom: 1rem;
  text-align: left;
}

/* ==========================================================
   Lists
   ========================================================== */
ul {
  padding-left: 1.2rem;
  margin-top: 0.3rem;
}

li {
  margin-bottom: 0.4rem;
}

/* ==========================================================
   Footer
   ========================================================== */
footer {
  font-size: 0.9rem;
  color: var(--muted-text);
  text-align: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--divider-color);
}

footer a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: #1e4eb7;
}

/* ==========================================================
   Responsive Adjustments
   ========================================================== */
@media (max-width: 1000px) {
  body {
    font-size: 0.95rem;
    line-height: 1.7;
  }

  header,
  main,
  footer {
    padding: 1.2rem;
  }

  nav ul {
    gap: 1rem;
  }

  main section {
    margin-top: 2.2rem;
  }

  main section:first-of-type {
    margin-top: 1rem;
  }
}

/* ==========================================================
   Print Styles
   ========================================================== */
@media print {
  nav,
  footer {
    display: none;
  }

  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.6;
  }

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