/* ===========================
   OurExitPlans — main styles
   Editorial dark theme
   =========================== */

:root {
  /* Backgrounds */
  --bg:           #0a1a0e;
  --green-deep:   #081509;
  --surface:      #111f14;
  --surface-2:    #192a1c;
  --white:        #f7f3ed;       /* "light" sections */
  --cream:        #f5f0e8;       /* primary text on dark */
  --cream-dark:   #ede8df;       /* quiz CTA section bg */

  /* Borders */
  --border:       rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.16);

  /* Accent */
  --gold:         #c9a84c;
  --gold-light:   #dfc27a;

  /* Text on dark */
  --text:         #e8e4dc;
  --text-muted:   rgba(232,228,220,0.5);
  --text-dim:     rgba(232,228,220,0.25);

  /* Text on light */
  --text-dark:    #1a2a1e;
  --text-dark-muted: #5a6b5e;

  /* Misc */
  --radius:       10px;
  --radius-lg:    18px;
  --transition:   0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --max-w:        1200px;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main { flex: 1; }

h1, h2, h3 {
  font-family: 'Cormorant Garamond', serif;
  line-height: 1.15;
  font-weight: 600;
}

/* ── NAV ────────────────────────────────────────────────────────────────── */
.oep-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(8, 21, 10, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.oep-nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.oep-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cream);
  flex-shrink: 0;
}

.oep-logo span { color: var(--gold); }

.oep-nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: 1.5rem;
}

.oep-nav-links li a {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  transition: all var(--transition);
  white-space: nowrap;
}

.oep-nav-links li a:hover,
.oep-nav-links li a.active {
  color: var(--gold);
  background: rgba(201, 168, 76, 0.08);
}

.oep-nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.nav-user {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.btn-nav-ghost {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all var(--transition);
}

.btn-nav-ghost:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.btn-nav-primary {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--green-deep);
  background: var(--gold);
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  transition: all var(--transition);
}

.btn-nav-primary:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
}

.nav-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  font-size: 1.1rem;
  margin-left: auto;
}

/* Mobile nav open state */
@media (max-width: 768px) {
  .oep-nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: 58px;
    left: 0; right: 0;
    background: rgba(8, 21, 10, 0.98);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    gap: 0.15rem;
    z-index: 199;
  }
  .oep-nav-links.open { display: flex; }
  .nav-hamburger { display: block; }
  .oep-nav-right { display: none; }
}

/* ── FLASH MESSAGES ─────────────────────────────────────────────────────── */
.oep-messages {
  position: fixed;
  top: 70px;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
}

.oep-alert {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.oep-alert-success { border-color: rgba(62,207,142,0.3); }
.oep-alert-error   { border-color: rgba(224,82,82,0.3); }
.oep-alert-warning { border-color: rgba(201,168,76,0.3); }

.oep-alert-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

/* ── HERO ───────────────────────────────────────────────────────────────── */
.oep-hero {
  position: relative;
  background: var(--green-deep);
  text-align: center;
  overflow: hidden;
}

/* Decorative dot-grid overlay */
.oep-hero-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(201,168,76,0.12) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
  pointer-events: none;
}

/* Ambient glow */
.oep-hero::before {
  content: '';
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(201,168,76,0.07) 0%, transparent 70%);
  pointer-events: none;
}

.oep-hero-content {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.oep-hero-content h1 {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  color: var(--cream);
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.oep-hero-content h1 em {
  font-style: italic;
  color: var(--gold-light);
}

.oep-hero-content p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 46ch;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

/* ── EYEBROW ────────────────────────────────────────────────────────────── */
.eyebrow {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

/* ── BUTTONS ────────────────────────────────────────────────────────────── */
.btn-primary-oep {
  display: inline-block;
  background: var(--gold);
  color: var(--green-deep);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.85rem 2rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.01em;
  font-family: 'DM Sans', sans-serif;
}

.btn-primary-oep:hover {
  background: var(--gold-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(201,168,76,0.3);
  color: var(--green-deep);
}

.btn-outline-oep {
  display: inline-block;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.85rem 2rem;
  border-radius: var(--radius);
  border: 1px solid rgba(232,228,220,0.22);
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'DM Sans', sans-serif;
}

.btn-outline-oep:hover {
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-1px);
}

/* Light-section button variants */
.section-light .btn-outline-oep {
  color: var(--text-dark);
  border-color: rgba(26,42,30,0.22);
}

.section-light .btn-outline-oep:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* ── SECTIONS ───────────────────────────────────────────────────────────── */
.section {
  padding: 5rem 1.5rem;
}

.section-dark {
  background: var(--green-deep) !important;
}

.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

/* Light sections need dark text */
.section[style*="background:var(--white)"],
.section[style*="background: var(--white)"] {
  color: var(--text-dark);
}

.section[style*="background:var(--white)"] h2,
.section[style*="background: var(--white)"] h2,
.section[style*="background:var(--cream-dark)"] h2,
.section[style*="background: var(--cream-dark)"] h2 {
  color: var(--text-dark);
}

.section[style*="background:var(--white)"] p,
.section[style*="background: var(--white)"] p,
.section[style*="background:var(--cream-dark)"] p,
.section[style*="background: var(--cream-dark)"] p {
  color: var(--text-dark-muted);
}

/* ── GRIDS ──────────────────────────────────────────────────────────────── */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
}

/* ── COUNTRY CARDS ──────────────────────────────────────────────────────── */
.country-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  color: var(--text);
}

/* Cards on light-bg sections */
.section[style*="background:var(--white)"] .country-card,
.section[style*="background: var(--white)"] .country-card {
  background: #fff;
  border-color: rgba(26,42,30,0.1);
  color: var(--text-dark);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.country-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
}

.section[style*="background:var(--white)"] .country-card:hover,
.section[style*="background: var(--white)"] .country-card:hover {
  box-shadow: 0 12px 36px rgba(0,0,0,0.12);
  border-color: rgba(201,168,76,0.35);
}

.country-card-flag {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  padding: 1.5rem;
  background: var(--surface-2);
  min-height: 110px;
}

.section[style*="background:var(--white)"] .country-card-flag,
.section[style*="background: var(--white)"] .country-card-flag {
  background: var(--cream-dark);
}

.country-card-score {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  background: var(--gold);
  color: var(--green-deep);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  letter-spacing: 0.04em;
}

.country-card-body {
  padding: 1.1rem 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.country-card-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
}

.country-card-region {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section[style*="background:var(--white)"] .country-card-region,
.section[style*="background: var(--white)"] .country-card-region {
  color: var(--text-dark-muted);
}

.country-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

/* ── TAGS ───────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.section[style*="background:var(--white)"] .tag,
.section[style*="background: var(--white)"] .tag {
  background: var(--cream-dark);
  color: var(--text-dark-muted);
  border-color: rgba(26,42,30,0.1);
}

.tag-green {
  background: rgba(62,207,142,0.1);
  color: #2a9b68;
  border-color: rgba(62,207,142,0.25);
}

.tag-gold {
  background: rgba(201,168,76,0.1);
  color: var(--gold);
  border-color: rgba(201,168,76,0.25);
}

/* ── RESULT CARDS (Top Rated) ───────────────────────────────────────────── */
.result-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid rgba(26,42,30,0.1);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  color: var(--text-dark);
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}

.result-card:hover {
  border-color: rgba(201,168,76,0.4);
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.result-rank {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  color: rgba(26,42,30,0.2);
  min-width: 2rem;
  line-height: 1;
}

.result-card > div:nth-child(2) {
  flex: 1;
}

.result-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.2;
}

.result-region {
  font-size: 0.72rem;
  color: var(--text-dark-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-score-pill {
  display: inline-block;
  background: var(--gold);
  color: var(--green-deep);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 99px;
  white-space: nowrap;
}

/* ── FOOTER ─────────────────────────────────────────────────────────────── */
.oep-footer {
  background: var(--green-deep);
  border-top: 1px solid var(--border);
  padding: 4rem 1.5rem 0;
  margin-top: auto;
}

.oep-footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 2fr;
  gap: 4rem;
  padding-bottom: 3rem;
}

.footer-brand .oep-logo {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.footer-brand p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 28ch;
}

.footer-links-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.footer-links-grid h6 {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 0.85rem;
}

.footer-links-grid ul {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.footer-links-grid a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer-links-grid a:hover { color: var(--gold); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.footer-disclaimer { font-style: italic; }

@media (max-width: 900px) {
  .oep-footer-inner { grid-template-columns: 1fr; gap: 2.5rem; }
}

@media (max-width: 600px) {
  .footer-links-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ── TICKER animation ───────────────────────────────────────────────────── */
@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── HTMX loading ───────────────────────────────────────────────────────── */
body.htmx-loading::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  z-index: 9999;
  animation: progress 1.5s ease infinite;
}

@keyframes progress {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Utility ────────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }