/* RUCID WIKI — 뉴스형 정적 사이트 템플릿 공통 스타일
   출처: RUCID WIKI 아티팩트 목업(2026-08)을 다중 페이지 정적 사이트용으로 이식
   테마 토큰 구조: :root(라이트 기본) → @media(dark, 미지정시) → [data-theme=dark](명시적 토글) */
:root {
  --bg: #F6F4EE;
  --surface: #FFFFFF;
  --surface-2: #FBF9F3;
  --ink: #14213D;
  --text: #2A2F3A;
  --text-muted: #7A7566;
  --border: #DEDACC;
  --border-strong: #C7C2AF;
  --accent: #C2542D;
  --accent-ink: #FFF9F2;
  --breaking: #C63B34;
  --breaking-ink: #FFF3EE;
  --cat-auto: #1F6F6B;
  --cat-loan: #4B3F91;
  --cat-estate: #2F6B3A;
  --cat-mind: #9A6A1D;
  --cat-health: #1D6E8C;
  --cat-issue: #B5501F;
  --chrome-bg: #14213D;
  --chrome-text: #FFF9F2;
  --chrome-text-muted: #DCD6C6;
  --shadow: 0 1px 2px rgba(20,33,61,0.06), 0 8px 20px -12px rgba(20,33,61,0.18);
  --serif: 'Batangche', 'Nanum Myeongjo', 'Noto Serif KR', 'Songti SC', serif;
  --sans: 'Malgun Gothic', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont, sans-serif;
  --watermark: rgba(20,33,61,0.32);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #13161C;
    --surface: #1B1F27;
    --surface-2: #1F2430;
    --ink: #F2EEE3;
    --text: #C9CBD3;
    --text-muted: #8D909B;
    --border: #2B303B;
    --border-strong: #3A404E;
    --accent: #E38657;
    --accent-ink: #1B1108;
    --breaking: #DE5B52;
    --breaking-ink: #2A0E0B;
    --cat-auto: #4CB6AC;
    --cat-loan: #8B7FDD;
    --cat-estate: #6BBB77;
    --cat-mind: #D99A3E;
    --cat-health: #4FB8DE;
    --cat-issue: #E08A4C;
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 10px 24px -14px rgba(0,0,0,0.6);
    --watermark: rgba(242,238,227,0.4);
  }
}
:root[data-theme="dark"] {
  --bg: #13161C;
  --surface: #1B1F27;
  --surface-2: #1F2430;
  --ink: #F2EEE3;
  --text: #C9CBD3;
  --text-muted: #8D909B;
  --border: #2B303B;
  --border-strong: #3A404E;
  --accent: #E38657;
  --accent-ink: #1B1108;
  --breaking: #DE5B52;
  --breaking-ink: #2A0E0B;
  --cat-auto: #4CB6AC;
  --cat-loan: #8B7FDD;
  --cat-estate: #6BBB77;
  --cat-mind: #D99A3E;
  --cat-health: #4FB8DE;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 10px 24px -14px rgba(0,0,0,0.6);
  --watermark: rgba(242,238,227,0.4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding-top: 14px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  /* 한글은 어절(띄어쓰기) 단위로만 줄바꿈 — 기본값(글자 단위 줄바꿈)은
     제목·강조 문구가 단어 중간에서 잘려 다음 줄로 넘어가 보여 가독성이 떨어진다.
     너무 긴 토큰(URL 등)이 있을 때만 예외적으로 강제 줄바꿈되도록 break-word를 함께 둔다. */
  word-break: keep-all;
  overflow-wrap: break-word;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- Masthead ---------- */
.utility-bar { color: var(--chrome-text); font-size: 12.5px; }
.utility-bar .wrap {
  background: var(--chrome-bg);
  border-radius: 8px 8px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 34px;
  gap: 16px;
}
.utility-date { font-variant-numeric: tabular-nums; opacity: .85; letter-spacing: .02em; }

.masthead .wrap {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 18px;
  gap: 20px;
}
.brand { display: flex; flex-direction: column; gap: 4px; }
.brand-mark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.01em;
  color: var(--ink);
}
.masthead-search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--text-muted);
  font-size: 13px;
  min-width: 200px;
}

/* ---------- Breaking ticker ---------- */
.ticker-bar { color: var(--breaking-ink); }
.ticker-bar .wrap { background: var(--breaking); display: flex; align-items: center; height: 42px; gap: 14px; }
.ticker-tag {
  flex: none;
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: .04em;
  background: var(--breaking-ink);
  color: var(--breaking);
  border-radius: 4px;
  padding: 4px 9px;
}
.ticker-viewport { overflow: hidden; flex: 1; }
.ticker-track {
  display: flex;
  gap: 56px;
  white-space: nowrap;
  width: max-content;
  animation: ticker-scroll 26s linear infinite;
  font-size: 13.5px;
  font-weight: 600;
}
.ticker-track a:hover { text-decoration: underline; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

/* ---------- Nav ---------- */
.nav-bar .wrap { background: var(--chrome-bg); border-radius: 0 0 8px 8px; display: flex; align-items: center; gap: 4px; height: 46px; overflow-x: auto; }
.nav-link {
  color: #DCD6C6;
  font-size: 14.5px;
  font-weight: 600;
  padding: 0 16px;
  height: 46px;
  display: flex; align-items: center;
  flex: none;
  border-bottom: 3px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.nav-link.active, .nav-link:hover { color: #FFFFFF; border-bottom-color: var(--accent); }

/* ---------- Layout shell ---------- */
#page-home { position: relative; }
main.wrap {
  display: grid;
  grid-template-columns: minmax(0,1fr) 300px;
  gap: 40px;
  padding-top: 32px;
  padding-bottom: 60px;
  align-items: start;
}
@media (max-width: 860px) {
  main.wrap { grid-template-columns: 1fr; }
}

/* ---------- Hero ---------- */
.hero { margin-bottom: 48px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--accent);
}
.hero-eyebrow::before { content: "●"; font-size: 8px; }
.hero-feature .thumb { aspect-ratio: 2.4/1; }
.hero-feature { display: flex; flex-direction: column; gap: 14px; }
.hero-feature h1 {
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.32;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}
.hero-feature p { margin: 0; color: var(--text-muted); font-size: 14.5px; }
.hero-feature h1 a:hover { color: var(--accent); }
.byline { font-size: 12.5px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; }

.thumb {
  aspect-ratio: 16/10;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* 실제 <img>가 들어가면 자르지 않고 원본 비율 유지한 채 가로폭에 맞춰 축소 — 박스 높이도 따라감(여백 없음) */
.thumb:has(img) { aspect-ratio: auto; height: auto; }
.thumb img { position: static; display: block; width: 100%; height: auto; }
.thumb.sm { aspect-ratio: 4/3; }

/* 워터마크 — 실제 이미지 위에 저작권 표기(대각선 반투명 문구) */
.thumb.watermarked { position: relative; }
.thumb.watermarked::after {
  content: "RUCIDWIKI";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(20px, 5vw, 40px);
  letter-spacing: 0.16em;
  color: var(--watermark);
  transform: rotate(-16deg);
  pointer-events: none;
  text-align: center;
}

/* ---------- Section header ---------- */
.section { margin-bottom: 46px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 20px;
}
.section-head .title-group { display: flex; align-items: center; gap: 10px; }
.section-head h2 { font-family: var(--serif); font-size: 21px; margin: 0; color: var(--ink); }
.section-head .more { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.section-bar { width: 4px; height: 18px; border-radius: 2px; }
.section-bar.auto { background: var(--cat-auto); }
.section-bar.loan { background: var(--cat-loan); }
.section-bar.estate { background: var(--cat-estate); }
.section-bar.mind { background: var(--cat-mind); }
.section-bar.health { background: var(--cat-health); }
.section-bar.issue { background: var(--cat-issue); }

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 760px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .card-grid { grid-template-columns: 1fr; } }

.card { display: flex; flex-direction: column; gap: 10px; }
.card h3 { margin: 0; font-size: 15.5px; line-height: 1.42; font-weight: 700; color: var(--ink); }
.card p { margin: 0; font-size: 13px; color: var(--text-muted); }
.card:hover h3 { color: var(--accent); }

/* ---------- Sidebar ---------- */
.sidebar-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
}
.sidebar-box h4 { font-family: var(--serif); font-size: 16px; margin: 0 0 14px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.rank-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.rank-item:last-child { border-bottom: none; }
.rank-num { font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--border-strong); flex: none; width: 18px; font-variant-numeric: tabular-nums; }
.rank-item:nth-child(-n+3) .rank-num { color: var(--accent); }
.rank-item span { font-size: 13.5px; line-height: 1.4; color: var(--text); }

.hook-item {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  transition: color .15s ease;
}
.hook-item:last-child { border-bottom: none; padding-bottom: 2px; }
.hook-item:hover { color: var(--accent); }
.hook-item::before { content: "👀 "; }

/* ---------- 광고 영역 (자리표시자 — 실제 배포 시 애드센스 코드로 교체) ---------- */
.ad-caption { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--text-muted); margin: 0 0 8px; }
.ad-slot {
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: .04em;
  margin-bottom: 16px;
}
.ad-slot:last-child { margin-bottom: 0; }
.ad-multiplex { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 16px; color: var(--text-muted); font-size: 12px; letter-spacing: .02em; }
.ad-multiplex-label { text-align: center; margin-bottom: 12px; }
.ad-multiplex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ad-multiplex-grid div { aspect-ratio: 1/1; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 6px; }

.ad-infeed-card { display: flex; flex-direction: column; gap: 10px; }
.ad-infeed-card .thumb.sm { aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; border-style: dashed; background: var(--surface-2); color: var(--text-muted); font-size: 12px; }
.ad-label {
  display: inline-flex;
  align-self: flex-start;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .05em;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 2px 6px;
}
.ad-infeed-card h3 { color: var(--text-muted); font-weight: 600; }

.side-rail { position: absolute; top: 0; bottom: 0; width: 160px; pointer-events: none; }
.side-rail.left { left: calc(50% - 770px); }
.side-rail.right { left: calc(50% + 610px); }
.side-ad {
  position: sticky;
  top: 150px;
  width: 160px;
  height: 600px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: auto;
}
@media (max-width: 1560px) { .side-rail { display: none; } }

/* 기사·정적 페이지 전용 양옆 광고 레일. 본문 폭이 .static-page(720px)라 홈 화면(1180px)과
   기준이 달라 좌표를 새로 계산했고, 본문이 좁은 만큼 더 좁은 화면에서도 자리가 나서
   숨김 기준(1280px)도 홈 화면(1560px)보다 낮춰 더 많은 방문자에게 노출되게 했다.
   .side-rail과 이름을 분리해 홈 화면의 1560px 숨김 규칙과 서로 간섭하지 않게 함. */
#page-article { position: relative; }
.article-side-rail { position: absolute; top: 0; bottom: 0; width: 160px; pointer-events: none; }
.article-side-rail.left { left: calc(50% - 544px); }
.article-side-rail.right { left: calc(50% + 384px); }
@media (max-width: 1280px) { .article-side-rail { display: none; } }

.ad-leaderboard {
  margin: 18px auto 0;
  max-width: 970px;
  min-height: 90px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ad-inline {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: .04em;
  padding: 22px 16px;
  text-align: center;
  margin: 4px 0 2px;
}
.ad-anchor-mobile { display: none; }
@media (max-width: 760px) {
  .ad-anchor-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 56px;
    background: var(--chrome-bg);
    color: var(--chrome-text);
    font-size: 12px;
    letter-spacing: .04em;
    z-index: 30;
    border-top: 1px solid rgba(255,255,255,.12);
  }
}

/* ---------- Footer ---------- */
footer { background: var(--chrome-bg); color: #C9C4B2; margin-top: 20px; }
footer .wrap { padding: 40px 20px 30px; display: flex; flex-direction: column; gap: 18px; }
footer .brand-mark { color: #F2EEE3; font-size: 20px; }
.footer-info-links { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12.5px; color: #ACA795; padding-top: 4px; }
.footer-info-links a:hover { color: #F2EEE3; }
.footer-note { font-size: 12px; color: #8D8878; line-height: 1.7; border-top: 1px solid #2B3040; padding-top: 16px; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: transparent;
  color: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.theme-toggle:hover { border-color: rgba(255,255,255,.5); }

/* ---------- 정적 페이지(소개/방침/문의) + 기사 상세 ---------- */
/* main.wrap { display:grid; ... } (홈 화면용 2단 레이아웃)이 element+class 선택자라
   .static-page(class 1개)보다 우선순위가 높아 기사 페이지에도 그리드가 그대로 걸려
   본문이 존재하지 않는 우측 300px 칸과 함께 좁게 눌리는 문제가 있었다. main.wrap.static-page로
   더 구체적인 선택자를 줘서 기사·정적 페이지에서는 그리드를 확실히 해제한다. */
main.wrap.static-page { display: block; grid-template-columns: none; }
.static-page { max-width: 720px; padding: 44px 20px 70px; margin: 0 auto; }

/* 카테고리 '기사 더보기' 전용 목록 페이지 — 사이드바 없이 카드 그리드만 넓게 보여준다 */
main.wrap.category-page { display: block; grid-template-columns: none; }
.category-page { max-width: 1080px; padding: 32px 20px 70px; margin: 0 auto; }
.category-page .back-link { display: inline-block; margin-bottom: 18px; }
.category-page .section-head { margin-bottom: 22px; }
.static-page h1 { font-family: var(--serif); font-size: 30px; color: var(--ink); margin: 0 0 22px; }
.static-page h2 { font-family: var(--serif); font-size: 18px; color: var(--ink); margin: 32px 0 10px; }
.static-page p { font-size: 14.5px; color: var(--text); margin: 0 0 12px; }
.static-page ul { margin: 0 0 14px; padding-left: 20px; }
.static-page li { font-size: 14.5px; color: var(--text); margin-bottom: 6px; }
.back-link { display: inline-block; font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 18px; }
.back-link:hover { color: var(--accent); }
.article-page .thumb { margin-bottom: 22px; }
.article-page h1 { margin-bottom: 10px; }
.article-page .byline { margin-bottom: 26px; }
.article-page .ad-caption { margin-top: 26px; }

/* ---------- 카드뉴스형 본문 ---------- */
.article-page p.lede { font-size: 16.5px; line-height: 1.75; color: var(--text); margin: 0 0 26px; }
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin: 32px 0;
}
.section-card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 18.5px;
  color: var(--ink);
  margin: 0 0 12px;
  text-wrap: balance;
}
.card-num {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.section-card p { margin: 0; font-size: 15px; line-height: 1.7; color: var(--text); }

/* ---------- 포커스용 인용구(pull-quote) — 흐름을 끊고 핵심 문장에 시선을 모음 ---------- */
.pull-quote {
  position: relative;
  margin: 28px 4px 30px 26px;
  padding: 2px 0 2px 22px;
  border-left: 4px solid var(--accent);
}
.pull-quote p {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 21px;
  line-height: 1.5;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}
.pull-quote::before {
  content: "\201C";
  position: absolute;
  left: -2px; top: -30px;
  font-family: var(--serif);
  font-size: 64px;
  color: var(--accent);
  opacity: .3;
  line-height: 1;
}

.contact-box { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 26px; margin-top: 20px; }
.contact-email { display: inline-flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--accent); margin-top: 6px; }
.contact-email:hover { text-decoration: underline; }
