/* ── Meridian Light design system ───────────────────────────────────────── */
:root {
  --bg:          #f0f2f8;
  --card:        #ffffff;
  --card-inner:  #f7f8fc;
  --ink:         #0c1024;
  --muted:       #6878a8;
  --muted-light: #8898c8;
  --accent:      #c8960a;   /* amber / gold — darkened for light bg contrast */
  --accent-dim:  rgba(200,150,10,0.08);
  --accent2:     #4466c8;   /* periwinkle — darkened for readability */
  --border:      #dde1f0;
  --border-mid:  #c8ceea;
  --gold:        #c8960a;
}

/* ── Reset & base ───────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Instrument Sans', system-ui, sans-serif;
  background: var(--bg);
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  width: 100%;
  max-width: 760px;
  border-radius: 4px;
  border: 1px solid var(--border-mid);
  padding: 36px;
  box-shadow:
    0 0 0 1px rgba(200,150,10,0.06),
    0 8px 32px rgba(12,16,36,0.10);
  position: relative;
}

/* Corner registration marks */
.card::before,
.card::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
  opacity: 0.5;
}
.card::before { top: 12px; left: 12px; border-top-width: 1px; border-left-width: 1px; }
.card::after  { bottom: 12px; right: 12px; border-bottom-width: 1px; border-right-width: 1px; }

/* ── Header ─────────────────────────────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 24px;
}
header h1 {
  margin: 0 0 5px;
  font-family: 'Jura', sans-serif;
  font-weight: 300;
  font-size: 1.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}
.subtitle {
  margin: 0;
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ── Progress bar ───────────────────────────────────────────────────────── */
.progress {
  height: 1px;
  background: var(--border);
  margin-bottom: 28px;
}
.progress-bar {
  height: 100%;
  width: 25%;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* ── Wizard ─────────────────────────────────────────────────────────────── */
fieldset { border: 0; margin: 0; padding: 0; }
legend {
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  margin-bottom: 18px;
}
legend small {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted-light);
  margin-left: 6px;
}

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--card);
  font-size: 0.92rem;
  color: var(--ink);
}
.option:hover { border-color: var(--accent); background: var(--accent-dim); }
.option input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ── Navigation ─────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.nav button { margin-left: auto; }
.nav #backBtn { margin-left: 0; margin-right: auto; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
button {
  font-family: 'DM Mono', monospace;
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 24px;
  border-radius: 2px;
  border: 1px solid var(--accent);
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  min-height: 44px;
  transition: opacity 0.15s ease-out, transform 0.05s ease-out, box-shadow 0.15s ease-out;
}
button:hover { opacity: 0.88; box-shadow: 0 2px 12px rgba(200,150,10,0.25); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-mid);
}
button.secondary:hover { border-color: var(--muted); color: var(--ink); box-shadow: none; }

/* ── Utility ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── States ─────────────────────────────────────────────────────────────── */
.state {
  text-align: center;
  padding: 32px 0;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}
.state p { text-transform: none; font-size: 0.88rem; letter-spacing: 0; margin: 0; }
.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 18px;
  border: 1px solid var(--border-mid);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Results ────────────────────────────────────────────────────────────── */
#results h2 {
  margin: 0 0 20px;
  font-family: 'Jura', sans-serif;
  font-weight: 300;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Currency bar ───────────────────────────────────────────────────────── */
.currency-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.currency-bar select {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.currency-bar select:focus { border-color: var(--accent); }
.currency-bar select:focus:not(:focus-visible) { outline: none; }

/* ── Recommendation cards ───────────────────────────────────────────────── */
.rec {
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 20px;
  margin-bottom: 10px;
  background: var(--card);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.rec:hover { border-color: var(--border-mid); box-shadow: 0 2px 12px rgba(12,16,36,0.06); }

.rec.top {
  border-color: var(--accent);
  background: var(--card);
  box-shadow: 0 0 0 1px rgba(200,150,10,0.15), 0 4px 16px rgba(200,150,10,0.08);
}

.rec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.rec-name {
  font-family: 'Jura', sans-serif;
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  margin: 0;
  color: var(--ink);
}
.rec-name a { color: var(--accent2); text-decoration: none; }
.rec-name a:hover { color: var(--accent); }

.badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 3px 8px;
  border-radius: 2px;
  white-space: nowrap;
}

.rec-price {
  font-family: 'DM Mono', monospace;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--accent);
  margin: 6px 0 4px;
  letter-spacing: 0.02em;
}
.rec-price-sub {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 8px;
}
.rec-local-note {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0 0 10px;
}
.rec-local-note a { color: var(--accent2); text-decoration: none; }
.rec-local-note a:hover { text-decoration: underline; }

.rec-reason {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #3a4466;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 8px;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.page-footer {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-light);
  margin-top: 24px;
  text-align: center;
  line-height: 1.8;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  body { padding: 14px; }
  .card { padding: 22px 18px; }
  header h1 { font-size: 1.3rem; }
}

/* ── Skip link ───────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  border-radius: 0 0 4px 4px;
  z-index: 9999;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; outline: 2px solid #fff; outline-offset: 2px; }

/* ── Step header & counter ──────────────────────────────────────────────── */
.step-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.step-counter {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Answer summary ─────────────────────────────────────────────────────── */
.answers-summary {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 18px;
}

/* ── Savings badge ───────────────────────────────────────────────────────── */
.savings-badge {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 0.60rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(42, 122, 42, 0.10);
  color: #2a7a2a;
  border: 1px solid rgba(42, 122, 42, 0.25);
  padding: 2px 6px;
  border-radius: 2px;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Rec head layout ─────────────────────────────────────────────────────── */
.rec-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rec-rank {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--muted-light);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* ── Result actions ──────────────────────────────────────────────────────── */
.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── Focus styles ────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Footer links ────────────────────────────────────────────────────────── */
.footer-link {
  color: var(--muted);
  text-decoration: underline;
  font-size: 0.8em;
}
.footer-link:hover { color: var(--ink); }

/* ── Cookie consent banner ───────────────────────────────────────────────── */
#wbf-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--card);
  border-top: 1px solid var(--border-mid);
  box-shadow: 0 -2px 16px rgba(12,16,36,0.10);
  padding: 14px 20px;
}
.wbf-cb-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.wbf-cb-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ink);
  flex: 1 1 280px;
  text-transform: none;
  letter-spacing: 0;
  font-family: 'Instrument Sans', system-ui, sans-serif;
}
.wbf-cb-link { color: var(--accent2); text-decoration: underline; }
.wbf-cb-btns { display: flex; gap: 10px; flex-shrink: 0; }
.wbf-cb-btn {
  font-family: 'Instrument Sans', system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 4px;
  border: 1px solid var(--border-mid);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: auto;
  text-transform: none;
  letter-spacing: 0;
}
.wbf-cb-accept { background: var(--accent2); color: #fff; border-color: var(--accent2); }
.wbf-cb-accept:hover { background: #3355b0; }
.wbf-cb-decline { background: transparent; color: var(--ink); }
.wbf-cb-decline:hover { background: var(--border); }
.wbf-cb-btn:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; }

/* ── Screen-reader only ──────────────────────────────────────────────────── */
.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;
}

/* ── Compare label on cards ────────────────────────────────────────────────── */
.compare-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.compare-label input { accent-color: var(--accent2); cursor: pointer; }

/* ── Compare bar (fixed bottom) ────────────────────────────────────────────── */
.compare-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--accent2);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  box-shadow: 0 -2px 16px rgba(68,102,200,0.25);
}
.compare-bar-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.compare-bar-actions { display: flex; gap: 8px; }

.btn-compare-clear {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 14px;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.45);
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: border-color 0.15s;
}
.btn-compare-clear:hover { border-color: #fff; box-shadow: none; }

/* ── Comparison table ──────────────────────────────────────────────────────── */
#comparisonTable { margin-top: 20px; }
.compare-title {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.compare-scroll { overflow-x: auto; }
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.comparison-table th {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-mid);
  white-space: nowrap;
}
.comparison-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.comparison-table a { color: var(--accent2); text-decoration: none; }
.comparison-table a:hover { color: var(--accent); }
.comparison-table th small { font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; }
.compare-row-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  background: var(--card);
  min-width: 110px;
}
.feat-yes { color: #2a7a2a; font-weight: 600; }
.feat-no  { color: var(--muted); }
.compare-usd {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
}

/* ── Share menu popover ────────────────────────────────────────────────────── */
.share-wrap { position: relative; }
.share-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--card);
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(12,16,36,0.14);
  min-width: 190px;
  z-index: 150;
  overflow: hidden;
}
.share-menu[hidden] { display: none; }
.share-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  background: none;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  font-family: 'Instrument Sans', system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background 0.1s;
  min-height: auto;
}
.share-menu-item:last-child { border-bottom: none; }
.share-menu-item:hover { background: var(--accent-dim); }
.share-menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.share-menu-item svg { flex-shrink: 0; }
.share-menu-item.copied { color: #2a7a2a; }

/* ── Accessibility widget ─────────────────────────────────────────────────── */
#a11yWidget {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 200;
  font-family: 'Instrument Sans', system-ui, sans-serif;
}

#a11yBtn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(200,150,10,0.35);
  transition: background 0.15s, transform 0.1s;
  min-height: auto;
}
#a11yBtn:hover { background: #a87808; }
#a11yBtn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#a11yBtn[aria-expanded="true"] { background: #a87808; transform: scale(0.95); }

#a11yPanel {
  position: absolute;
  bottom: 54px;
  left: 0;
  width: 240px;
  background: var(--card);
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(12,16,36,0.15);
  padding: 14px 16px 12px;
}

.a11y-panel-title {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

.a11y-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.a11y-row:last-of-type { border-bottom: none; }

.a11y-label {
  font-size: 0.82rem;
  color: var(--ink);
  flex: 1;
}

.a11y-size-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}
.a11y-size-btn {
  border: 1px solid var(--border-mid);
  background: var(--card-inner);
  color: var(--ink);
  border-radius: 3px;
  padding: 3px 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.1s;
  min-height: auto;
}
.a11y-size-btn:hover { background: var(--accent-dim); border-color: var(--accent); }
.a11y-size-val {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--muted);
  min-width: 60px;
  text-align: center;
}

.a11y-toggle-row { cursor: pointer; }
.a11y-cb {
  width: 36px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 10px;
  background: var(--border-mid);
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.a11y-cb::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.a11y-cb:checked { background: var(--accent2); }
.a11y-cb:checked::after { transform: translateX(16px); }
.a11y-cb:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.a11y-reset {
  margin-top: 10px;
  width: 100%;
  padding: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--muted);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  min-height: auto;
}
.a11y-reset:hover { border-color: var(--accent); color: var(--ink); }

/* ── Accessibility modes ──────────────────────────────────────────────────── */
:root[data-text-size="1"] { font-size: 112%; }
:root[data-text-size="2"] { font-size: 128%; }

.a11y-high-contrast {
  --bg:          #000;
  --card:        #111;
  --card-inner:  #1a1a1a;
  --ink:         #ffffff;
  --muted:       #cccccc;
  --muted-light: #aaaaaa;
  --accent:      #ffd700;
  --accent-dim:  rgba(255,215,0,0.12);
  --accent2:     #6699ff;
  --border:      #444444;
  --border-mid:  #666666;
}
.a11y-high-contrast body { background-image: none; }
.a11y-high-contrast .card,
.a11y-high-contrast .rec,
.a11y-high-contrast #a11yPanel { border-color: #666; }

.a11y-dyslexia,
.a11y-dyslexia * {
  font-family: Georgia, 'Times New Roman', serif !important;
  letter-spacing: 0.06em;
  word-spacing: 0.12em;
  line-height: 1.75;
}

.a11y-reduce-motion *,
.a11y-reduce-motion *::before,
.a11y-reduce-motion *::after {
  transition: none !important;
  animation: none !important;
}
.a11y-reduce-motion .spinner { display: none; }

/* ── Reduced motion (OS preference) ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .spinner {
    animation: none;
    border-color: var(--accent);
    opacity: 0.7;
  }
}
