/* ═══════════════════════════════════════════
   Region Deep Dive — Styles
   ═══════════════════════════════════════════ */

/* ── Container ── */
.rd-container {
  display: flex;
  min-height: calc(100vh - var(--header-height, 64px));
  background: var(--cream, #F5F1E8);
  position: relative;
}

/* ── Sidebar ── */
.rd-sidebar {
  width: 30%;
  min-width: 280px;
  max-width: 380px;
  background: var(--cream-mid, #EDE8DC);
  border-right: 1px solid var(--border, rgba(114,47,55,0.18));
  overflow-y: auto;
  padding: 2rem 0 3rem;
  transition: width 0.4s ease, min-width 0.4s ease, opacity 0.3s ease;
  flex-shrink: 0;
}
.rd-sidebar.rd-sidebar--collapsed {
  width: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  border-right: none;
}

.rd-sidebar-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink, #1A1A1A);
  padding: 0 1.5rem 1.25rem;
  margin: 0;
  letter-spacing: 0.01em;
}

/* ── Continent group ── */
.rd-continent {
  margin-bottom: 0.25rem;
}
.rd-continent-label {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-xlight, #6B6B6B);
  padding: 1rem 1.5rem 0.4rem;
  margin: 0;
}

/* ── Country item ── */
.rd-country-item {
  display: flex;
  align-items: flex-start;
  padding: 0.65rem 1.5rem;
  cursor: pointer;
  transition: background 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.rd-country-item:hover {
  background: rgba(114,47,55,0.06);
}
.rd-country-item:active {
  background: rgba(114,47,55,0.10);
}

.rd-country-name {
  font-family: var(--font-subhead);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--ink, #1A1A1A);
  line-height: 1.3;
}
.rd-country-meta {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--ink-xlight, #6B6B6B);
  margin-top: 0.15rem;
  line-height: 1.4;
}

/* ── Content panel ── */
.rd-content {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 3rem 4rem;
  transition: opacity 0.35s ease;
  max-width: 780px;
}
.rd-content.rd-content--full {
  max-width: 900px;
  margin: 0 auto;
}

/* ── Breadcrumb ── */
.rd-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-subhead);
  font-size: 0.9rem;
  color: var(--ink-xlight, #6B6B6B);
}
.rd-breadcrumb-link {
  color: var(--maroon, #722F37);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}
.rd-breadcrumb-link:hover {
  color: var(--maroon-mid, #8B3A44);
  text-decoration: underline;
}
.rd-breadcrumb-sep {
  color: var(--ink-xlight, #6B6B6B);
  font-size: 0.8rem;
  user-select: none;
}
.rd-breadcrumb-current {
  color: var(--ink, #1A1A1A);
  font-weight: 500;
}

/* ── Level switcher pill ── */
.rd-level-switcher {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  display: flex;
  gap: 0;
  background: var(--cream-mid, #EDE8DC);
  border-radius: 20px;
  padding: 3px;
  border: 1px solid var(--border, rgba(114,47,55,0.18));
  z-index: 5;
}
.rd-level-btn {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border: none;
  background: none;
  color: var(--ink-xlight, #6B6B6B);
  cursor: pointer;
  border-radius: 16px;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: 28px;
}
.rd-level-btn:hover {
  color: var(--ink, #1A1A1A);
}
.rd-level-btn.active {
  background: var(--maroon, #722F37);
  color: #fff;
}

/* ── Hero line ── */
.rd-hero {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--ink, #1A1A1A);
  line-height: 1.35;
  margin: 0 0 0.5rem;
}
.rd-hero-sub {
  font-family: var(--font-subhead);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--ink-light, #4A4A4A);
  margin: 0 0 2rem;
  line-height: 1.5;
}

/* ── Section blocks ── */
.rd-section {
  margin-bottom: 2.25rem;
}
.rd-section-heading {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--maroon, #722F37);
  margin: 0 0 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border, rgba(114,47,55,0.18));
}
.rd-section p,
.rd-section-text {
  font-family: var(--font-subhead);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink-mid, #3D3D3D);
  margin: 0;
}

/* ── Grape tags ── */
.rd-grape-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.rd-grape-tag {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  background: rgba(114,47,55,0.08);
  color: var(--maroon, #722F37);
  border-radius: 14px;
}

/* ── Key regions list ── */
.rd-region-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}
.rd-region-link {
  display: block;
  padding: 0.55rem 0.8rem;
  font-family: var(--font-subhead);
  font-size: 1rem;
  color: var(--maroon, #722F37);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.rd-region-link:hover {
  background: rgba(114,47,55,0.06);
}
.rd-region-link-sub {
  font-family: var(--font-body);
  font-size: 0.68rem;
  color: var(--ink-xlight, #6B6B6B);
  margin-left: 0.5rem;
}

/* ── Producers list ── */
.rd-producer-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.rd-producer-tag {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 400;
  padding: 0.25rem 0.65rem;
  background: rgba(184,148,62,0.10);
  color: var(--gold-mid, #B8963E);
  border-radius: 14px;
}

/* ── Cross-link card ── */
.rd-crosslink {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, rgba(114,47,55,0.06) 0%, rgba(184,148,62,0.06) 100%);
  border: 1px solid var(--border, rgba(114,47,55,0.18));
  border-radius: 10px;
  margin-top: 2rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.rd-crosslink:hover {
  background: linear-gradient(135deg, rgba(114,47,55,0.10) 0%, rgba(184,148,62,0.10) 100%);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(26,26,26,0.06));
}
.rd-crosslink-text {
  font-family: var(--font-subhead);
  font-size: 1rem;
  color: var(--maroon, #722F37);
  font-weight: 500;
}
.rd-crosslink-sub {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--ink-xlight, #6B6B6B);
  margin-top: 0.2rem;
}

/* ── Country hero ── */
.rd-country-hero {
  margin-bottom: 2rem;
}
.rd-country-hero h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--ink, #1A1A1A);
  margin: 0 0 0.3rem;
}
.rd-country-stats {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--ink-xlight, #6B6B6B);
}

/* ── World default content ── */
.rd-world-intro {
  padding: 3rem 2rem;
  text-align: center;
}
.rd-world-intro h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ink, #1A1A1A);
  margin: 0 0 0.75rem;
}
.rd-world-intro p {
  font-family: var(--font-subhead);
  font-size: 1.05rem;
  color: var(--ink-light, #4A4A4A);
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Embedded world map ── */
.rd-map-embed {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 24px auto 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.rd-map-embed svg {
  width: 100%;
  height: auto;
  display: block;
}
.rd-map-legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  gap: 12px;
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.6);
}
.rd-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.rd-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.rd-map-tooltip {
  position: fixed;
  z-index: 10001;
  background: rgba(28,46,80,0.95);
  color: #FAF7F2;
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  max-width: 200px;
  line-height: 1.4;
}

/* ── Back button ── */
.rd-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--maroon, #722F37);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0;
  margin-bottom: 1rem;
  transition: color 0.2s;
}
.rd-back-btn:hover { color: var(--maroon-mid, #8B3A44); }
.rd-back-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ═══ Dark mode ═══ */
@media (prefers-color-scheme: dark) {
  .rd-container { background: #1C1917; }
  .rd-sidebar { background: #231F1C; border-right-color: rgba(232,224,212,0.10); }
  .rd-sidebar-title { color: #E8E0D4; }
  .rd-country-name { color: #E8E0D4; }
  .rd-country-meta { color: #9A8E80; }
  .rd-continent-label { color: #9A8E80; }
  .rd-hero { color: #E8E0D4; }
  .rd-hero-sub { color: #B5A99A; }
  .rd-section-heading { color: #D4A0A6; border-bottom-color: rgba(232,224,212,0.10); }
  .rd-section p, .rd-section-text { color: #C8BDB0; }
  .rd-breadcrumb { color: #9A8E80; }
  .rd-breadcrumb-link { color: #D4A0A6; }
  .rd-breadcrumb-current { color: #E8E0D4; }
  .rd-grape-tag { background: rgba(212,160,166,0.12); color: #D4A0A6; }
  .rd-producer-tag { background: rgba(201,169,97,0.12); color: #D4B872; }
  .rd-region-link { color: #D4A0A6; }
  .rd-region-link:hover { background: rgba(232,224,212,0.06); }
  .rd-country-item:hover { background: rgba(232,224,212,0.06); }
  .rd-crosslink { background: linear-gradient(135deg, rgba(212,160,166,0.06) 0%, rgba(201,169,97,0.06) 100%); border-color: rgba(232,224,212,0.10); }
  .rd-crosslink:hover { background: linear-gradient(135deg, rgba(212,160,166,0.10) 0%, rgba(201,169,97,0.10) 100%); }
  .rd-crosslink-text { color: #D4A0A6; }
  .rd-level-switcher { background: #2A2521; border-color: rgba(232,224,212,0.12); }
  .rd-level-btn { color: #9A8E80; }
  .rd-level-btn:hover { color: #E8E0D4; }
  .rd-level-btn.active { background: var(--maroon, #722F37); color: #fff; }
  .rd-country-hero h1 { color: #E8E0D4; }
  .rd-country-stats { color: #9A8E80; }
  .rd-world-intro h2 { color: #E8E0D4; }
  .rd-world-intro p { color: #B5A99A; }
  .rd-back-btn { color: #D4A0A6; }
}
[data-theme="dark"] .rd-container { background: #1C1917; }
[data-theme="dark"] .rd-sidebar { background: #231F1C; border-right-color: rgba(232,224,212,0.10); }
[data-theme="dark"] .rd-sidebar-title { color: #E8E0D4; }
[data-theme="dark"] .rd-country-name { color: #E8E0D4; }
[data-theme="dark"] .rd-country-meta { color: #9A8E80; }
[data-theme="dark"] .rd-continent-label { color: #9A8E80; }
[data-theme="dark"] .rd-hero { color: #E8E0D4; }
[data-theme="dark"] .rd-hero-sub { color: #B5A99A; }
[data-theme="dark"] .rd-section-heading { color: #D4A0A6; border-bottom-color: rgba(232,224,212,0.10); }
[data-theme="dark"] .rd-section p,
[data-theme="dark"] .rd-section-text { color: #C8BDB0; }
[data-theme="dark"] .rd-breadcrumb { color: #9A8E80; }
[data-theme="dark"] .rd-breadcrumb-link { color: #D4A0A6; }
[data-theme="dark"] .rd-breadcrumb-current { color: #E8E0D4; }
[data-theme="dark"] .rd-grape-tag { background: rgba(212,160,166,0.12); color: #D4A0A6; }
[data-theme="dark"] .rd-producer-tag { background: rgba(201,169,97,0.12); color: #D4B872; }
[data-theme="dark"] .rd-region-link { color: #D4A0A6; }
[data-theme="dark"] .rd-region-link:hover { background: rgba(232,224,212,0.06); }
[data-theme="dark"] .rd-country-item:hover { background: rgba(232,224,212,0.06); }
[data-theme="dark"] .rd-crosslink { background: linear-gradient(135deg, rgba(212,160,166,0.06) 0%, rgba(201,169,97,0.06) 100%); border-color: rgba(232,224,212,0.10); }
[data-theme="dark"] .rd-crosslink-text { color: #D4A0A6; }
[data-theme="dark"] .rd-level-switcher { background: #2A2521; border-color: rgba(232,224,212,0.12); }
[data-theme="dark"] .rd-level-btn { color: #9A8E80; }
[data-theme="dark"] .rd-level-btn.active { background: var(--maroon, #722F37); color: #fff; }
[data-theme="dark"] .rd-country-hero h1 { color: #E8E0D4; }
[data-theme="dark"] .rd-country-stats { color: #9A8E80; }
[data-theme="dark"] .rd-world-intro h2 { color: #E8E0D4; }
[data-theme="dark"] .rd-world-intro p { color: #B5A99A; }
[data-theme="dark"] .rd-back-btn { color: #D4A0A6; }

/* ═══ Mobile: stacked layout ═══ */
@media (max-width: 768px) {
  .rd-container {
    flex-direction: column;
  }
  .rd-sidebar {
    width: 100%;
    max-width: none;
    min-width: 0;
    max-height: 45vh;
    border-right: none;
    border-bottom: 1px solid var(--border, rgba(114,47,55,0.18));
    padding: 1.25rem 0 1.5rem;
  }
  .rd-sidebar.rd-sidebar--collapsed {
    max-height: 0;
    padding: 0;
    border-bottom: none;
  }
  .rd-sidebar-title {
    font-size: 1.25rem;
    padding: 0 1rem 0.75rem;
  }
  .rd-continent-label {
    padding: 0.75rem 1rem 0.3rem;
  }
  .rd-country-item {
    padding: 0.55rem 1rem;
  }
  .rd-content {
    padding: 1.5rem 1rem 3rem;
    max-width: 100%;
  }
  .rd-hero {
    font-size: 1.45rem;
  }
  .rd-country-hero h1 {
    font-size: 1.6rem;
  }
  .rd-level-switcher {
    position: relative;
    top: auto;
    right: auto;
    margin-bottom: 1.25rem;
    justify-content: center;
    flex-wrap: wrap;
  }
  .rd-level-btn {
    font-size: 0.58rem;
    padding: 0.25rem 0.5rem;
  }
}
