/* ===========================================================
   NomadVisa — site-wide stylesheet
   =========================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #0e1117;
  --ink-muted: #5a6070;
  --ink-faint: #6b7280;
  --surface: #ffffff;
  --surface-2: #f7f6f3;
  --surface-3: #f0ede7;
  --border: #e8e4dc;
  --accent: #b5531f;
  --accent-2: #1b4f72;
  --accent-light: #fdf0e8;
  --green: #1a6b45;
  --green-light: #e8f5ee;
  --radius: 10px;
  --radius-lg: 16px;
  --maxw: 1140px;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.7;
  font-size: 16px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ─── HEADER ─── */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo { font-family: 'Playfair Display', serif; font-size: 1.4rem; font-weight: 900; letter-spacing: -0.5px; }
.logo span { color: var(--accent); }
nav.main-nav { display: flex; gap: 0.25rem; align-items: center; }
nav.main-nav a {
  font-size: 0.875rem; font-weight: 500;
  padding: 0.4rem 0.75rem; border-radius: 6px;
  color: var(--ink-muted); transition: color .15s, background .15s;
}
nav.main-nav a:hover, nav.main-nav a.active { color: var(--ink); background: var(--surface-2); }
.nav-cta { background: var(--accent) !important; color: #fff !important; padding: 0.4rem 1rem !important; }
.nav-cta:hover { opacity: .9; background: var(--accent) !important; }
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--ink); }

/* ─── FLAG IMAGES (cross-platform, replaces emoji) ─── */
.auto-flag {
  height: 1em; width: auto; aspect-ratio: 4 / 3; object-fit: cover;
  display: inline-block; vertical-align: -0.12em; border-radius: 2px;
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.12);
}
.card-flag .auto-flag { box-shadow: 0 1px 6px rgba(0,0,0,0.15); border-radius: 4px; }
.country-flag { display: inline-flex; align-items: center; }

/* ─── BREADCRUMB ─── */
.breadcrumb {
  max-width: var(--maxw); margin: 0 auto; padding: 1rem 2rem 0;
  font-size: 0.8rem; color: var(--ink-faint);
}
.breadcrumb a { color: var(--ink-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 0.4rem; }

/* ─── HERO ─── */
.hero {
  background-color: #0e1117;
  background-image: linear-gradient(rgba(14,17,23,0.55), rgba(14,17,23,0.68)), url('/static/hero.jpg');
  background-size: cover; background-position: center 38%; background-repeat: no-repeat;
  border-bottom: 1px solid var(--border);
  padding: 6rem 2rem 5rem; text-align: center; position: relative; overflow: hidden;
}
@supports (background-image: image-set(url('x') type('image/webp'))) {
  .hero {
    background-image: linear-gradient(rgba(14,17,23,0.55), rgba(14,17,23,0.68)),
      image-set(url('/static/hero.webp') type('image/webp'), url('/static/hero.jpg') type('image/jpeg'));
  }
}
.hero-inner { position: relative; max-width: 760px; margin: 0 auto; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.15); color: #fff;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em;
  padding: 0.3rem 0.85rem; border-radius: 99px; margin-bottom: 1.5rem;
  border: 1px solid rgba(255,255,255,0.25); backdrop-filter: blur(4px);
}
.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.4rem, 5vw, 3.8rem); font-weight: 900;
  line-height: 1.1; letter-spacing: -1px; margin-bottom: 1.25rem;
  color: #fff; text-shadow: 0 2px 24px rgba(0,0,0,0.25);
}
.hero h1 em { font-style: normal; color: #f0a06a; }
.hero p { font-size: 1.1rem; color: rgba(255,255,255,0.92); max-width: 560px; margin: 0 auto 2rem; font-weight: 300; }
.hero-search {
  display: flex; max-width: 520px; margin: 0 auto; background: #fff;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.hero-search input {
  flex: 1; border: none; outline: none; padding: 0.85rem 1.25rem;
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem; color: var(--ink); background: transparent;
}
.hero-search button {
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 0.85rem 1.5rem; font-family: 'DM Sans', sans-serif; font-size: 0.875rem; font-weight: 600;
  transition: opacity .15s;
}
.hero-search button:hover { opacity: .9; }
.hero-stats { display: flex; justify-content: center; gap: 2.5rem; margin-top: 2.5rem; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat strong { display: block; font-family: 'Playfair Display', serif; font-size: 1.8rem; font-weight: 700; color: #fff; }
.hero-stat span { font-size: 0.8rem; color: rgba(255,255,255,0.75); }

/* ─── PAGE HEADER (interior pages) ─── */
.page-head { max-width: 820px; margin: 0 auto; padding: 2rem 2rem 1rem; }
.page-head .eyebrow { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.6rem; }
.page-head h1 { font-family: 'Playfair Display', serif; font-size: clamp(2rem, 4vw, 3rem); font-weight: 900; line-height: 1.12; letter-spacing: -0.5px; margin-bottom: 0.85rem; }
.page-head .lede { font-size: 1.15rem; color: var(--ink-muted); font-weight: 300; }
.page-head .meta { display: flex; gap: 1.25rem; margin-top: 1.25rem; font-size: 0.8rem; color: var(--ink-faint); flex-wrap: wrap; }

/* ─── SECTIONS ─── */
.section { padding: 4rem 2rem; }
.section-inner { max-width: var(--maxw); margin: 0 auto; }
.section-label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem; }
.section-title { font-family: 'Playfair Display', serif; font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 700; line-height: 1.2; margin-bottom: 0.75rem; }
.section-sub { color: var(--ink-muted); font-size: 1rem; max-width: 540px; margin-bottom: 2.5rem; }
.bg-alt { background: var(--surface-2); }

/* ─── ARTICLE BODY ─── */
.article { max-width: 820px; margin: 0 auto; padding: 2rem; }
.article h2 { font-family: 'Playfair Display', serif; font-size: 1.7rem; font-weight: 700; margin: 2.5rem 0 1rem; line-height: 1.25; }
.article h3 { font-size: 1.25rem; font-weight: 600; margin: 1.75rem 0 0.75rem; }
.article p { margin-bottom: 1.15rem; color: #2a2f3a; }
.article ul, .article ol { margin: 0 0 1.25rem 1.25rem; }
.article li { margin-bottom: 0.5rem; color: #2a2f3a; }
.article a.inline { color: var(--accent); font-weight: 500; border-bottom: 1px solid rgba(200,98,42,0.3); }
.article a.inline:hover { border-color: var(--accent); }
.article strong { font-weight: 600; }
.article hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.article img { border-radius: var(--radius); margin: 1.5rem 0; }

.callout {
  background: var(--accent-light); border: 1px solid rgba(200,98,42,0.2);
  border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 1.75rem 0;
}
.callout strong { color: var(--accent); }
.callout.info { background: #e8f0f9; border-color: rgba(27,79,114,0.2); }
.callout.info strong { color: var(--accent-2); }
.callout.tip { background: var(--green-light); border-color: rgba(26,107,69,0.2); }
.callout.tip strong { color: var(--green); }

.toc {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 1.5rem 0 2.5rem;
}
.toc h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); margin-bottom: 0.75rem; }
.toc ol { margin-left: 1.1rem; }
.toc li { margin-bottom: 0.35rem; font-size: 0.9rem; }
.toc a { color: var(--accent-2); }
.toc a:hover { color: var(--accent); }

/* ─── DATA TABLE ─── */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th { text-align: left; padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-3); }
tbody td { padding: 0.9rem 1rem; vertical-align: middle; }
tbody td a { text-decoration: underline; text-underline-offset: 2px; }
.pill { display: inline-block; padding: 0.2rem 0.65rem; border-radius: 99px; font-size: 0.75rem; font-weight: 500; }
.pill-green { background: var(--green-light); color: var(--green); }
.pill-orange { background: var(--accent-light); color: var(--accent); }
.pill-blue { background: #e8f0f9; color: var(--accent-2); }
.country-flag { font-size: 1.3rem; margin-right: 0.5rem; }
.country-name { font-weight: 500; }

/* ─── CARDS ─── */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,0.08); }
.card-flag { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 4rem; background: var(--surface-2); }
.card-body { padding: 1.25rem; }
.card-tag { display: inline-block; background: var(--green-light); color: var(--green); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.2rem 0.6rem; border-radius: 4px; margin-bottom: 0.6rem; }
.card-tag.orange { background: var(--accent-light); color: var(--accent); }
.card-tag.blue { background: #e8f0f9; color: var(--accent-2); }
.card h3 { font-family: 'Playfair Display', serif; font-size: 1.15rem; font-weight: 700; margin-bottom: 0.5rem; line-height: 1.3; }
.card p { font-size: 0.875rem; color: var(--ink-muted); margin-bottom: 1rem; }
.card-meta { display: flex; gap: 1rem; font-size: 0.75rem; color: var(--ink-faint); border-top: 1px solid var(--border); padding-top: 0.75rem; }
.card-meta span { display: flex; align-items: center; gap: 4px; }

/* ─── AFFILIATE TOOLS ─── */
.affiliate-strip { background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 2.5rem 2rem; }
.affiliate-inner { max-width: var(--maxw); margin: 0 auto; }
.affiliate-label { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 1rem; }
.tools-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.tool-card { flex: 1; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; transition: border-color .15s, box-shadow .15s; }
.tool-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.tool-icon { font-size: 1.75rem; }
.tool-card h4 { font-size: 0.95rem; font-weight: 600; }
.tool-card p { font-size: 0.8rem; color: var(--ink-muted); flex: 1; }
.tool-link { font-size: 0.8rem; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 3px; }
.tool-link::after { content: '→'; }

/* ─── TOPIC GRID ─── */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.topic-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; display: flex; align-items: flex-start; gap: 0.75rem; transition: border-color .15s, transform .15s; }
.topic-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.topic-emoji { font-size: 1.5rem; }
.topic-item h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.2rem; }
.topic-item p { font-size: 0.8rem; color: var(--ink-muted); }

/* ─── AD SLOT (AdSense placeholder) ─── */
.ad-slot { max-width: 820px; margin: 2.5rem auto; padding: 0 2rem; }
.ad-inner { background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius); min-height: 90px; display: flex; align-items: center; justify-content: center; color: var(--ink-faint); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* ─── NEWSLETTER ─── */
.newsletter { background: var(--accent-2); color: #fff; padding: 4rem 2rem; text-align: center; }
.newsletter h2 { font-family: 'Playfair Display', serif; font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 700; margin-bottom: 0.75rem; }
.newsletter p { opacity: 0.8; margin-bottom: 2rem; }
.nl-form { display: flex; max-width: 460px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; }
.nl-form input { flex: 1; border: none; outline: none; padding: 0.9rem 1.25rem; font-family: 'DM Sans', sans-serif; font-size: 0.9rem; }
.nl-form button { background: var(--accent); color: #fff; border: none; cursor: pointer; padding: 0.9rem 1.5rem; font-family: 'DM Sans', sans-serif; font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.nl-note { margin-top: 0.75rem; font-size: 0.75rem; opacity: 0.5; }

/* ─── FOOTER ─── */
footer { background: var(--ink); color: rgba(255,255,255,0.6); padding: 3rem 2rem 2rem; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2.5rem; }
.footer-brand .logo { color: #fff; margin-bottom: 0.75rem; }
.footer-brand p { font-size: 0.85rem; line-height: 1.6; }
footer h2 { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.6); margin-bottom: 0.75rem; }
footer ul { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
footer ul li a { font-size: 0.875rem; transition: color .15s; color: rgba(255,255,255,0.8); }
footer ul li a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1.5rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.footer-bottom p { font-size: 0.8rem; }
.footer-disclaimer { font-size: 0.75rem; opacity: 0.4; max-width: 600px; line-height: 1.5; margin-bottom: 1rem; }

/* ─── COOKIE CONSENT ─── */
#cookie-banner {
  position: fixed; bottom: 1rem; left: 1rem; right: 1rem; max-width: 480px; margin: 0 auto;
  background: var(--ink); color: #fff; border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem; z-index: 999; box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  font-size: 0.85rem; display: none;
}
#cookie-banner.show { display: block; }
#cookie-banner p { margin-bottom: 1rem; line-height: 1.5; opacity: 0.85; }
#cookie-banner a { color: #fff; text-decoration: underline; }
.cookie-btns { display: flex; gap: 0.5rem; }
.cookie-btns button { flex: 1; border: none; cursor: pointer; padding: 0.6rem; border-radius: 6px; font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.8rem; }
.btn-accept { background: var(--accent); color: #fff; }
.btn-decline { background: rgba(255,255,255,0.12); color: #fff; }

/* ─── MISC ─── */
.btn-primary { display: inline-block; background: var(--accent); color: #fff; padding: 0.7rem 1.5rem; border-radius: var(--radius); font-weight: 600; font-size: 0.9rem; transition: opacity .15s; }
.btn-primary:hover { opacity: 0.9; }
.center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.faq-item { border-bottom: 1px solid var(--border); padding: 1.25rem 0; }
.faq-item h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.5rem; }
.faq-item p { color: var(--ink-muted); margin: 0; }

@media (max-width: 768px) {
  nav.main-nav { position: absolute; top: 64px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: 0.5rem; border-bottom: 1px solid var(--border); display: none; }
  nav.main-nav.open { display: flex; }
  .menu-toggle { display: block; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero-stats { gap: 1.5rem; }
  .tools-row { flex-direction: column; }
}
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
