/* ============================================================
   US Study Guide — 디자인 시스템
   토큰 → 베이스 → 컴포넌트 → 페이지 → 반응형
   ============================================================ */

/* ── Design Tokens (8pt 스케일) ── */
:root {
  --navy-900: #0E2A47;
  --navy-800: #123A63;
  --navy-700: #1B4E85;
  --blue-600: #2E6FB7;
  --blue-500: #4A8FD4;
  --blue-200: #B9D3EA;
  --blue-100: #EAF2FB;
  --teal-700: #1F4D46;
  --teal-600: #2E7D74;
  --teal-100: #E3F1EE;
  --ink-900: #16283C;
  --ink-700: #33475C;
  --ink-600: #5A6B7C;
  --ink-500: #71849A;
  --ink-400: #93A5B8;
  --line: #E4EBF3;
  --paper: #FFFFFF;
  --bg: #F6F9FC;
  --bg-warm: #FBF6EC;
  --amber-500: #E0A030;
  --amber-400: #F2C14E;
  --green-600: #3FA46A;
  --red-600: #C4553F;

  --font-body: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --font-display: "Noto Serif KR", "Pretendard Variable", serif;

  --fs-hero: clamp(2.5rem, 6vw, 4.25rem);
  --fs-h1: clamp(2rem, 4.2vw, 3rem);
  --fs-h2: clamp(1.5rem, 2.6vw, 2rem);
  --fs-h3: 1.25rem;
  --fs-body: 1.0625rem;
  --fs-sm: 0.9375rem;
  --fs-xs: 0.8125rem;

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-sm: 0 1px 2px rgba(14, 42, 71, .05);
  --shadow-md: 0 6px 20px rgba(14, 42, 71, .08);
  --shadow-lg: 0 18px 44px rgba(14, 42, 71, .14);

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;
  --space-7: 96px;
  --space-8: 128px;

  --container: 1180px;
  --measure: 760px;

  --ease: cubic-bezier(.25, .6, .3, 1);
  --dur: 200ms;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.75;
  color: var(--ink-700);
  background: var(--paper);
  letter-spacing: -0.01em;
  word-break: keep-all;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--navy-900); line-height: 1.35; letter-spacing: -0.015em; margin: 0 0 .5em; }
p { margin: 0 0 1.1em; }
a { color: var(--blue-600); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--navy-700); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { padding-left: 1.4em; margin: 0 0 1.2em; }
li { margin-bottom: .45em; }
table { border-collapse: collapse; width: 100%; }
strong { color: var(--ink-900); }
:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--navy-800); color: #fff; padding: 12px 20px; border-radius: 0 0 12px 0;
}
.skip-link:focus { left: 0; }

.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--space-3); }

/* ── Button ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 26px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: .975rem; line-height: 1.2;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  cursor: pointer; border: 1px solid transparent; text-align: center;
}
.btn-primary { background: var(--navy-800); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--navy-700); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.45); backdrop-filter: blur(6px); }
.btn-ghost:hover { background: rgba(255,255,255,.16); color: #fff; transform: translateY(-2px); }
.btn-light { background: var(--amber-400); color: var(--navy-900); }
.btn-light:hover { background: var(--amber-500); color: var(--navy-900); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-sm { min-height: 42px; padding: 9px 18px; font-size: .9rem; }

/* ── Badge ── */
.badge {
  display: inline-block; padding: 5px 13px; border-radius: 999px;
  background: var(--blue-100); color: var(--navy-800);
  font-size: .8rem; font-weight: 700; letter-spacing: .02em;
}

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header.is-scrolled { box-shadow: var(--shadow-md); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark { display: inline-flex; width: 42px; height: 42px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.18rem; color: var(--navy-900); letter-spacing: -.01em; }
.site-nav { display: flex; align-items: center; gap: 20px; }
.nav-list { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-list .menu-item a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 15px;
  border-radius: var(--radius-sm); color: var(--ink-700); font-weight: 600; font-size: .95rem;
}
.nav-list .menu-item a:hover, .nav-list .menu-item.current-menu-item a { color: var(--navy-800); background: var(--blue-100); }
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 46px; height: 46px; padding: 10px; background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.nav-toggle .bar { display: block; height: 2px; width: 24px; background: var(--navy-900); border-radius: 2px; transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.nav-toggle[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Hero ── */
.hero {
  position: relative; isolation: isolate;
  padding: clamp(64px, 10vw, 128px) 0 clamp(56px, 8vw, 104px);
  color: #fff; overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -2;
  background-size: cover; background-position: center 38%;
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(10, 30, 52, .82) 0%, rgba(14, 42, 71, .62) 46%, rgba(14, 42, 71, .25) 100%);
}
.hero-inner { max-width: 720px; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 15px; margin-bottom: 22px; border-radius: 999px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28);
  font-size: .85rem; font-weight: 700; letter-spacing: .04em;
}
.hero-title {
  margin: 0 0 18px; color: #fff;
  font-size: var(--fs-hero); font-weight: 700; line-height: 1.2;
}
.hero-sub { font-size: clamp(1.02rem, 1.6vw, 1.18rem); line-height: 1.8; color: rgba(255,255,255,.88); max-width: 560px; margin-bottom: 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 34px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 12px 26px; padding: 18px 0 0; border-top: 1px solid rgba(255,255,255,.22); }
.hero-fact { display: flex; align-items: center; gap: 9px; font-size: .9rem; color: rgba(255,255,255,.9); }
.hero-fact::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--amber-400); flex: none; }

/* ── Section 헤드 ── */
.section { padding: var(--space-7) 0; }
.section-alt { background: var(--bg); }
.section-head { max-width: 640px; margin-bottom: var(--space-5); }
.section-kicker { display: inline-block; margin-bottom: 10px; color: var(--blue-600); font-size: .85rem; font-weight: 800; letter-spacing: .06em; }
.section-title { font-size: var(--fs-h2); margin-bottom: 12px; }
.section-desc { color: var(--ink-600); font-size: 1.02rem; }

/* ── 카드 그리드 ── */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.post-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); color: var(--ink-700);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.post-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--blue-200); color: var(--ink-700); }
.post-card-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg); }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s var(--ease); }
.post-card:hover .post-card-media img { transform: scale(1.045); }
.post-card-body { display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 24px; flex: 1; }
.post-card-title { font-family: var(--font-display); font-size: 1.14rem; font-weight: 700; color: var(--navy-900); line-height: 1.45; }
.post-card-excerpt { font-size: .92rem; color: var(--ink-600); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-meta { margin-top: auto; font-size: .8rem; color: var(--ink-400); }

/* ── 캐러셀 ── */
.carousel-wrap { position: relative; }
.carousel {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 52px) / 3);
  gap: 26px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 4px 4px 18px; margin: -4px; scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel-item { scroll-snap-align: start; }
.carousel-arrow {
  position: absolute; top: 38%; transform: translateY(-50%); z-index: 5;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255,255,255,.95); box-shadow: var(--shadow-md); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; color: var(--navy-800);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.carousel-arrow:hover { background: var(--blue-100); }
.carousel-arrow.prev { left: -58px; }
.carousel-arrow.next { right: -58px; }
.carousel-arrow[hidden] { display: none; }

/* ── 스텝(절차) ── */
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; counter-reset: step; }
.step-card {
  position: relative; padding: 28px 26px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.step-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px; margin-bottom: 16px;
  background: var(--navy-800); color: #fff; font-weight: 800; font-size: 1.05rem;
}
.step-card h3 { font-size: 1.08rem; margin-bottom: 8px; }
.step-card p { margin: 0; font-size: .93rem; color: var(--ink-600); line-height: 1.7; }

/* ── 푸터 ── */
.site-footer { background: var(--navy-900); color: rgba(255,255,255,.82); padding: var(--space-7) 0 var(--space-5); margin-top: var(--space-7); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 44px; padding-bottom: var(--space-5); border-bottom: 1px solid rgba(255,255,255,.14); }
.brand-light .brand-name { color: #fff; }
.footer-desc { margin-top: 16px; font-size: .94rem; line-height: 1.8; color: rgba(255,255,255,.7); max-width: 360px; }
.footer-title { color: #fff; font-size: 1rem; margin-bottom: 16px; font-family: var(--font-body); }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { color: rgba(255,255,255,.78); font-size: .93rem; }
.footer-links a:hover { color: var(--amber-400); }
.footer-notices { padding: var(--space-4) 0; border-bottom: 1px solid rgba(255,255,255,.14); }
.footer-notices p { margin: 0 0 8px; font-size: .8rem; line-height: 1.75; color: rgba(255,255,255,.6); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: var(--space-4); }
.footer-bottom p { margin: 0; font-size: .82rem; color: rgba(255,255,255,.55); }

/* ── 글 상세 ── */
.post-hero { padding: var(--space-5) 0 var(--space-3); }
.post-hero-inner { max-width: var(--measure); }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .86rem; color: var(--ink-400); margin-bottom: 20px; }
.breadcrumb a { color: var(--ink-500); }
.breadcrumb a:hover { color: var(--blue-600); }
.breadcrumb .current { color: var(--ink-600); }
.post-heading { margin-top: 14px; }
.post-title { font-size: var(--fs-h1); line-height: 1.3; margin: 14px 0 14px; }
.post-meta { display: flex; gap: 8px; align-items: center; font-size: .88rem; color: var(--ink-500); }
.post-hero-figure { max-width: var(--measure); margin: var(--space-4) auto var(--space-5); }
.post-hero-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.post-layout, .page-layout { max-width: var(--measure); margin-inline: auto; }

/* ── 본문(entry content) ── */
.entry-content { font-size: 1.0625rem; line-height: 1.85; color: var(--ink-700); }
.entry-content > * { margin-bottom: 1.4em; }
.entry-content h2 { font-size: var(--fs-h2); margin-top: 2.4em; padding-top: .4em; }
.entry-content h3 { font-size: var(--fs-h3); margin-top: 1.8em; }
.entry-content a { text-decoration: underline; text-underline-offset: 3px; }
.entry-content figure { margin-inline: 0; }
.entry-content img { border-radius: var(--radius-md); }

.post-summary-box {
  background: var(--blue-100); border: 1px solid var(--blue-200);
  border-radius: var(--radius-lg); padding: 22px 24px; margin-bottom: 1.8em;
}
.post-summary-box p { margin: 0; font-size: .98rem; line-height: 1.8; color: var(--ink-700); }
.post-summary-box strong { color: var(--navy-800); }

.cmp-table-wrap { overflow-x: auto; max-width: 100%; border-radius: var(--radius-md); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.entry-content table.cmp-table { width: 100%; min-width: 560px; font-size: .93rem; margin: 0; }
.cmp-table th {
  background: var(--navy-800); color: #fff; text-align: left;
  padding: 13px 16px; font-weight: 700; white-space: nowrap;
}
.cmp-table td { padding: 13px 16px; border-top: 1px solid var(--line); vertical-align: top; color: var(--ink-700); background: #fff; }
.cmp-table tbody tr:nth-child(even) td { background: var(--bg); }
.cmp-table tbody tr:hover td { background: var(--blue-100); }

blockquote.callout {
  margin: 1.8em 0; padding: 18px 22px 18px 26px;
  border-left: 4px solid var(--blue-600); border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--bg); color: var(--ink-700); font-size: .97rem; line-height: 1.8;
}
blockquote.callout p { margin: 0; }
blockquote.callout strong { color: var(--navy-800); }

.checklist-box { background: var(--bg-warm); border: 1px solid #EFE3C8; border-radius: var(--radius-lg); padding: 22px 24px; margin-bottom: 1.8em; }
.checklist-box ul { list-style: none; padding: 0; margin: 0; }
.checklist-box li { position: relative; padding-left: 30px; margin-bottom: 9px; }
.checklist-box li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  width: 20px; height: 20px; border-radius: 6px;
  background: var(--teal-600); color: #fff; font-size: .75rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}

.chart-bar { display: grid; gap: 14px; background: var(--bg); border-radius: var(--radius-lg); padding: 22px 24px; margin-bottom: 10px; }
.chart-item { display: grid; grid-template-columns: 130px 1fr 120px; gap: 14px; align-items: center; font-size: .88rem; }
.chart-label { color: var(--ink-900); font-weight: 700; }
.chart-track { height: 12px; background: #E1E9F2; border-radius: 999px; overflow: hidden; }
.chart-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--navy-800), var(--blue-500)); }
.chart-note { color: var(--ink-500); font-size: .8rem; }
.chart-caption { font-size: .82rem; color: var(--ink-500); margin-top: 2px; }

ol.step-flow, ol.timeline-steps { counter-reset: flow; list-style: none; padding: 0; margin: 1.6em 0; }
ol.step-flow li, ol.timeline-steps li {
  position: relative; padding: 12px 16px 12px 52px; margin-bottom: 10px;
  background: var(--bg); border-radius: var(--radius-md); border: 1px solid var(--line);
  counter-increment: flow; font-size: .97rem;
}
ol.step-flow li::before, ol.timeline-steps li::before {
  content: counter(flow); position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy-800); color: #fff; font-weight: 800; font-size: .85rem;
  display: inline-flex; align-items: center; justify-content: center;
}

.entry-figure { margin: 2em 0; }
.entry-figure img { width: 100%; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.entry-figure figcaption { text-align: center; font-size: .84rem; color: var(--ink-500); margin-top: 10px; }

.faq-item { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 20px 22px; margin-bottom: 14px; background: #fff; }
.faq-item h3 { font-family: var(--font-body); font-size: 1.02rem; margin-bottom: 8px; color: var(--navy-900); }
.faq-item p { margin: 0; font-size: .96rem; }

.legal-notice p, .ai-notice { font-size: .85em; color: #888; }
.entry-content .ai-notice { margin-top: 2.4em; }

/* Easy TOC 스타일 통일 */
.ez-toc-container { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px 22px; margin: 1.6em 0 2em; }
.ez-toc-title { font-weight: 800; color: var(--navy-900); }
.ez-toc-list li a { color: var(--ink-600); text-decoration: none; }

/* ── 관련글 섹션 ── */
.related-section { padding: var(--space-6) 0 var(--space-4); background: var(--bg); }
.related-section .section-title { margin-bottom: var(--space-4); }

/* ── 페이지(약관 등) ── */
.page-hero { padding: var(--space-6) 0 var(--space-3); border-bottom: 1px solid var(--line); background: var(--bg); }
.page-title { font-size: var(--fs-h1); margin-top: 12px; }
.page-layout { padding: var(--space-5) 0 var(--space-6); }

/* ── 아카이브 ── */
.archive-hero { padding: var(--space-6) 0 var(--space-4); background: var(--bg); border-bottom: 1px solid var(--line); }
.archive-title { font-size: var(--fs-h1); margin-top: 12px; }
.archive-desc { color: var(--ink-600); max-width: 640px; }
.archive-section { padding: var(--space-6) 0; }
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: var(--space-5); }
.pagination a, .pagination span { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink-700); }
.pagination .current { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.empty-note { color: var(--ink-500); padding: var(--space-5) 0; text-align: center; }

/* ── 404 ── */
.error-section { padding: var(--space-8) 0; text-align: center; }
.error-code { font-family: var(--font-display); font-size: 5rem; color: var(--blue-200); font-weight: 700; margin: 0; }
.error-title { font-size: var(--fs-h1); }
.error-desc { color: var(--ink-600); margin-bottom: var(--space-4); }

/* ── 모션(reveal) ── */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ── 반응형 ── */
@media (max-width: 1080px) {
  .carousel { grid-auto-columns: calc((100% - 26px) / 2); }
  .carousel-arrow.prev { left: -8px; }
  .carousel-arrow.next { right: -8px; }
}
@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: fixed; inset: 72px 0 auto 0; z-index: 99;
    flex-direction: column; align-items: stretch; gap: 8px;
    background: #fff; padding: 18px 24px 26px;
    border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg);
    transform: translateY(-8px); opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
  }
  .site-nav.is-open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
  .nav-list { flex-direction: column; gap: 2px; }
  .nav-list .menu-item a { width: 100%; min-height: 48px; }
  .nav-cta { margin-top: 8px; }
  .card-grid, .steps-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  :root { --space-7: 72px; }
  .card-grid, .steps-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .carousel { grid-auto-columns: 86%; }
  .chart-item { grid-template-columns: 1fr; gap: 6px; }
  .hero-actions .btn { width: 100%; }
  .post-hero-img { aspect-ratio: 4/3; }
  .cmp-table-wrap { margin-inline: -4px; }
}

/* ── 접근성: 모션 줄이기 ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
