@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;700&display=swap');

/* ===== 基础变量 ===== */
:root {
  --c-primary: #eb879c;
  --c-secondary: #ffb6c1;
  --c-dark: #26171a;
  --c-dark-80: rgba(38,23,26,0.8);
  --c-dark-60: rgba(38,23,26,0.6);
  --c-dark-20: rgba(38,23,26,0.12);
  --c-bg: #fff7f8;
  --c-bg-2: #fff0f2;
  --c-surface: #ffffff;
  --c-border: rgba(235,135,156,0.2);
  --c-text: #26171a;
  --c-text-soft: #5a3840;
  --c-white: #ffffff;
  --nav-width: 240px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 6px rgba(38,23,26,0.08), 0 1px 2px rgba(235,135,156,0.12);
  --shadow-md: 0 4px 16px rgba(38,23,26,0.1), 0 2px 6px rgba(235,135,156,0.15);
  --shadow-lg: 0 8px 32px rgba(38,23,26,0.12), 0 4px 12px rgba(235,135,156,0.18);
  --transition: 200ms ease;
  --transition-md: 300ms ease;
  --font: 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
  --scroll-top: 0px;
}

/* ===== 重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--c-text);
  background: var(--c-bg);
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--c-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--c-dark); }
a:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 3px; border-radius: 3px; }
ul, ol { list-style: none; }

/* ===== 页面骨架 ===== */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== 左侧固定导航 ===== */
.sidenav {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--nav-width);
  background: var(--c-dark);
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 2px 0 16px rgba(38,23,26,0.18);
  display: flex;
  flex-direction: column;
}
.sidenav-inner {
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem 2rem;
  min-height: 100%;
  gap: 1.5rem;
}
.sidenav-brand {
  border-bottom: 1px solid rgba(235,135,156,0.25);
  padding-bottom: 1.25rem;
}
.brand-logo {
  display: block;
  margin-bottom: 0.5rem;
}
.brand-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-secondary);
  letter-spacing: 0.02em;
}
.brand-text:hover { color: var(--c-primary); }
.logo-img { max-height: 36px; width: auto; }
.sidenav-slogan {
  font-size: 0.72rem;
  color: rgba(255,182,193,0.6);
  letter-spacing: 0.05em;
  font-weight: 300;
}

.sidenav-links {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}
.sidenav-links dt { display: block; }
.nav-link {
  display: block;
  padding: 0.65rem 0.875rem;
  border-radius: var(--radius);
  color: rgba(255,182,193,0.85);
  font-size: 0.875rem;
  font-weight: 400;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  min-height: 40px;
  display: flex;
  align-items: center;
}
.nav-link:hover {
  background: rgba(235,135,156,0.18);
  color: var(--c-white);
  transform: translateX(3px);
}
.nav-link:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}
.sidenav-badge {
  margin-top: auto;
}
.badge-label {
  display: inline-block;
  background: rgba(235,135,156,0.15);
  border: 1px solid rgba(235,135,156,0.3);
  color: var(--c-secondary);
  font-size: 0.72rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* ===== 右侧内容区 ===== */
.content-wrap {
  margin-left: var(--nav-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 100vh;
  background: linear-gradient(145deg, var(--c-dark) 0%, #3d1f25 55%, #5a2d36 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  scroll-margin-top: 0;
}
.hero-bg-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(6rem, 18vw, 16rem);
  font-weight: 700;
  color: rgba(235,135,156,0.06);
  letter-spacing: 0.2em;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  z-index: 0;
}
.hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 3rem 2rem;
  max-width: 680px;
  width: 100%;
}
.hero-eyebrow {
  display: inline-block;
  background: rgba(235,135,156,0.15);
  border: 1px solid rgba(235,135,156,0.35);
  color: var(--c-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  letter-spacing: 0.06em;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}
.hero-h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--c-white);
  line-height: 1.3;
  margin-bottom: 1rem;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.hero-sub {
  font-size: 1rem;
  color: rgba(255,182,193,0.8);
  line-height: 1.7;
  margin-bottom: 2rem;
  font-weight: 300;
}
.hero-cta {
  display: inline-block;
  background: var(--c-primary);
  color: var(--c-white);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.8rem 2rem;
  border-radius: 40px;
  box-shadow: var(--shadow-md);
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  min-height: 48px;
  line-height: 1.4;
  letter-spacing: 0.03em;
}
.hero-cta:hover {
  background: #d4637a;
  color: var(--c-white);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.hero-cta:focus-visible { outline: 3px solid var(--c-secondary); outline-offset: 3px; }
.hero-arc {
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 80px;
  background: var(--c-bg);
  border-radius: 50% 50% 0 0 / 80px 80px 0 0;
  z-index: 3;
}

/* ===== 主内容 ===== */
.main-content {
  flex: 1;
  padding: 3rem 0;
}

/* ===== 内容 section ===== */
.content-section {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: auto auto;
  gap: 0 2rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
}

/* aside 在左侧 */
.content-aside {
  grid-column: 1;
  grid-row: 1 / 3;
  position: sticky;
  top: 2rem;
  align-self: start;
}
.aside-inner {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1.25rem;
  border: 1px solid var(--c-border);
}
.aside-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-text-soft);
  margin-bottom: 1rem;
  text-transform: uppercase;
}
.aside-title span { display: inline; }
.aside-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
}
.aside-nav-list li { display: block; }
.aside-link {
  display: block;
  font-size: 0.82rem;
  color: var(--c-text-soft);
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
  min-height: 40px;
  display: flex;
  align-items: center;
  line-height: 1.4;
}
.aside-link:hover {
  background: var(--c-bg-2);
  color: var(--c-primary);
}
.aside-tip {
  background: linear-gradient(135deg, #fff0f2, #fff7f8);
  border-left: 3px solid var(--c-primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.875rem 1rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--c-text-soft);
}
.aside-tip strong {
  display: block;
  color: var(--c-dark);
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
}

/* figure 装饰 */
.content-figure {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 1rem 0 0;
  pointer-events: none;
  user-select: none;
}
.figure-deco {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  opacity: 0.08;
}
.deco-num {
  font-size: clamp(4rem, 8vw, 7rem);
  font-weight: 700;
  color: var(--c-dark);
  line-height: 1;
  letter-spacing: -0.04em;
}
.deco-label {
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  font-weight: 300;
  color: var(--c-primary);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* 正文 */
.content-body {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}

/* ===== 正文内容样式（page.content 里的元素）===== */
.content-body h2,
.content-body h3 {
  scroll-margin-top: 2rem;
  color: var(--c-dark);
  font-weight: 700;
}
.content-body h2 {
  font-size: 1.4rem;
  margin: 2.5rem 0 1rem;
  line-height: 1.4;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--c-border);
}
.content-body h2 span { display: inline; color: inherit; }
.content-body h3 {
  font-size: 1.1rem;
  margin: 1.75rem 0 0.75rem;
  line-height: 1.5;
  color: var(--c-text-soft);
}
.content-body h3 span { display: inline; }
.content-body p {
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--c-text);
}
.content-body ul,
.content-body ol {
  margin: 0.75rem 0 1rem 1.25rem;
}
.content-body ul { list-style: disc; }
.content-body ol { list-style: decimal; }
.content-body li {
  margin-bottom: 0.5rem;
  line-height: 1.65;
  font-size: 0.97rem;
}
.content-body strong { color: var(--c-dark); font-weight: 600; }
.content-body em { color: var(--c-primary); font-style: normal; font-weight: 500; }
.content-body a { color: var(--c-primary); text-decoration: underline; text-underline-offset: 3px; }
.content-body a:hover { color: var(--c-dark); }
.content-body blockquote {
  border-left: 4px solid var(--c-primary);
  background: var(--c-bg-2);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.25rem 0;
  font-size: 0.95rem;
  color: var(--c-text-soft);
}
.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}
.content-body th {
  background: var(--c-dark);
  color: var(--c-white);
  padding: 0.6rem 0.875rem;
  text-align: left;
  font-weight: 600;
}
.content-body td {
  padding: 0.55rem 0.875rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
.content-body tr:nth-child(even) td { background: var(--c-bg-2); }

/* section 内的 figure / aside（page.content 自带的）*/
.content-body section {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--c-border);
  scroll-margin-top: 80px;
}
.content-body section:last-child { border-bottom: none; }
.content-body section figure {
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1rem 0;
}
.content-body section aside {
  background: linear-gradient(135deg, #fff0f2 0%, #fff7f8 100%);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--c-text-soft);
  box-shadow: var(--shadow-sm);
}

/* ===== 页脚 ===== */
.site-footer {
  background: var(--c-dark);
  padding: 3rem 2rem 1.5rem;
  margin-top: auto;
}
.footer-nav {
  max-width: 1100px;
  margin: 0 auto 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
.footer-dl { display: flex; flex-direction: column; gap: 0.35rem; }
.footer-dl-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255,182,193,0.5);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: block;
}
.footer-dl dd { display: block; }
.footer-dl dd a {
  color: rgba(255,182,193,0.75);
  font-size: 0.83rem;
  transition: color var(--transition);
  display: block;
  padding: 0.2rem 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  line-height: 1.4;
}
.footer-dl dd a:hover { color: var(--c-secondary); }
.footer-site {
  color: rgba(255,182,193,0.4);
  font-size: 0.8rem;
  padding: 0.2rem 0;
}
.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(235,135,156,0.12);
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-brand {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: rgba(235,135,156,0.18);
  letter-spacing: -0.02em;
  line-height: 1;
  flex-shrink: 0;
}
.footer-copy {
  font-size: 0.78rem;
  color: rgba(255,182,193,0.4);
  flex: 1;
  min-width: 180px;
}

/* ===== scroll-margin for sections ===== */
section[id] { scroll-margin-top: 1.5rem; }

/* ===== Scroll Reveal 动效 ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 300ms ease, transform 300ms ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-child {
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 250ms ease 100ms, transform 250ms ease 100ms;
}
.reveal-child.visible {
  opacity: 1;
  transform: translateX(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-child {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ===== 断点：平板 ===== */
@media (max-width: 900px) {
  :root { --nav-width: 200px; }
  .content-section {
    grid-template-columns: 180px 1fr;
    padding: 0 1.25rem;
    gap: 0 1.25rem;
  }
  .deco-num { font-size: 4rem; }
}

/* ===== 断点：移动端 ===== */
@media (max-width: 680px) {
  :root { --nav-width: 0px; }

  /* 移动导航 —— 底部横排 */
  .sidenav {
    position: fixed;
    left: 0; right: 0;
    top: auto; bottom: 0;
    width: 100%;
    height: auto;
    max-height: 56px;
    overflow: hidden;
    box-shadow: 0 -2px 12px rgba(38,23,26,0.18);
    z-index: 200;
    flex-direction: row;
  }
  .sidenav-inner {
    flex-direction: row;
    padding: 0 0.75rem;
    gap: 0;
    align-items: center;
    min-height: 56px;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
  }
  .sidenav-brand { display: none; }
  .sidenav-badge { display: none; }
  .sidenav-links {
    flex-direction: row;
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    scrollbar-width: none;
  }
  .sidenav-links::-webkit-scrollbar { display: none; }
  .sidenav-links dt { flex-shrink: 0; }
  .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: 6px;
    min-height: 44px;
  }
  .nav-link:hover { transform: none; }

  .content-wrap { margin-left: 0; padding-bottom: 60px; }

  .hero { min-height: 100svh; }
  .hero-inner { padding: 2rem 1.25rem; }
  .hero-h1 { font-size: 1.6rem; }
  .hero-arc { height: 50px; border-radius: 50% 50% 0 0 / 50px 50px 0 0; }

  .content-section {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    padding: 0 1rem;
    gap: 1.5rem 0;
  }
  .content-aside {
    grid-column: 1;
    grid-row: 2;
    position: static;
  }
  .content-figure {
    grid-column: 1;
    grid-row: 1;
    justify-content: center;
    padding: 0;
  }
  .content-body {
    grid-column: 1;
    grid-row: 3;
  }

  .content-body h2 { font-size: 1.2rem; }
  .content-body h3 { font-size: 1rem; }

  .footer-nav {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
  .footer-bottom { flex-direction: column; gap: 0.5rem; }
  .footer-brand { font-size: 2rem; }

  .site-footer { padding-bottom: 2rem; }
}

@media (max-width: 400px) {
  .footer-nav { grid-template-columns: 1fr; }
  .hero-cta { padding: 0.75rem 1.5rem; font-size: 0.85rem; }
}

button[aria-expanded]{min-width:44px;min-height:44px}
