:root {
  --bg: #e0e7ff;
  --surface: #ffffff;
  --primary: #1e3a8a;
  --accent: #2563eb;
  --text: #0f172a;
  --muted: #475569;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--surface);
  color: var(--text);
  line-height: 1.6;
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  background: #f5f6f9;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: inline-block;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.05rem;
}

.language-switch {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.05rem;
  margin-left: 0.75rem;
}

.nav-group {
  position: relative;
}

.nav-group > a {
  display: inline-block;
}

.dropdown {
  position: absolute;
  left: 0;
  top: calc(100% + 0.1rem);
  display: none;
  /* use block layout for predictable hover behavior */
  min-width: 13rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  padding: 0.5rem 0;
  z-index: 9999;
}

.dropdown a {
  display: block;
  padding: 0.45rem 0.9rem;
  color: var(--text);
  white-space: nowrap;
}

.dropdown a:hover {
  background: #eff6ff;
}

.nav-group:hover .dropdown,
.nav-group:focus-within .dropdown {
  display: block;
}

@media (max-width: 640px) {
  .nav-group:hover .dropdown,
  .nav-group:focus-within .dropdown {
    display: none;
  }
}

.hero {
  padding: 2.5rem 0 2rem;
  text-align: center;
  background: var(--surface);
}

.hero h1 {
  margin: 0 0 2.5rem;
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  line-height: 1.2;
}

.hero .container h1 {
  margin-bottom: 3rem;
}

.section h1 {
  margin-top: 0;
  margin-bottom: 2.5rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.hero p {
  max-width: 700px;
  margin: 0 auto 1.75rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-img {
  display: block;
  width: min(380px, 80%);
  max-width: 420px;
  height: auto;
  margin: 0 auto 2rem;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  background: var(--accent);
  color: #ffffff;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 500;
  margin-top: 1.5rem;
  line-height: 1.2;
}

.contact-inline .button {
  position: relative;
  top: -0.45rem;
}

.section {
  padding: 2rem 0;
  background: var(--surface);
}

.section:nth-of-type(even) {
  background: var(--bg);
}

.service-grid {
  background: var(--surface) !important;
}

.section-alt {
  background: #e0e7ff !important;
}

.section h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
}

.book-content h3 {
  margin: 1.4rem 0 0.5rem;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: 1.18rem;
  font-weight: 700;
}

.section p {
  max-width: 760px;
  color: var(--muted);
}

.section ul,
.section ol {
  max-width: 760px;
  margin: 1rem 0 1.5rem;
  padding-left: 1.25rem;
}

.section li + li {
  margin-top: 0.6rem;
}

.card-grid,
.trip-list {
  display: grid;
  gap: 1.5rem;
  margin-top: 2rem;
}

.card-grid {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card,
.trip-card {
  background: #eff0f3;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.75rem;
}

.card h3,
.trip-card h3 {
  margin-top: 0;
  min-height: 3.2rem;
  margin-bottom: 1rem;
}

.card-img {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  margin: 0 0 1.2rem;
  object-fit: contain;
}

/* Page-level image used under titles */
.page-image {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: 0 0 2rem 0;
  object-fit: contain;
}

/* Layout container for book image + metadata: image above metadata */
.book-hero {
  display: block;
  text-align: left;
  margin-left: 0;
}
.book-images {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}
.book-images .page-image {
  width: auto;
  max-width: 320px;
}

.trip-card-images {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 2rem;
  margin-bottom: 1.2rem;
}

.trip-intro {
  max-width: 760px;
  margin-bottom: 2.5rem;
}

.trip-intro ul {
  margin-bottom: 0;
}

.trip-intro strong {
  color: var(--text);
}

.trip-gallery .card h3 {
  margin-bottom: 0.5rem;
}

.trip-card-images img {
  display: block;
  width: 100%;
  height: auto;
}

.page-scan {
  border: 1px solid #cbd5e1;
}

.book-cover {
  margin-bottom: 0.25rem;
}

.book-cover .page-image {
  margin-bottom: 0.5rem;
}

.course-images {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.course-images .page-image {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
}

.photography-images .page-image {
  max-width: 680px;
}

.book-meta {
  margin: 0;
  max-width: 720px;
  text-align: left;
}

.contact-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
}

.wechat-inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wechat-inline p {
  margin: 0;
}

.wechat-qr {
  display: block;
  width: 90px;
  height: auto;
}

.site-footer {
  padding: 2rem 0;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
}

/* Wider screens: increase space between nav items for better readability */
@media (min-width: 1024px) {
  .site-nav {
    gap: 1.25rem;
  }
}

.hamburger {
  display: none;
}

.nav-expand {
  display: none;
}

@media (max-width: 640px) {
  .site-header .container {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .logo {
    flex: 1 1 auto;
    order: 1;
  }

  .site-nav {
    margin-top: 0;
    display: none; /* hidden by default on small screens; toggled by hamburger */
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    order: 4;
  }

  .language-switch {
    order: 2;
    margin-left: auto;
    padding: 0.35rem 0;
  }

  .site-nav .nav-home {
    display: none;
  }

  /* Hamburger button (injected by JS) */
  .hamburger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-left: 0;
    padding: 0.15rem;
    flex-shrink: 0;
    order: 3;
  }

  .hamburger:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .hamburger-box {
    display: inline-block;
    width: 22px;
    height: 16px;
    position: relative;
  }

  .hamburger-inner,
  .hamburger-inner::before,
  .hamburger-inner::after {
    width: 22px;
    height: 2px;
    background-color: var(--muted);
    display: block;
    position: absolute;
    left: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .hamburger-inner {
    top: 50%;
    transform: translateY(-50%);
  }

  .hamburger-inner::before {
    content: '';
    top: -7px;
  }

  .hamburger-inner::after {
    content: '';
    top: 7px;
  }

  /* When nav is open, show nav and animate hamburger */
  .site-header.nav-open .site-nav {
    display: block;
  }

  .site-header.nav-open .hamburger-inner {
    transform: rotate(45deg);
  }
  .site-header.nav-open .hamburger-inner::before {
    transform: rotate(90deg) translateX(0);
    top: 0;
  }
  .site-header.nav-open .hamburger-inner::after {
    opacity: 0;
  }

  /* Ensure dropdown links remain stacked on small screens */
  .nav-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .site-nav a {
    display: inline-block;
    margin-left: 0;
    margin-right: 1rem;
  }

  .nav-group > a {
    display: block;
    width: 100%;
    padding: 0.35rem 0;
  }

  .nav-group .nav-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.45rem;
  }

  .site-header .site-nav .nav-row > a {
    display: block;
    flex: 1 1 auto;
    padding: 0.5rem 0.7rem;
    background: #dbeafe;
    color: #1e3a8a;
    border: 1px solid #93c5fd;
    border-radius: 0.6rem;
    line-height: 1.15;
    text-decoration: none;
  }

  .nav-expand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    margin-left: 0;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    background: #f8fafc;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    padding: 0;
    transition: transform 0.2s ease, color 0.2s ease;
  }

  .nav-group.open .nav-expand {
    color: var(--accent);
  }

  .nav-group.open .nav-expand::before {
    content: '−';
  }

  .nav-group:not(.open) .nav-expand::before {
    content: '+';
  }

  .site-nav .dropdown {
    position: static;
    border: none;
    box-shadow: none;
    padding: 0;
    min-width: auto;
    display: none;
    margin-left: 1rem;
    width: 100%;
  }

  .site-nav .nav-group.open .dropdown {
    display: block;
  }

  .site-header .site-nav .dropdown a {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    white-space: normal !important;
    padding: 0.5rem 0.65rem !important;
    background: #eff6ff !important;
    color: #1e3a8a !important;
    border: 1px solid #bfdbfe !important;
    border-radius: 0.55rem !important;
    line-height: 1.2 !important;
    box-shadow: none !important;
    text-decoration: none !important;
  }

  .site-header .site-nav .dropdown a:hover,
  .site-header .site-nav .dropdown a:focus-visible {
    background: #dbeafe !important;
    color: #1e3a8a !important;
  }

  .site-header .site-nav .dropdown a:first-child {
    margin-top: 0 !important;
  }

  .page-image {
    margin: 1rem auto;
  }
  .book-hero {
    /* keep stacked on mobile and left-aligned */
    display: block;
    text-align: left;
  }
}
