/* ---------- Design tokens ---------- */
:root {
  --bg: #f3ede2;
  --bg-elev: #faf6ee;
  --ink: #1f1d1a;
  --ink-soft: #5b554c;
  --ink-mute: #8a847a;
  --rule: #e2dccf;
  --accent: #c96442;
  --accent-ink: #ffffff;
  --accent-soft: #f1d9ce;
  --ok: #4f7a3d;
  --shadow: 0 1px 2px rgba(31, 29, 26, 0.04), 0 8px 24px rgba(31, 29, 26, 0.06);
  --radius: 14px;
  --serif: "Tiempos Headline", "Cormorant Garamond", Georgia, "Apple SD Gothic Neo", "Noto Serif KR", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Inter", "Segoe UI", "Malgun Gothic", Roboto, Helvetica, Arial, sans-serif;
}

/* Tighten line-height slightly for Korean text — hangul renders taller than Latin */
:lang(ko) { word-break: keep-all; line-break: strict; }

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1.1; margin: 0 0 1rem; }
h2 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); line-height: 1.2; margin: 2rem 0 1rem; }
h3 { font-size: 1.25rem; margin: 1.5rem 0 0.6rem; }
p  { margin: 0 0 1rem; color: var(--ink-soft); }

/* ---------- Top nav ---------- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem clamp(1.25rem, 4vw, 3rem);
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.nav .brand {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--serif); font-size: 1.15rem; color: var(--ink);
}
.nav .brand-mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--ink); color: var(--bg-elev);
  display: grid; place-items: center; font-family: var(--serif); font-size: 0.95rem;
}
.nav .nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav .nav-links a { color: var(--ink-soft); font-size: 0.95rem; }
.nav .nav-links a:hover { color: var(--ink); text-decoration: none; }

/* ---------- Container ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3rem); }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3rem); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.8rem 1.25rem; border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.98rem; font-weight: 500;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg-elev); }
.btn-primary:hover { background: #2a2722; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-ghost:hover { background: var(--bg-elev); text-decoration: none; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #b3573a; text-decoration: none; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Landing: hero ---------- */
.hero { padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2rem, 4vw, 3rem); }
.hero .eyebrow {
  display: inline-block; font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute); margin-bottom: 1rem;
}
.hero p.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 60ch; margin-bottom: 1.75rem; }
.hero .cta-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero .meta {
  display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 2.25rem;
  color: var(--ink-soft); font-size: 0.95rem;
}
.hero .meta strong { color: var(--ink); font-weight: 600; display: block; font-size: 1rem; }

/* ---------- Landing: two-column ---------- */
.landing-grid {
  display: grid; gap: 2.5rem;
  grid-template-columns: 1fr;
  padding-bottom: 4rem;
}
@media (min-width: 900px) {
  .landing-grid { grid-template-columns: 1fr 380px; align-items: start; }
}

/* ---------- Curriculum card (matches screenshot) ---------- */
.curriculum-card {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.5rem 1rem;
}
.curriculum-card h3.card-title {
  font-family: var(--serif); font-size: 1.4rem; margin: 0 0 1.25rem; color: var(--ink);
}
.curriculum-card .section-title {
  font-family: var(--serif); font-weight: 500;
  font-size: 1.05rem; color: var(--ink);
  padding: 1rem 0 0.6rem;
}
.curriculum-card ul { list-style: none; padding: 0; margin: 0; }
.curriculum-card li a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.7rem 0; color: var(--ink); font-size: 0.96rem;
  border-top: 1px solid var(--rule);
}
.curriculum-card li:first-child a { border-top: 1px solid var(--rule); }
.curriculum-card li a:hover { color: var(--accent); text-decoration: none; }
.curriculum-card li a .play {
  color: var(--accent); font-size: 0.7rem; line-height: 1;
}

/* ---------- Sections ---------- */
.section { padding: 3rem 0; border-top: 1px solid var(--rule); }
.section h2 { margin-top: 0; }
.feature-grid {
  display: grid; gap: 1.5rem; grid-template-columns: 1fr;
  margin-top: 1.5rem;
}
@media (min-width: 720px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature {
  background: var(--bg-elev); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 1.5rem;
}
.feature h3 { margin-top: 0; }

/* ---------- Footer (matches ai-terms style) ---------- */
footer {
  padding: 40px 0 48px;
  border-top: 1px solid var(--rule);
  background: var(--bg-elev);
  margin-top: 32px;
}
footer .foot-mini {
  text-align: center;
  color: rgba(61, 40, 23, 0.6);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
footer .foot-mini a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-bottom: 1px dotted currentColor;
  padding-bottom: 1px;
  transition: color 0.15s ease;
}
footer .foot-mini a:hover { color: var(--accent); }
footer .foot-mini .sep { opacity: 0.5; }
footer .foot-mini svg { display: block; }

/* ---------- Course player layout ---------- */
.player {
  display: grid; grid-template-columns: 1fr;
  min-height: calc(100vh - 64px);
}
@media (min-width: 960px) {
  .player { grid-template-columns: 320px 1fr; }
}
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--rule);
  padding: 1.5rem 1.25rem;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  position: sticky; top: 64px;
}
.sidebar h2 { font-size: 1.25rem; margin: 0 0 0.5rem; }
.progress {
  height: 6px; background: var(--rule); border-radius: 99px; overflow: hidden;
  margin: 0.5rem 0 1.25rem;
}
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.4s ease; }
.progress-text { font-size: 0.85rem; color: var(--ink-mute); margin-bottom: 1rem; }

.sidebar .section-title {
  font-family: var(--serif); font-size: 0.98rem; color: var(--ink);
  padding: 0.8rem 0 0.4rem; margin-top: 0.6rem;
  border-top: 1px solid var(--rule);
}
.sidebar .section-title:first-of-type { border-top: 0; margin-top: 0; }
.sidebar ul { list-style: none; padding: 0; margin: 0 0 0.5rem; }
.sidebar li button {
  width: 100%; text-align: left;
  background: transparent; border: 0; padding: 0.55rem 0.6rem;
  border-radius: 8px; color: var(--ink-soft); font-size: 0.93rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.sidebar li button:hover { background: var(--bg); color: var(--ink); }
.sidebar li button.active { background: var(--accent-soft); color: var(--ink); font-weight: 500; }
.sidebar li button .check {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--ink-mute);
  display: grid; place-items: center; font-size: 10px; color: transparent;
  flex-shrink: 0;
}
.sidebar li button.done .check { background: var(--ok); border-color: var(--ok); color: white; }
.sidebar li button.active .check { border-color: var(--accent); }

/* ---------- Lesson content ---------- */
.lesson { padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3rem); max-width: 820px; }
.lesson .crumb { color: var(--ink-mute); font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 0.5rem; }
.lesson h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); margin-bottom: 1.5rem; }
.lesson .body p, .lesson .body li { color: var(--ink-soft); font-size: 1.02rem; }
.lesson .body ul, .lesson .body ol { padding-left: 1.25rem; }
.lesson .body li { margin-bottom: 0.4rem; }
.lesson .body strong { color: var(--ink); }
.lesson .body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1rem; margin: 1.25rem 0;
  color: var(--ink); background: var(--bg-elev);
  border-radius: 0 8px 8px 0;
}
.lesson .body code {
  background: var(--bg-elev); border: 1px solid var(--rule);
  padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.92em;
}
.callout {
  background: var(--bg-elev); border: 1px solid var(--rule);
  border-radius: 10px; padding: 1rem 1.25rem; margin: 1.5rem 0;
}
.callout strong { color: var(--ink); }

/* ---------- Quiz ---------- */
.quiz {
  background: var(--bg-elev); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 1.5rem; margin: 2rem 0 1rem;
}
.quiz h3 { margin-top: 0; }
.quiz .q { margin-bottom: 1.25rem; }
.quiz .q p { color: var(--ink); font-weight: 500; margin-bottom: 0.5rem; }
.quiz label {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.55rem 0.7rem; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
}
.quiz label:hover { background: var(--bg); }
.quiz label input { margin-top: 0.25rem; }
.quiz label.correct { background: rgba(79, 122, 61, 0.12); border-color: var(--ok); }
.quiz label.incorrect { background: rgba(201, 100, 66, 0.12); border-color: var(--accent); }
.quiz .feedback { margin-top: 0.5rem; font-size: 0.92rem; color: var(--ink-soft); display: none; }
.quiz .feedback.show { display: block; }

.lesson-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); gap: 0.75rem;
}

/* ---------- Certificate ---------- */
.cert {
  background: var(--bg-elev); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 3rem 2rem;
  text-align: center; box-shadow: var(--shadow);
  margin: 2rem 0;
}
.cert .seal {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--ink); color: var(--bg-elev);
  display: grid; place-items: center; margin: 0 auto 1.25rem;
  font-family: var(--serif); font-size: 1.5rem;
}
.cert h1 { font-size: 2.2rem; margin-bottom: 0.5rem; }
.cert .recipient { font-family: var(--serif); font-size: 1.6rem; color: var(--ink); margin: 1rem 0; }
.cert .meta-line { color: var(--ink-mute); font-size: 0.9rem; }
.cert.locked { opacity: 0.55; }

/* ---------- Utility ---------- */
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.muted { color: var(--ink-mute); }
.spacer { height: 1.5rem; }
