/* ==========================================================================
   TheSalaryCalc — Design tokens
   Direction: boarding-pass / customs-ledger. Precise, cross-border, trustworthy.
   ========================================================================== */

:root {
  /* Color */
  --ink: #1C1E20;
  --ink-soft: #55585C;
  --paper: #F7F7F6;
  --paper-raised: #FFFFFF;
  --accent: #3D6B94;
  --accent-deep: #1F3A54;
  --teal: #0F6E56;
  --warn: #8C3B2E;
  --line: #E3E3E1;
  --line-strong: #C9C9C6;

  /* Type */
  --font-display: "Public Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Public Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Public Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Scale */
  --step-0: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.75rem, 1.5rem + 1vw, 2.25rem);
  --step-3: clamp(2.25rem, 1.85rem + 1.8vw, 3.25rem);
  --step-4: clamp(2.75rem, 2.1rem + 2.8vw, 4.25rem);

  --radius: 3px;
  --max-w: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; color: var(--ink-soft); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Focus visibility — never suppressed */
:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Header / boarding strip ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper-raised);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 0.6rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--accent-deep); }
.brand .dot { color: var(--accent); }

.region-nav {
  display: flex;
  gap: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.region-nav a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.5rem 0.85rem;
  border-left: 1px solid var(--line);
}
.region-nav a:first-child { border-left: none; }
.region-nav a:hover,
.region-nav a[aria-current="true"] {
  background: var(--ink);
  color: var(--paper-raised);
}

/* ---------- Hero ---------- */
.hero {
  padding: 4.5rem 0 3.5rem;
  border-bottom: 1px dashed var(--line-strong);
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1rem;
  display: inline-block;
}
.hero p.lede {
  font-size: 1.15rem;
  max-width: 42ch;
}

/* ---------- Boarding-pass ticket card (the signature element) ---------- */
.ticket {
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 1fr auto;
  position: relative;
  box-shadow: 0 1px 0 var(--line);
}
.ticket::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  right: 220px;
  border-left: 1px dashed var(--line-strong);
}
.ticket-notch {
  position: absolute;
  right: 220px;
  width: 18px; height: 18px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  transform: translateX(-50%);
}
.ticket-notch.top { top: -9px; }
.ticket-notch.bottom { bottom: -9px; }

.ticket-main { padding: 2rem 2rem 2rem 2rem; }
.ticket-stub {
  width: 220px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.35rem;
}
.stub-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.stub-value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--teal);
}
.stub-value.is-capped { color: var(--warn); }

@media (max-width: 640px) {
  .ticket { grid-template-columns: 1fr; }
  .ticket::after, .ticket-notch { display: none; }
  .ticket-stub { width: auto; border-top: 1px dashed var(--line-strong); }
}

/* ---------- Calculator form ---------- */
.calc-form {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 640px) { .calc-form { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field input,
.field select {
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0.75rem 0.75rem;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
.field input:focus,
.field select:focus { background: var(--paper-raised); }
.field-full { grid-column: 1 / -1; }
.field-hint { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.15rem; }

.btn {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper-raised);
  border: none;
  border-radius: var(--radius);
  padding: 0.9rem 1.5rem;
  min-height: 44px;
  cursor: pointer;
  width: 100%;
}
@media (min-width: 641px) { .btn { width: auto; } }
.btn:hover { background: var(--accent-deep); }

/* ---------- Ledger result ---------- */
.ledger { margin-top: 2rem; border-top: 1px dashed var(--line-strong); padding-top: 1.5rem; }
.ledger-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.92rem;
}
.ledger-row .label { color: var(--ink-soft); }
.ledger-row .value { font-weight: 600; }
.ledger-row.total {
  border-bottom: none;
  border-top: 1px solid var(--ink);
  margin-top: 0.4rem;
  padding-top: 0.85rem;
  font-size: 1.15rem;
}
.ledger-row.total .value { color: var(--teal); }
.ledger-row.total .value.is-capped { color: var(--warn); }
.ledger-note {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 0.75rem;
}

.notice {
  border-left: 3px solid var(--accent);
  background: var(--paper-raised);
  padding: 1rem 1.25rem;
  font-size: 0.92rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
}
.notice.warn { border-left-color: var(--warn); }
.notice p:last-child { margin-bottom: 0; }

/* ---------- Content sections ---------- */
.section { padding: 3.5rem 0; }
.section-border { border-top: 1px solid var(--line); }
.two-col {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 3rem;
}
@media (max-width: 780px) { .two-col { grid-template-columns: 1fr; gap: 1.5rem; } }

.toc {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  position: sticky;
  top: 1.5rem;
}
@media (max-width: 780px) {
  .toc {
    position: static;
    top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px dashed var(--line-strong);
  }
  .toc a { padding: 0.15rem 0; }
}
.toc a { display: block; color: var(--ink-soft); text-decoration: none; padding: 0.3rem 0; }
.toc a:hover { color: var(--accent-deep); }

table.rate-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  margin: 1.5rem 0;
}
@media (max-width: 480px) {
  table.rate-table { display: block; overflow-x: auto; white-space: nowrap; }
}
table.rate-table th, table.rate-table td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line);
}
table.rate-table th {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

/* ---------- Country picker cards ---------- */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line-strong);
  border: 1px solid var(--line-strong);
}
.country-card {
  background: var(--paper-raised);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--ink);
  display: block;
  transition: background 0.15s ease;
}
.country-card:hover { background: var(--paper); }
.country-card .flag-code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  text-transform: uppercase;
}
.country-card h3 { margin: 0.4rem 0 0.3rem; font-size: 1.1rem; }
.country-card .status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.country-card.soon { opacity: 0.55; cursor: default; }
.country-card.soon:hover { background: var(--paper-raised); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-raised);
  padding: 2.5rem 0;
  margin-top: 3rem;
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.85rem;
}
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--accent-deep); }
.footer-disclaimer {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 1.5rem;
  max-width: 70ch;
}
