/* ==========================================================================
   ELITE HISTORICAL COUNTRY INTELLIGENCE DOSSIER THEME ENGINE (WW1 & WW2)
   Custom Bespoke Material Architecture • Zero-Compromise Authenticity
   ========================================================================== */

/* --- Universal Scrim, Grain & Vignette Overlay --- */
.country-profile-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: 
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.72) 100%),
    linear-gradient(to bottom, rgba(6, 9, 14, 0.3) 0%, rgba(6, 9, 14, 0.7) 100%);
  opacity: 0.85;
}

/* Subtle Film Grain */
.country-profile-body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.035'/%3E%3C/svg%3E");
  opacity: 0.45;
}

/* Ensure interactive content sits above the scrim & grain */
.top-nav, .era-subnav, .country-page, .corporate-footer {
  position: relative;
  z-index: 10;
}

/* --- Corner Ornament Frame Elements --- */
.theme-frame-corner {
  position: absolute;
  width: 72px;
  height: 72px;
  pointer-events: none;
  z-index: 20;
  background-size: contain;
  background-repeat: no-repeat;
  mix-blend-mode: screen;
  opacity: 0.85;
  transition: opacity 0.3s ease;
}

.theme-frame-corner.top-left {
  top: 12px;
  left: 12px;
  transform: none;
}

.theme-frame-corner.top-right {
  top: 12px;
  right: 12px;
  transform: scaleX(-1);
}

.theme-frame-corner.bottom-left {
  bottom: 12px;
  left: 12px;
  transform: scaleY(-1);
}

.theme-frame-corner.bottom-right {
  bottom: 12px;
  right: 12px;
  transform: scale(-1);
}

@media (max-width: 768px) {
  .theme-frame-corner {
    width: 44px;
    height: 44px;
  }
}

/* --- Hero Section Background Overrides --- */
.country-page .cp-hero {
  background-size: cover !important;
  background-position: center top !important;
  background-repeat: no-repeat !important;
  border-bottom: 1.5px solid var(--ct-border, rgba(255, 215, 0, 0.35)) !important;
  position: relative;
}

@media (max-width: 768px) {
  .country-page .cp-hero {
    background-image: var(--ct-hero-mobile, var(--ct-hero)) !important;
  }
}

/* Scrim over Hero to guarantee WCAG AA text contrast */
.country-page .cp-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.55) 0%, rgba(6, 10, 18, 0.85) 75%, var(--bg, #06090e) 100%),
              radial-gradient(circle at 50% 30%, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.7) 100%);
  pointer-events: none;
  z-index: 1;
}

.country-page .cp-hero-content {
  position: relative;
  z-index: 5;
}

/* Emblem Motif in Hero */
.cp-hero-emblem {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px auto;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  mix-blend-mode: screen;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.8));
  display: block;
}

/* --- Material-Infused Buttons --- */
#btn-export-dossier-png, #btn-share-dossier, .cp-hq-btn {
  background-size: cover !important;
  background-position: center !important;
  position: relative !important;
  overflow: hidden !important;
  border: 1px solid var(--ct-button-border, rgba(255, 255, 255, 0.25)) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.3) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8) !important;
}

#btn-export-dossier-png:hover, #btn-share-dossier:hover, .cp-hq-btn:hover {
  transform: translateY(-2px) scale(1.02) !important;
  box-shadow: 0 6px 20px var(--ct-glow, rgba(255, 215, 0, 0.4)), inset 0 1px 2px rgba(255, 255, 255, 0.5) !important;
  filter: brightness(1.15) !important;
}

#btn-export-dossier-png:active, #btn-share-dossier:active, .cp-hq-btn:active {
  transform: translateY(1px) scale(0.98) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6) !important;
}

#btn-export-dossier-png:focus-visible, #btn-share-dossier:focus-visible, .cp-hq-btn:focus-visible {
  outline: 2px solid var(--ct-accent, #ffd700) !important;
  outline-offset: 2px !important;
}

/* --- Material Cards & Panels --- */
.cp-info, .cp-map-wrap, .marshal-card, .division-card, .cp-weapon-card, 
.cp-power-arc, .cp-power-radar, .cp-gauge-card, .cp-ranking-card, .cp-power-dossier-card {
  background-color: var(--ct-surface-bg, rgba(14, 20, 32, 0.88)) !important;
  background-image: var(--ct-panel-texture, none) !important;
  background-size: cover !important;
  background-position: center !important;
  border: 1px solid var(--ct-border, rgba(255, 255, 255, 0.12)) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  border-radius: var(--ct-radius, 12px) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  position: relative !important;
}

.marshal-card:hover, .division-card:hover, .cp-weapon-card:hover, .cp-power-dossier-card:hover {
  border-color: var(--ct-accent, #ffd700) !important;
  box-shadow: 0 12px 36px var(--ct-glow, rgba(255, 215, 0, 0.25)), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-4px) !important;
}

/* --- Section Dividers --- */
.cp-section-line {
  height: 18px !important;
  background: var(--ct-divider-bg, linear-gradient(90deg, transparent, var(--ct-border, rgba(255, 215, 0, 0.4)), transparent)) !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: contain !important;
  border: none !important;
  margin: 16px 0 28px 0 !important;
  mix-blend-mode: screen;
  opacity: 0.9;
}

/* Scrollbar & Selection */
::selection {
  background-color: var(--ct-accent, #ffd700);
  color: #000000;
}

::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #080c14;
}
::-webkit-scrollbar-thumb {
  background: var(--ct-border, #334155);
  border-radius: 5px;
  border: 2px solid #080c14;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ct-accent, #ffd700);
}

/* Reduced Motion Safeguard */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   SPECIFIC THEMES (25 NATIONS)
   ========================================================================== */

/* --------------------------------------------------------------------------
   WW1: GERMANY (Kaiserreich)
   Palette: Muted Black-White-Red, Feldgrau, Imperial Brass Gold
   Material: Heavy Forged Wrought Iron + Antique Brass Rivets
   -------------------------------------------------------------------------- */
[data-country-theme="ww1-germany"],
body.ww1-theme.theme-ww1-germany {
  --ct-primary: #121820;
  --ct-accent: #d4af37;
  --ct-accent-rgb: 212, 175, 55;
  --ct-border: rgba(212, 175, 55, 0.42);
  --ct-glow: rgba(212, 175, 55, 0.28);
  --ct-surface-bg: rgba(14, 18, 26, 0.92);
  --ct-radius: 6px;
  --ct-hero: url("/assets/country-themes/ww1/germany/hero.webp");
  --ct-hero-mobile: url("/assets/country-themes/ww1/germany/hero-mobile.webp");
  --ct-panel-texture: url("/assets/country-themes/ww1/germany/panel.webp");
  --ct-button-texture: url("/assets/country-themes/ww1/germany/button.webp");
  --ct-corner-ornament: url("/assets/country-themes/ww1/germany/frame-corner.webp");
  --ct-divider-bg: url("/assets/country-themes/ww1/germany/divider.webp");
  --ct-emblem: url("/assets/country-themes/ww1/germany/emblem.webp");
}

[data-country-theme="ww1-germany"] .cp-hero {
  background-image: var(--ct-hero) !important;
}

[data-country-theme="ww1-germany"] #btn-export-dossier-png,
[data-country-theme="ww1-germany"] #btn-share-dossier,
[data-country-theme="ww1-germany"] .cp-hq-btn {
  background-image: var(--ct-button-texture) !important;
  border-color: rgba(212, 175, 55, 0.6) !important;
  color: #fff9e6 !important;
}

/* --------------------------------------------------------------------------
   WW2: GERMANY (Wehrmacht Era)
   Palette: Feldgrau, Slate Anthracite, Cold Bone White, Subtle Rust
   Material: Raw Monolithic Concrete + Darkened Armor Steel Plate + Hex Bolts
   -------------------------------------------------------------------------- */
[data-country-theme="ww2-germany"],
body.ww2-theme.theme-ww2-germany {
  --ct-primary: #0d1117;
  --ct-accent: #94a3b8;
  --ct-accent-rgb: 148, 163, 184;
  --ct-border: rgba(148, 163, 184, 0.35);
  --ct-glow: rgba(148, 163, 184, 0.22);
  --ct-surface-bg: rgba(15, 18, 23, 0.94);
  --ct-radius: 2px;
  --ct-hero: url("/assets/country-themes/ww2/germany/hero.webp");
  --ct-hero-mobile: url("/assets/country-themes/ww2/germany/hero-mobile.webp");
  --ct-panel-texture: url("/assets/country-themes/ww2/germany/panel.webp");
  --ct-button-texture: url("/assets/country-themes/ww2/germany/button.webp");
  --ct-corner-ornament: url("/assets/country-themes/ww2/germany/frame-corner.webp");
  --ct-divider-bg: url("/assets/country-themes/ww2/germany/divider.webp");
  --ct-emblem: url("/assets/country-themes/ww2/germany/emblem.webp");
}

[data-country-theme="ww2-germany"] .cp-hero {
  background-image: var(--ct-hero) !important;
}

[data-country-theme="ww2-germany"] #btn-export-dossier-png,
[data-country-theme="ww2-germany"] #btn-share-dossier,
[data-country-theme="ww2-germany"] .cp-hq-btn {
  background-image: var(--ct-button-texture) !important;
  border-color: rgba(148, 163, 184, 0.45) !important;
  color: #f1f5f9 !important;
}
