/* ==========================================================================
   eTravel.wiki — design system
   Mobile-first. Breakpoints: 640px (tablet), 1024px (desktop), 1280px (wide).
   Light and dark palettes are driven by custom properties so the theme toggle
   only has to flip one attribute on <html>.
   ========================================================================== */

:root {
  --bg:            #ffffff;
  --bg-soft:       #f6f8f8;
  --bg-elev:       #ffffff;
  --text:          #14201f;
  --text-soft:     #55635f;
  --border:        #dde5e3;
  --brand:         #0f766e;
  --brand-strong:  #0b5d57;
  --brand-soft:    #e6f4f2;
  --accent:        #b45309;
  --warn-bg:       #fef3c7;
  --warn-text:     #7c4a03;
  --ok-bg:         #dcfce7;
  --ok-text:       #14532d;
  --sponsor-bg:    #ede9fe;
  --sponsor-text:  #4c1d95;
  --shadow:        0 1px 2px rgba(16, 32, 30, .06), 0 8px 24px rgba(16, 32, 30, .06);
  --radius:        12px;
  --radius-sm:     8px;
  --maxw:          1200px;
  --maxw-narrow:   760px;
  --font:          system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ar:       "Noto Naskh Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --step--1: .875rem;
  --step-0:  1rem;
  --step-1:  1.125rem;
  --step-2:  1.375rem;
  --step-3:  1.75rem;
  --step-4:  2.25rem;
  --step-5:  3rem;
}

[data-theme="dark"] {
  --bg:           #0d1514;
  --bg-soft:      #131d1c;
  --bg-elev:      #16211f;
  --text:         #e8efed;
  --text-soft:    #9fb0ac;
  --border:       #26332f;
  --brand:        #2dd4bf;
  --brand-strong: #5eead4;
  --brand-soft:   #10312d;
  --accent:       #fbbf24;
  --warn-bg:      #3a2c07;
  --warn-text:    #fde68a;
  --ok-bg:        #0d2f1c;
  --ok-text:      #86efac;
  --sponsor-bg:   #241a45;
  --sponsor-text: #ddd6fe;
  --shadow:       0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #0d1514;
    --bg-soft:      #131d1c;
    --bg-elev:      #16211f;
    --text:         #e8efed;
    --text-soft:    #9fb0ac;
    --border:       #26332f;
    --brand:        #2dd4bf;
    --brand-strong: #5eead4;
    --brand-soft:   #10312d;
    --accent:       #fbbf24;
    --warn-bg:      #3a2c07;
    --warn-text:    #fde68a;
    --ok-bg:        #0d2f1c;
    --ok-text:      #86efac;
    --sponsor-bg:   #241a45;
    --sponsor-text: #ddd6fe;
    --shadow:       0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background-color .25s ease, color .25s ease;
}

html[dir="rtl"] body { font-family: var(--font-ar); }

img, svg { max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-strong); }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

p { margin: 0 0 1em; }

ul, ol { margin: 0 0 1em; padding-inline-start: 1.25em; }

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Container widths named in the layout specification (mobile / tablet /
   desktop / large). The tablet and desktop caps are declared here so the
   full set is greppable in one place. */
body { --container-md: 768px; --container-lg: 1024px; }

.skip-link {
  position: absolute; inset-inline-start: -9999px; top: 0; z-index: 100;
  background: var(--brand); color: #fff; padding: .75rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { inset-inline-start: 0; }

/* ---------------------------------------------------------------- layout */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 1rem;
}
.container.narrow { max-width: var(--maxw-narrow); }
.container.center { text-align: center; }

.section { margin-block: 2.5rem; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.section-head h2 { margin: 0; }
.section-head .count, .link-more { color: var(--text-soft); font-size: var(--step--1); }

.band { background: var(--bg-soft); border-radius: var(--radius); padding: 1.5rem 1rem; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: .75rem;
  min-height: 64px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 800; font-size: var(--step-1); color: var(--text); text-decoration: none;
  margin-inline-end: auto;
}
.brand-mark { color: var(--brand); font-size: 1.25em; }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 1px solid var(--border);
  background: var(--bg-elev); border-radius: var(--radius-sm); cursor: pointer;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 20px; height: 2px; background: var(--text); content: "";
  position: relative;
}
.nav-toggle-bars::before { position: absolute; top: -6px; }
.nav-toggle-bars::after  { position: absolute; top: 6px; }

.site-nav { flex-basis: 100%; order: 3; display: none; }
.site-nav.is-open { display: block; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.nav-list a {
  display: block; padding: .75rem .25rem; color: var(--text);
  text-decoration: none; border-bottom: 1px solid var(--border); font-weight: 500;
}
.nav-list a:hover { color: var(--brand); }

.header-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.site-search { display: flex; align-items: stretch; }
.site-search input {
  width: 100%; min-width: 0; padding: .5rem .75rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--bg-elev); color: var(--text); font: inherit; font-size: var(--step--1);
}
html[dir="rtl"] .site-search input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.site-search button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .5rem .75rem; border: 1px solid var(--border); border-inline-start: 0;
  background: var(--brand); color: #fff; cursor: pointer; line-height: 1;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: var(--step--1);
}
html[dir="rtl"] .site-search button { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* ------------------------------------------------------- language switch */
.lang-switch { position: relative; }
.lang-switch__button {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .45rem .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--text); font: inherit; font-size: var(--step--1); cursor: pointer;
}
.lang-switch__menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + .35rem); z-index: 50;
  min-width: 12rem; max-height: 60vh; overflow: auto;
  list-style: none; margin: 0; padding: .35rem;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); display: none;
}
.lang-switch.is-open .lang-switch__menu { display: block; }
.lang-switch__menu a {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .5rem .6rem; border-radius: 6px; color: var(--text); text-decoration: none;
}
.lang-switch__menu a:hover { background: var(--brand-soft); color: var(--brand-strong); }
.lang-switch__code { color: var(--text-soft); font-size: .8em; text-transform: uppercase; }

/* --------------------------------------------------------- theme toggle */
.theme-toggle {
  display: inline-flex; gap: 2px; padding: 2px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg-elev);
}
.theme-toggle__opt {
  width: 30px; height: 30px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-soft); cursor: pointer; font-size: .95rem;
}
.theme-toggle__opt[aria-checked="true"] { background: var(--brand); color: #fff; }

/* ------------------------------------------------------------------ hero */
.hero {
  background: linear-gradient(160deg, var(--brand-soft), var(--bg) 70%);
  border-bottom: 1px solid var(--border);
  padding-block: 3rem 2.5rem;
}
.hero-inner { max-width: 46rem; }
.hero-title { font-size: var(--step-4); margin-bottom: .5rem; }
.hero-sub { font-size: var(--step-1); color: var(--text-soft); }
.hero-search { display: flex; gap: .5rem; margin-block: 1.5rem; flex-wrap: wrap; }
.hero-search input {
  flex: 1 1 16rem; padding: .8rem 1rem; font: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--text);
}
.hero-search button, .btn {
  padding: .8rem 1.25rem; border: 0; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-block;
}
.hero-search button:hover, .btn:hover { background: var(--brand-strong); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }

.hero-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;
  list-style: none; margin: 0; padding: 0;
}
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-size: var(--step-2); color: var(--brand-strong); }
.hero-stats span { font-size: var(--step--1); color: var(--text-soft); }

/* The continent list holds an odd number of items (seven), so a grid would
   always leave a ragged hole in the last row. A centred wrapping flex row
   keeps a partial final row looking deliberate at every width. */
.card-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1rem; grid-template-columns: 1fr;
}
.continent-grid {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem;
}
.continent-grid > li { flex: 0 1 100%; }
@media (min-width: 640px) {
  .continent-grid > li { flex: 0 1 14rem; }
}
.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .5rem;
}
.card-link { text-decoration: none; color: inherit; display: block; }
.card-title { margin: 0 0 .35rem; font-size: var(--step-1); }
.card-meta {
  display: flex; gap: .75rem; flex-wrap: wrap;
  font-size: var(--step--1); color: var(--text-soft); margin: 0 0 .35rem;
}
.card-body { margin: 0; color: var(--text-soft); font-size: var(--step--1); }
.card--section .card-body { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.continent-card {
  display: flex; flex-direction: column; gap: .25rem; padding: 1.25rem;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; color: inherit; box-shadow: var(--shadow);
}
.continent-card:hover { border-color: var(--brand); }
.continent-card__name { font-weight: 700; font-size: var(--step-1); }
.continent-card__count { color: var(--text-soft); font-size: var(--step--1); }

.coverage { display: flex; align-items: center; gap: .5rem; }
.coverage__bar {
  flex: 1; height: 6px; border-radius: 999px; background: var(--border); position: relative; overflow: hidden;
}
.coverage__bar::after {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0;
  width: var(--pct, 0%); background: var(--brand); border-radius: 999px;
}
.coverage__label { font-size: .75rem; color: var(--text-soft); }

/* ----------------------------------------------------------------- chips */
.chip-row, .filter-row, .topic-row {
  list-style: none; margin: 0 0 1rem; padding: 0;
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .8rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-elev); color: var(--text); text-decoration: none; font-size: var(--step--1);
}
.chip:hover, .chip.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip__tag { font-size: .7em; opacity: .8; }

/* ------------------------------------------------------------ page heads */
.page-head { margin-block: 1.5rem 1.25rem; }
.page-head h1 { margin-bottom: .35rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; color: var(--text-soft); margin: 0 0 .25rem; }
.lede { font-size: var(--step-1); color: var(--text-soft); max-width: 60ch; }

.breadcrumbs { font-size: var(--step--1); color: var(--text-soft); margin-top: 1rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "/"; margin-inline-end: .35rem; color: var(--border); }
.breadcrumbs a { color: var(--text-soft); }

/* --------------------------------------------------------------- factbar */
.factbar { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.facts { display: grid; grid-template-columns: 1fr; gap: .75rem; margin: 0; }
.facts > div { display: flex; flex-direction: column; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); }
.facts dd { margin: 0; font-weight: 600; }
.facts-note { margin: .75rem 0 0; font-size: var(--step--1); color: var(--text-soft); }

/* --------------------------------------------------------------- article */
.layout-with-rail { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.prose { max-width: 68ch; }
.prose p { margin-bottom: 1.1em; }
.prose--intro { max-width: none; }
.reviewline { font-size: var(--step--1); color: var(--text-soft); }

.rail-nav { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.rail-nav h2 { font-size: var(--step-0); text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); }
.rail-nav ul { list-style: none; margin: 0; padding: 0; }
.rail-nav li { border-bottom: 1px solid var(--border); }
.rail-nav li:last-child { border-bottom: 0; }
.rail-nav a { display: block; padding: .5rem 0; color: var(--text); text-decoration: none; font-size: var(--step--1); }
.rail-nav a:hover { color: var(--brand); }
.rail-nav .is-current a { color: var(--brand-strong); font-weight: 700; }

/* --------------------------------------------------------------- records */
.record-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.record { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.record h2, .record h3 { margin: 0 0 .35rem; font-size: var(--step-1); }
.record__line { margin: 0 0 .25rem; font-size: var(--step--1); color: var(--text-soft); }
.record__flags { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; }

.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; background: var(--bg-soft); color: var(--text-soft);
  border: 1px solid var(--border);
}
.badge--warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.badge--ok { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.badge--sponsor { background: var(--sponsor-bg); color: var(--sponsor-text); border-color: transparent; }

.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-block: 1rem; }
.alert--info { background: var(--brand-soft); color: var(--brand-strong); }
.notice { font-size: var(--step--1); color: var(--text-soft); }

/* ------------------------------------------------------------ partner ad */
.partner-notice {
  margin-block: 2rem 1rem; padding: 1rem 1.25rem;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--bg-soft);
}
.partner-notice__heading { margin: 0 0 .35rem; font-size: var(--step-0); text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); }
.partner-notice__body { margin: 0 0 .5rem; }
.partner-notice__disclaimer { margin: 0; font-size: .78rem; color: var(--text-soft); }
/* v3: the block can carry several anchors. External ones take the link colour
   and an underline so they are obviously clickable; the disclaimer's link back
   to this site stays quiet but is still a real anchor. */
.partner-notice__link { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 2px; }
.partner-notice__link:hover { color: var(--brand); }
.partner-notice__site-link { color: var(--text-soft); text-decoration: underline; text-underline-offset: 2px; }
.partner-notice__site-link:hover { color: var(--brand-strong); }

/* ------------------------------------------------------------------ tabs */
.tab-row { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab {
  padding: .6rem .9rem; border: 0; background: transparent; color: var(--text-soft);
  font: inherit; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap;
}
.tab.is-active { color: var(--brand-strong); border-bottom-color: var(--brand); font-weight: 600; }
.tab-panel[hidden] { display: none; }

/* ---------------------------------------------------------------- search */
.search-page-form { display: flex; gap: .5rem; margin-block: 1rem 1.5rem; flex-wrap: wrap; }
.search-page-form input {
  flex: 1 1 16rem; padding: .7rem 1rem; font: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--text);
}
.search-page-form button {
  padding: .7rem 1.25rem; border: 0; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.result { border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.result__kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); margin: 0 0 .2rem; }
.result h2 { margin: 0 0 .25rem; font-size: var(--step-1); }
.result__summary { margin: 0; color: var(--text-soft); font-size: var(--step--1); }

.error-code { font-size: 4rem; font-weight: 800; color: var(--brand-soft); margin: 0; line-height: 1; }
.debug { text-align: start; background: var(--bg-soft); padding: 1rem; border-radius: var(--radius-sm); overflow: auto; }

/* ---------------------------------------------------------------- footer */
.site-footer { margin-top: 3rem; border-top: 1px solid var(--border); background: var(--bg-soft); padding-block: 2rem 1rem; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.footer-grid h2 { font-size: var(--step--1); text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid a { color: var(--text); text-decoration: none; font-size: var(--step--1); }
.footer-grid a:hover { color: var(--brand); }
.footer-brand { font-weight: 800; font-size: var(--step-1); margin: 0 0 .35rem; }
.footer-about { color: var(--text-soft); font-size: var(--step--1); max-width: 34ch; }
.footer-langs { display: flex; flex-wrap: wrap; gap: .35rem .75rem; }
.footer-legal { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-soft); }

/* ------------------------------------------------------------ breakpoints */
@media (min-width: 640px) {
  .container { padding-inline: 1.5rem; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { grid-template-columns: repeat(4, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: var(--step-4); }
}

@media (min-width: 1024px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; flex-basis: auto; order: 0; }
  .nav-list { flex-direction: row; gap: 1.25rem; }
  .nav-list a { border-bottom: 0; padding: .5rem 0; }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .layout-with-rail { grid-template-columns: minmax(0, 1fr) 20rem; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .hero { padding-block: 4.5rem 3.5rem; }
  .hero-title { font-size: var(--step-5); }
}

@media (min-width: 1280px) {
  .card-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .site-header, .site-footer, .rail, .partner-notice, .theme-toggle, .lang-switch { display: none; }
  body { background: #fff; color: #000; }
}
