/* ============================================================
   뉴스 대시보드 허브 — Editorial Research Dashboard
   RE_property_tracker의 종이형 리서치 UI 톤을 뉴스 허브에 맞게 적용
   ============================================================ */

:root {
  --paper: #F8F8F6;
  --paper-2: #F1F1ED;
  --surface: #FFFFFF;
  --surface-alt: #FAFAF8;

  --ink: #1F2937;
  --ink-2: #374151;
  --ink-3: #6B7280;
  --mute: #9CA3AF;

  --rule: #E5E7EB;
  --rule-strong: #D1D5DB;

  --brand: #1F4E79;
  --brand-deep: #163B5C;
  --brand-soft: #D6E4F0;
  --domain-bg: var(--paper);

  --moss: #047857;
  --moss-soft: #D1FAE5;
  --amber: #B45309;
  --amber-soft: #FEF3C7;
  --rust: #C0392B;
  --rust-soft: #F4D7D2;

  --font-sans: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shadow-1: 0 1px 0 rgba(31, 41, 55, 0.04);
  --shadow-2: 0 4px 14px rgba(31, 41, 55, 0.06);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
}

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

html, body {
  min-height: 100%;
  background: var(--domain-bg);
  color: var(--ink);
}

body {
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "ss02", "tnum";
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

.domain-hub {
  --domain-bg: #F8F8F6;
  --brand: #1F4E79;
  --brand-deep: #163B5C;
  --brand-soft: #D6E4F0;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
a:hover {
  color: var(--brand-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

code,
.stat-value,
.domain-metrics strong,
.li-date,
.briefing-tag,
.eyebrow {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ─── Navbar ─────────────────────────────────────────────── */

.navbar {
  background: #1F2937;
  color: #E5E7EB;
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  border-bottom: 1px solid #111827;
  overflow-x: auto;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  font-weight: 700;
  font-size: 0.96rem;
  letter-spacing: -0.01em;
  flex: 0 0 auto;
}
.nav-brand:hover { color: #fff; text-decoration: none; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.brand-name { white-space: nowrap; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex: 0 0 auto;
}

.domain-switcher {
  padding-right: 1.4rem;
  border-right: 1px solid #374151;
}

.nav-links a {
  color: #9CA3AF;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  white-space: nowrap;
}
.nav-links a:hover {
  color: #fff;
  text-decoration: none;
  border-bottom-color: var(--item-color, var(--brand));
}
.nav-links a.active {
  color: #fff;
  border-bottom-color: var(--item-color, var(--brand));
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--item-color, var(--brand));
  opacity: 0.45;
}
.nav-links a.active .nav-dot { opacity: 1; }

.section-nav {
  gap: 1rem;
  margin-left: -0.3rem;
}

.nav-context {
  margin-left: auto;
  border: 1px solid #374151;
  border-radius: 999px;
  padding: 0.32rem 0.8rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.03);
}
.context-label {
  color: #9CA3AF;
  font-size: 0.7rem;
}
.nav-context strong {
  color: #fff;
  font-size: 0.8rem;
}

/* ─── Layout & headings ─────────────────────────────────── */

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 2.4rem 2rem 4rem;
}

.page-head {
  margin-bottom: 1.8rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--rule);
}

.eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.55rem;
}
.eyebrow.mini {
  font-size: 0.62rem;
  margin-bottom: 0.25rem;
}

h1 {
  font-size: 1.95rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.22;
}

h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.page-sub {
  color: var(--ink-3);
  font-size: 0.92rem;
  margin-top: 0.45rem;
}

/* ─── Home domain cards ─────────────────────────────────── */

.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.domain-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.35rem 1.45rem;
  color: var(--ink);
  display: block;
  min-height: 245px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.domain-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--brand);
}
.domain-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--domain-bg), transparent 46%);
  opacity: 0.58;
  pointer-events: none;
}
.domain-card > * {
  position: relative;
  z-index: 1;
}
.domain-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--ink);
}

.domain-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.domain-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
}
.domain-kicker {
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.domain-card h2 {
  font-size: 1.24rem;
  margin-bottom: 0.42rem;
}
.domain-card p {
  color: var(--ink-3);
  font-size: 0.9rem;
  min-height: 2.9rem;
}

.domain-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin-top: 1.3rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.domain-metrics div {
  padding: 0.75rem 0.85rem;
  border-right: 1px solid var(--rule);
}
.domain-metrics div:last-child { border-right: none; }
.domain-metrics .wide {
  grid-column: 1 / -1;
  border-right: none;
}
.domain-metrics span {
  display: block;
  color: var(--ink-3);
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
}
.domain-metrics strong {
  color: var(--ink);
  font-size: 0.88rem;
}
.card-action {
  margin-top: 1rem;
  color: var(--brand);
  font-size: 0.84rem;
  font-weight: 700;
}

/* ─── Stats & quick links ───────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  margin-bottom: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat-card {
  padding: 1.15rem 1.25rem;
  border-right: 1px solid var(--rule);
  color: var(--ink);
  position: relative;
  background: var(--surface);
}
.stat-card:last-child { border-right: none; }
.stat-card.clickable:hover {
  background: var(--surface-alt);
  text-decoration: none;
  color: var(--ink);
}
.highlight-accent::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--brand);
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.highlight-accent .stat-value { color: var(--brand); }
.stat-label {
  color: var(--ink-2);
  font-size: 0.79rem;
  font-weight: 700;
  margin-top: 0.35rem;
}
.stat-sub {
  color: var(--ink-3);
  font-size: 0.76rem;
  margin-top: 0.16rem;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.75rem;
  margin: 1.2rem 0 2rem;
}
.quick-link {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  box-shadow: var(--shadow-1);
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.quick-link:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
  color: var(--ink);
  text-decoration: none;
}
.ql-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 700;
}
.ql-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.ql-text strong {
  font-size: 0.9rem;
  color: var(--ink);
}
.ql-text em {
  color: var(--ink-3);
  font-size: 0.78rem;
  font-style: normal;
}

/* ─── Briefing / markdown ───────────────────────────────── */

.briefing-card,
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.briefing-header {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.briefing-header h2 {
  margin: 0;
  display: block;
}
.briefing-tag {
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--brand-soft);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.briefing-body {
  padding: 1.6rem 1.75rem;
}

.markdown-body {
  color: var(--ink-2);
  line-height: 1.82;
  font-size: 0.96rem;
}
.markdown-body h1 {
  font-size: 1.5rem;
  margin: 0.4rem 0 1.25rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--rule);
}
.markdown-body h2 {
  font-size: 1.08rem;
  margin: 2rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.markdown-body h2::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 0.95rem;
  background: var(--brand);
  border-radius: 1px;
}
.markdown-body h3 {
  font-size: 1rem;
  color: var(--ink);
  margin: 1.3rem 0 0.5rem;
}
.markdown-body p { margin: 0.65rem 0; }
.markdown-body ul,
.markdown-body ol {
  padding-left: 1.45rem;
  margin: 0.6rem 0;
}
.markdown-body li { margin: 0.35rem 0; }
.markdown-body strong { color: var(--ink); font-weight: 700; }
.markdown-body a { font-weight: 600; }
.markdown-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}
.markdown-body blockquote {
  border-left: 3px solid var(--brand);
  padding: 0.6rem 0.9rem;
  margin: 1rem 0;
  background: var(--surface-alt);
  color: var(--ink-2);
}
.markdown-body code {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 0.08rem 0.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
}
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.markdown-body th {
  background: var(--paper-2);
  color: var(--ink-2);
  padding: 0.75rem 0.9rem;
  text-align: left;
  font-size: 0.78rem;
}
.markdown-body td {
  border-top: 1px solid var(--rule);
  padding: 0.75rem 0.9rem;
}

/* ─── Lists / policies ──────────────────────────────────── */

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.list-item:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
  color: var(--ink);
  text-decoration: none;
}
.li-date {
  width: 56px;
  flex: 0 0 56px;
  text-align: center;
  padding-right: 0.9rem;
  border-right: 1px solid var(--rule);
}
.li-date strong {
  display: block;
  color: var(--brand);
  font-size: 1.05rem;
  line-height: 1.2;
}
.li-date span {
  color: var(--ink-3);
  font-size: 0.68rem;
  text-transform: uppercase;
}
.li-content { flex: 1; min-width: 0; }
.li-title {
  font-weight: 700;
  color: var(--ink);
}
.li-meta {
  color: var(--ink-3);
  font-size: 0.78rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.15rem;
}
.li-arrow {
  color: var(--brand);
  font-weight: 700;
}

.policy-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.policy-card {
  padding: 1.15rem 1.25rem;
}
.policy-card:hover {
  border-color: var(--brand);
}
.card-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}
.card-title {
  margin: 0 0 0.45rem;
  display: block;
  font-size: 1rem;
}
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--brand); }
.policy-card p {
  color: var(--ink-2);
  font-size: 0.9rem;
  margin-bottom: 0.55rem;
}
.card-meta {
  color: var(--ink-3);
  font-size: 0.78rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.58rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid;
}
.tag-policy {
  color: var(--brand);
  border-color: var(--brand-soft);
  background: var(--brand-soft);
}
.tag-region {
  color: var(--moss);
  border-color: var(--moss-soft);
  background: var(--moss-soft);
}

/* ─── Empty / back ───────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 3.3rem 2rem;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
}
.empty-state h3 {
  color: var(--ink);
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}
.empty-state p {
  font-size: 0.92rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--ink-3);
  font-weight: 700;
  font-size: 0.84rem;
  margin-bottom: 1rem;
}
.back-link:hover { color: var(--brand); }

/* ─── Responsive ─────────────────────────────────────────── */

@media (max-width: 860px) {
  .navbar {
    gap: 1.1rem;
    padding: 0.75rem 1rem;
  }
  .section-nav {
    gap: 0.85rem;
  }
  .nav-context {
    display: none;
  }
  .container {
    padding: 1.6rem 1rem 3rem;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat-card:nth-child(2) {
    border-right: none;
  }
  .stat-card {
    border-bottom: 1px solid var(--rule);
  }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .navbar {
    align-items: flex-start;
  }
  .brand-name {
    display: none;
  }
  .domain-switcher {
    padding-right: 0.9rem;
  }
  .nav-links {
    gap: 0.8rem;
  }
  h1 {
    font-size: 1.55rem;
  }
  .domain-grid,
  .quick-links {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stat-card,
  .stat-card:nth-child(2) {
    border-right: none;
  }
  .briefing-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .briefing-body {
    padding: 1.1rem;
  }
  .list-item {
    align-items: flex-start;
  }
  .li-arrow {
    display: none;
  }
}
