/* ============================================================
   MoneyScoop — Design System
   A financial intelligence platform
   ============================================================ */

/* 전역 폰트는 Pretendard Variable 로 통일 (Instrument Serif·IBM Plex Mono·Cormorant Garamond 제거) */

/* Pretendard for Korean */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.css');

/* ------------------------------------------------------------
   Design Tokens — Light (default)
   ------------------------------------------------------------ */
:root {
  /* Brand */
  --brand-ink: #0a0e1a;
  --brand-accent: #a16a2e;       /* deeper gold for AA contrast on white bg */
  --brand-accent-2: #7d4e22;     /* deeper bronze */

  /* Surfaces — editorial clean (near-white neutral) */
  --bg: #fafafa;                 /* off-white, reduces pure-white glare */
  --bg-elevated: #f4f4f5;        /* subtle elevation layer */
  --bg-panel: #ffffff;           /* pure white cards, contrast via border */
  --bg-inset: #ededee;           /* sunken surfaces / form fields */
  --bg-terminal: #14161e;
  --bg-overlay: rgba(24, 24, 27, 0.045);

  /* Text — neutral gray-black stack (no blue or warm cast) */
  --text: #18181b;               /* ~17:1 on bg — AAA, neutral zinc-900 */
  --text-secondary: #3f3f46;     /* ~9.4:1 — AAA, zinc-700 */
  --text-muted: #52525b;         /* ~7:1 — AAA for small text (was 3.85:1) */
  --text-faint: #a1a1aa;         /* ~2.8:1, decorative only */
  --text-inverse: #fafafa;

  /* Borders — cool neutral */
  --border: #d4d4d8;             /* zinc-300 */
  --border-strong: #a1a1aa;      /* zinc-400 */
  --border-subtle: #e4e4e7;      /* zinc-200 */

  /* Semantic — Korean convention: up=red, down=blue (tuned for white bg AA) */
  --up: #c9263e;
  --up-soft: rgba(201, 38, 62, 0.09);
  --up-strong: #a81e33;
  --down: #1f56b5;
  --down-soft: rgba(31, 86, 181, 0.09);
  --down-strong: #184596;
  --flat: #71717a;
  --warn: #a16207;
  --warn-soft: rgba(161, 98, 7, 0.10);

  /* Shadows — neutral gray (editorial crispness) */
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.05), 0 1px 1px rgba(24, 24, 27, 0.03);
  --shadow-md: 0 4px 12px rgba(24, 24, 27, 0.07), 0 2px 4px rgba(24, 24, 27, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(24, 24, 27, 0.15), 0 8px 16px -8px rgba(24, 24, 27, 0.08);

  /* Fonts — 전역 통일: Pretendard Variable (굵기·색상은 개별 요소에서 유지) */
  --font-display: 'Pretendard Variable', -apple-system, sans-serif;
  --font-body: 'Pretendard Variable', -apple-system, sans-serif;
  --font-mono: 'Pretendard Variable', -apple-system, sans-serif;
  --font-kr: 'Pretendard Variable', -apple-system, sans-serif;
  --font-sans: 'Pretendard Variable', -apple-system, sans-serif;

  /* Layout */
  --container-wide: 1480px;
  --container-narrow: 1200px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ------------------------------------------------------------
   Design Tokens — Dark (luxurious financial terminal)
   ------------------------------------------------------------ */
[data-theme="dark"] {
  /* Surfaces — refined charcoal with very subtle warm (not navy-purple) */
  --bg: #0c0f14;                 /* deeper, less purple than old #0a0e1a */
  --bg-elevated: #12161f;        /* layered elevation */
  --bg-panel: #171c27;           /* cards — lifted presence */
  --bg-inset: #080b11;           /* sunken (DEEPER than bg, was lighter) */
  --bg-terminal: #06080c;        /* terminal-grade black */
  --bg-overlay: rgba(255, 255, 255, 0.04);

  /* Text — neutral off-white (removes cream-on-navy tone clash) */
  --text: #eaecef;               /* ~16:1 AAA, truly neutral */
  --text-secondary: #b4b7bf;     /* ~9.5:1 AAA */
  --text-muted: #858892;         /* ~6:1 AAA for small text (was 5.6:1) */
  --text-faint: #5a5d6a;         /* ~3.4:1 decorative */
  --text-inverse: #0c0f14;

  /* Borders — cool slate neutral (less blue saturation) */
  --border: #252a36;
  --border-strong: #3b4152;
  --border-subtle: #1a1e28;

  /* Semantic — KR convention, desaturated for premium feel (no neon) */
  --up: #e84a63;                 /* was #ef4565, less neon */
  --up-soft: rgba(232, 74, 99, 0.14);
  --up-strong: #ff6b82;
  --down: #5b9bed;               /* was #4a8fe8, softer */
  --down-soft: rgba(91, 155, 237, 0.14);
  --down-strong: #7ab4f4;
  --flat: #858892;
  --warn: #e5a055;
  --warn-soft: rgba(229, 160, 85, 0.14);

  /* Shadows — deep blacks for luxury depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45), 0 1px 1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.55), 0 2px 5px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 28px 54px -14px rgba(0, 0, 0, 0.78), 0 10px 22px -8px rgba(0, 0, 0, 0.55);

  /* Brand — richer gold against deeper bg */
  --brand-accent: #d9b26a;       /* was #d4a574 */
  --brand-accent-2: #b8895a;
}

/* ------------------------------------------------------------
   Reset & Base
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

/* 모바일 가로 오버플로우 안전망 — sticky 헤더 영향 없음 */
html, body { overflow-x: clip; }
main { overflow-x: clip; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-kr);
  font-feature-settings: "ss01", "cv01", "cv11";
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  letter-spacing: -0.005em;
  min-height: 100vh;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image: none;
}

[data-theme="dark"] body::before {
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(217, 178, 106, 0.055), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(91, 155, 237, 0.04), transparent 60%);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; display: block; }
iframe, video, embed, object { max-width: 100%; }

::selection { background: var(--brand-accent); color: var(--bg); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ------------------------------------------------------------
   Typography
   ------------------------------------------------------------ */
.font-display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.02em; }
.font-mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.italic { font-style: italic; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.025em; font-weight: 600; }

.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.8rem, 5.5vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--text);
}
.hero-title em { font-style: italic; color: var(--brand-accent); font-weight: 400; }

.kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--brand-accent);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
.kicker::before {
  content: '';
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}

/* ── 섹션 제목 표준 체계 ──────────────────────────────────
   H1 .panel-title   크게   주황색  섹션/위젯 대표 제목
   H2 .area-label    중간   노란색  콘텐츠 내 구분 (우측 라인)
   H3 .block-label   작게   기본    세부 블록 제목
   S1 .section-label 중간   파란색  보조/사이드바 레이블
   S2 .side-label    작게   기본    최소 단위 보조 레이블
──────────────────────────────────────────────────────── */
.panel-title {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--brand-accent);
}
.area-label {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.area-label::before {
  content: '';
  width: 3px;
  height: 1em;
  background: rgba(245,158,11,0.5);
  border-radius: 2px;
  flex-shrink: 0;
}
.block-label {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.section-label {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #60a5fa;
}
.side-label {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.num { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.tone-up { color: var(--up); }
.tone-down { color: var(--down); }
.tone-flat { color: var(--flat); }
.tone-warn { color: var(--warn); }

/* ------------------------------------------------------------
   Container
   ------------------------------------------------------------ */
.container {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 32px;
  width: 100%;
}
.container--narrow { max-width: var(--container-narrow); }
@media (max-width: 768px) {
  .container { padding: 0 20px; }
}

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border-subtle);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 48px;
  height: 72px;
  padding-top: 0;
  padding-bottom: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand__mark {
  width: 36px;
  height: 36px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-ink);
  color: var(--bg);
  overflow: hidden;
}
[data-theme="dark"] .brand__mark { background: var(--brand-accent); color: var(--bg); }

.brand__mark::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(212, 165, 116, 0.3) 100%);
}
.brand__mark svg { width: 20px; height: 20px; position: relative; z-index: 1; }

.brand__copy { display: flex; flex-direction: column; line-height: 1; }
.brand__title {
  font-family: var(--font-kr);
  font-size: 1.55rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text);
}
.brand__sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Primary Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-slot { position: relative; }

.nav-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: all 0.2s var(--ease);
  position: relative;
}
.nav-main:hover { color: var(--text); background: var(--bg-overlay); }
.nav-slot.is-active .nav-main { color: var(--text); }
.nav-slot.is-active .nav-main::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -2px;
  height: 2px;
  background: var(--brand-accent);
}

.nav-main__badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  background: var(--up);
  color: #fff;
  border-radius: 3px;
  animation: pulse-badge 2s ease-in-out infinite;
}

/* 네비게이션 내 라이브 인디케이터 — 펄스 도트 */
.nav-main .live-dot,
.mobile-nav__link .live-dot,
.mobile-nav__heading .live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--up);
  flex-shrink: 0;
  animation: live-pulse 1.6s ease-in-out infinite;
  vertical-align: 1px;
}
.mobile-nav__heading .live-dot {
  margin-right: 0;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Dropdown */
.nav-sub {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
  z-index: 60;
}
.nav-slot:hover .nav-sub,
.nav-slot:focus-within .nav-sub,
.nav-slot.is-open .nav-sub { opacity: 1; visibility: visible; transform: translateY(0); }

.nav-sub__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: all 0.15s var(--ease);
}
.nav-sub__link:hover { background: var(--bg-inset); color: var(--text); }
.nav-sub__link.is-active { color: var(--brand-accent); background: var(--bg-inset); }
.nav-sub__link .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

/* Header tools */
.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  transition: all 0.2s var(--ease);
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.theme-toggle svg { width: 18px; height: 18px; transition: transform 0.3s var(--ease); }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

/* Daily Scoop newsletter CTA — header */
.header-newsletter-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 1;
  transition: all 0.2s var(--ease);
  box-sizing: border-box;
}
.header-newsletter-cta:hover {
  color: var(--text);
  border-color: var(--brand-accent);
}
.header-newsletter-cta svg {
  width: 13px;
  height: 13px;
  color: var(--brand-accent);
  flex-shrink: 0;
}
.header-newsletter-cta__text {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
}
.header-newsletter-cta__kicker {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
  text-transform: none;
}
.header-newsletter-cta__label {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
}
@media (max-width: 900px) {
  .header-newsletter-cta__text { display: none; }
  .header-newsletter-cta { padding: 0 10px; }
}

.header-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
.header-clock__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.header-clock__time {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.header-clock__time .live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--up);
  margin-right: 6px;
  animation: live-pulse 1.6s ease-in-out infinite;
  vertical-align: 1px;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--up); }
  50% { opacity: 0.5; box-shadow: 0 0 0 4px transparent; }
}

/* Hamburger button */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  flex-shrink: 0;
}
.nav-hamburger:hover { background: var(--bg-overlay); border-color: var(--brand-accent); }
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}
.nav-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.nav-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* PWA Install Button */
.pwa-install-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 8px;
  background: transparent;
  border: 1px solid var(--brand-accent);
  border-radius: 20px;
  color: var(--brand-accent);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease),
              background 0.15s var(--ease), color 0.15s var(--ease);
}
.pwa-install-btn--show { opacity: 1; transform: translateY(0); }
.pwa-install-btn--hide { opacity: 0; transform: translateY(-4px); }
.pwa-install-btn:hover {
  background: var(--brand-accent);
  color: #fff;
}
.pwa-install-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.pwa-install-btn__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 2px;
  padding: 0;
  background: none;
  border: none;
  color: inherit;
  font-size: 0.7rem;
  opacity: 0.5;
  cursor: pointer;
  line-height: 1;
  transition: opacity 0.12s;
}
.pwa-install-btn__close:hover { opacity: 1; }
@media (max-width: 640px) {
  .pwa-install-btn span { display: none; }
  .pwa-install-btn { padding: 6px 8px; gap: 0; }
  .pwa-install-btn svg { width: 15px; height: 15px; }
}

/* Mobile nav drawer */
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 49;
}
.mobile-nav__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.mobile-nav__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(280px, 85vw);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 72px 0 32px;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.mobile-nav.is-open { display: block; }
.mobile-nav.is-open .mobile-nav__backdrop { opacity: 1; }
.mobile-nav.is-open .mobile-nav__panel { transform: translateX(0); }

.mobile-nav__section { padding: 4px 0 6px; }
.mobile-nav__section + .mobile-nav__section {
  border-top: 1px solid var(--border-subtle);
  margin-top: 6px;
  padding-top: 6px;
}

.mobile-nav__heading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-accent);
}
.mobile-nav__heading::before {
  content: "";
  width: 3px;
  height: 12px;
  background: var(--brand-accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.mobile-nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px 10px 38px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.mobile-nav__link:hover,
.mobile-nav__link.is-active { background: var(--bg-inset); color: var(--text); }
.mobile-nav__link .dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.55;
  flex-shrink: 0;
}
.mobile-nav__link.is-active .dot {
  background: var(--brand-accent);
  opacity: 1;
}
.mobile-nav__link--top {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  padding: 14px 24px;
  gap: 8px;
  letter-spacing: -0.005em;
}
.mobile-nav__link--top::before {
  content: "";
  width: 3px;
  height: 14px;
  background: var(--brand-accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.mobile-nav__link--top:hover,
.mobile-nav__link--top.is-active {
  background: var(--bg-inset);
  color: var(--brand-accent);
}
.mobile-nav__link--top.is-active::before {
  height: 18px;
}

/* Mobile nav toggle — responsive */
@media (max-width: 1024px) {
  .site-nav { gap: 0; }
  .nav-main { padding: 8px 10px; font-size: 0.85rem; }
  .brand__sub { display: none; }
  .header-clock { display: none; }
}

/* 761~900px: 폴드 펼침 / 태블릿 — compact nav */
@media (max-width: 900px) and (min-width: 761px) {
  .site-nav { gap: 0; }
  .nav-main { padding: 6px 7px; font-size: 0.78rem; }
  .nav-slot.is-active .nav-main::after { left: 7px; right: 7px; }
  .brand__mark { width: 28px; height: 28px; }
}

/* 600~760px: 폴드 커버 landscape 등 — 더 좁은 compact nav */
@media (max-width: 760px) and (min-width: 600px) {
  .site-nav { gap: 0; display: flex; }
  .nav-main { padding: 4px 5px; font-size: 0.72rem; }
  .nav-slot.is-active .nav-main::after { left: 5px; right: 5px; }
  .brand__mark { width: 26px; height: 26px; }
  .brand__name { font-size: 0.9rem; }
}

/* 599px 이하: 햄버거 전환 */
@media (max-width: 599px) {
  .site-nav { display: none; }
  .nav-hamburger { display: flex; }
  .header-tools { margin-left: auto; }
}

@media (max-width: 768px) {
  .site-header__inner { height: 60px; gap: 12px; }
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.site-footer {
  margin-top: 32px;
  padding-top: 16px;
  padding-bottom: 10px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  position: relative;
  content-visibility: auto;
  contain-intrinsic-size: 0 360px;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
  opacity: 0.3;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(5, 1fr);
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  align-items: start;
}
@media (max-width: 1024px) { .footer-grid { grid-template-columns: 1.2fr repeat(5, 1fr); gap: 14px; } }
@media (max-width: 900px) { .footer-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; } .footer-brand { grid-column: 1 / -1; } }

.footer-brand { }
.footer-brand .brand { margin-bottom: 4px; }
.footer-brand p {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-accent);
  margin-bottom: 4px;
}

.footer-col a {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--text-secondary);
  padding: 0;
  transition: color 0.12s var(--ease);
}
.footer-col a::before {
  content: '·';
  color: var(--border);
  font-size: 0.9rem;
  line-height: 1;
  transition: color 0.12s var(--ease);
}
.footer-col a:hover { color: var(--brand-accent); }
.footer-col a:hover::before { color: var(--brand-accent); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.footer-bottom__legal { display: flex; gap: 14px; }

@media (max-width: 640px) {
  .footer-bottom { flex-direction: column; gap: 8px; align-items: flex-start; }
}

/* mobile footer accordion */
@media (max-width: 640px) {
  .site-footer { margin-top: 24px; padding-top: 12px; }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 0;
    border-bottom: none;
    padding-bottom: 0;
  }
  .footer-brand { display: none; }
  .footer-col {
    border-bottom: 1px solid var(--border-subtle);
  }
  .footer-col h4 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
  }
  .footer-col h4::after {
    content: '+';
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
    transition: transform 0.15s;
  }
  .footer-col:not(.footer-col--collapsed) h4::after {
    content: '−';
  }
  .footer-col--collapsed a { display: none; }
  .footer-col a { padding: 3px 0 3px 8px; }
  .footer-col a:last-child { margin-bottom: 6px; }
}

/* ------------------------------------------------------------
   Beta notice slot — unified placeholder for future AdSense
   (covers .ad-slot, .post-ad, .kw-ad-slot sitewide)
   ------------------------------------------------------------ */
.ad-slot,
.post-ad,
.kw-ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 32px 0;
  padding: 14px 20px;
  background: rgba(192,120,60,0.06);
  border: 1px solid rgba(192,120,60,0.28);
  border-radius: 8px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--brand-accent);
  min-height: 56px;
  opacity: 0.9;
  overflow: hidden;
}
.ad-slot--inline  { margin: 24px 0; }
.ad-slot--sidebar { margin: 24px 0; }
.post-ad__label   { color: inherit; font: inherit; letter-spacing: inherit; }

/* ------------------------------------------------------------
   Common components
   ------------------------------------------------------------ */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s var(--ease);
  cursor: pointer;
  border: 1px solid transparent;
}
.btn--primary {
  background: var(--brand-ink);
  color: var(--bg);
}
[data-theme="dark"] .btn--primary { background: var(--brand-accent); color: var(--brand-ink); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { border-color: var(--text); background: var(--bg-overlay); }

.btn svg { width: 16px; height: 16px; }

/* Live indicator inside buttons — pulsing dot for realtime CTAs */
.btn .live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--up);
  flex-shrink: 0;
  animation: live-pulse 1.6s ease-in-out infinite;
}

/* Section */
.section { padding: 72px 0; }
.section--tight { padding: 40px 0; }
.section--flush { padding: 0 0 32px; }

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
}
.section-title em { font-style: italic; color: var(--brand-accent); }

.section-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 60ch;
  line-height: 1.6;
}

/* Tag / badge */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-inset);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 3px;
  letter-spacing: 0.02em;
  transition: all 0.15s var(--ease);
}
a.tag:hover { background: var(--brand-accent); color: var(--bg); }

/* Divider with label */
.divider-labeled {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 40px 0 20px;
}
.divider-labeled::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Utility */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.helper { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.03em; }

/* ------------------------------------------------------------
   Below-fold rendering hints — 지식 노드화로 커지는 DOM 대비
   content-visibility: auto 는 뷰포트 진입 전까지 내부 레이아웃/페인트 생략
   ------------------------------------------------------------ */
.gterm-related,
.post-related,
.post-terms__grid {
  content-visibility: auto;
  contain-intrinsic-size: 0 320px;
}

/* Animation helpers */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal { animation: fade-up 0.7s var(--ease-out) both; }
.reveal[data-delay="1"] { animation-delay: 0.05s; }
.reveal[data-delay="2"] { animation-delay: 0.12s; }
.reveal[data-delay="3"] { animation-delay: 0.2s; }
.reveal[data-delay="4"] { animation-delay: 0.28s; }
.reveal[data-delay="5"] { animation-delay: 0.36s; }

/* ── 전역 기울임 해제 (사이트 전체 italic 미적용) ── */
*, em, i, cite, address, dfn, var { font-style: normal !important; }
