/*
Theme Name: Eurasia 2026
Theme URI: https://eurasiabaike.com
Description: 2026 design refresh for Eurasia Baike — a warm ivory-paper editorial system with an indigo-plum accent, Newsreader (serif headlines) + Libre Franklin (sans body), full mobile responsiveness and a dark mode. Child theme of "Eurasian Template" (eurasia-theme): inherits all custom post types, taxonomies, the interactive map, the timeline, the mosaic hub and the Polylang multilingual setup.
Author: Florin Cosma
Template: eurasia-theme
Version: 1.0.3
Requires PHP: 7.4
Text Domain: eurasia2026
*/

/* ==========================================================================
   Eurasia Baike — Design Refresh
   Drop-in stylesheet for the "Eurasian Template" (eurasia-theme).
   Warm-paper editorial system: Newsreader (serif headlines) + Libre Franklin
   (sans body). Loads AFTER the theme's style.css so these rules win.
   Restyle only — no markup or logic changes required.
   ========================================================================== */

/* ---- Fonts (fallback loader; prefer enqueuing via functions.php) --------- */
/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
  /* Warm paper / ink palette */
  --eb-paper:      #f1efe9;
  --eb-paper-2:    #f1efe9;
  --eb-ink:        #211b26;
  --eb-ink-soft:   #514b58;
  --eb-muted:      #857f74;
  --eb-line:       #dad5c9;
  --eb-line-soft:  #e8e4da;
  --eb-accent:     #4b3a86;   /* indigo-plum */
  --eb-accent-2:   #6a58a8;
  --eb-footer-bg:  #1c1726;
  --eb-scrim:      rgba(24,19,34,0.5);

  /* Type */
  --eb-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --eb-sans:  'Libre Franklin', system-ui, -apple-system, sans-serif;

  /* Map onto the theme's existing variables so inherited rules pick up the new look */
  --font-latin: var(--eb-serif);
  --font-cyrillic: var(--eb-serif);
  --font-ui: var(--eb-sans);
  --red: var(--eb-accent);

  --eb-radius: 10px;
  --eb-maxw: 1220px;
}

/* Dark mode — toggled by body.eb-dark (script) or system preference */
body.eb-dark {
  --eb-paper:      #17141c;
  --eb-paper-2:    #1f1a28;
  --eb-ink:        #efeaf1;
  --eb-ink-soft:   #c4bcc9;
  --eb-muted:      #8a8290;
  --eb-line:       #322b3d;
  --eb-line-soft:  #262030;
  --eb-accent:     #9b86d6;
  --eb-accent-2:   #9b86d6;
  --eb-footer-bg:  #100d16;
  --eb-scrim:      rgba(8,6,12,0.72);
}

/* ==========================================================================
   2. BASE
   ========================================================================== */
body {
  background: var(--eb-paper) !important;
  color: var(--eb-ink);
  font-family: var(--eb-sans);
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}
::selection { background: rgba(75,58,134,0.2); }

h1, h2, h3, h4, .site-title,
.featured-title, .list-card-title2,
.editorial-preview h4, .card-body h4 {
  font-family: var(--eb-serif);
  color: var(--eb-ink);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

a { color: var(--eb-accent); }

.container,
.frontpage-grid-container.container {
  max-width: var(--eb-maxw);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(16px, 4vw, 36px);
  padding-right: clamp(16px, 4vw, 36px);
}

/* ==========================================================================
   3. SITE HEADER  (#masthead .site-header)
   Layout mirrors the homepage design: a slim utility strip (search + dark
   toggle) above a centered branding block, with the primary nav (which
   contains the Polylang language item, pushed to the right) as its own row
   underneath. Achieved via flex `order` — no markup changes required.
   ========================================================================== */
.site-header {
  background: var(--eb-paper);
  border-bottom: 1px solid var(--eb-line);
  position: sticky;
  top: 0;
  z-index: 60;
  padding: 0;
}
.header-flex-container {
  display: flex;
  flex-direction: column;
  max-width: var(--eb-maxw);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 36px);
  width: 100%;
}
.site-header .header-flex-container > * {
  width: 100%;
  align-self: stretch;
}

/* ---- Utility strip: search + dark toggle, promoted above branding ------- */
.site-header .header-search {
  order: -1;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--eb-line-soft);
  width: 100%;
}
.search-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid var(--eb-line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--eb-paper-2);
  flex: 0 1 260px;
}
.search-field {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 6px 13px;
  font-family: var(--eb-sans);
  font-size: 0.82rem;
  color: var(--eb-ink);
  outline: none;
}
.search-submit {
  border: none;
  background: transparent;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--eb-ink-soft);
  font-size: 0.95rem;
  line-height: 1;
}
.search-submit:hover { color: var(--eb-accent); }

/* ---- Branding: centered logo + wordmark + tagline ------------------------ */
.site-header .site-branding {
  order: 0;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0 9px;
}
.header-logo { margin-bottom: 12px; }
.header-logo .custom-logo-link { display: inline-block; }
.header-logo .custom-logo {
  display: block;
  height: 52px;
  object-fit: cover;
}
.site-title, .site-title a {
  font-family: var(--eb-serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 5.5vw, 3.1rem);
  line-height: 1;
  color: var(--eb-ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  margin: 0;
}
.site-slogan { margin-top: 9px; max-width: 46ch; }
.site-description {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--eb-muted);
  line-height: 1.6;
}

/* ---- Primary nav — centered pill row with rule above/below --------------- */
.site-header .header-nav {
  order: 1;
  position: relative;
  display: flex !important;
  align-items: center;
  border-top: 2px solid var(--eb-ink);
  border-bottom: 1px solid var(--eb-line);
  padding: 4px 0;
  margin-top: 7px;
}
.header-nav .nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  flex-wrap: wrap;
  gap: clamp(12px, 2.6vw, 30px);
}
.header-nav .nav-menu > li > a {
  display: block;
  padding: 13px 0;
  font-family: var(--eb-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--eb-ink);
  text-decoration: none;
}
.header-nav .nav-menu > li > a:hover,
.header-nav .nav-menu > li.current-menu-item > a { color: var(--eb-accent); }

/* Polylang language switcher, if it renders as a menu item — pushed right */
.header-nav .nav-menu li.lang-item,
.header-nav .nav-menu li.menu-item-language {
  margin-left: auto;
  padding-left: 12px;
}
.header-nav .nav-menu img.flag,
.header-nav .nav-menu li.lang-item img { height: 13px; width: auto; vertical-align: middle; }

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--eb-line);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 1.1rem;
  color: var(--eb-ink);
  cursor: pointer;
}

/* ==========================================================================
   4. MAP HERO  (.map-hero)
   ========================================================================== */
.map-hero { padding: 24px 0 4px; }
.map-hero .container > * {
  border: 1px solid var(--eb-line);
  border-radius: 12px;
  overflow: hidden;
}

/* ==========================================================================
   5. ROW TOP FEATURE  (.row-top-feature)
   ========================================================================== */
.row-top-feature {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(22px, 3.5vw, 40px);
  padding: 24px 0 8px;
  align-items: start;
}

/* Editorial / Live News toggle */
.carousel-controls { display: flex; gap: 8px; margin-bottom: 16px; }
.toggle-btn.btn-badge-style {
  background: transparent;
  color: var(--eb-ink-soft);
  border: 1px solid var(--eb-line);
  border-radius: 5px;
  padding: 7px 15px;
  cursor: pointer;
  font-family: var(--eb-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.toggle-btn.btn-badge-style.active-btn,
.toggle-btn.btn-badge-style:hover {
  background: var(--eb-accent);
  color: #fff;
  border-color: var(--eb-accent);
}

#editorial-carousel-item {
  border: none !important;
  padding: 0 !important;
}
.editorial-preview h4 {
  font-weight: 600;
  font-size: clamp(1.7rem, 3.6vw, 2.9rem);
  line-height: 1.06;
  margin: 0 0 14px;
}
.editorial-preview h4 a { color: var(--eb-ink); text-decoration: none; }
.editorial-preview h4 a:hover { color: var(--eb-accent); }
.editorial-excerpt {
  font-family: var(--eb-serif);
  font-size: clamp(1.02rem, 1.5vw, 1.22rem);
  line-height: 1.55;
  color: var(--eb-ink-soft);
  margin-bottom: 16px;
  max-width: 62ch;
}
.read-more {
  font-family: var(--eb-sans);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--eb-accent);
  text-decoration: none;
}

/* Live-news list items */
.sources-list .list-card,
.two-column-six-rows .list-card {
  border-bottom: 1px solid var(--eb-line);
  padding: 16px 0;
}
.list-card-category {
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--eb-accent);
  font-weight: 700;
  margin-bottom: 6px;
}
.list-card-title2 {
  font-family: var(--eb-serif);
  font-size: 1.15rem;
  line-height: 1.28;
  margin: 0 0 6px;
}
.list-card-title2 a { color: var(--eb-ink); text-decoration: none; }
.list-card-title2 a:hover { color: var(--eb-accent); }
.list-card-date { font-size: 0.76rem; color: var(--eb-muted); }

.mosaic-loader { color: var(--eb-muted); padding: 30px 0; text-align: center; }
.spinner {
  width: 26px; height: 26px; margin: 0 auto 10px;
  border: 3px solid var(--eb-line);
  border-top-color: var(--eb-accent);
  border-radius: 50%;
  animation: eb-spin 0.8s linear infinite;
}
@keyframes eb-spin { to { transform: rotate(360deg); } }

/* Featured cards (.featured-expand-card) */
.featured-posts { display: flex; flex-direction: column; gap: 14px; }
.featured-expand-card {
  position: relative;
  min-height: 150px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--eb-line);
}
.featured-expand-card:first-child { min-height: 168px; }
.featured-link-wrapper { display: block; height: 100%; text-decoration: none; }
.featured-bg-image {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transition: transform .5s ease;
}
.featured-expand-card:hover .featured-bg-image { transform: scale(1.04); }
.featured-expand-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(18,14,10,0.9) 8%, rgba(18,14,10,0.15) 62%, rgba(18,14,10,0.35));
}
.featured-badge {
  position: absolute; top: 13px; left: 13px; z-index: 2;
  background: var(--eb-accent); color: #fff;
  font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 700; padding: 3px 9px; border-radius: 3px;
}
.featured-overlay {
  position: absolute; left: 0; bottom: 0; z-index: 2;
  padding: 16px 16px 15px;
}
.featured-title {
  font-weight: 600; font-size: 1.18rem; line-height: 1.16;
  margin: 0; color: #fff;
}
.featured-excerpt p {
  font-size: 0.8rem; line-height: 1.4;
  color: rgba(255,255,255,0.78); margin: 7px 0 0;
}

/* ==========================================================================
   6. MOSAIC HUB  (.mosaic-hub)
   ========================================================================== */
.mosaic-hub { padding: 38px 0 20px; margin-top: 20px; border-top: 1px solid var(--eb-line); }
.mosaic-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 1px solid var(--eb-line);
  margin-bottom: 22px;
}
.mosaic-tabs .tab {
  padding: 10px 4px; margin: 0 4px -1px 0;
  font-family: var(--eb-sans);
  font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 700; text-decoration: none;
  color: var(--eb-muted);
  border-bottom: 2px solid transparent;
}
.mosaic-tabs .tab:hover { color: var(--eb-ink-soft); }
.mosaic-tabs .tab.active {
  color: var(--eb-accent);
  border-bottom-color: var(--eb-accent);
}
.mosaic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: clamp(16px, 2vw, 24px);
}
.mosaic-grid .card {
  background: var(--eb-paper);
  border: 1px solid var(--eb-line);
  border-radius: var(--eb-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .2s ease, transform .2s ease;
}
.mosaic-grid .card:hover { border-color: var(--eb-accent); transform: translateY(-2px); }
.mosaic-grid .card-image { display: block; aspect-ratio: 3 / 2; overflow: hidden; }
.mosaic-grid .card-image img { width: 100%; height: 100%; object-fit: cover; }
.mosaic-grid .card-body { padding: 15px 16px 17px; display: flex; flex-direction: column; flex: 1; }
.mosaic-grid .card-body h4 {
  font-weight: 600; font-size: 1.14rem; line-height: 1.22; margin: 0 0 8px;
}
.mosaic-grid .card-body h4 a { color: var(--eb-ink); text-decoration: none; }
.mosaic-grid .card-body h4 a:hover { color: var(--eb-accent); }
.mosaic-grid .card-body .meta {
  order: -1;
  font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--eb-accent); font-weight: 700; margin-bottom: 8px;
}
.mosaic-grid .card-body .excerpt {
  font-size: 0.85rem; line-height: 1.45; color: var(--eb-ink-soft); margin: 0 0 12px;
}
.mosaic-grid .card-body .read-more { margin-top: auto; }

/* ==========================================================================
   7. SITE FOOTER  (.site-footer)   [overrides its inline styles]
   ========================================================================== */
.site-footer {
  background: var(--eb-footer-bg) !important;
  color: #f0ece2 !important;
  padding: 56px 0 28px !important;
  margin-top: 8px !important;
}
.site-footer h2, .site-footer h4 { color: #fff; }
.footer-grid { grid-template-columns: 2fr 1fr 1fr; }
.footer-col-brand h2 { font-family: var(--eb-serif); }
.footer-socials h4,
.footer-col-links h4,
.footer-col-contact h4 { color: var(--eb-accent-2) !important; }
.footer-links-list a,
.footer-language-switcher a {
  color: rgba(240,236,226,0.78);
  text-decoration: none;
}
.footer-links-list a:hover,
.footer-language-switcher a:hover { color: #fff; }

/* ==========================================================================
   8. RESPONSIVE  (the site's #1 pain point)
   ========================================================================== */
@media (max-width: 900px) {
  .row-top-feature { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767px) {
  .header-flex-container { padding: 0 clamp(14px, 4vw, 24px); }
  .menu-toggle { display: inline-block; align-self: flex-start; margin: 4px 0 14px; order: 1; }
  .header-search { order: -1; }
  .site-branding { order: 0; }

  /* Collapsible menu */
  .header-nav {
    order: 2;
    flex-direction: column;
    align-items: stretch;
    border-top: 1px solid var(--eb-line);
  }
  .header-nav .nav-menu {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .header-nav.eb-open .nav-menu { display: flex; }
  .header-nav .nav-menu > li > a {
    padding: 12px 4px;
    border-bottom: 1px solid var(--eb-line-soft);
  }
  .header-nav .nav-menu li.lang-item,
  .header-nav .nav-menu li.menu-item-language { margin-left: 0; padding-left: 0; }

  .map-hero .container > * { border-radius: 8px; }
  .mosaic-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .footer-grid { grid-template-columns: 1fr; gap: 30px; }
  .footer-bottom { flex-direction: column; align-items: flex-start !important; gap: 10px; }
}

/* ==========================================================================
   9. DARK-MODE TOGGLE BUTTON (injected by eurasia-refresh.js)
   ========================================================================== */
.eb-theme-toggle {
  background: transparent;
  border: 1px solid var(--eb-line);
  border-radius: 999px;
  width: 32px; height: 32px;
  cursor: pointer;
  color: var(--eb-ink-soft);
  font-size: 0.95rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.eb-theme-toggle:hover { border-color: var(--eb-accent); color: var(--eb-accent); }