/* 마이웨이 아카데미 — 공용 스타일 (모든 강의 공통) */
:root {
  --bg: #FAF8F4;
  --surface: #F2EEE5;
  --line: #E0D9CB;
  --ink: #1F2A44;
  --muted: #4E5873;
  --gold: #B8925A;          /* 장식·막대 */
  --gold-ink: #7F6130;      /* 글자용 골드 (크림 대비 4.5:1 이상) */
  --done: #3F7D5C;
  --done-bg: #E4EFE8;
  --focus: #1F2A44;
  --radius: 10px;
  --read: 720px;
  --wide: 1120px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151F;
    --surface: #181E2B;
    --line: #2A3243;
    --ink: #E8E4DA;
    --muted: #B3AEA2;
    --gold: #D4B27A;
    --gold-ink: #D4B27A;
    --done: #6FB28C;
    --done-bg: #1B2B24;
    --focus: #D4B27A;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
h1, h2, h3 { line-height: 1.3; letter-spacing: -0.02em; text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 6px; z-index: 50; }
.skip:focus { top: 12px; }
.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } body { font-size: 16px; } }

/* 헤더 */
.site-head { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.brand svg { flex: none; }
.site-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.site-nav a { text-decoration: none; padding: 6px 10px; border-radius: 6px; color: var(--muted); font-size: 15px; }
.site-nav a:hover { color: var(--ink); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--surface); font-weight: 700; }
.nav-toggle { display: none; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 6px 12px; min-height: 40px; cursor: pointer; }
.section-jump { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; padding-bottom: 16px; }
.section-jump a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-size: 14px; }
.section-jump a:hover { background: var(--surface); }
@media (max-width: 720px) {
  .site-head .nav-wrap { position: relative; justify-content: space-between; }
  .nav-toggle { display: inline-block; margin-left: auto; }
  .site-nav { display: none; position: absolute; top: 100%; left: 16px; right: 16px; z-index: 25; margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); box-shadow: 0 8px 24px var(--line); }
  .site-nav.open { display: grid; }
  .site-nav a { min-height: 44px; display: flex; align-items: center; }
}

.notice { background: var(--surface); border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.notice .wrap { padding-top: 8px; padding-bottom: 8px; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px; border-radius: 8px; border: 1.5px solid var(--ink); background: var(--ink); color: var(--bg); font-weight: 600; text-decoration: none; cursor: pointer; transition: transform .15s ease, background-color .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 15px; }
.btn[aria-pressed="true"] { background: var(--done); border-color: var(--done); color: #fff; }
@media (prefers-color-scheme: dark) { .btn[aria-pressed="true"] { color: #0E1A14; } }

.eyebrow { font-size: 14px; font-weight: 600; letter-spacing: .04em; color: var(--gold-ink); }
.section { padding: 88px 0; border-top: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 32px; align-items: end; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
.section-head p { color: var(--muted); }
@media (max-width: 820px) { .section { padding: 60px 0; } .section-head { grid-template-columns: 1fr; gap: 12px; } }

/* 홈 히어로 */
.hero { padding: 96px 0 80px; }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 56px; align-items: end; }
.hero h1 { font-size: clamp(2.1rem, 5.6vw, 4rem); font-weight: 800; letter-spacing: -0.035em; margin: 16px 0 24px; }
.hero h1 em { font-style: normal; color: var(--gold-ink); }
.hero .lead { font-size: clamp(1.05rem, 1.8vw, 1.25rem); color: var(--muted); max-width: 36em; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.resume { margin-top: 16px; font-size: 15px; color: var(--muted); }
.check { border-left: 3px solid var(--gold); padding: 4px 0 4px 24px; }
.check h2 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.check ol { margin: 0; padding-left: 1.2em; display: grid; gap: 10px; }
.check p { margin-top: 16px; font-weight: 600; }
@media (max-width: 820px) { .hero { padding: 56px 0 48px; } .hero .wrap { grid-template-columns: 1fr; gap: 40px; } }

/* 다섯 개의 문 */
.doors { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; position: relative; }
.door { display: grid; grid-template-rows: auto auto 1fr auto; gap: 8px; }
.door .arch { height: 128px; border: 1.5px solid var(--ink); border-bottom-width: 4px; border-radius: 999px 999px 4px 4px; display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.door h3 { font-size: 17px; margin-top: 8px; }
.door p { font-size: 15px; color: var(--muted); }
.door small { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }
.door.ai .arch { background: var(--gold); border-color: var(--gold); color: #1F2A44; }
.doors-note { margin-top: 36px; max-width: var(--read); font-size: 18px; }
@media (max-width: 960px) { .doors { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 32px; } }
@media (max-width: 560px) {
  .doors { grid-template-columns: 1fr; gap: 20px; }
  .door { grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: auto; column-gap: 16px; align-items: start; }
  .door .arch { grid-row: span 3; height: 76px; font-size: 20px; }
  .door h3 { margin-top: 0; }
  .door small { grid-column: 2; }
}

/* 진도 막대 */
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--done); border-radius: 99px; transition: width .3s ease; }

/* 로드맵 */
.roadmap { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 4px solid var(--ink); }
.step { padding: 24px 24px 8px 0; position: relative; display: flex; flex-direction: column; gap: 10px; }
.step::before { content: ""; position: absolute; top: -12px; left: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); border: 4px solid var(--ink); }
.step.complete::before { background: var(--done); border-color: var(--done); }
.step .code { font-size: 14px; font-weight: 700; color: var(--gold-ink); margin-top: 8px; }
.step h3 { font-size: 19px; }
.step h3 a { text-decoration: none; }
.step h3 a:hover { text-decoration: underline; }
.step .promise { color: var(--muted); font-size: 15px; }
.step .meta { font-size: 14px; color: var(--muted); }
@media (max-width: 820px) {
  .roadmap { grid-template-columns: 1fr; border-top: 0; border-left: 4px solid var(--ink); }
  .step { padding: 0 0 32px 28px; }
  .step::before { top: 2px; left: -12px; }
  .step .code { margin-top: 0; }
}

/* 강의 목록 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip { min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 15px; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.courses { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.course-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 220px; gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--line); align-items: start; }
.course-row .code { font-size: 28px; font-weight: 800; color: var(--gold-ink); line-height: 1; }
.course-row h3 { font-size: 21px; margin-bottom: 6px; }
.course-row h3 a { text-decoration: none; }
.course-row h3 a::after { content: " →"; color: var(--gold-ink); }
.course-row h3 a:hover { text-decoration: underline; }
.course-row .tagline { color: var(--muted); }
.course-row .side { display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
.course-row.soon { opacity: .75; }
.badge { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 99px; border: 1px solid currentColor; color: var(--gold-ink); width: fit-content; }
.empty { padding: 32px 0; color: var(--muted); }
@media (max-width: 720px) { .course-row { grid-template-columns: 48px minmax(0, 1fr); gap: 16px; } .course-row .side { grid-column: 2; } .course-row .code { font-size: 22px; } }

/* 클립 · 기관 */
.clips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 0 48px; }
.clip { padding: 20px 0; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.clip:first-child { grid-row: span 2; border-bottom: 0; grid-template-columns: 1fr; padding: 28px; background: var(--surface); border-radius: var(--radius); align-content: start; }
.clip:first-child h3 { font-size: 24px; }
.clip .len { font-size: 13px; font-weight: 700; color: var(--gold-ink); }
.clip h3 { font-size: 18px; margin-bottom: 4px; }
.clip p { color: var(--muted); font-size: 15px; }
@media (max-width: 820px) { .clips { grid-template-columns: 1fr; } .clip:first-child { grid-row: auto; margin-bottom: 8px; } }
.tracks { width: 100%; border-collapse: collapse; }
.tracks th, .tracks td { text-align: left; padding: 16px 16px 16px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tracks thead th { font-size: 14px; color: var(--muted); font-weight: 600; }
.tracks tbody th { font-size: 18px; width: 22%; }
.tracks td.path { font-weight: 600; width: 34%; }
.tracks td { color: var(--muted); }
.tracks td.path { color: var(--ink); }
@media (max-width: 720px) {
  .tracks thead { display: none; }
  .tracks, .tracks tbody, .tracks tr, .tracks th, .tracks td { display: block; width: auto !important; }
  .tracks tr { padding: 16px 0; border-bottom: 1px solid var(--line); }
  .tracks th, .tracks td { border: 0; padding: 2px 0; }
}
.org-note { margin-top: 32px; max-width: var(--read); color: var(--muted); }

.site-foot { border-top: 1px solid var(--line); padding: 40px 0 56px; color: var(--muted); font-size: 14px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between; }

/* 강의 대시보드 */
.course-hero { padding: 56px 0 32px; }
.course-hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); margin: 10px 0 12px; }
.course-hero .tagline { color: var(--muted); font-size: 18px; max-width: 40em; }
.tags { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font-size: 14px; padding: 2px 12px; border-radius: 99px; background: var(--surface); color: var(--muted); }
.tablist { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: transparent; padding: 12px 16px; min-height: 48px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 48px; padding: 40px 0 80px; }
.dash aside { display: grid; gap: 40px; align-content: start; }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; gap: 40px; } }
.status { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 24px; align-items: center; padding-bottom: 32px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
.status .big { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.status .big small { font-size: 16px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.status .bar { grid-column: 1 / -1; height: 8px; }
.stats { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 32px; color: var(--muted); font-size: 15px; }
.stats b { color: var(--ink); }
@media (max-width: 520px) { .status { grid-template-columns: 1fr; } .status .btn { width: 100%; } }
.h-side { font-size: 17px; margin-bottom: 14px; }
.acc { border-top: 1px solid var(--line); }
.acc-sec { border-bottom: 1px solid var(--line); }
.acc-sec h3 { font-size: inherit; }
.acc-btn { width: 100%; display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 18px 4px; min-height: 56px; background: none; border: 0; text-align: left; cursor: pointer; font-weight: 700; font-size: 17px; }
.acc-btn > span:first-child { flex: 1; min-width: 0; }
.acc-btn .count { font-weight: 500; font-size: 14px; color: var(--muted); white-space: nowrap; }
.acc-btn::after { content: ""; flex: none; width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s ease; margin: 0 6px 4px; }
.acc-btn[aria-expanded="true"]::after { transform: rotate(-135deg); margin-bottom: -4px; }
.units { list-style: none; margin: 0 0 12px; padding: 0; }
.unit a { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 10px 8px; border-radius: 8px; text-decoration: none; }
.unit a:hover { background: var(--surface); }
.unit a[aria-current="page"] { background: var(--surface); box-shadow: inset 3px 0 0 var(--gold); }
.unit .mark { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); display: inline-grid; place-items: center; font-size: 12px; transform: translateY(3px); }
.unit.done .mark { background: var(--done); border-color: var(--done); color: #fff; }
@media (prefers-color-scheme: dark) { .unit.done .mark { color: #0E1A14; } }
.unit .no { font-size: 13px; color: var(--muted); }
.unit.missing .t { color: var(--muted); }
.news, .log { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.news li, .log li { display: grid; gap: 2px; font-size: 15px; }
.news time, .log time { font-size: 13px; color: var(--muted); }
.log li { padding-left: 14px; border-left: 2px solid var(--done); }
.muted { color: var(--muted); }
.intro { max-width: var(--read); padding: 40px 0 80px; display: grid; gap: 36px; }
.intro h2 { font-size: 20px; margin-bottom: 10px; }
.intro ul { margin: 0; padding-left: 1.2em; }
.intro dl { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.intro dt { color: var(--muted); }
.intro dd { margin: 0; }

.panel-msg { max-width: var(--read); margin: 80px auto; padding: 0 16px; text-align: center; display: grid; gap: 16px; justify-items: center; }
.panel-msg h1 { font-size: 26px; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }

/* 학습 페이지 */
.lesson-bar .wrap { gap: 16px; }
.lesson-bar .lesson-context { min-height: 40px; justify-content: space-between; border-top: 1px solid var(--line); }
.lesson-bar .crumb { min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-bar .crumb a { text-decoration: none; font-weight: 600; }
.lesson-bar .prog { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.lesson-bar .prog .bar { width: 96px; }
@media (max-width: 520px) { .lesson-bar .prog .bar { display: none; } }
.lesson { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 48px; max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.lesson article { max-width: var(--read); width: 100%; margin: 0 auto; padding: 48px 0 96px; }
.md h1 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); margin-bottom: 8px; }
.md h1 + p { color: var(--muted); font-size: 15px; }
.md h2 { font-size: 1.3rem; margin: 2.4em 0 .7em; padding-top: .2em; }
.md h3 { font-size: 1.1rem; margin: 1.8em 0 .5em; }
.md p, .md ul, .md ol, .md table, .md pre, .md blockquote { margin: 0 0 1.1em; }
.md li { margin: .3em 0; }
.md blockquote { border-left: 3px solid var(--gold); background: var(--surface); padding: 14px 20px; border-radius: 0 8px 8px 0; }
.md blockquote p:last-child { margin-bottom: 0; }
.md code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; background: var(--surface); padding: 1px 6px; border-radius: 4px; }
.md pre { background: var(--surface); padding: 16px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font-size: 15px; }
.md th, .md td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.md th { background: var(--surface); }
.md img { max-width: 100%; height: auto; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.soon-box { margin-top: 24px; padding: 28px; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.soon-box strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.finish { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); display: grid; gap: 24px; }
.finish .complete-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager a { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; min-width: 0; }
.pager a:hover { border-color: var(--ink); }
.pager a small { color: var(--muted); font-size: 13px; }
.pager a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 15px; }
.pager .next { text-align: right; grid-column: 2; }

.rail { position: sticky; top: 64px; align-self: start; height: calc(100vh - 64px); display: flex; flex-direction: column; border-left: 1px solid var(--line); }
body[data-page="lesson"] .rail { top: 104px; height: calc(100vh - 104px); }
.rail-toggle { display: none; }
.rail .tablist { padding: 0 8px; }
.rail .tab { padding: 12px 10px; font-size: 15px; }
.rail-panels { flex: 1; overflow-y: auto; padding: 20px 16px 32px 20px; }
.rail .units { margin: 0; }
.rail .sec-t { font-size: 13px; font-weight: 700; color: var(--muted); margin: 18px 8px 6px; }
.rail .sec-t:first-child { margin-top: 0; }
.note-area { width: 100%; min-height: 260px; resize: vertical; padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 15px; line-height: 1.6; }
.note-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
label.h-side { display: block; }
.qa-soon { display: grid; gap: 10px; font-size: 15px; }
.qa-soon strong { font-size: 17px; }

@media (max-width: 960px) {
  .lesson { grid-template-columns: 1fr; padding: 0 16px; gap: 0; }
  .lesson article { padding: 32px 0 120px; }
  .rail { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; max-height: 78vh; z-index: 30; background: var(--bg); border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px rgb(0 0 0 / .12); }
  .rail-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 56px; padding: 8px 20px; background: none; border: 0; cursor: pointer; font-weight: 700; }
  .rail-toggle::after { content: ""; width: 10px; height: 10px; border-left: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg); margin-top: 6px; transition: transform .2s ease; }
  .rail.open .rail-toggle::after { transform: rotate(-135deg); margin-top: -6px; }
  .rail:not(.open) .tablist, .rail:not(.open) .rail-panels { display: none; }
  .rail-panels { max-height: calc(78vh - 112px); }
}
@media (max-width: 420px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: 1; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
@media print { .site-head, .rail, .finish { display: none; } }
