/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f9f9f9;
}

a {
  color: #0066cc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header Styles */
header {
  background-color: #1a5f3f;
  color: white;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
}

.logo a {
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
}

.logo a:hover {
  text-decoration: none;
}

/* Navigation */
nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
}

nav a {
  color: white;
  font-size: 0.95rem;
  transition: color 0.3s ease;
}

nav a:hover,
nav a.active {
  color: #a8d5ba;
  text-decoration: none;
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  gap: 0.5rem;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background-color: white;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #1a5f3f 0%, #2d8659 100%);
  color: white;
  padding: 4rem 2rem;
  text-align: center;
}

.hero-content h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
}

/* Main Content */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.content-section {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
}

.main-content {
  grid-column: 1;
}

.main-content h2 {
  font-size: 1.8rem;
  color: #1a5f3f;
  margin-top: 2rem;
  margin-bottom: 1rem;
  border-bottom: 3px solid #1a5f3f;
  padding-bottom: 0.5rem;
}

.main-content h2:first-child {
  margin-top: 0;
}

.main-content h3 {
  font-size: 1.3rem;
  color: #2d8659;
  margin-top: 1.5rem;
  margin-bottom: 0.8rem;
}

.main-content p {
  margin-bottom: 1rem;
  text-align: justify;
}

.main-content strong {
  color: #1a5f3f;
}

/* Sidebar */
.sidebar {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.ad-space {
  background-color: #f0f0f0;
  border: 2px dashed #ccc;
  padding: 2rem;
  text-align: center;
  border-radius: 4px;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.toc {
  background-color: #f9f9f9;
  border-left: 4px solid #1a5f3f;
  padding: 1.5rem;
  border-radius: 4px;
}

.toc h3 {
  font-size: 1.1rem;
  color: #1a5f3f;
  margin-bottom: 1rem;
}

.toc ul {
  list-style: none;
}

.toc li {
  margin-bottom: 0.5rem;
}

.toc a {
  color: #0066cc;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.toc a:hover {
  color: #1a5f3f;
  text-decoration: none;
}

/* Footer */
footer {
  background-color: #1a5f3f;
  color: white;
  padding: 2rem;
  margin-top: 3rem;
  text-align: center;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-links {
  margin-bottom: 1rem;
}

.footer-links a {
  color: #a8d5ba;
  margin: 0 1rem;
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: white;
  text-decoration: none;
}

.copyright {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background-color: #1a5f3f;
    flex-direction: column;
    padding: 1rem;
  }

  nav.active {
    display: flex;
  }

  nav ul {
    flex-direction: column;
    gap: 1rem;
  }

  .header-container {
    padding: 1rem;
  }

  .hero-content h1 {
    font-size: 1.8rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-column: 1;
  }

  .main-content h2 {
    font-size: 1.5rem;
  }

  .main-content h3 {
    font-size: 1.1rem;
  }

  .content-section {
    padding: 1rem;
  }

  main {
    padding: 1rem;
  }

  .footer-links a {
    display: block;
    margin: 0.5rem 0;
  }
}

@media (max-width: 480px) {
  .hero-content h1 {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .main-content h2 {
    font-size: 1.3rem;
  }

  .main-content h3 {
    font-size: 1rem;
  }

  .main-content p {
    text-align: left;
  }

  .ad-space {
    min-height: 150px;
  }
}


/* === Mobile fix v3 (auto-injected) === */
html, body { overflow-x: hidden; }
img, video, iframe, table { max-width: 100%; }

@media (max-width: 768px) {
  /* ヒーローテキストがviewportからはみ出さないようにする */
  h1, h2, h3 {
    font-size: clamp(1.3rem, 5vw, 2.5rem) !important;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  p, li, td, th, span, a {
    overflow-wrap: break-word;
    word-break: break-word;
  }
  /* 全要素の幅を100vw以内に */
  .container, main, section, article, header, footer, nav,
  [class*="container"], [class*="wrapper"], [class*="content"] {
    max-width: 100vw;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}
/* === End Mobile fix v3 === */
