/* 모두랭킹 — magazine-style design system (light/dark) */

:root {
  --maxw: 1080px;
  --brand: #1f3864;
  --brand-2: #315490;
  --accent: #e0503a;
  --gold: #c8a23c;
  --silver: #9aa4b2;
  --bronze: #b07a4a;

  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --surface: #ffffff;
  --border: #e6e8ec;
  --border-strong: #d3d7de;
  --text: #17203a;
  --text-soft: #55607a;
  --text-mute: #8a92a6;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --shadow-hover: 0 4px 10px rgba(16,24,40,.08), 0 18px 40px rgba(16,24,40,.12);
}

:root[data-theme="dark"] {
  --brand: #9db8e8;
  --brand-2: #7f9fd8;
  --accent: #ff7a63;
  --gold: #d9b452;
  --silver: #aab3c2;
  --bronze: #c98f5c;

  --bg: #0e1320;
  --bg-soft: #141b2c;
  --surface: #161d2e;
  --border: #26304a;
  --border-strong: #33405f;
  --text: #e9edf6;
  --text-soft: #aeb8cd;
  --text-mute: #7b869e;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  --shadow-hover: 0 6px 14px rgba(0,0,0,.4), 0 22px 50px rgba(0,0,0,.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #9db8e8; --brand-2: #7f9fd8; --accent: #ff7a63;
    --gold: #d9b452; --silver: #aab3c2; --bronze: #c98f5c;
    --bg: #0e1320; --bg-soft: #141b2c; --surface: #161d2e;
    --border: #26304a; --border-strong: #33405f;
    --text: #e9edf6; --text-soft: #aeb8cd; --text-mute: #7b869e;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    --shadow-hover: 0 6px 14px rgba(0,0,0,.4), 0 22px 50px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 24px;
}
.brand {
  display: flex; align-items: baseline; gap: 8px;
  font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand .dot { color: var(--accent); }
.brand .sub { font-size: .72rem; font-weight: 600; color: var(--text-mute); letter-spacing: 0; }

.nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; }
.nav a {
  color: var(--text-soft); text-decoration: none;
  padding: 7px 12px; border-radius: 8px;
  font-size: .9rem; font-weight: 600; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--bg-soft); color: var(--text); }
.nav a.active { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }

.theme-toggle {
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-soft); width: 38px; height: 38px; border-radius: 10px;
  cursor: pointer; font-size: 1.05rem; line-height: 1; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, transform .1s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--brand); }
.theme-toggle:active { transform: scale(.94); }

/* On phones the brand + nav + toggle can't fit one row, which pushed the toggle
   past the viewport and gave every page a horizontal scroll. Stack instead. */
@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .brand { font-size: 1.15rem; }
  .brand .sub { display: none; }
  .theme-toggle { margin-left: auto; }
  .nav { order: 3; width: 100%; margin-left: 0; justify-content: flex-start; }
  .nav a { padding: 6px 9px; font-size: .84rem; }
}

/* ---------- Generic layout ---------- */
main { min-height: 62vh; padding: 40px 0 72px; }

.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}

h1.page-title {
  font-size: clamp(1.7rem, 3.6vw, 2.5rem); line-height: 1.2; letter-spacing: -0.035em;
  margin: 0 0 12px; font-weight: 800;
}
.lead { font-size: 1.08rem; color: var(--text-soft); margin: 0 0 8px; max-width: 720px; }

.breadcrumb { font-size: .82rem; color: var(--text-mute); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-mute); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }

/* ---------- Source meta ---------- */
.source-bar {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  margin: 20px 0 8px; padding: 12px 16px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px;
  font-size: .84rem; color: var(--text-soft);
}
.source-bar .k { font-weight: 700; color: var(--text); }
.source-bar a { color: var(--brand); font-weight: 600; text-decoration: none; }
.source-bar a:hover { text-decoration: underline; }
.source-bar .sep { color: var(--border-strong); }

/* ---------- Rank list ---------- */
.rank-list { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-direction: column; gap: 10px; }
.rank-item {
  display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 16px;
  padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.rank-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.rank-item.top { border-color: color-mix(in srgb, var(--gold) 40%, var(--border)); }

.rank-badge {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums;
  background: var(--bg-soft); color: var(--text-soft); border: 1px solid var(--border);
}
.rank-item .rank-badge.r1 { background: linear-gradient(145deg, #f4d780, var(--gold)); color: #4a3a10; border: none; }
.rank-item .rank-badge.r2 { background: linear-gradient(145deg, #d7dde6, var(--silver)); color: #2b3444; border: none; }
.rank-item .rank-badge.r3 { background: linear-gradient(145deg, #d9a877, var(--bronze)); color: #402713; border: none; }

.rank-main { min-width: 0; }
.rank-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; margin: 0; }
.rank-name a { text-decoration: none; }
.rank-name a:hover { color: var(--brand); }
.rank-sub { margin: 3px 0 0; font-size: .88rem; color: var(--text-soft); }
.rank-value {
  text-align: right; font-weight: 800; font-size: 1.05rem; color: var(--brand);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rank-value small { display: block; font-size: .72rem; font-weight: 600; color: var(--text-mute); }

.closing { margin-top: 28px; color: var(--text-soft); }
.disclaimer { font-size: .8rem; color: var(--text-mute); margin-top: 18px; line-height: 1.6; }

/* ---------- Cards / grids ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 46px 0 18px; }
.section-head h2 { font-size: 1.3rem; letter-spacing: -0.03em; margin: 0; font-weight: 800; }
.section-head a.more { font-size: .85rem; font-weight: 700; color: var(--brand); text-decoration: none; white-space: nowrap; }

/* minmax(0,·) rather than 1fr: the ellipsised nowrap lines inside cards have a
   wide min-content size and would otherwise stretch the track past the viewport. */
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .card-grid, .card-grid.two { grid-template-columns: minmax(0, 1fr); } }

.card {
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px; text-decoration: none; color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.card .cat-icon { font-size: 1.6rem; line-height: 1; }
.card h3 { margin: 0; font-size: 1.12rem; letter-spacing: -0.02em; }
.card p { margin: 0; color: var(--text-soft); font-size: .92rem; }
.card .card-src { margin-top: auto; font-size: .78rem; color: var(--text-mute); font-weight: 600; }

/* featured (home hero rankings) */
.feature-card { position: relative; overflow: hidden; }
.feature-card .badge-live {
  position: absolute; top: 16px; right: 16px;
  font-size: .68rem; font-weight: 800; letter-spacing: .08em;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  padding: 3px 8px; border-radius: 999px;
}
.mini-rank { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 6px; }
.mini-rank li { display: flex; gap: 10px; align-items: center; font-size: .92rem; }
.mini-rank .n { font-weight: 800; color: var(--brand); width: 18px; font-variant-numeric: tabular-nums; }
.mini-rank .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-rank .v { margin-left: auto; color: var(--text-mute); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Hero ---------- */
.hero { padding: 34px 0 6px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.1; letter-spacing: -0.04em; margin: 0 0 14px; font-weight: 800; }
.hero h1 .hl { color: var(--brand); }
.hero .lead { font-size: 1.15rem; max-width: 640px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 32px 0 56px; color: var(--text-soft); font-size: .86rem; background: var(--bg-soft); }
.site-footer .foot-brand { font-weight: 800; font-size: 1.05rem; color: var(--text); }
.footer-links { margin-top: 8px; }
.footer-links a { color: var(--text-soft); text-decoration: none; margin-right: 14px; }
.footer-links a:hover { color: var(--brand); }
.footer-note { font-size: .78rem; color: var(--text-mute); margin-top: 12px; max-width: 720px; line-height: 1.6; }

/* ---------- Analysis (original commentary) ---------- */
.analysis {
  margin-top: 36px; padding: 24px 26px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 16px;
}
.analysis h2 { margin: 0 0 12px; font-size: 1.2rem; letter-spacing: -0.02em; }
.analysis p { margin: 0 0 12px; color: var(--text-soft); }
.analysis p:last-child { margin-bottom: 0; }

/* ---------- "1위 OOO" teaser (shared by every recommendation surface) ---------- */
.teaser {
  display: inline-flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  font-size: .84rem; color: var(--text-soft); font-weight: 600;
  min-width: 0; overflow: hidden;
}
.teaser b {
  color: var(--accent); font-weight: 800; font-size: .72rem;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 2px 7px; border-radius: 999px; flex: none;
}
.teaser i {
  font-style: normal; color: var(--text-mute); font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Related rankings (internal links) ---------- */
.related { margin-top: 40px; }
.related h2 { font-size: 1.15rem; letter-spacing: -0.02em; margin: 0 0 14px; }
.rel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .rel-grid { grid-template-columns: minmax(0, 1fr); } }
.rel-card {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.rel-card:hover { border-color: var(--brand); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.rel-cat {
  font-size: .68rem; font-weight: 800; letter-spacing: .08em;
  color: var(--brand); text-transform: uppercase;
}
.rel-hook { font-size: 1rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.35; }
.rel-card:hover .rel-hook { color: var(--brand); }
.rel-title {
  font-size: .82rem; color: var(--text-mute); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rel-card .teaser { margin-top: 2px; }

/* ---------- Next ranking banner (end-of-page continuation) ---------- */
.next-ranking {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  margin-top: 34px; padding: 26px 28px; border-radius: 18px;
  border: 1px solid var(--border-strong); background: var(--bg-soft);
  color: var(--text); text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.next-ranking:hover { border-color: var(--brand); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.next-label {
  font-size: .68rem; font-weight: 800; letter-spacing: .12em;
  color: var(--accent); text-transform: uppercase;
}
.next-hook {
  font-size: clamp(1.15rem, 2.4vw, 1.5rem); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.3;
}
.next-title { font-size: .86rem; color: var(--text-mute); font-weight: 600; }
.next-cta { margin-top: 4px; font-size: .9rem; font-weight: 800; color: var(--brand); }

/* ---------- Recent-updates cards (home) ---------- */
.badge-cat {
  align-self: flex-start; font-size: .68rem; font-weight: 800; letter-spacing: .08em;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent);
  padding: 3px 9px; border-radius: 999px;
}
.recent-card h3 { line-height: 1.35; }
.recent-card p {
  font-size: .84rem; color: var(--text-mute);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- Prose (about/privacy/contact) ---------- */
.prose { max-width: 720px; }
.prose h2 { font-size: 1.25rem; margin: 34px 0 10px; letter-spacing: -0.02em; }
.prose p, .prose li { color: var(--text-soft); }
.prose ul { padding-left: 20px; }
