/* ============================================================
   VIlegends.com — Stylesheet
   Four-theme system via CSS custom properties on data-theme
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }

/* --- Theme: Light (default) --- */
[data-theme="light"] {
  --bg: #FAF6F0;
  --bg-surface: #F0EBE3;
  --bg-card: #FFFFFF;
  --text-primary: #2C2416;
  --text-secondary: #6B5D4F;
  --text-muted: #786A5C;
  --accent: #8B6914;
  --accent-light: #D4A843;
  --accent-faint: rgba(184,134,11,0.08);
  --border: #E5DFD5;
  --link: #7A6B3A;
  --sidebar-bg: #2C2416;
  --sidebar-text: #D4CFC7;
  --sidebar-active: rgba(184,134,11,0.15);
  --font-weight-body: 400;
  --font-weight-heading: 700;
  --shadow: 0 1px 3px rgba(44,36,22,0.08);
  --shadow-hover: 0 2px 8px rgba(184,134,11,0.15);
  --card-border: #E5DFD5;
}

/* --- Theme: Dark --- */
[data-theme="dark"] {
  --bg: #1A1917;
  --bg-surface: #242220;
  --bg-card: #2E2C2A;
  --text-primary: #E0DED8;
  --text-secondary: #B8B4AC;
  --text-muted: #8A8580;
  --accent: #E8C547;
  --accent-light: #F0D060;
  --accent-faint: rgba(232,197,71,0.10);
  --border: rgba(255,255,255,0.10);
  --link: #E8C547;
  --sidebar-bg: #141311;
  --sidebar-text: #B8B4AC;
  --sidebar-active: rgba(232,197,71,0.15);
  --font-weight-body: 350;
  --font-weight-heading: 650;
  --shadow: none;
  --shadow-hover: none;
  --card-border: rgba(255,255,255,0.08);
}

/* --- Theme: VI Proud (vibrant) --- */
[data-theme="vibrant"] {
  --bg: #FFF8E7;
  --bg-surface: #FFEEBB;
  --bg-card: #FFFDF5;
  --text-primary: #2A1500;
  --text-secondary: #4A2E10;
  --text-muted: #7A5C3A;
  --accent: #E8930A;
  --accent-light: #FFB020;
  --accent-faint: rgba(232,147,10,0.18);
  --border: #F0C860;
  --link: #1A70C0;
  --sidebar-bg: #1A9B8A;
  --sidebar-text: #FFFFFF;
  --sidebar-active: rgba(255,255,255,0.25);
  --font-weight-body: 400;
  --font-weight-heading: 700;
  --shadow: 0 2px 8px rgba(212,133,10,0.15);
  --shadow-hover: 0 4px 16px rgba(212,133,10,0.25);
  --card-border: #F0C860;
}

/* --- Accessible overlay (stacks on any theme) --- */
[data-accessible="true"] {
  --base-font-size: 18px;
  --line-height: 1.6;
}

/* --- Madras colors (constant) --- */
:root {
  --madras-amber: #D4850A;
  --madras-turquoise: #1A9B8A;
  --madras-red: #C4382A;
  --madras-blue: #2458A8;
  --madras-pink: #D45C8A;
  --base-font-size: 16px;
  --line-height: 1.8;
  --banner-height: 41px;
}

/* --- App root --- */
#app {
  background: var(--bg);
  color: var(--text-secondary);
  min-height: 100vh;
  font-family: 'DM Sans', -apple-system, 'Helvetica Neue', sans-serif;
  font-size: var(--base-font-size);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height);
  transition: background 0.3s, color 0.3s;
}

/* --- Preview banner --- */
#preview-banner {
  background: var(--text-primary);
  color: var(--bg);
  text-align: center;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
  z-index: 100;
  line-height: 1.5;
}
#preview-banner strong { color: var(--accent-light); }

/* --- Madras sticky bar (VI Proud only) --- */
#madras-sticky {
  display: none;
  height: 5px;
  background: linear-gradient(to right,
    var(--madras-amber) 0%, var(--madras-amber) 20%,
    var(--madras-turquoise) 20%, var(--madras-turquoise) 40%,
    var(--madras-red) 40%, var(--madras-red) 60%,
    var(--madras-blue) 60%, var(--madras-blue) 80%,
    var(--madras-pink) 80%, var(--madras-pink) 100%
  );
  position: sticky;
  top: var(--banner-height);
  z-index: 99;
}
[data-theme="vibrant"] #madras-sticky { display: block; }

/* --- Layout --- */
#layout {
  display: flex;
}

/* --- Sidebar shared --- */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  padding: 28px 20px;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-logo-wrap { margin-bottom: 28px; }
.sidebar-logo {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--sidebar-text);
}
.sidebar-logo .logo-accent { color: var(--accent-light); }
.sidebar-byline {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.nav-item {
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 2px;
  cursor: pointer;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--sidebar-text);
  transition: background 0.15s;
  user-select: none;
}
.nav-item:hover { background: var(--sidebar-active); }
.nav-item.nav-active {
  background: var(--sidebar-active);
  color: var(--accent-light);
  font-weight: 600;
}
.sidebar-divider {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-section-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.theme-btn {
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 3px;
  cursor: pointer;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--sidebar-text);
  font-weight: 400;
  transition: background 0.15s;
  user-select: none;
}
.theme-btn:hover { background: var(--sidebar-active); }
.theme-btn.nav-active {
  background: var(--sidebar-active);
  color: var(--accent-light);
  font-weight: 600;
}
.accessible-btn {
  padding: 8px 12px;
  border-radius: 4px;
  margin-top: 8px;
  cursor: pointer;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--sidebar-text);
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
  user-select: none;
}
.accessible-btn:hover { background: var(--sidebar-active); }
.accessible-btn.nav-active {
  background: var(--sidebar-active);
  color: var(--accent-light);
  font-weight: 600;
}
.accessible-check {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 2px solid var(--sidebar-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}
.accessible-btn.nav-active .accessible-check { border-color: var(--accent-light); }

/* --- Desktop sidebar (sticky) --- */
#sidebar-desktop {
  position: sticky;
  top: 48px;
  max-height: calc(100vh - 48px);
  display: none; /* shown via media query */
}

/* --- Mobile sidebar (fixed overlay) --- */
#sidebar-mobile {
  position: fixed;
  top: 0;
  left: -300px;
  height: 100vh;
  z-index: 200;
  transition: left 0.3s ease;
  box-shadow: none;
  display: block;
}
#sidebar-mobile.sidebar-open {
  left: 0;
  box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}

/* --- Sidebar overlay backdrop --- */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}
#sidebar-overlay.overlay-visible { display: block; }

/* --- Hamburger button --- */
#hamburger-btn {
  position: fixed;
  top: 56px;
  left: 16px;
  z-index: 300;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--sidebar-bg);
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
}
.hamburger-bar {
  width: 18px;
  height: 2px;
  background: var(--sidebar-text);
  border-radius: 1px;
  display: block;
}

/* --- Media queries --- */
@media (min-width: 900px) {
  #sidebar-desktop { display: flex; flex-direction: column; }
  #sidebar-mobile { display: none !important; }
  #hamburger-btn { display: none !important; }
}
@media (max-width: 899px) {
  #sidebar-desktop { display: none !important; }
}

/* --- Main content --- */
#main-content {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 32px;
}
@media (max-width: 600px) {
  #main-content { padding: 0 20px; }
}

/* --- Site header --- */
.site-header {
  padding: 80px 0 56px;
  text-align: center;
}
.site-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 56px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  line-height: 1;
}
.site-title .title-accent { color: var(--accent); }
.site-subtitle {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.site-presented-by {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 22px;
}
.site-tagline {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 23px;
  font-weight: 300;
  font-style: italic;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 28px;
  line-height: 1.5;
}
.header-rule {
  width: 48px;
  height: 2px;
  background: var(--accent);
  opacity: 0.5;
  margin: 0 auto 28px;
}
.coming-soon {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* --- Stats bar --- */
#stats-bar {
  display: flex;
  justify-content: center;
  gap: 56px;
  padding: 36px 0 24px;
  flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-num {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 40px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.stat-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Sections --- */
.content-section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}
.section-num {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 14px;
}
.section-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 32px;
  font-weight: var(--font-weight-heading);
  color: var(--text-primary);
  margin-bottom: 20px;
  line-height: 1.25;
  margin-top: 0;
}
.body-p {
  font-size: 16px;
  line-height: var(--line-height);
  color: var(--text-secondary);
  margin-bottom: 16px;
  max-width: 720px;
}
.bo { color: var(--text-primary); font-weight: 600; }

/* --- Badges --- */
.badge {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 3px;
  margin-right: 6px;
  margin-bottom: 4px;
}
.badge-usvi-original   { color: #6B4E00; background: rgba(184,134,11,0.12); }
.badge-west-african    { color: #5A3F14; background: rgba(123,91,42,0.12); }
.badge-taino           { color: #6B4E00; background: rgba(139,105,20,0.12); }
.badge-danish          { color: #34506A; background: rgba(74,99,128,0.12); }
.badge-caribbean-creole{ color: #1A6B5E; background: rgba(46,139,122,0.12); }
.badge-east-indian     { color: #7A4A14; background: rgba(184,115,51,0.12); }
.badge-puerto-rican    { color: #6E3518; background: rgba(160,82,45,0.12); }
.badge-british         { color: #4A5A6A; background: rgba(107,123,141,0.12); }
.badge-french          { color: #6B3040; background: rgba(139,69,87,0.12); }

/* --- Chips --- */
.chip {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
  margin-right: 6px;
  margin-bottom: 6px;
}
.chip-cat {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

/* --- Content cards --- */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.card-category {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  margin-bottom: 14px;
}
.card-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2px;
}
.card-subtitle {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 16px;
  font-weight: 300;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.card-body { font-size: 15px; line-height: var(--line-height); color: var(--text-secondary); }
.card-body p { margin-bottom: 14px; }
.connected-header {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.connected-wrap {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* --- "Both" legend badge --- */
.both-badge {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  background: var(--accent-faint);
  padding: 5px 12px;
  border-radius: 3px;
  margin-bottom: 14px;
}

/* --- Structure category cards --- */
.structure-card {
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 22px 26px;
  margin-bottom: 14px;
}
.structure-card.foundation {
  background: var(--accent-faint);
  border-color: rgba(184,134,11,0.2);
}
[data-theme="dark"] .structure-card.foundation { border-color: rgba(232,197,71,0.2); }
[data-theme="vibrant"] .structure-card.foundation { border-color: rgba(232,147,10,0.2); }
.structure-num {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}
.structure-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.structure-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.structure-count { font-size: 13px; color: var(--text-muted); }
.structure-entries { font-size: 13px; color: var(--text-muted); margin-top: 6px; line-height: 1.6; }

/* --- Editorial principles --- */
.principle {
  margin-bottom: 32px;
  padding-left: 22px;
  border-left: 3px solid var(--accent-faint);
}
.principle-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.principle-body { font-size: 15px; line-height: 1.75; color: var(--text-secondary); margin: 0; }

/* --- Madras bar divider (inside content) --- */
.madras-bar-divider {
  height: 4px;
  border-radius: 2px;
  margin: 36px 0;
  background: linear-gradient(to right,
    var(--madras-amber) 0%, var(--madras-amber) 20%,
    var(--madras-turquoise) 20%, var(--madras-turquoise) 40%,
    var(--madras-red) 40%, var(--madras-red) 60%,
    var(--madras-blue) 60%, var(--madras-blue) 80%,
    var(--madras-pink) 80%, var(--madras-pink) 100%
  );
}

/* --- Demo content notice --- */
.demo-notice {
  background: var(--accent-faint);
  border: 1px solid rgba(184,134,11,0.13);
  border-radius: 6px;
  padding: 14px 22px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}
.demo-notice strong { color: var(--accent); }

/* --- Theme swatches (section 05 — hardcoded, not CSS vars) --- */
.theme-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.theme-swatch {
  border-radius: 6px;
  padding: 22px;
}
.swatch-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.6;
  margin-bottom: 8px;
}
.swatch-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 8px;
}
.swatch-body { font-size: 13px; line-height: 1.6; opacity: 0.8; }

/* --- Community tiers --- */
.tier {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.tier-num {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  width: 36px;
  text-align: center;
  line-height: 1;
  padding-top: 2px;
}
.tier-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.tier-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

/* --- Pullquote --- */
.pullquote {
  margin: 32px 0;
  padding: 22px 28px;
  border-left: 3px solid var(--accent);
  background: var(--accent-faint);
  border-radius: 0 6px 6px 0;
}
.pullquote-text {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 6px;
}
.pullquote-attr {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text-muted);
}

/* --- Ecosystem section --- */
.ecosystem-item {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}
.ecosystem-item:last-child { border-bottom: none; }
.ecosystem-role {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 4px;
}
.ecosystem-name {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.ecosystem-desc { font-size: 15px; color: var(--text-secondary); line-height: 1.7; }

/* --- Directory --- */
.dir-category { margin-bottom: 28px; }
.dir-header {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.dir-items {
  columns: 2;
  column-gap: 32px;
}
.dir-entry {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 3px 0;
  break-inside: avoid;
}
.dir-island { font-size: 11px; color: var(--text-muted); margin-left: 4px; }
@media (max-width: 480px) { .dir-items { columns: 1; } }

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 56px 0;
  text-align: center;
}
.footer-logo {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.footer-logo .logo-accent { color: var(--accent); }
.footer-byline {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.footer-body {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 540px;
  margin: 0 auto;
}
.footer-body p { margin-bottom: 14px; }
.footer-body strong { color: var(--text-primary); }
.footer-copy {
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0.6;
  margin-top: 24px;
}
