/*
 * Every reusable piece of UI. Anything here works in both the marketing site and the app,
 * which is the test for whether it belongs in this file.
 */

/* ------------------------------------------------------------- Buttons ----- */
/* Buttons are MONO and uppercase, everywhere. This is the design system's own rule and it is
   easy to get wrong: a button set in the body face reads as a chip of prose, and the whole
   product loses the line between "text" and "control". */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 15px 26px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--motion), border-color var(--motion), color var(--motion);
  white-space: nowrap;
  /* 44px is the minimum comfortable touch target; .btn--sm trims padding, not height. */
  min-height: 44px;
}

/* Gold: the header CTA, the annual plan, the final call to action. */
.btn--primary { background: var(--gold); color: var(--bg); }
.btn--primary:hover { background: var(--ink); color: var(--bg); }

/* Off-white: the hero's own primary. It outranks gold ON the hero, where gold is already
   spoken for by the header CTA sitting directly above it -- two gold buttons in one viewport
   and neither is the emphasis. */
.btn--ink { background: var(--ink); color: var(--bg); }
.btn--ink:hover { background: var(--gold); color: var(--bg); }

.btn--secondary { background: transparent; color: var(--ink-2); border-color: var(--rule); }
.btn--secondary:hover { border-color: var(--gold); color: var(--ink); }

/* The other real choice beside a primary, rather than a button that should recede: the monthly
   plan next to annual. */
.btn--outline { background: transparent; color: var(--ink); border-color: var(--border-btn); }
.btn--outline:hover { border-color: var(--ink); }

/* A link that behaves like a button: no box, just a rule under it that goes gold on hover.
   Deliberately NOT uppercase -- it is set in the same sentence case as the copy beside it. */
.btn--ghost {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  padding: 15px 4px;
  min-height: 0;
  color: var(--ink-4);
  background: transparent;
  border-radius: 0;
  border-bottom: 1px solid var(--border-link);
}
.btn--ghost:hover { color: var(--ink); border-bottom-color: var(--gold); }

.btn--block { width: 100%; justify-content: center; }
/* The comp draws the header CTA at 40px. The brief also sets a 44px minimum hit target, and a
   4px difference nobody can see is not worth failing that on. */
.btn--sm { padding: 10px 16px; font-size: 12.5px; min-height: 44px; }

/* Social sign-in buttons — branded per Google & Apple guidelines (4-color "G" on a light
   button, Apple mark on a black button). Fill colors are brand-mandated, not theme tokens. */
.provider-btns { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.provider-btns form.button_to { margin: 0; width: 100%; }
.provider-btn { display: flex; align-items: center; justify-content: center; gap: 11px; width: 100%; padding: 13px; border-radius: var(--r-btn); border: 1px solid var(--rule); background: #fff; color: #1f1f1f; font-weight: 600; font-size: 15px; cursor: pointer; font-family: inherit; transition: border-color var(--motion); }
.provider-btn:hover { border-color: var(--gold); }
.provider-btn--apple { border-color: #000; background: #000; color: #fff; }
.provider-btn--apple:hover { border-color: var(--gold); }
.provider-btn__logo { flex: 0 0 auto; display: block; }
.provider-caption { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* Pills & chips */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gold);
  border: 1px solid var(--gold-45);
  border-radius: var(--r-pill);
  padding: 7px 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--r-chip);
  padding: 5px 10px;
}


/* --------------------------------------------------------------- Forms ----- */
label { display: block; font-size: 13.5px; color: var(--ink-3); margin-bottom: 6px; }

input[type="text"], input[type="email"], input[type="number"], input[type="password"],
textarea, select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--r-input);
  padding: 12px 15px;
  outline: none;
  transition: border-color var(--motion);
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
/* `outline: none` above is for the mouse; a keyboard user still needs to see where they are. */
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: var(--muted); }

.field { margin-bottom: 16px; }
.field-hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field-error { font-size: 13px; color: var(--danger); margin-top: 6px; }


/* --------------------------------------------------------------- Cards ----- */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 24px;
}
/* Hover is border or background. No transform, no shadow, nothing moves. */
a.card { display: block; text-decoration: none; transition: border-color var(--motion), background var(--motion); }
a.card:hover { border-color: var(--gold-45); background: var(--bg-raised); }

.card__kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin-bottom: 10px;
}
.card__title { font-size: 16px; color: var(--ink); margin: 0 0 8px; }
.card__body { font-size: 13.5px; color: var(--ink-3); margin: 0; }

/* Green-check list */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { position: relative; padding-left: 26px; margin-bottom: 8px; font-size: 14px; color: var(--ink-3); }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--mint); font-weight: 600; }
/* ...and its inverse, for "what you can't do" lists. Same shape so the two read as a pair. */
.checks--x li::before { content: "×"; color: var(--dim); }



/* ------------------------------------------------------------- Card grid --- */
/* The continuous-rule grid: a 1px --rule background showing through a 1px gap between --bg
   children, so the dividers read as ONE grid rather than a row of separately-bordered boxes.
   This is the construction that is easiest to get wrong by hand, so it is a component. */
.card-grid {
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.card-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card-grid > * { background: var(--bg); padding: 24px; margin: 0; }
.card-grid > a { display: block; text-decoration: none; transition: background var(--motion); }
.card-grid > a:hover { background: var(--bg-raised); }

@media (max-width: 899px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------------- Glyphs ----- */
/* Mono glyph bullets. `+` neutral, `✓` mint for included/done, `×` dim for a spec row.
   Text, not an icon font and never an emoji, so they inherit colour and size. */
.glyphs { list-style: none; margin: 0; padding: 0; }
.glyphs li { position: relative; padding-left: 24px; margin-bottom: 8px; }
.glyphs li::before {
  content: "+";
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  color: var(--muted);
}
.glyphs--check li::before { content: "✓"; color: var(--mint); }
.glyphs--x li::before { content: "×"; color: var(--dim); }

/* ---------------------------------------------------------- Code well ------ */
.well-block {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 13.5px;
}
.well-block__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--muted);
  font-size: 12px;
}
.well-block__dots { display: inline-flex; gap: 6px; margin-right: 6px; }
.well-block__dots i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.well-block__dots i:nth-child(1) { background: var(--danger); }
.well-block__dots i:nth-child(2) { background: var(--gold); }
.well-block__dots i:nth-child(3) { background: var(--mint); }
.well-block__body { padding: 16px; line-height: 1.7; white-space: pre-wrap; }
.well-block__body .cmd::before { content: "$ "; color: var(--gold); }
.well-block__body .ok { color: var(--mint); }
.well-block__body .dim { color: var(--muted); }


/* --------------------------------------------------------- Disclosure ------ */
/* Collapsed help: troubleshooting most readers never need to open. A native <details>,
   so it toggles with no JS — which is what we want under the enforced CSP, where an
   inline <script> would be blocked silently. */
.disclosure {
  background: var(--bg);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-card);
}
.disclosure > summary {
  padding: 13px 16px;
  color: var(--ink-3);
  font-size: 14px;
  cursor: pointer;
  list-style: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "▸ "; color: var(--gold); }
.disclosure[open] > summary { color: var(--ink-2); border-bottom: 1px solid var(--rule-soft); }
.disclosure[open] > summary::before { content: "▾ "; }
.disclosure__body { padding: 6px 16px 16px; color: var(--ink-3); font-size: 14px; line-height: 1.7; }
.disclosure__body ol { margin: 0; padding-left: 20px; }
.disclosure__body li { margin: 12px 0; }
.disclosure__body code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  overflow-wrap: anywhere;
}


/* ------------------------------------------------------ Warning callout ---- */
.callout {
  background: var(--bg-accent);
  border: 1px solid var(--gold-45);
  border-radius: var(--r-card);
  padding: 18px 20px;
  color: var(--gold);
  font-size: 14px;
}
.callout__label { font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }


/* ------------------------------------------------------------- Flash ------- */
/* ------------------------------------------------------------- Toasts ----- */
/* Bottom-left, square, on the raised surface. Fixed rather than in the document flow, so a flash
   never pushes the page down and moves what someone was about to click. */
.toasts {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 40px));
}
.toast { background: var(--bg-raised); border: 1px solid var(--rule); padding: 14px 16px; }
.toast__label {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.toast__body { margin: 0; font-size: 14px; color: var(--ink-2); max-width: none; }
.toast--notice { border-left: 2px solid var(--mint); }
.toast--notice .toast__label { color: var(--mint); }
.toast--alert { border-left: 2px solid var(--danger); }
.toast--alert .toast__label { color: var(--danger); }

/* Loading is a 1px gold rule across the top of the viewport, never a spinner. Turbo sets
   .turbo-progress-bar itself; this is only its appearance. */
.turbo-progress-bar { height: 1px; background: var(--gold); }


/* --------------------------------------------------------- Utilities ------- */
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.trust-bar { display: flex; flex-wrap: wrap; gap: 8px 20px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.narrow { max-width: 720px; margin-inline: auto; }
/* 16px, not 64: .section already supplies --section-y above this, and the two stacked to ~150px of
   empty page before the card even started. */
.auth-card { max-width: 440px; margin: 16px auto; }



@media (max-width: 640px) {
  /* Never let a wide element (code wells, terminal mocks) force horizontal page scroll. */
  .well-block__body { overflow-x: auto; }
  .btn { padding: 12px 18px; }
}

/* ---------------------------------------------------------- Page header ---- */
/* Heading on the left, actions on the right, stacking under 640px so a button never
   sits alone on a line beside a wrapped heading. */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

/* ------------------------------------------------------- Section header ---- */
.section-head { margin-bottom: 32px; }

/* --------------------------------------------------------------- Stats ----- */
.stat { display: block; text-decoration: none; }
.stat__label {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat__value {
  margin: 0;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--ink);
  /* Digits share a width, so a column of numbers lines up and a changing value does not jitter. */
  font-variant-numeric: tabular-nums;
}
.stat__note {
  margin: 10px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.stat__note--up { color: var(--mint); }
.stat__note--down { color: var(--danger); }

/* ---------------------------------------------------------- Data table ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--rule-soft); color: var(--ink-2); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table__num { text-align: right; font-variant-numeric: tabular-nums; }
/* An ISO date must never break across lines: "2026-" above "10-01" reads as two broken values
   rather than one date, and on a fare board every row carries three of them. The wrap below is
   what makes the table overflow instead, which is exactly what .data-table-wrap is for. */
.data-table__date { white-space: nowrap; }
.data-table__empty { padding: 24px 16px; color: var(--muted); }
/* A table cannot reflow, so it scrolls inside its own box rather than widening the page. */
.data-table-wrap { overflow-x: auto; border: 1px solid var(--rule); }

/* ------------------------------------------------------- Fare calendar ---- */
/* A month grid of the cheapest fare per departure date. The first component this product needed
   that the kit did not already have: a table cannot express "these seven cells are a week", and a
   fare calendar is the one screen where the shape of the month IS the information.

   Same rules as everything else -- 1px rules, no shadow, 2px radius ceiling, and colour used only
   as a signal: gold marks the cheapest day of the month, and nothing else is tinted. */
.fare-calendar { border: 1px solid var(--rule); }

.fare-calendar__head,
.fare-calendar__week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.fare-calendar__head { background: var(--bg-raised); border-bottom: 1px solid var(--rule); }
.fare-calendar__day-name {
  padding: 10px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.fare-calendar__week { border-bottom: 1px solid var(--rule-soft); }
.fare-calendar__week:last-child { border-bottom: 0; }

.fare-calendar__cell {
  min-height: 72px;
  padding: 8px 6px;
  border-right: 1px solid var(--rule-soft);
  text-align: center;
  text-decoration: none;
  display: block;
}
.fare-calendar__cell:last-child { border-right: 0; }

/* Days either side of the month. Present so the grid stays rectangular, and unreadable on purpose
   so they do not compete with the month itself. */
.fare-calendar__cell--outside { background: var(--bg); }
.fare-calendar__cell--outside .fare-calendar__date { color: var(--glyph-2); }

.fare-calendar__date {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.fare-calendar__price {
  display: block;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* The one tinted thing on the grid: the cheapest departure of the month. Gold is price and active
   state everywhere else in the system, so it means the same thing here. */
.fare-calendar__cell--low { background: var(--bg-accent); }
.fare-calendar__cell--low .fare-calendar__price { color: var(--gold); }

/* A price the airline has not reconfirmed in a week. Greyed and marked rather than hidden: an old
   number a reader can see and date is honest, an old number shown as current is not. */
.fare-calendar__cell--stale .fare-calendar__price { color: var(--muted); }

.fare-calendar__flag {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 4px;
}

/* Seven columns cannot reflow into fewer without ceasing to be a calendar, so the grid scrolls
   inside its own box rather than widening the page -- same arrangement as .data-table-wrap. */
.fare-calendar-wrap { overflow-x: auto; }
.fare-calendar-wrap .fare-calendar { min-width: 460px; }

/* On a phone, tighten the cells until the whole month fits instead. A calendar you have to scroll
   sideways to read is barely a calendar: the point of the grid is seeing the shape of the month at
   a glance, and half a month does not have a shape. The scroll above stays as the backstop for the
   very narrowest screens. */
@media (max-width: 640px) {
  .fare-calendar-wrap .fare-calendar { min-width: 0; }
  .fare-calendar__day-name { padding: 8px 2px; font-size: 10px; letter-spacing: 0.06em; }
  .fare-calendar__cell { min-height: 58px; padding: 6px 2px; }
  .fare-calendar__date { font-size: 10px; margin-bottom: 3px; }
  .fare-calendar__price { font-size: 12px; }
  .fare-calendar__flag { font-size: 9px; }
}

.fare-calendar__foot {
  padding: 12px 16px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
}

/* --------------------------------------------------------- Danger zone ---- */
/* A plain --danger border and nothing else. No red fill: a destructive action should be
   findable, not alarming, and a filled panel makes the whole screen read as an error. */
.danger-zone { border: 1px solid var(--danger); padding: 24px; }
.danger-zone .card__kicker { color: var(--danger); }

/* -------------------------------------------------------- Form errors ----- */
.form-errors { border: 1px solid var(--danger); padding: 16px 20px; margin-bottom: 20px; }
.form-errors__title { margin: 0 0 8px; color: var(--danger); font-size: 14.5px; font-weight: 600; }
.form-errors .glyphs li { color: var(--ink-2); font-size: 14px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- Pills ---- */
.pill--gold { color: var(--gold); border-color: var(--gold-45); }
.pill--mint { color: var(--mint); border-color: var(--mint); }
.pill--dim  { color: var(--muted); border-color: var(--rule); }

/* The ONE highlighted card in a view: the current plan, the annual tier. A gold border and the
   accent ground, used once per screen -- a second one on the same page and neither reads as
   the emphasis any more. */
.card--accent { background: var(--bg-accent); border-color: var(--gold-45); }

/* Buttons inside a card sit below the body copy, which has its own bottom margin. */
.card__actions { margin-top: 16px; }
.card__actions form.button_to { margin: 0; }

/* Destructive. Outlined rather than filled, for the same reason .danger-zone is. */
.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn--danger:hover { background: var(--bg-accent); color: var(--danger); border-color: var(--danger); }

/* Vertical rhythm between the stacked blocks of a settings-style page. */
.stack-above { margin-top: 24px; }

/* Body copy rendered from a plain text column (simple_format), rather than the markdown
   .prose in blog.css. Same measure, no heading ramp -- there are no headings in it. */
.prose-plain { color: var(--ink-2); max-width: var(--measure); }
.prose-plain p { margin: 0 0 1em; }

/* A kicker and a status pill on one line at the top of a card. */
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* Secondary detail beside a card title (an account handle, a date). */
.card__meta { color: var(--muted); font-size: 13px; font-weight: 400; }
/* A second well stacked directly under the first. */
.well-block--stacked { margin-top: 12px; }

/* ------------------------------------------------------------ Auth card ---- */
.auth-card { max-width: 400px; }
.auth-card__head { margin-bottom: 24px; }
.auth-card__title { font-size: 21px; letter-spacing: -0.02em; margin: 0 0 6px; }
.auth-card__note { color: var(--muted); font-size: 14px; margin: 0; }
.auth-card__fine { color: var(--muted); font-size: 12px; margin: 20px 0 0; }
.auth-card__resend { margin-top: 4px; }
.bot-check { margin-bottom: 16px; }

/* A rule with the word set into it, rather than a word floating between two blocks. */
.rule-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.rule-label::before, .rule-label::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* The one-time code. Mono and widely tracked so six digits read as six digits. */
.otp-input {
  font-family: var(--font-mono);
  font-size: 28px;
  letter-spacing: 12px;
  text-align: center;
  /* The tracking adds a trailing gap after the last digit, which reads as off-centre. */
  text-indent: 12px;
}
.auth-card__plans { margin-top: 16px; }

/* Small print, and its gold variant for a launch-price note. */
.fine { font-size: 13px; color: var(--muted); }
.fine--gold { color: var(--gold); }
.subscribed { color: var(--mint); }

.plan-chooser__price { font-size: 26px; font-weight: 600; color: var(--ink); letter-spacing: -0.03em; }
.plan-chooser__period { font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--muted); }

.plan-card { max-width: 420px; margin: 40px auto 0; }
.license-summary { margin: 40px 0; }
.license-summary__lead { font-size: 18px; color: var(--ink); margin: 8px 0 0; }
