:root {
  --bg: #EEF3F8;
  --paper: #FFFFFF;
  --ink: #18233A;
  --muted: #5E6B80;
  --line: #D4DCE6;
  --sea: #0B6E79;
  --sea-ink: #FFFFFF;
  --stamp: #C2343E;
  --radius: 18px;
  --display: 'Secular One', 'Assistant', system-ui, sans-serif;
  --body: 'Assistant', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1726; --paper: #182236; --ink: #E8EEF6; --muted: #9AA8BC;
    --line: #2C3A52; --sea: #3DB3BF; --sea-ink: #0F1726; --stamp: #FF6B73;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 17px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
.top {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 980px; margin: 0 auto; padding: 18px 16px;
}
.brand { font: 400 20px/1 var(--display); }
.lang {
  background: none; border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 6px 14px; font: 600 14px var(--body); cursor: pointer;
}
main { max-width: 980px; margin: 0 auto; padding: 8px 16px 48px; }
h1 {
  font: 400 clamp(30px, 5vw, 48px)/1.12 var(--display);
  margin: 18px 0 10px; max-width: 22ch; letter-spacing: -0.01em;
}
.lede { color: var(--muted); max-width: 60ch; margin: 0 0 28px; }

/* The boarding pass: ticket + stub, joined by a perforation. */
.pass {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  background: var(--paper); border-radius: var(--radius);
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px rgba(24, 35, 58, .35);
  position: relative;
}
.ticket { padding: 26px 28px; }
/* grid and flex children must be allowed to shrink below their inputs' natural width */
.pass > section, .port, .field, .route > * { min-width: 0; }
.port input, .field input, .field select { min-width: 0; max-width: 100%; }
.port input { width: 100%; }
.stub {
  padding: 26px 24px; position: relative;
  border-inline-start: 2px dashed var(--line);
  display: flex; flex-direction: column; gap: 16px;
}
/* punched notches at the perforation */
.stub::before, .stub::after {
  content: ''; position: absolute; inset-inline-start: -13px;
  width: 24px; height: 24px; border-radius: 50%; background: var(--bg);
}
.stub::before { top: -12px; }
.stub::after { bottom: -12px; }

.trip-type { display: flex; gap: 18px; margin-bottom: 18px; color: var(--muted); }
.trip-type label { cursor: pointer; }

.route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; margin-bottom: 20px; }
.port label { display: block; color: var(--muted); font-size: 14px; }
.port input {
  width: 100%; border: 0; border-bottom: 2px solid var(--line); background: transparent;
  font: 400 clamp(40px, 7vw, 64px)/1.05 var(--display); color: var(--ink);
  text-transform: uppercase; padding: 2px 0; direction: ltr; text-align: start;
}
[dir="rtl"] .port input { text-align: right; }
.port input:focus { outline: none; border-bottom-color: var(--sea); }
.port-name { display: block; color: var(--muted); font-size: 14px; min-height: 21px; }
.swap {
  border: 1px solid var(--line); background: var(--paper); color: var(--sea);
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer; margin-bottom: 26px; font-size: 20px;
}
[dir="rtl"] .plane { display: inline-block; transform: scaleX(-1); }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row.three > .field { flex: 1 1 140px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; flex: 1 1 180px; }
.field > label, legend { color: var(--muted); font-size: 14px; }
input[type="date"], input[type="number"], input[type="email"], select {
  font: 600 16px var(--body); color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-height: 42px;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--sea) 45%, transparent); outline-offset: 2px;
}
#days-field { flex-direction: row; align-items: center; gap: 8px; }
#trip_days { width: 84px; }
fieldset { border: 0; padding: 0; margin: 0 0 6px; }
.choice, .check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.pairs { color: var(--sea); font-weight: 600; font-size: 14px; margin: 4px 0 0; min-height: 21px; }

.stub .field { flex: 0 0 auto; margin-bottom: 0; }
.target label { color: var(--stamp); }
.price { display: flex; align-items: center; gap: 6px; }
.price select { width: 64px; padding-inline: 6px; font: 400 22px var(--display); border-color: var(--stamp); color: var(--stamp); }
.price input {
  flex: 1; min-width: 0; font: 400 40px/1 var(--display); color: var(--stamp);
  border: 2px solid var(--stamp); border-radius: 12px; padding: 8px 10px; direction: ltr;
  transform: rotate(-1.5deg);
}
[dir="rtl"] .price input { transform: rotate(1.5deg); }

.go {
  margin-top: auto; background: var(--sea); color: var(--sea-ink); border: 0; border-radius: 12px;
  padding: 14px 16px; font: 700 18px var(--body); cursor: pointer;
}
.go[disabled] { opacity: .6; cursor: progress; }
.msg { min-height: 24px; margin: 0; font-size: 15px; }
.msg.err { color: var(--stamp); }
.msg.ok { color: var(--sea); font-weight: 600; }

.foot { color: var(--muted); font-size: 14px; margin-top: 22px; max-width: 70ch; }
.foot a { color: var(--sea); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Plain document pages (verify, manage, privacy) */
.doc { background: var(--paper); border-radius: var(--radius); padding: 26px 28px; max-width: 680px; }
.doc h1 { font-size: clamp(26px, 4vw, 36px); max-width: none; }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; }
.doc td, .doc th { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: start; }
.doc .actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn { background: var(--sea); color: var(--sea-ink); border: 0; border-radius: 10px; padding: 10px 16px; font: 700 15px var(--body); cursor: pointer; }
.btn.quiet { background: none; color: var(--stamp); border: 1px solid var(--stamp); }

@media (max-width: 760px) {
  .pass { grid-template-columns: 1fr; }
  .ticket { padding: 22px 18px; }
  .stub { border-inline-start: 0; border-top: 2px dashed var(--line); padding: 22px 18px; }
  .stub::before, .stub::after { top: -13px; bottom: auto; }
  .stub::before { inset-inline-start: -12px; }
  .stub::after { inset-inline-start: auto; inset-inline-end: -12px; }
  .route { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
