/* TravelPayLab — base stylesheet
   Plain CSS, no build step, no external fonts or CDNs. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --bg-sunken: #eef1f5;
  --text: #1a1f26;
  --text-soft: #55606e;
  --text-faint: #7b8794;
  --border: #dde3ea;
  --border-strong: #c4cdd8;
  --accent: #0f6b6b;
  --accent-hover: #0b5252;
  --accent-soft: #e3f2f1;
  --taxable: #2b6cb0;
  --taxable-soft: #dbeafe;
  --taxfree: #0f8a5f;
  --taxfree-soft: #d7f2e6;
  --warn: #a15c00;
  --warn-bg: #fff6e5;
  --warn-border: #f0cf95;
  --danger: #a3231b;
  --danger-bg: #fdecea;
  --danger-border: #f2b8b3;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .05);
  --maxw: 1120px;
  --readw: 720px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --bg-soft: #181e26;
    --bg-sunken: #1f2731;
    --text: #e9edf2;
    --text-soft: #aab5c2;
    --text-faint: #8794a3;
    --border: #2b3540;
    --border-strong: #3c4854;
    --accent: #4ecdc4;
    --accent-hover: #78ded6;
    --accent-soft: #14312f;
    --taxable: #7cb3ef;
    --taxable-soft: #1b2c42;
    --taxfree: #56d19b;
    --taxfree-soft: #123328;
    --warn: #f0c169;
    --warn-bg: #2d2410;
    --warn-border: #574421;
    --danger: #f39a92;
    --danger-bg: #331714;
    --danger-border: #5e2b26;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: clamp(1.85rem, 1.3rem + 2.2vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.7rem); margin-top: 2em; }
h3 { font-size: 1.15rem; margin-top: 1.6em; }
p { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.3em; }
li { margin-bottom: .4em; }
small { font-size: .85rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.read { max-width: var(--readw); }
.center { text-align: center; }
.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }

.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;
}

/* ---------- Skip link ---------- */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0;
}
.skip:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 62px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none;
  letter-spacing: -.02em;
}
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: .78rem; font-weight: 800;
}
@media (prefers-color-scheme: dark) { .brand .mark { color: #0b1114; } }

.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.nav a {
  color: var(--text-soft); text-decoration: none; font-size: .93rem;
  padding: 6px 10px; border-radius: var(--radius-sm);
}
.nav a:hover { background: var(--bg-soft); color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

/* ---------- Hero ---------- */
.hero { padding: 44px 0 26px; }
.hero h1 { margin-bottom: .35em; }
.hero .lede { font-size: 1.1rem; color: var(--text-soft); max-width: 62ch; margin-bottom: 1em; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  font-size: .8rem; padding: 4px 10px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-soft);
}

/* ---------- Calculator ---------- */
.calc {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px; align-items: start; margin-bottom: 36px;
}
@media (max-width: 900px) { .calc { grid-template-columns: 1fr; } }

.panel {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.panel + .panel { margin-top: 18px; }
.panel h2, .panel h3 { margin-top: 0; }
.panel-title {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .07em;
  font-weight: 700; color: var(--text-faint); margin: 0 0 14px;
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .field-grid { grid-template-columns: 1fr; } }
.field-grid .span2 { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: .86rem; font-weight: 600; color: var(--text-soft); }
.field .hint { font-size: .76rem; color: var(--text-faint); line-height: 1.4; }

/* Base control styling MUST come before the .input-money overrides below:
   `.input-money input` and `input[type="number"]` have identical specificity,
   so whichever is declared last wins. With the order reversed, the shorthand
   `padding` here wiped out the padding-left that makes room for the "$". */
input[type="number"], input[type="text"], input[type="email"], select, textarea {
  width: 100%; font: inherit; font-size: .97rem;
  padding: 9px 11px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); appearance: none;
}

/* Hide the number spinners — they collide with the currency affixes. */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.input-money { position: relative; display: flex; align-items: center; }
.input-money .prefix, .input-money .suffix {
  position: absolute; color: var(--text-faint); font-size: .95rem;
  pointer-events: none; line-height: 1; user-select: none;
}
.input-money .prefix { left: 12px; }
.input-money .suffix { right: 12px; }
.input-money input { padding-left: 27px; }
.input-money.has-suffix input { padding-right: 34px; }
.input-money.no-prefix input { padding-left: 11px; }

select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%), linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
textarea { min-height: 130px; resize: vertical; }

.btn {
  display: inline-block; font: inherit; font-weight: 600; font-size: .95rem;
  padding: 10px 18px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  text-decoration: none;
}
@media (prefers-color-scheme: dark) { .btn { color: #08120f; } }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
@media (prefers-color-scheme: dark) { .btn:hover { color: #08120f; } }
.btn-ghost { background: transparent; color: var(--text-soft); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-sunken); color: var(--text); border-color: var(--border-strong); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

details.advanced { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
details.advanced > summary {
  cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--accent); list-style: none;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: "▸ "; }
details.advanced[open] > summary::before { content: "▾ "; }
details.advanced .field-grid { margin-top: 14px; }

/* ---------- Results ---------- */
.result-hero {
  background: var(--accent-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.result-hero .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--text-soft); }
.result-hero .big { font-size: clamp(2rem, 1.4rem + 2.4vw, 2.7rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: 2px 0; }
.result-hero .sub { font-size: .9rem; color: var(--text-soft); }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (max-width: 620px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 12px;
}
.kpi .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; }
.kpi .v { font-size: 1.18rem; font-weight: 700; letter-spacing: -.02em; }
.kpi .n { font-size: .75rem; color: var(--text-faint); }

/* split bar */
.split { margin: 4px 0 18px; }
.split-bar {
  display: flex; height: 26px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-sunken);
}
.split-bar span { display: block; height: 100%; transition: width .25s ease; }
.split-bar .s-tax { background: var(--taxable); }
.split-bar .s-free { background: var(--taxfree); }
.split-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .82rem; margin-top: 7px; color: var(--text-soft); }
.split-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.split-legend .l-tax i { background: var(--taxable); }
.split-legend .l-free i { background: var(--taxfree); }

/* breakdown table */
.brk { width: 100%; border-collapse: collapse; font-size: .93rem; }
.brk th, .brk td { padding: 8px 0; border-bottom: 1px solid var(--border); text-align: right; }
.brk th { text-align: left; font-weight: 500; color: var(--text-soft); }
.brk td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.brk tr.total th, .brk tr.total td { font-weight: 700; color: var(--text); border-bottom: 0; border-top: 2px solid var(--border-strong); }
.brk tr.sub th { padding-left: 14px; font-size: .88rem; color: var(--text-faint); }
.brk caption { caption-side: top; text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--text-faint); padding-bottom: 8px; }

/* alerts */
.alert {
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: .9rem;
  border: 1px solid; margin-bottom: 12px; line-height: 1.5;
}
.alert strong { display: block; margin-bottom: 2px; }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.alert-info { background: var(--bg-sunken); border-color: var(--border); color: var(--text-soft); }
.alert a { color: inherit; }

.disclaimer-strip {
  font-size: .85rem; color: var(--text-soft); background: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; margin: 18px 0 0;
}

/* ---------- Prose ---------- */
.prose { max-width: var(--readw); }
.prose h2 { scroll-margin-top: 80px; }
.prose h3 { scroll-margin-top: 80px; }
.prose ul li::marker { color: var(--accent); }
.prose blockquote {
  margin: 1.4em 0; padding: 2px 0 2px 16px;
  border-left: 3px solid var(--accent); color: var(--text-soft); font-style: italic;
}
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 1.2em 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--bg-soft); font-weight: 600; }
.table-scroll { overflow-x: auto; margin: 1.2em 0; -webkit-overflow-scrolling: touch; }
.table-scroll table { margin: 0; }
.prose code {
  font-family: var(--mono); font-size: .87em;
  background: var(--bg-sunken); padding: 1px 5px; border-radius: 4px;
}
.callout {
  background: var(--bg-soft); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 14px 16px; margin: 1.5em 0; font-size: .95rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout .callout-title { font-weight: 700; margin-bottom: .4em; }

.sources { font-size: .88rem; }
.sources ol { padding-left: 1.4em; }
.sources li { margin-bottom: .45em; color: var(--text-soft); }
.sources a { word-break: break-word; }

/* ---------- Blog ---------- */
.post-meta { font-size: .88rem; color: var(--text-faint); margin-bottom: 1.4em; }
.post-meta span + span::before { content: " · "; }

.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; margin: 26px 0; }
.card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  background: var(--bg-soft); display: flex; flex-direction: column;
}
.card h3 { margin: 0 0 .4em; font-size: 1.05rem; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card p { font-size: .92rem; color: var(--text-soft); margin-bottom: .8em; }
.card .card-foot { margin-top: auto; font-size: .8rem; color: var(--text-faint); }

.next-prev { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 2.5rem; }
@media (max-width: 620px) { .next-prev { grid-template-columns: 1fr; } }

.cta-box {
  border: 1px solid var(--border); background: var(--accent-soft);
  border-radius: var(--radius); padding: 18px 20px; margin: 2rem 0;
}
.cta-box h3 { margin-top: 0; }
.cta-box p:last-child { margin-bottom: 0; }

/* ---------- Ad slots (reserved, empty until AdSense code is pasted in) ---------- */
.ad-slot { margin: 28px auto; text-align: center; max-width: 100%; overflow: hidden; }
.ad-slot:empty { display: none; }
.ad-slot > ins { display: block; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); background: var(--bg-soft);
  margin-top: 60px; padding: 34px 0 40px; font-size: .9rem; color: var(--text-soft);
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; gap: 18px; } }
.site-footer h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); margin-bottom: .7em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .35em; }
.site-footer a { color: var(--text-soft); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.footer-legal { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); font-size: .82rem; color: var(--text-faint); }

/* ---------- Contact form (mailto, no backend) ---------- */
.form-note { font-size: .88rem; color: var(--text-soft); }

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .ad-slot, .btn-row, .nav { display: none !important; }
  body { font-size: 12pt; }
  .calc { grid-template-columns: 1fr; }
}
