/* =====================================================
   darknet-regions.com — main.css
   Design: geographic travel-guide / expat resource
   Palette: dark slate + sky-blue accent
===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=IBM+Plex+Sans:ital,wght@0,400;0,500;1,400&display=swap');

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

:root {
  --bg:         #0d1117;
  --surface:    #161b22;
  --surface-2:  #1c2330;
  --border:     #30363d;
  --accent:     #38bdf8;
  --accent-dim: #0ea5e9;
  --accent-glow:#38bdf820;
  --text:       #e2e8f0;
  --text-muted: #8b949e;
  --text-dim:   #6e7681;
  --green:      #3fb950;
  --yellow:     #d29922;
  --red:        #f85149;
  --orange:     #e67e22;

  /* Risk level colors */
  --risk-1: #3fb950;
  --risk-2: #58a6ff;
  --risk-3: #d29922;
  --risk-4: #f85149;
  --risk-5: #ff0000;

  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);

  --font-head: 'Outfit', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --container: 1200px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* ── Typography ── */
h1,h2,h3,h4,h5,h6 { font-family: var(--font-head); font-weight: 600; line-height: 1.25; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin: 2.5rem 0 1rem; color: var(--text); }
h3 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
h4 { font-size: 1rem; font-weight: 600; margin-bottom: .4rem; }
p  { margin-bottom: 1rem; color: var(--text-muted); }
a  { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: #fff; }
ul, ol { padding-left: 1.4rem; margin-bottom: 1rem; }
ul li, ol li { margin-bottom: .3rem; color: var(--text-muted); }
strong { color: var(--text); font-weight: 600; }

/* ── Layout ── */
.container { max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
.section    { padding: 4rem 0; }

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,17,23,.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 1.5rem;
  height: 64px;
}
.site-logo {
  display: flex; align-items: center; gap: .5rem;
  text-decoration: none; flex-shrink: 0;
}
.logo-icon { font-size: 1.4rem; }
.logo-text  {
  font-family: var(--font-head); font-size: 1.1rem;
  color: var(--text); letter-spacing: -.01em;
}
.logo-text strong { color: var(--accent); font-weight: 700; }

.site-nav { display: flex; gap: .25rem; margin-left: auto; }
.nav-link {
  padding: .45rem .85rem; border-radius: var(--radius);
  color: var(--text-muted); font-family: var(--font-head);
  font-size: .9rem; font-weight: 500; transition: all .15s;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--accent); }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: .5rem; margin-left: auto;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text-muted); border-radius: 2px; transition: all .2s;
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex; align-items: center; gap: .4rem;
  padding: 1rem 0 0; font-size: .85rem;
}
.bc-item { color: var(--text-muted); }
.bc-item:hover { color: var(--accent); }
.bc-current { color: var(--text-dim); }
.bc-sep { color: var(--text-dim); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .65rem 1.4rem; border-radius: var(--radius);
  font-family: var(--font-head); font-size: .9rem; font-weight: 500;
  transition: all .15s; cursor: pointer; border: none;
  text-decoration: none; white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: #000;
}
.btn-primary:hover { background: #7dd3fc; color: #000; }
.btn-outline {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

/* ── Risk badges ── */
.risk-badge {
  display: inline-block; padding: .2rem .65rem;
  border-radius: 99px; font-size: .78rem; font-weight: 600;
  font-family: var(--font-head); letter-spacing: .03em;
  text-transform: uppercase; white-space: nowrap;
}
.risk-low       { background: rgba(63,185,80,.15); color: var(--green); border: 1px solid rgba(63,185,80,.3); }
.risk-medium    { background: rgba(210,153,34,.15); color: var(--yellow); border: 1px solid rgba(210,153,34,.3); }
.risk-high      { background: rgba(248,81,73,.15); color: var(--red); border: 1px solid rgba(248,81,73,.3); }
.risk-very-high { background: rgba(255,0,0,.15); color: #ff4444; border: 1px solid rgba(255,0,0,.3); }

/* ── Hero ── */
.hero {
  padding: 5rem 0 4rem;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(56,189,248,.08) 0%, transparent 70%);
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 680px; }
.hero-badge {
  display: inline-block; padding: .25rem .8rem; margin-bottom: 1.2rem;
  border-radius: 99px; font-size: .8rem; font-weight: 600;
  font-family: var(--font-head); letter-spacing: .05em; text-transform: uppercase;
  background: var(--accent-glow); color: var(--accent);
  border: 1px solid rgba(56,189,248,.25);
}
.hero-title { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.1; margin-bottom: 1.2rem; }
.hero-title .accent { color: var(--accent); }
.hero-sub { font-size: 1.1rem; color: var(--text-muted); max-width: 580px; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── Page Hero (inner pages) ── */
.page-hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(56,189,248,.06) 0%, transparent 70%);
}
.page-hero-inner { display: flex; align-items: flex-start; gap: 1.5rem; }
.page-icon { font-size: 3rem; line-height: 1; flex-shrink: 0; }
.page-lead { font-size: 1.05rem; color: var(--text-muted); max-width: 640px; margin-top: .5rem; }

/* ── Filter bar ── */
.filter-bar {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: 2rem; flex-wrap: wrap;
}
.filter-label { font-size: .85rem; color: var(--text-dim); font-family: var(--font-head); }
.filter-btn {
  padding: .3rem .8rem; border-radius: 99px;
  font-family: var(--font-head); font-size: .82rem; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #000; }

/* ── Region Grid ── */
.section-header { margin-bottom: 2rem; }
.section-header h2 { margin-top: 0; }
.section-sub { color: var(--text-muted); max-width: 560px; }

.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.2rem;
}

.region-card {
  display: flex; gap: 1rem; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.4rem;
  transition: all .2s; text-decoration: none;
  position: relative;
}
.region-card:hover {
  border-color: var(--accent); background: var(--surface-2);
  transform: translateY(-2px); box-shadow: var(--shadow);
}
.region-card.hidden { display: none; }
.card-flag { font-size: 2.2rem; line-height: 1; flex-shrink: 0; margin-top: .1rem; }
.card-body { flex: 1; min-width: 0; }
.card-name { font-size: 1.1rem; color: var(--text); margin-bottom: .4rem; margin-top: 0; }
.card-summary { font-size: .85rem; color: var(--text-muted); margin: .6rem 0 .8rem; line-height: 1.5; }
.card-markets { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.markets-label { font-size: .78rem; color: var(--text-dim); font-family: var(--font-head); }
.market-tag {
  display: inline-block; padding: .15rem .55rem;
  background: rgba(56,189,248,.1); border: 1px solid rgba(56,189,248,.2);
  border-radius: 99px; font-size: .75rem; color: var(--accent);
  font-family: var(--font-head);
}
.card-arrow {
  color: var(--text-dim); font-size: 1.1rem; transition: all .2s;
  align-self: center;
}
.region-card:hover .card-arrow { color: var(--accent); transform: translateX(4px); }

/* ── Highlight section ── */
.highlight-section { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.highlight-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem;
}
.highlight-card {
  padding: 1.8rem; background: var(--bg);
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  transition: border-color .2s;
}
.highlight-card:hover { border-color: var(--border); }
.highlight-icon { font-size: 2rem; margin-bottom: .8rem; }
.highlight-card h3 { font-size: 1.1rem; color: var(--text); margin: 0 0 .5rem; }
.highlight-card p { font-size: .9rem; margin-bottom: 1rem; }
.link-arrow { color: var(--accent); font-size: .9rem; font-family: var(--font-head); font-weight: 500; }
.link-arrow:hover { color: #fff; }

/* ── Risk overview table section ── */
.risk-overview-section { padding-top: 3rem; }
.risk-table-wrap { overflow-x: auto; margin: 1.5rem 0; }
.risk-table {
  width: 100%; border-collapse: collapse;
  font-size: .9rem;
}
.risk-table th {
  padding: .75rem 1rem; text-align: left;
  background: var(--surface-2); color: var(--text-muted);
  font-family: var(--font-head); font-weight: 500; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.risk-table td {
  padding: .75rem 1rem; border-bottom: 1px solid var(--border);
  color: var(--text-muted); vertical-align: middle;
}
.risk-table tr:hover td { background: var(--surface); }
.risk-table td a { color: var(--text); }
.risk-table td a:hover { color: var(--accent); }
.table-cta { margin-top: 1.5rem; }

/* ── Region detail layout ── */
.region-hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(56,189,248,.06) 0%, transparent 70%);
}
.region-hero-inner { display: flex; gap: 2rem; align-items: flex-start; }
.region-flag-lg { font-size: 4.5rem; line-height: 1; flex-shrink: 0; }
.region-hero-text h1 { margin-bottom: .75rem; }
.region-lead { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 1.2rem; }
.region-meta-row { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.meta-item { display: flex; flex-direction: column; gap: .2rem; }
.meta-label { font-size: .75rem; color: var(--text-dim); font-family: var(--font-head); text-transform: uppercase; letter-spacing: .05em; }
.meta-value { font-size: .9rem; color: var(--text); }

.region-layout {
  display: grid; grid-template-columns: 260px 1fr;
  gap: 2.5rem; padding-top: 2.5rem; padding-bottom: 3rem;
  align-items: start;
}
.content-layout {
  display: grid; grid-template-columns: 260px 1fr;
  gap: 2.5rem; padding-top: 2.5rem; padding-bottom: 3rem;
  align-items: start;
}

/* ── Sidebar ── */
.region-sidebar { display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 80px; }
.sidebar-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.2rem;
}
.sidebar-card h3 { font-size: .9rem; color: var(--text-muted); margin: 0 0 .8rem; font-family: var(--font-head); text-transform: uppercase; letter-spacing: .05em; }
.fact-list { display: flex; flex-direction: column; gap: 0; }
.fact-list dt { font-size: .78rem; color: var(--text-dim); font-family: var(--font-head); text-transform: uppercase; letter-spacing: .04em; margin-top: .6rem; }
.fact-list dd { font-size: .88rem; color: var(--text); padding-left: 0; margin: .2rem 0 0; }
.fact-list dd .market-tag { margin: .1rem .1rem 0 0; }
.region-nav-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .2rem; }
.region-nav-list li a { display: block; padding: .4rem .5rem; border-radius: var(--radius); font-size: .88rem; color: var(--text-muted); transition: all .15s; }
.region-nav-list li a:hover { background: var(--surface-2); color: var(--accent); }

/* ── Risk meter ── */
.risk-meter { height: 6px; background: var(--surface-2); border-radius: 3px; margin: .3rem 0 .2rem; overflow: hidden; }
.risk-meter-bar { height: 100%; border-radius: 3px; transition: width .4s; }

/* ── Article body ── */
.region-body {
  min-width: 0;
}
.region-body h2 { color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: .5rem; }
.region-body ul li, .region-body ol li { color: var(--text-muted); margin-bottom: .4rem; }
.wide-article { padding: 2rem 0 3rem; }
.narrow-article { max-width: 720px; }

/* ── Guide TOC ── */
.guide-toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.4rem 1.6rem;
  margin-bottom: 2rem; display: inline-block; min-width: 280px;
}
.guide-toc h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin: 0 0 .8rem; }
.guide-toc ol { margin: 0; padding-left: 1.2rem; }
.guide-toc ol li { margin-bottom: .3rem; }
.guide-toc ol li a { color: var(--text-muted); font-size: .9rem; }
.guide-toc ol li a:hover { color: var(--accent); }

/* ── Info grid ── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin: 1.5rem 0; }
.info-card { padding: 1.4rem; border-radius: var(--radius-lg); border: 1px solid; }
.info-card h4 { margin-bottom: .7rem; }
.info-card ul li { font-size: .88rem; }
.info-green { background: rgba(63,185,80,.07); border-color: rgba(63,185,80,.25); }
.info-green h4 { color: var(--green); }
.info-red { background: rgba(248,81,73,.07); border-color: rgba(248,81,73,.25); }
.info-red h4 { color: var(--red); }

/* ── Risk ranking list ── */
.risk-ranking-list { display: flex; flex-direction: column; gap: 1.2rem; margin: 1.5rem 0 2.5rem; }
.risk-rank-item {
  display: flex; gap: 1.2rem; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.4rem; transition: border-color .2s;
}
.risk-rank-item:hover { border-color: var(--border); }
.rank-flag { font-size: 2.5rem; line-height: 1; flex-shrink: 0; }
.rank-body { flex: 1; min-width: 0; }
.rank-header { display: flex; align-items: center; gap: 1rem; margin-bottom: .5rem; flex-wrap: wrap; }
.rank-header h3 { font-size: 1.1rem; margin: 0; }
.rank-header h3 a { color: var(--text); }
.rank-header h3 a:hover { color: var(--accent); }
.risk-bar-wrap { display: flex; align-items: center; gap: .8rem; margin-bottom: .7rem; }
.risk-bar-track { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; max-width: 200px; }
.risk-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s; }
.risk-score-label { font-size: .8rem; color: var(--text-dim); font-family: var(--font-head); white-space: nowrap; }
.rank-summary { font-size: .9rem; margin-bottom: .5rem; }
.rank-meta { font-size: .82rem; color: var(--text-dim); }
.rank-meta strong { color: var(--text-muted); }

/* ── Factor grid ── */
.factor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; margin: 1.5rem 0; }
.factor-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.4rem;
}
.factor-card h4 { color: var(--accent); margin-bottom: .5rem; }
.factor-card p { font-size: .88rem; margin: 0; }

/* ── Table full ── */
.table-wrap { overflow-x: auto; }
.risk-table-full td { font-size: .85rem; }

/* ── Region bottom nav ── */
.region-bottom { padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--border); }
.next-prev-nav { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── Error page ── */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.error-inner { text-align: center; }
.error-code { font-size: 8rem; font-family: var(--font-head); font-weight: 700; color: var(--border); line-height: 1; margin-bottom: 1rem; }
.error-inner h1 { margin-bottom: 1rem; }
.error-inner p { color: var(--text-muted); max-width: 400px; margin: 0 auto 2rem; }
.error-links { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── Footer ── */
.site-footer { border-top: 1px solid var(--border); margin-top: auto; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2.5rem; padding: 3rem 0 2rem; }
.footer-brand { font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: .6rem; }
.footer-desc { font-size: .85rem; color: var(--text-dim); line-height: 1.6; }
.footer-col h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-bottom: .8rem; }
.footer-col ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.footer-col ul li a { font-size: .88rem; color: var(--text-muted); }
.footer-col ul li a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding: 1rem 0; }
.footer-bottom span { font-size: .8rem; color: var(--text-dim); }

/* ── Markdown body styling (for region body text) ── */
.region-body h2 { margin-top: 2rem; }
.region-body p { color: var(--text-muted); }
.region-body li { color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .region-layout, .content-layout { grid-template-columns: 1fr; }
  .region-sidebar { position: static; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .site-nav { display: none; flex-direction: column; gap: .2rem; position: absolute; top: 64px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: .8rem 1rem; }
  .site-nav.open { display: flex; }
  .nav-toggle { display: flex; }
  .header-inner { position: relative; }
  .region-hero-inner { flex-direction: column; gap: 1rem; }
  .region-flag-lg { font-size: 3rem; }
  .page-hero-inner { flex-direction: column; }
  .hero-title { font-size: 2rem; }
  .region-grid { grid-template-columns: 1fr; }
  .highlight-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .factor-grid { grid-template-columns: 1fr; }
  .risk-table { font-size: .8rem; }
  .risk-table th, .risk-table td { padding: .5rem .7rem; }
}
