/* SchengenCount — design tokens (see docs/design/site-002-design-system.md) */
:root {
  --bg: #f7f6f2; --surface: #ffffff; --surface-2: #f1efe8; --ink: #16202a; --muted: #4d5b68; --line: #dcd9d0;
  --brand: #1d4ed8; --brand-hover: #1e40af; --brand-ink: #ffffff; --brand-soft: #e6edff;
  --ok: #157347; --ok-soft: #e3f4ea; --warn: #8a4f00; --warn-soft: #fdf0dc; --bad: #b42318; --bad-soft: #fde8e6;
  --day-in: #1d4ed8; --day-plan: #7c3aed; --day-out: #e4e1d7; --focus: #f59e0b;
  --r: 10px; --r-sm: 8px; --shadow: 0 1px 2px rgb(16 24 40 / .06), 0 1px 3px rgb(16 24 40 / .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419; --surface: #172029; --surface-2: #1d2833; --ink: #e8ecef; --muted: #a7b3bd; --line: #2f3c48;
    --brand: #8fb3ff; --brand-hover: #b3cbff; --brand-ink: #0f1419; --brand-soft: #1c2a44;
    --ok: #5fd39a; --ok-soft: #12301f; --warn: #f2b45a; --warn-soft: #352711; --bad: #ff8a80; --bad-soft: #3a1714;
    --day-in: #8fb3ff; --day-plan: #c4a5ff; --day-out: #2a3641;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
img, svg { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.25rem); }
h2 { font-size: 1.375rem; margin-top: 1.75em; }
h3 { font-size: 1.125rem; margin-top: 1.5em; }
p, ul, ol { margin: 0 0 1em; }
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 16px; }
.prose { max-width: 42rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--surface); color: var(--ink); padding: 8px 12px; border-radius: var(--r-sm); z-index: 10; }
.skip-link:focus { top: 8px; }
main { display: block; padding: 24px 0 48px; }
main:focus { outline: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand-mark { color: var(--brand); flex: none; }
@media (prefers-color-scheme: dark) { .brand-mark { color: #2f5fd8; } }
.site-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a { display: block; padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 500; }
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.nav-toggle { display: none; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--r-sm); font: inherit; font-weight: 600; cursor: pointer; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 16px; height: 2px; background: currentColor; position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -5px; } .nav-toggle-bars::after { top: 5px; }
@media (max-width: 759px) {
  .js .nav-toggle { display: inline-flex; }
  .js .site-nav { display: none; width: 100%; padding-bottom: 12px; }
  .js .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; }
}

/* Hero & layout */
.hero { padding: 8px 0 16px; }
.hero p.lead { font-size: 1.125rem; color: var(--muted); max-width: 46rem; }
.tool { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .tool { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
  .trips-card { grid-column: 1; grid-row: 1; } .results-card { grid-column: 2; grid-row: 1; }
  .planner-card { grid-column: 1; grid-row: 2; } .window-card { grid-column: 2; grid-row: 2; }
}
.tool > .card { margin-top: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { margin-top: 0; font-size: 1.2rem; }
.card + .card { margin-top: 20px; }
.section { margin-top: 32px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .label { font-weight: 600; font-size: .95rem; }
.hint { font-size: .85rem; color: var(--muted); }
input[type="date"], input[type="text"], input[type="number"], select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #8b96a1; border-radius: var(--r-sm);
  min-height: 44px; padding: 8px 10px; width: 100%; min-width: 0;
}
@media (prefers-color-scheme: dark) { input[type="date"], input[type="text"], input[type="number"], select { border-color: #5d6b78; } }
input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.field-error { color: var(--bad); font-size: .875rem; font-weight: 600; }
.field-error:empty { display: none; }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 420px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.check input { width: 20px; height: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); color: var(--brand-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-link { background: none; border: none; color: var(--brand); padding: 0 8px; text-decoration: underline; }
.btn-danger { background: none; color: var(--bad); border-color: transparent; text-decoration: underline; padding: 0 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Trip list */
.trip-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.trip { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.trip-dates { font-weight: 600; font-variant-numeric: tabular-nums; }
.trip-meta { color: var(--muted); font-size: .9rem; }
.trip-actions { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: center; gap: 0; }
.trip.is-editing { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.chip { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.chip-planned { background: #efe7ff; color: #5b21b6; } .chip-ongoing { background: var(--brand-soft); color: var(--brand); } .chip-over { background: var(--bad-soft); color: var(--bad); }
@media (prefers-color-scheme: dark) { .chip-planned { background: #2c2142; color: #d7c4ff; } }
.empty { padding: 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r-sm); color: var(--muted); margin-top: 16px; }

/* Results */
.big { font-size: 3rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.gauge { height: 12px; background: var(--day-out); border-radius: 999px; overflow: hidden; margin: 12px 0 6px; }
.gauge > span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.gauge.warn > span { background: var(--warn); } .gauge.bad > span { background: var(--bad); }
.status { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--r-sm); margin: 12px 0; font-weight: 500; }
.status svg { flex: none; margin-top: 2px; }
.status-ok { background: var(--ok-soft); color: var(--ok); } .status-warn { background: var(--warn-soft); color: var(--warn); } .status-bad { background: var(--bad-soft); color: var(--bad); }
.status p { margin: 0; color: var(--ink); }
.facts { display: grid; gap: 0; margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); } .facts dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* Window strip */
.strip-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin: 8px 0; }
.strip-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.strip { display: grid; gap: 6px; }
.strip-month { display: grid; grid-template-columns: 3.2rem 1fr; gap: 8px; align-items: center; }
.strip-month-label { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip-days { display: grid; grid-template-columns: repeat(31, minmax(0, 1fr)); gap: 2px; }
.strip-days i { display: block; aspect-ratio: 1; border-radius: 2px; background: var(--day-out); min-width: 0; }
.strip-days i.in { background: var(--day-in); } .strip-days i.plan { background: var(--day-plan); }
.strip-days i.ref { outline: 2px solid var(--ink); outline-offset: 0; }
.strip-days i.blank { background: transparent; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; }
.table-wrap { overflow-x: auto; }
details > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* Notices */
.notice { padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); }
.notice-info { border-color: transparent; background: var(--brand-soft); }
.notice-warn { background: var(--warn-soft); border-color: transparent; }
.notice-error { background: var(--bad-soft); border-color: transparent; color: var(--ink); }
.notice-error strong { color: var(--bad); }
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r-sm); display: flex; gap: 12px; align-items: center; z-index: 20; max-width: calc(100% - 32px); }
.toast button { background: none; border: 0; color: inherit; text-decoration: underline; font: inherit; font-weight: 700; min-height: 36px; cursor: pointer; }

/* Article */
.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(20px, 4vw, 40px); }
.article > *:first-child { margin-top: 0; }
.article .meta { color: var(--muted); font-size: .9rem; }
.breadcrumb { font-size: .875rem; margin-bottom: 12px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.cta { margin: 28px 0 0; padding: 20px; border-radius: var(--r); background: var(--brand-soft); display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cta p { margin: 0; font-weight: 600; }
.example { border-left: 4px solid var(--brand); background: var(--surface-2); padding: 12px 16px; border-radius: 0 var(--r-sm) var(--r-sm) 0; margin: 0 0 1em; }
.sources { font-size: .9rem; }
.sources li { overflow-wrap: anywhere; }
details.faq { border-bottom: 1px solid var(--line); padding: 4px 0; }
details.faq > div { padding: 0 0 12px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.explainer { margin-top: 40px; }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 32px 0 16px; }
.footer-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-brand { font-weight: 800; font-size: 1.1rem; margin-bottom: 4px; }
.footer-heading { font-weight: 700; margin-bottom: 8px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li a { display: inline-block; padding: 6px 0; }
.footer-base { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; }

/* Ads (only rendered when enabled) */
.ad-slot { margin: 32px auto; min-height: 280px; text-align: center; }
.ad-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .06em; }

@media (prefers-reduced-motion: no-preference) { .btn, .site-nav a { transition: background-color .15s, color .15s; } }

/* Print */
.print-only { display: none; }
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --muted: #333; --line: #bbb; }
  .site-header, .site-footer, .no-print, .ad-slot, .skip-link, .toast, .explainer { display: none !important; }
  .print-only { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
  .tool { display: block; }
  details { display: block; } details > summary { display: none; }
  details[open] > *, details > * { display: block; }
  a { color: #000; }
}
.lg-in { background: var(--day-in); } .lg-plan { background: var(--day-plan); } .lg-out { background: var(--day-out); }
.field-end { justify-content: flex-end; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.file-input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.plan-out { margin-top: 12px; }
.sources li, .article ul li { margin-bottom: 8px; }
.grid-2 .card { margin: 0; text-decoration: none; color: var(--ink); }
.grid-2 .card strong { color: var(--brand); }
.grid-2 .card:hover { border-color: var(--brand); }
