/* ═══════════════════════════════════════════════
   개발자리 CS 커리큘럼 — 공통 스타일
   ═══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #FFFFFF;
  --surface:   #F7F8FA;
  --surface2:  #EEF0F4;
  --border:    #E2E4EA;
  --border2:   #D0D3DC;
  --orange:    #e04a1c;
  --orange-dim:#e04a1c14;
  --blue:      #2E8BD8;
  --blue-dim:  #2E8BD812;
  --green:     #2DA55D;
  --green-dim: #2DA55D12;
  --yellow:    #D4950A;
  --yellow-dim:#D4950A12;
  --purple:    #7C5DC7;
  --red:       #DC3545;
  --text:      #1A1D2A;
  --muted:     #6B7190;
  --tag-bg:    #F0F1F5;
  --radius:    14px;
  --radius-lg: 20px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Noise overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.012'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0;
}

/* ── NAV ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  margin-right: 32px;
  letter-spacing: -0.02em;
}

.nav-logo span { color: var(--orange); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  flex: 1;
}

.nav-links a {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color .2s, background .2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--surface2);
}

.nav-links a.active { color: var(--orange); }

.nav-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border2);
  color: var(--muted);
  margin-left: auto;
}

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 40px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  position: relative; z-index: 1;
  border-bottom: 1px solid var(--border);
}

.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--orange); }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--text); }

/* ── LAYOUT ── */
.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px;
  position: relative; z-index: 1;
}

/* ── TYPOGRAPHY ── */
.font-mono { font-family: 'DM Mono', monospace; }
.font-display { font-family: 'Space Grotesk', sans-serif; }

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 100px;
}

.badge-orange { color: var(--orange); background: var(--orange-dim); border: 1px solid #e04a1c44; }
.badge-blue   { color: var(--blue);   background: var(--blue-dim);   border: 1px solid #5AB4FF44; }
.badge-green  { color: var(--green);  background: var(--green-dim);  border: 1px solid #4ADE8044; }
.badge-yellow { color: var(--yellow); background: var(--yellow-dim); border: 1px solid #FFD16644; }

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.4; transform:scale(.8); }
}

/* ── CHIP ROW ── */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.chip {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border2);
  color: var(--muted);
  background: var(--tag-bg);
  letter-spacing: 0.04em;
}

.chip.orange { border-color:#e04a1c44; color:var(--orange); }
.chip.blue   { border-color:#5AB4FF44; color:var(--blue);   }
.chip.green  { border-color:#4ADE8044; color:var(--green);  }
.chip.yellow { border-color:#FFD16644; color:var(--yellow); }

/* ── CARD BASE ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.card:hover {
  border-color: var(--border2);
  box-shadow: 0 4px 24px #00000010;
}

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border2), transparent);
  margin: 60px 0;
}

/* ── FOOTER ── */
.footer {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  border-top: 1px solid var(--border);
  letter-spacing: 0.05em;
  position: relative; z-index: 1;
}

/* ── TOPIC CARD (expandable) ── */
.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color .2s;
}
.topic-card:hover { border-color: var(--border2); }
.topic-card.open  { border-color: var(--border2); }

.topic-header {
  padding: 20px 22px 18px;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
  transition: background .15s;
}
.topic-card.open .topic-header { border-bottom-color: var(--border); }

.topic-header:hover { background: rgba(0,0,0,.02); }

.topic-left { display:flex; flex-direction:column; gap:4px; }

.topic-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.topic-subtitle {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
  font-style: italic;
}

.toggle-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--border);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s, transform .3s, color .2s;
  color: var(--muted);
  font-size: 16px; line-height: 1;
}
.topic-card.open .toggle-btn {
  transform: rotate(45deg);
  background: var(--orange-dim);
  color: var(--orange);
}

.topic-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s cubic-bezier(.4,0,.2,1), padding .3s;
}
.topic-card.open .topic-body { max-height: 3000px; padding: 18px 22px 22px; }

/* ── TOPIC QUESTIONS ── */
.topic-questions {
  background: var(--orange-dim);
  border-left: 3px solid var(--orange);
  border-radius: 0 10px 10px 0;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.topic-questions.blue {
  background: var(--blue-dim);
  border-left-color: var(--blue);
}
.topic-questions.green {
  background: var(--green-dim);
  border-left-color: var(--green);
}
.topic-questions.yellow {
  background: var(--yellow-dim);
  border-left-color: var(--yellow);
}

.tq-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.topic-questions ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topic-questions li {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  padding-left: 18px;
  position: relative;
}

.topic-questions li::before {
  content: 'Q.';
  position: absolute;
  left: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 11px;
  color: var(--orange);
}

.topic-questions.blue li::before { color: var(--blue); }
.topic-questions.green li::before { color: var(--green); }
.topic-questions.yellow li::before { color: var(--yellow); }

.topic-items { display:flex; flex-direction:column; gap:12px; }

.topic-item { display:flex; align-items:flex-start; gap:12px; }

.item-dot {
  width:6px; height:6px; border-radius:50%;
  background: var(--orange);
  margin-top:7px; flex-shrink:0; opacity:.7;
}

.item-content { flex:1; }

.item-title {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--orange);
  margin-bottom: 3px;
  font-weight: 500;
}

.item-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* color variants */
.color-blue  .item-dot { background:var(--blue);   }
.color-blue  .item-title { color:var(--blue);   }
.color-green .item-dot { background:var(--green);  }
.color-green .item-title { color:var(--green);  }
.color-yellow .item-dot { background:var(--yellow); }
.color-yellow .item-title { color:var(--yellow); }

/* ── TOPICS GRID ── */
.topics-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── SECTION HEADER ── */
.section-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.section-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  font-size: 24px; flex-shrink:0; margin-top:2px;
}

.icon-orange { background: var(--orange-dim); }
.icon-blue   { background: var(--blue-dim);   }
.icon-green  { background: var(--green-dim);  }
.icon-yellow { background: var(--yellow-dim); }

.section-code {
  font-family:'DM Mono',monospace;
  font-size:10px; letter-spacing:.1em; text-transform:uppercase;
  color:var(--muted); margin-bottom:6px;
}

.section-title {
  font-family:'Space Grotesk',sans-serif;
  font-size:26px; font-weight:800;
  color:var(--text); margin-bottom:6px; letter-spacing:-.02em;
}

.section-trigger {
  font-size:13px; color:var(--muted); font-style:italic;
}
.section-trigger::before { content:'↳ '; color:var(--orange); }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity:0; transform:translateY(14px); }
  to   { opacity:1; transform:translateY(0); }
}

.fade-in { animation: fadeUp .5s both; }
.delay-1 { animation-delay:.1s; }
.delay-2 { animation-delay:.2s; }
.delay-3 { animation-delay:.3s; }
.delay-4 { animation-delay:.4s; }

/* ── SPLIT LAYOUT ── */
.split-layout {
  display: flex;
  gap: 48px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px 100px;
  position: relative; z-index: 1;
}

.content-col {
  flex: 1;
  min-width: 0;
}

.preview-col {
  flex: 0 0 220px;
  position: relative;
}

.sticky-phone {
  position: sticky;
  top: 80px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.sticky-phone .phone-frame {
  width: 200px;
  min-height: 420px;
  border-radius: 36px;
  border: 2.5px solid #1A1D2A;
  background: #FFFFFF;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.10);
}

.sticky-phone .phone-notch {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 84px;
  height: 26px;
  background: #1A1D2A;
  border-radius: 14px;
  z-index: 2;
}

.sticky-phone .phone-screen {
  padding: 52px 14px 24px;
  min-height: 380px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  font-size: 13px;
  color: #1A1D2A;
}

.preview-content {
  display: none;
  flex-direction: column;
  min-height: 320px;
}

.preview-content.active {
  display: flex;
}

/* Content sections in split layout */
.content-section {
  margin-bottom: 56px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--border);
}

.content-section:last-child {
  border-bottom: none;
}

.cs-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.cs-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.cs-subtitle {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 20px;
}

/* ── CODE + PREVIEW ── */
.code-preview {
  display: flex;
  gap: 20px;
  margin-top: 18px;
  align-items: stretch;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.code-block {
  flex: 1;
  min-width: 0;
  background: #1E1F2E;
  border-radius: 12px;
  overflow: hidden;
}

.code-preview > .phone-preview,
.code-preview > .output-box {
  flex: 1;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #2A2D40;
}

.code-dots { display: flex; gap: 5px; }
.code-dots span { width: 8px; height: 8px; border-radius: 50%; }
.code-dots span:nth-child(1) { background: #FF5F57; }
.code-dots span:nth-child(2) { background: #FFBD2E; }
.code-dots span:nth-child(3) { background: #28C840; }

.code-lang {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .06em;
  color: #6B7190;
}

.code-block pre {
  margin: 0;
  padding: 14px;
  font-family: 'DM Mono', monospace;
  font-size: 11.5px;
  line-height: 1.7;
  color: #E4E6F0;
  overflow-x: auto;
  white-space: pre;
}

/* Syntax highlighting */
.code-block .kw { color: #FF79C6; }
.code-block .pr { color: #FF79C6; font-style: italic; }
.code-block .ty { color: #8BE9FD; }
.code-block .str { color: #50FA7B; }
.code-block .cm { color: #6272A4; font-style: italic; }
.code-block .num { color: #BD93F9; }

/* Phone preview mockup */
.phone-preview {
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-frame {
  width: 100%;
  max-width: 280px;
  min-height: 380px;
  border-radius: 36px;
  border: 3px solid #1A1D2A;
  background: #FFFFFF;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.10);
}

.phone-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 24px;
  background: #1A1D2A;
  border-radius: 14px;
  z-index: 1;
}

.phone-screen {
  padding: 48px 16px 20px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  font-size: 14px;
  color: #1A1D2A;
}

.phone-screen .preview-label {
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 12px;
  text-align: center;
}

/* Output box for non-UI examples */
.output-box {
  background: #1E1F2E;
  border-radius: 12px;
  overflow: hidden;
}

.output-box .output-header {
  padding: 8px 14px;
  border-bottom: 1px solid #2A2D40;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #6B7190;
  letter-spacing: .06em;
}

.output-box pre {
  margin: 0;
  padding: 12px 14px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  color: #50FA7B;
  white-space: pre-wrap;
}

/* ── COMMENTS ── */
.comment-donation-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px 60px;
  position: relative; z-index: 1;
}

.section-heading {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.utterances-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-height: 120px;
}

/* ── DONATION FLOAT ── */
.donation-float {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.donation-float-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--orange);
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 4px 20px rgba(232,93,26,.45);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.donation-float-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(232,93,26,.55);
}

.donation-float-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,.13);
  transform-origin: bottom right;
  transform: scale(.85) translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .2s;
  width: 200px;
}

.donation-float-card.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.donation-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.donation-qr {
  width: 148px;
  height: 148px;
  border-radius: 12px;
  object-fit: cover;
}

.donation-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.donation-kakao-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .06em;
  padding: 3px 10px;
  border-radius: 100px;
  background: #FEE500;
  color: #3C1E1E;
  font-weight: 600;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .nav { padding: 0 20px; }
  .breadcrumb { padding: 10px 20px; }
  .page-wrap { padding: 0 20px; }
  .topics-grid { grid-template-columns: 1fr; }
  .section-title { font-size: 20px; }
  /* nav-links는 nav.js의 햄버거 메뉴가 관리 */
  .split-layout { flex-direction: column; gap: 24px; padding: 0 20px 60px; }
  .preview-col { flex: none; position: static; }
  .sticky-phone { position: static; padding-top: 0; }
  .sticky-phone .phone-frame { width: 200px; min-height: 340px; border-radius: 30px; }
  .sticky-phone .phone-screen { min-height: 320px; }
  .code-preview { flex-direction: column; }
  .phone-preview { align-self: center; }
  .phone-frame { max-width: 240px; }
  .output-box { width: 100%; }
  .code-preview > .phone-preview,
  .code-preview > .output-box { flex: none; }
  .comment-donation-wrap { padding: 0 20px 60px; }
  .donation-float { bottom: 20px; right: 20px; }
  .donation-float-card { width: 180px; }
  .donation-qr { width: 130px; height: 130px; }
}
