/*
 * 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 set in the BODY face, sentence case, on a 12px radius -- and that is a reversal of
   what this file used to say. The old system made every button mono and uppercase to keep the line
   between "text" and "control"; this one draws that line with a filled or outlined shape instead,
   which is what lets a pill of a control sit inside a sentence of numbers without shouting. The
   mono face still carries every number, label and timestamp, which is the job it is good at.

   .btn is the rectangular control: form submits, the primary call to action. .pill is the round
   one: mode selectors, tabs, and every secondary action beside them. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 13px 22px;
  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;
}

/* The accent fill, carrying its own ink. The one primary action in a view. */
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }

/* Neutral fill. Outranks the accent where the accent is already spoken for above it -- two green
   buttons in one viewport and neither is the emphasis. */
.btn--ink { background: var(--text); color: var(--bg); }
.btn--ink:hover { background: var(--accent); color: var(--on-accent); }

.btn--secondary { background: transparent; color: var(--text-2); border-color: var(--line2); }
.btn--secondary:hover { border-color: var(--accent); color: var(--text); }

/* The other real choice beside a primary, rather than a button that should recede. */
.btn--outline { background: transparent; color: var(--text); border-color: var(--line3); }
.btn--outline:hover { border-color: var(--text); }

/* The quietest control that is still a control: a pill outline that takes the accent on hover.
   Used for "Add another alert", "Pause alert", "Update payment method". */
.btn--ghost {
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  min-height: 44px;
  color: var(--text-2);
  background: transparent;
  border-radius: var(--r-pill);
  border: 1px solid var(--line3);
}
.btn--ghost:hover { color: var(--text); border-color: var(--accent); }

.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: 8px 14px; font-size: 13px; font-weight: 600; min-height: 44px; border-radius: var(--r-pill); }

/* 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(--line1); 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(--accent); }
.provider-btn--apple { border-color: #000; background: #000; color: #fff; }
.provider-btn--apple:hover { border-color: var(--accent); }
.provider-btn__logo { flex: 0 0 auto; display: block; }
.provider-caption { text-align: center; color: var(--text-4); 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(--accent);
  border: 1px solid var(--accent-35);
  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(--text-3);
  background: var(--bg);
  border: 1px solid var(--line1);
  border-radius: var(--r-chip);
  padding: 5px 10px;
}


/* --------------------------------------------------------------- Forms ----- */
label { display: block; font-size: 13.5px; color: var(--text-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(--text-2);
  background: var(--bg);
  border: 1px solid var(--line1);
  border-radius: var(--r-input);
  padding: 12px 15px;
  outline: none;
  transition: border-color var(--motion);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
/* `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(--accent); outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: var(--text-4); }

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


/* --------------------------------------------------------------- Cards ----- */
.card {
  background: var(--surface);
  border: 1px solid var(--line1);
  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(--accent-35); background: var(--surface); }

.card__kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 10px;
}
.card__title { font-size: 16px; color: var(--text); margin: 0 0 8px; }
.card__body { font-size: 13.5px; color: var(--text-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(--text-3); }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); 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(--text-5); }



/* ------------------------------------------------------------- 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(--line1);
  border: 1px solid var(--line1);
}
.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(--surface); }

@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(--text-4);
}
.glyphs--check li::before { content: "✓"; color: var(--accent); }
.glyphs--x li::before { content: "×"; color: var(--text-5); }

/* ---------------------------------------------------------- Code well ------ */
.well-block {
  background: var(--bg);
  border: 1px solid var(--line1);
  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(--line1);
  color: var(--text-4);
  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(--accent); }
.well-block__dots i:nth-child(3) { background: var(--accent); }
.well-block__body { padding: 16px; line-height: 1.7; white-space: pre-wrap; }
.well-block__body .cmd::before { content: "$ "; color: var(--accent); }
.well-block__body .ok { color: var(--accent); }
.well-block__body .dim { color: var(--text-4); }


/* --------------------------------------------------------- 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(--line1);
  border-radius: var(--r-card);
}
.disclosure > summary {
  padding: 13px 16px;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  list-style: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "▸ "; color: var(--accent); }
.disclosure[open] > summary { color: var(--text-2); border-bottom: 1px solid var(--line1); }
.disclosure[open] > summary::before { content: "▾ "; }
.disclosure__body { padding: 6px 16px 16px; color: var(--text-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(--text);
  overflow-wrap: anywhere;
}


/* ------------------------------------------------------ Warning callout ---- */
.callout {
  background: var(--field);
  border: 1px solid var(--accent-35);
  border-radius: var(--r-card);
  padding: 18px 20px;
  color: var(--accent);
  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(--surface); border: 1px solid var(--line1); 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(--text-2); max-width: none; }
.toast--notice { border-left: 2px solid var(--accent); }
.toast--notice .toast__label { color: var(--accent); }
.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(--accent); }


/* --------------------------------------------------------- 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(--text-4); }
.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(--text-4);
}
.stat__value {
  margin: 0;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--text);
  /* 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(--text-4);
}
.stat__note--up { color: var(--accent); }
.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(--surface);
  border-bottom: 1px solid var(--line1);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-4);
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--line1); color: var(--text-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(--text-4); }
/* 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(--line1); }

/* ------------------------------------------------------- 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(--line1); }

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

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

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

.fare-calendar__cell {
  min-height: 72px;
  padding: 8px 6px;
  border-right: 1px solid var(--line1);
  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(--text-5); }

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

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

/* 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(--field); }
.fare-calendar__cell--low .fare-calendar__price { color: var(--accent); }

/* 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(--text-4); }

.fare-calendar__flag {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-4);
  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(--line1);
  font-size: 13px;
  color: var(--text-4);
}

/* --------------------------------------------------------- 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(--text-2); font-size: 14px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- Pills ---- */
.pill--gold { color: var(--accent); border-color: var(--accent-35); }
.pill--mint { color: var(--accent); border-color: var(--accent); }
.pill--dim  { color: var(--text-4); border-color: var(--line1); }

/* 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(--field); border-color: var(--accent-35); }

/* 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. */
/* --danger-text and --danger-line, NOT --danger. The fill colour is a ground, and at 3.64:1 on
   --bg it misses the contrast floor as text -- which is the whole reason the palette carries the
   two separately. --danger stays for the filled confirm button inside a danger panel. */
.btn--danger { background: transparent; color: var(--danger-text); border-color: var(--danger-line); border-radius: var(--r-pill); }
.btn--danger:hover { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-line); }
.btn--danger-fill { background: var(--danger); color: var(--on-danger); border-color: transparent; border-radius: var(--r-pill); }
.btn--danger-fill:hover { background: var(--danger); border-color: var(--danger-line); }

/* 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(--text-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(--text-4); 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(--text-4); font-size: 14px; margin: 0; }
.auth-card__fine { color: var(--text-4); 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(--text-4);
}
.rule-label::before, .rule-label::after { content: ""; flex: 1; height: 1px; background: var(--line1); }

/* 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(--text-4); }
.fine--gold { color: var(--accent); }
.subscribed { color: var(--accent); }

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

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