/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #1A0F0A;
  --bg-card:    #251610;
  --bg-card-hover: #2F1C13;
  --bg-section: #120A06;
  --text:       #F0EAE3;
  --text-muted: #9C8272;
  --text-dim:   #5A3E30;
  --accent:     #F397A8;
  --accent-soft:#F9C5D0;
  --border:     #3A2418;
  --tab-h:      56px;
  --header-h:   64px;
  --radius:     12px;
  --font-serif: 'Noto Serif TC', 'Georgia', serif;
  --font-sans:  -apple-system, 'PingFang TC', 'Helvetica Neue', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }

/* ===== HEADER ===== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(26, 15, 10, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  border-bottom: 1px solid var(--border);
}

.logo-link { display: flex; align-items: center; }
.logo { height: 32px; width: auto; }

.btn-header {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #2A0E0A;
  background: var(--accent);
  border: 1px solid transparent;
  padding: 7px 20px;
  border-radius: 100px;
  box-shadow: 0 2px 12px rgba(243, 151, 168, 0.35);
  transition: background .2s, box-shadow .2s;
}
.btn-header:hover {
  background: var(--accent-soft);
  box-shadow: 0 4px 20px rgba(243, 151, 168, 0.50);
}

/* ===== PAGE INTRO ===== */
.page-intro {
  padding: calc(var(--header-h) + 44px) 24px 36px;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.intro-name-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.intro-name {
  font-family: var(--font-serif);
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 400;
  color: rgba(240,234,227,0.75);
  letter-spacing: 0.08em;
}

.intro-brand {
  font-size: clamp(11px, 1.1vw, 13px);
  color: var(--accent-soft);
  letter-spacing: 0.1em;
  padding-bottom: 2px;
}

.intro-course {
  font-family: var(--font-serif);
  font-size: clamp(44px, 7.5vw, 80px);
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.06em;
  line-height: 1.1;
  margin-bottom: 14px;
}

.intro-works {
  font-size: clamp(14px, 2vw, 20px);
  color: var(--text-muted);
  letter-spacing: 0.12em;
}

@media (max-width: 640px) {
  .page-intro { padding-top: calc(var(--header-h) + 28px); padding-bottom: 24px; }
  .intro-name-row { gap: 8px; }
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #2A0E0A;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 14px 36px;
  border-radius: 100px;
  transition: background .2s, transform .2s, box-shadow .2s;
  box-shadow: 0 4px 20px rgba(243, 151, 168, 0.30);
}
.btn-primary:hover {
  background: #f0809a;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(243, 151, 168, 0.45);
}
.btn-large {
  font-size: 17px;
  padding: 18px 48px;
}

/* ===== STATS ===== */
.stats {
  background: var(--bg-section);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stats-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 40px;
  flex: 1 1 120px;
}

.stat-num {
  font-family: var(--font-serif);
  font-size: 42px;
  font-weight: 500;
  color: #fff;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.stat-divider {
  width: 1px;
  height: 48px;
  background: var(--border);
  flex-shrink: 0;
}

/* ===== CHAPTER TABS ===== */
.chapter-tabs {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  background: rgba(26, 15, 10, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--tab-h);
}

.tabs-inner {
  max-width: 900px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: 0;
}
.tabs-inner::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  white-space: nowrap;
  min-width: 80px;
}

.tab-btn:hover { background: rgba(240,234,227,0.04); }

.tab-btn.active {
  border-bottom-color: var(--accent);
}

.tab-num {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.tab-btn.active .tab-num { color: var(--accent); }

.tab-name {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.tab-btn.active .tab-name { color: var(--text); font-weight: 500; }

/* ===== CHAPTERS ===== */
.chapters-wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.chapter {
  padding-top: 56px;
}

/* Offset for sticky header + tab bar */
.chapter::before {
  content: '';
  display: block;
  height: calc(var(--header-h) + var(--tab-h));
  margin-top: calc(-1 * (var(--header-h) + var(--tab-h)));
  pointer-events: none;
}

.chapter-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.chapter-num {
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--accent);
  font-weight: 500;
  flex-shrink: 0;
}

.chapter-title-wrap {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.chapter-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.05em;
}

.chapter-sub {
  font-size: 14px;
  color: var(--text-muted);
}

.chapter-count {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin-left: auto;
  flex-shrink: 0;
}

/* ===== WORKS GRID ===== */
.works-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.work-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
  cursor: default;
}

.work-card:hover {
  transform: translateY(-4px);
  border-color: var(--text-dim);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.work-img-wrap {
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.work-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.work-card:hover .work-img-wrap img {
  transform: scale(1.06);
}

.work-info {
  padding: 14px 16px 16px;
}

.work-location {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent-soft);
  background: rgba(232,196,184,0.1);
  border: 1px solid rgba(232,196,184,0.2);
  border-radius: 100px;
  padding: 2px 10px;
  margin-bottom: 8px;
}

.work-title {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(240,234,227,0.8);
}

/* ===== CH1 THEORY SECTION ===== */
.ch1-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.ch1-desc {
  font-size: 15px;
  line-height: 2;
  color: rgba(240,234,227,0.72);
  border-left: 2px solid var(--accent);
  padding-left: 20px;
}

.units-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.unit-item {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 9px 18px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}


.unit-num {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 32px;
}

.unit-material .unit-num {
  color: var(--text-muted);
}

.unit-title {
  font-size: 14px;
  color: rgba(240,234,227,0.8);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .ch1-body { grid-template-columns: 1fr; gap: 28px; }
}

/* ===== BOTTOM CTA ===== */
.cta-section {
  background: var(--bg-section);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 96px 24px;
}

.cta-inner { max-width: 600px; margin: 0 auto; }

.cta-eyebrow {
  font-size: 13px;
  letter-spacing: 0.15em;
  color: var(--accent-soft);
  margin-bottom: 16px;
}

.cta-title {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.cta-desc {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text-muted);
  margin-bottom: 40px;
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--bg-section);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 24px;
}

.footer-logo { height: 28px; width: auto; opacity: 0.7; }

.footer-copy {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 5, 3, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lb-img-zone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(96vw, 1280px);
}

.lb-img-wrap {
  max-width: min(80vw, 1200px);
  max-height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.lb-img-wrap img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  transition: opacity .2s ease;
}

.lb-img-wrap img.loading { opacity: 0; }

.lb-caption {
  margin-top: 20px;
  text-align: center;
  min-height: 80px;
  padding: 0 24px;
  transition: opacity 0.2s ease;
}

.lb-location {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent-soft);
  background: rgba(232,196,184,0.1);
  border: 1px solid rgba(232,196,184,0.2);
  border-radius: 100px;
  padding: 3px 12px;
  margin-bottom: 8px;
}

.lb-title {
  font-size: 15px;
  color: rgba(240,234,227,0.85);
  line-height: 1.6;
  max-width: 560px;
}

.lb-counter {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  transition: opacity 0.2s ease;
}

.lb-close {
  position: absolute;
  top: 20px; right: 24px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  transition: color .15s;
}
.lb-close:hover { color: #fff; }

.lb-nav {
  flex-shrink: 0;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 50%;
  color: rgba(240,234,227,0.85);
  font-size: 20px;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
  z-index: 10;
}
.lb-nav:hover { background: rgba(255,255,255,0.20); color: #fff; }

/* Make work cards feel clickable */
.work-card { cursor: pointer; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .works-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-item { padding: 12px 24px; }
}

@media (max-width: 640px) {
  .site-header { padding: 0 20px; }
  .chapters-wrap { padding: 0 16px 60px; }
  .works-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .chapter-header { gap: 8px; }
  .chapter-title { font-size: 22px; }
  .chapter-sub { display: none; }
  .chapter-count { display: none; }
  .stat-divider { display: none; }
  .stat-item { padding: 8px 16px; flex: 1 1 80px; }
  .stat-num { font-size: 32px; }
  .tab-btn { padding: 0 14px; min-width: 48px; }
  .tab-name { display: none; }
  .tab-num { font-size: 12px; letter-spacing: 0.05em; }
  .lb-nav { width: 44px; height: 44px; font-size: 18px; background: rgba(255,255,255,0.15); }
  .lb-img-zone { gap: 6px; }
  .lb-img-wrap { max-width: 76vw; }
}

@media (max-width: 400px) {
  .works-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .work-info { padding: 10px 12px 12px; }
  .work-title { font-size: 12px; }
}
