/* Citizenship Date. The pale green-grey of security paper, passport navy ink, a
   green that means "go" and a calendar red that only ever marks dates.
   System fonts, so the page paints at once. */

:root {
  --paper: #eef2f0;
  --card: #ffffff;
  --ink: #14223a;
  --body: #36434f;
  --muted: #56636b;
  --rule: #d3dbd8;
  --rule-soft: #e5ebe8;
  --field: #ffffff;
  --field-border: #7f8c88;
  --accent: #1d6a4f;
  --accent-ink: #ffffff;
  --accent-soft: #e2efe8;
  --leaf: #b3283a;
  --warn: #85570a;
  --warn-soft: #f8eed8;
  --bad: #a33a2b;
  --bad-soft: #f9e5e0;
  --shadow: 0 1px 2px rgba(20, 33, 43, .06), 0 12px 32px -16px rgba(20, 33, 43, .28);
  --serif: "Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, Georgia, serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1519;
    --card: #172027;
    --ink: #eef2f3;
    --body: #c3ccd0;
    --muted: #9aa6ac;
    --rule: #2b373f;
    --rule-soft: #1f2a31;
    --field: #10181d;
    --field-border: #6a7880;
    --accent: #5cc49a;
    --accent-ink: #0b1a14;
    --accent-soft: #15302a;
    --leaf: #d8664f;
    --warn: #e5b663;
    --warn-soft: #2f2615;
    --bad: #ef8d79;
    --bad-soft: #36211c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1519;
  --card: #172027;
  --ink: #eef2f3;
  --body: #c3ccd0;
  --muted: #9aa6ac;
  --rule: #2b373f;
  --rule-soft: #1f2a31;
  --field: #10181d;
  --field-border: #6a7880;
  --accent: #5cc49a;
  --accent-ink: #0b1a14;
  --accent-soft: #15302a;
  --leaf: #d8664f;
  --warn: #e5b663;
  --warn-soft: #2f2615;
  --bad: #ef8d79;
  --bad-soft: #36211c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--ink); margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
strong { color: var(--ink); font-weight: 650; }
svg { flex: none; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.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 {
  position: absolute; left: 16px; top: -60px; z-index: 20;
  background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 8px;
}
.skip:focus { top: 12px; }

.wrap {
  width: 100%; max-width: 1100px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 720px) {
  .wrap { padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
}

.eyebrow {
  font-size: .76rem; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.hint { font-size: .9rem; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Header and hero ---------- */

header.site { padding: 18px 0 0; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.2rem;
}
.brand-mark { width: 30px; height: 30px; color: var(--ink); }

.hero { padding-top: 40px; padding-bottom: 28px; display: flex; flex-direction: column; gap: 14px; }
.hero h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(2.25rem, 7vw, 3.7rem); line-height: 1.04; letter-spacing: -.015em; max-width: 16ch;
}
.lede { font-size: 1.12rem; max-width: 60ch; }

/* ---------- Layout ---------- */

.layout { display: grid; gap: 20px; align-items: start; }
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; }
  .result-col { position: sticky; top: 20px; }
}

/* ---------- Form ---------- */

.form { padding: 4px 16px 18px; }
@media (min-width: 720px) { .form { padding: 10px 30px 26px; } }

.step { border: 0; margin: 0; padding: 22px 0 24px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.step + .step { border-top: 1px solid var(--rule-soft); }
.step legend {
  float: left; width: 100%; padding: 0;
  display: flex; align-items: center; gap: 12px;
  font-family: var(--serif); font-size: 1.32rem; font-weight: 700; color: var(--ink);
}
.step legend + * { clear: both; }
.step-num {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: .86rem; font-weight: 700;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label { font-weight: 600; color: var(--ink); font-size: .95rem; }

input[type="date"], input[type="text"], input[type="email"], textarea {
  width: 100%; min-width: 0;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--field);
  border: 1.5px solid var(--field-border);
  border-radius: 10px;
  padding: 11px 12px;
  min-height: 48px;
  -webkit-appearance: none; appearance: none;
}
input[type="date"] { display: block; line-height: 1.3; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
textarea { resize: vertical; line-height: 1.45; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; }
input:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[aria-invalid="true"] { border-color: var(--bad); }
.field > input[type="date"] { max-width: 260px; }

.options { display: grid; gap: 10px; }
@media (min-width: 520px) { .options { grid-template-columns: 1fr 1fr; } }
.option {
  position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px;
  padding: 14px 16px; border: 1.5px solid var(--rule); border-radius: 12px; cursor: pointer;
  font-weight: 400; background: var(--field);
}
.option input { grid-row: span 2; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.option-title { font-weight: 700; color: var(--ink); }
.option-text { font-size: .9rem; color: var(--muted); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Trips: each row lays itself out from its own width. Narrow rows put the
   two dates side by side, the place below, and remove beside the day count. */
.trips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; container-type: inline-size; }
.trip {
  display: grid; gap: 8px 10px; align-items: end;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "left back" "where where" "meta remove";
  padding: 10px; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper);
}
.trip .remove { justify-self: end; align-self: center; }
@container (min-width: 600px) {
  .trip {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr) 44px;
    grid-template-areas: "left back where remove" "meta meta meta meta";
  }
  .trip .remove { align-self: end; }
}
.trip .f-left { grid-area: left; }
.trip .f-back { grid-area: back; }
.trip .f-where { grid-area: where; }
.trip label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.trip input { min-height: 44px; padding: 9px 10px; }
.trip input[type="date"] { padding: 9px 8px; }
.trip-meta { grid-area: meta; align-self: center; font-size: .85rem; color: var(--muted); min-height: 1.2em; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.trip-meta .bad { color: var(--bad); font-weight: 600; }
.trip-meta .warn { color: var(--warn); font-weight: 600; }
.remove {
  grid-area: remove; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
}
.remove:hover { background: var(--rule-soft); color: var(--ink); }
.remove svg { width: 18px; height: 18px; }

.row-actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.paste { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px dashed var(--field-border); border-radius: 12px; }
.paste-status { font-size: .9rem; color: var(--muted); }

.saved {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding-top: 16px; border-top: 1px solid var(--rule-soft); font-size: .88rem; color: var(--muted);
}
.saved svg { width: 18px; height: 18px; }

.confirm, .example-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 12px 14px; border-radius: 12px; font-size: .92rem;
}
.confirm { margin-top: 12px; background: var(--bad-soft); color: var(--ink); }
.example-note { margin-top: 18px; background: var(--warn-soft); color: var(--ink); }
.example-note .btn-text { min-height: 0; padding: 2px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 10px;
  font: inherit; font-size: .95rem; font-weight: 650; cursor: pointer; text-decoration: none;
  border: 1.5px solid transparent;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-quiet { background: var(--card); color: var(--ink); border-color: var(--field-border); }
.btn-quiet:hover { background: var(--rule-soft); }
.btn-danger { background: var(--bad); color: var(--card); }
.btn-text {
  background: none; border: 0; padding: 6px 2px; min-height: 44px;
  font: inherit; font-size: .92rem; font-weight: 600; color: var(--accent); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.saved .btn-text { min-height: 0; padding: 2px; font-size: .88rem; }

/* ---------- Result ---------- */

.result { padding: 22px; display: flex; flex-direction: column; }
@media (min-width: 720px) { .result { padding: 28px; } }
#result-body { display: flex; flex-direction: column; gap: 20px; }

.empty { display: flex; gap: 18px; align-items: center; }
.empty p { color: var(--muted); }
.empty strong { display: block; font-family: var(--serif); font-size: 1.3rem; color: var(--ink); margin-bottom: 4px; }

.answer { display: flex; gap: 18px; align-items: center; }
.leaf {
  flex: none; width: 96px; border-radius: 12px; overflow: hidden; text-align: center;
  background: var(--field); border: 1px solid var(--rule); box-shadow: var(--shadow);
}
.leaf-month { background: var(--leaf); color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 5px 4px; }
.leaf-day { font-family: var(--serif); font-size: 2.9rem; line-height: 1; font-weight: 700; color: var(--ink); padding: 8px 0 2px; font-variant-numeric: lining-nums; }
.leaf-weekday { font-size: .72rem; color: var(--muted); padding: 0 4px 8px; }
.leaf.blank .leaf-month { background: var(--rule); color: var(--muted); }
.leaf.blank .leaf-day { color: var(--rule); }

.answer-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.answer-date { font-family: var(--serif); font-size: clamp(1.5rem, 4.6vw, 1.95rem); line-height: 1.15; font-weight: 700; color: var(--ink); }
.pill {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  font-size: .82rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.pill.go { background: var(--accent-soft); color: var(--accent); }
.pill.wait { background: var(--rule-soft); color: var(--ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

.why { font-size: 1rem; }

.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--rule-soft); }
.checks li { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--rule-soft); }
.checks li:last-child { border-bottom: 0; }
.check-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.check-icon svg { width: 14px; height: 14px; }
.check-icon.ok { background: var(--accent-soft); color: var(--accent); }
.check-icon.warn { background: var(--warn-soft); color: var(--warn); }
.check-icon.bad { background: var(--bad-soft); color: var(--bad); }
.check-title { font-weight: 650; color: var(--ink); }
.check-text { font-size: .9rem; color: var(--muted); }

.callout { border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; font-size: .95rem; }
.callout h3 { font-size: 1rem; }
.callout.warn { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.callout.warn h3 { color: var(--warn); }
.callout.bad { background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent); }
.callout.bad h3 { color: var(--bad); }
.callout ul { margin: 4px 0 0; padding-left: 20px; }

.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.footnote { font-size: .86rem; color: var(--muted); }

/* ---------- Trip list ---------- */

#list-section { margin-top: 28px; }
.list { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 720px) { .list { padding: 28px; } }
.list-head { display: flex; flex-wrap: wrap; gap: 14px 24px; justify-content: space-between; align-items: flex-end; }
.list-head h2 { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 4px; }
.list-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; min-width: 520px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
thead th { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 650; background: var(--rule-soft); }
tbody td { color: var(--ink); font-variant-numeric: tabular-nums; }
tfoot th, tfoot td { border-bottom: 0; font-weight: 700; color: var(--ink); background: var(--rule-soft); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td .tag { display: inline-block; margin-left: 8px; font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.tag.planned { background: var(--rule-soft); color: var(--muted); }
.tag.presumption { background: var(--warn-soft); color: var(--warn); }
.tag.break { background: var(--bad-soft); color: var(--bad); }

/* ---------- Signup ---------- */

.signup {
  margin-top: 28px; padding: 26px 22px; display: grid; gap: 22px;
  background: linear-gradient(160deg, var(--accent-soft), var(--card) 70%);
}
@media (min-width: 900px) { .signup { grid-template-columns: 1.1fr 1fr; align-items: center; padding: 34px; gap: 36px; } }
.signup-copy { display: flex; flex-direction: column; gap: 10px; }
.signup h2 { font-family: var(--serif); font-size: clamp(1.45rem, 4vw, 1.9rem); line-height: 1.15; }
.signup-form { display: flex; flex-direction: column; gap: 8px; }
.signup-row { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 520px) { .signup-row { flex-direction: row; } .signup-row input { flex: 1; } }
.signup-status { font-weight: 600; color: var(--accent); min-height: 1.4em; }
.signup-form .btn-primary:disabled { opacity: .6; cursor: progress; }
/* The bot trap: off screen, out of the tab order, hidden from screen readers. */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.signup-status.bad { color: var(--bad); }

/* ---------- FAQ ---------- */

.faq { margin-top: 56px; display: flex; flex-direction: column; }
.faq h2 { font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 2.1rem); margin-bottom: 14px; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  list-style: none; cursor: pointer; padding: 18px 36px 18px 0; position: relative;
  font-weight: 650; color: var(--ink); font-size: 1.04rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 6px; top: 50%; width: 10px; height: 10px; margin-top: -7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.answer-text { padding: 0 0 20px; display: flex; flex-direction: column; gap: 10px; max-width: 70ch; }
.answer-text ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.cite { font-size: .86rem; color: var(--muted); }

/* ---------- Footer ---------- */

footer.site { margin-top: 56px; padding: 26px 0 120px; border-top: 1px solid var(--rule); font-size: .88rem; color: var(--muted); }
footer.site .wrap { display: flex; flex-direction: column; gap: 10px; max-width: 820px; margin-left: 0; }
@media (min-width: 1100px) { footer.site .wrap { margin-left: auto; margin-right: auto; max-width: 1100px; } }
footer.site strong { color: var(--body); }

/* ---------- Phone peek bar ---------- */

.peek {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--ink); color: var(--paper);
  transform: translateY(110%); transition: transform .22s ease;
}
.peek[data-show="true"] { transform: none; }
.peek-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.peek-label { font-size: .74rem; opacity: .75; }
.peek-date { font-weight: 700; font-size: 1.02rem; }
.peek .btn-primary { background: var(--paper); color: var(--ink); }
@media (min-width: 960px) { .peek { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .peek, .faq summary::after { transition: none; }
}

/* ---------- Print: the answer and the trip list, nothing else ---------- */

@media print {
  :root { --paper: #fff; --card: #fff; --shadow: none; }
  body { font-size: 12pt; }
  header.site, .hero .lede, .form, .signup, .faq, .peek, .skip, .list-actions, .result-actions, footer.site p:last-child { display: none !important; }
  .hero { padding: 0 0 12pt; }
  .hero h1 { font-size: 20pt; max-width: none; }
  .layout { display: block; }
  .card { border: 0; box-shadow: none; padding: 0 !important; }
  .result-col { position: static; }
  #list-section { margin-top: 18pt; }
  .tablewrap { overflow: visible; border: 1px solid #999; }
  table { min-width: 0; }
  footer.site { margin-top: 18pt; padding: 0; border: 0; }
}
