/* ============================================================
   SplitWing calm components v2 — mobile-first (390px canvas).
   Desktop layouts are earned via min-width queries.
   Depends on tokens.css.
   ============================================================ */

/* ---------- app nav (mobile-first) ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: .7rem;
  background: var(--bar); color: var(--on-bar);
  padding: 0 1rem; height: 56px;
}
.appbar .brand {
  display: flex; align-items: center; gap: .55rem; text-decoration: none;
  font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg);
  color: light-dark(#ffffff, #ffffff);
}
.appbar .spacer { margin-left: auto; }
.appbar a.link { color: rgba(255,255,255,.85); text-decoration: none; font-size: var(--text-sm); padding: .4rem .7rem; border-radius: var(--radius-full); display: none; }
.appbar a.link:hover { background: rgba(255,255,255,.12); }
.appbar .menu-btn {
  background: transparent; border: 1.5px solid rgba(255,255,255,.4); color: #fff;
  border-radius: var(--radius-md); min-height: 40px; padding: .3rem .8rem;
  font: 600 var(--text-sm) var(--font-body); cursor: pointer;
}
@media (min-width: 800px) {
  .appbar a.link { display: inline-block; }
  .appbar .menu-btn.mobile-only { display: none; }
}

.appbar :focus-visible, .share-head :focus-visible, .results-bar:focus-visible, .cta-band :focus-visible {
  box-shadow: 0 0 0 3px var(--accent-fill), 0 0 0 6px #ffffff;
}

/* ---------- page scaffold ---------- */
.page { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 7.5rem; }
@media (min-width: 980px) {
  .page.with-results { max-width: 1100px; display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 1.4rem; align-items: start; padding-bottom: 3rem; }
}
.page-head { display: flex; align-items: center; gap: .6rem; margin: .4rem 0 1rem; }
.page-head .back { color: var(--ink-secondary); text-decoration: none; font-size: var(--text-xl); line-height: 1; padding: .4rem .5rem; }
.page-head h1 { font-size: var(--text-xl); flex: 1; min-width: 0; }
.page-head .more {
  background: transparent; border: 1.5px solid var(--hairline); color: var(--ink);
  border-radius: var(--radius-md); min-width: 44px; min-height: 44px; font-size: var(--text-lg); cursor: pointer;
}
.saved-note { font-size: var(--text-xs); color: var(--ink-muted); }

/* ---------- sections & fields ---------- */
.section-card { padding: 1.05rem 1.1rem; margin-bottom: .9rem; }
.section-card > h2 { font-size: var(--text-lg); margin-bottom: .8rem; display: flex; align-items: baseline; gap: .6rem; }
.section-card > h2 .note-chip { margin-left: auto; }
.fields { display: grid; gap: .85rem; }
@media (min-width: 640px) { .fields.two-up { grid-template-columns: 1fr 1fr; gap: .85rem 1rem; } }

.field { display: flex; flex-direction: column; gap: .25rem; position: relative; }
.field label {
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-secondary);
  display: flex; align-items: center; gap: .4rem; min-height: 18px;
}
.field input, .field select, .field textarea {
  height: 52px; padding: 0 .8rem; width: 100%;
  font: 400 var(--text-base) var(--font-body); font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface);
  border: 1.5px solid light-dark(#2a3a52, #5c6b80); border-radius: var(--radius-md);
  transition: border-color .15s var(--ease);
}
.field input:hover, .field textarea:hover { background: var(--card); }
.field input:focus, .field textarea:focus { background: var(--card); border-color: var(--accent-fill); outline: none; box-shadow: var(--focus-ring); }
.field textarea { height: auto; min-height: 96px; padding: .6rem .8rem; font-variant-numeric: normal; }
.fields .field-full { grid-column: 1 / -1; }

/* the disclosure ladder */
.srcdot {
  width: 24px; height: 24px; border: none; padding: 0; border-radius: 50%;
  background: transparent; position: relative; cursor: pointer; opacity: .55; transition: opacity .15s var(--ease);
}
.srcdot::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--accent-fill); }
.srcdot::before { content: ''; position: absolute; inset: -10px; } /* 44px hit area */
.field:hover .srcdot, .field:focus-within .srcdot, .field.open .srcdot, .srcdot:focus-visible { opacity: 1; }
@media (pointer: coarse) { .srcdot { opacity: 1; } }
.popover {
  position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin-top: .35rem;
  background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: .8rem .9rem; font-size: var(--text-sm);
}
.popover .tagrow { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .5rem; }
.tag { border: 1.5px solid var(--hairline); background: transparent; color: var(--ink-secondary); border-radius: var(--radius-full); padding: .25rem .7rem; min-height: 28px; font-size: var(--text-xs); font-weight: 600; cursor: pointer; }
.tag.on { background: var(--ink-strong); color: var(--surface); border-color: var(--ink-strong); }
.popover .note { color: var(--ink-secondary); }
.popover .byline { margin-top: .4rem; font-size: var(--text-xs); color: var(--ink-secondary); }
.formula { font-size: var(--text-sm); color: var(--ink-secondary); font-variant-numeric: tabular-nums; padding: .45rem 0 0; }

/* warning chip + banner */
.note-chip {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 28px;
  border: none; background: var(--warn-soft); color: var(--warn-text);
  border-radius: var(--radius-full); padding: .15rem .65rem;
  font: 600 var(--text-xs) var(--font-body); cursor: pointer;
}
.banner {
  background: var(--warn-soft); border-left: 3px solid var(--warn-text);
  border-radius: var(--radius-sm); padding: .55rem .8rem;
  font-size: var(--text-sm); color: var(--ink); margin-bottom: .8rem;
}

/* ---------- partner rows (ladder rung 0 → expanded) ---------- */
.partner { border: 1px solid light-dark(rgba(26,35,50,.18), rgba(236,231,223,.2)); border-radius: var(--radius-md); background: var(--card); }
.partner + .partner { margin-top: .55rem; }
.partner .rest {
  display: flex; align-items: center; gap: .7rem; width: 100%;
  background: none; border: none; padding: .8rem .9rem; cursor: pointer;
  font: inherit; color: inherit; text-align: left; min-height: 56px;
}
.partner .rest .name { font-weight: 600; flex: 1; min-width: 0; }
.partner .rest .share { font-family: var(--font-display); font-size: var(--text-lg); font-variant-numeric: tabular-nums; color: var(--ink-strong); }
.pct-min { font-family: var(--font-body); font-size: var(--text-xs); color: var(--ink-secondary); font-weight: 600; }
.partner .rest .monthly { font-variant-numeric: tabular-nums; color: var(--ink-secondary); font-size: var(--text-sm); width: 5.2rem; text-align: right; }
.partner .rest .chev { color: var(--ink-muted); transition: transform .2s var(--ease); }
.partner.expanded .rest .chev { transform: rotate(180deg); }
.partner .details { padding: 0 .9rem .9rem; display: grid; gap: .8rem; border-top: 1px dashed var(--hairline); padding-top: .8rem; }
.partner .detail-row { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; font-size: var(--text-sm); color: var(--ink-secondary); }
.partner .pair { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.popover .close { float: right; background: none; border: 1.5px solid var(--hairline); border-radius: var(--radius-sm); min-width: 32px; min-height: 28px; cursor: pointer; color: var(--ink-secondary); font-weight: 700; }
.partner .mini { width: 5rem; height: 44px; border: 1.5px solid light-dark(#2a3a52, #5c6b80); border-radius: var(--radius-sm); padding: 0 .5rem; font-variant-numeric: tabular-nums; background: var(--surface); color: var(--ink); font-size: var(--text-sm); }

.partner:not(.expanded) .details { display: none; }

/* detent slider (calm) */
.slider-wrap { position: relative; padding: 10px 0 14px; }
.ticks { position: absolute; left: 0; right: 0; top: 18px; height: 10px; pointer-events: none; }
.tick { position: absolute; width: 2px; height: 8px; background: light-dark(rgba(26,35,50,.48), rgba(236,231,223,.5)); transform: translateX(-1px); border-radius: 1px; }
input[type="range"].detent {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; border-radius: 3px;
  background: linear-gradient(to right, var(--accent-fill) var(--fill, 25%), light-dark(#c9c2b4, #44546b) var(--fill, 25%)) center / 100% 6px no-repeat;
  outline: none; margin: 0; touch-action: none;
}
input[type="range"].detent::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--accent-fill); box-shadow: var(--shadow-sm); cursor: grab;
}
input[type="range"].detent::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--card); border: 3px solid var(--accent-fill); cursor: grab; }
input[type="range"].detent:focus-visible { box-shadow: var(--focus-ring); }
.fracpill { display: inline-flex; background: var(--ink-strong); color: var(--surface); border-radius: var(--radius-full); padding: .08rem .6rem; font-size: var(--text-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.total-bar { display: flex; align-items: center; gap: .7rem; margin-top: .8rem; font-size: var(--text-sm); }
.total-track { flex: 1; height: 8px; border-radius: 4px; background: light-dark(#e6e1d8, #2a3442); overflow: hidden; }
.total-fill { height: 100%; background: var(--success-text); }

/* ---------- results: sticky bar (mobile) / pane (desktop) ---------- */
.results-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--bar); color: var(--on-bar);
  display: flex; align-items: center; gap: 1rem; padding: .7rem 1.1rem;
  border-top: 1px solid var(--hairline); cursor: pointer; border: none; width: 100%;
  font: inherit; text-align: left;
}
.results-bar .num { font-family: var(--font-display); font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.results-bar .lbl { font-size: var(--text-xs); opacity: .75; text-transform: uppercase; letter-spacing: .05em; }
.results-bar .open-hint { margin-left: auto; font-size: var(--text-sm); opacity: .8; }
.results-pane { display: none; }
@media (min-width: 980px) {
  .results-bar { display: none; }
  .results-pane { display: block; position: sticky; top: 72px; }
}
.results-pane .kv { display: flex; justify-content: space-between; align-items: baseline; padding: .3rem 0; }
.results-pane .kv .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.seat-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .7rem 0; }
.seat-tabs button {
  border: 1.5px solid var(--hairline); background: var(--card); color: var(--ink-secondary);
  border-radius: var(--radius-full); padding: .3rem .85rem; min-height: 44px;
  font: 700 var(--text-xs) var(--font-body); cursor: pointer;
}
.seat-tabs button.on { background: var(--ink-strong); color: var(--surface); border-color: var(--ink-strong); }
.savings { background: var(--success-soft); color: var(--success-text); border-radius: var(--radius-md); padding: .55rem .8rem; font-weight: 600; font-size: var(--text-sm); }

/* ---------- share view ---------- */
.share-head { background: var(--bar); color: var(--on-bar); padding: 1.3rem 1rem 1.2rem; }
.share-head .inner { max-width: 640px; margin: 0 auto; }
.share-head .microlabel { color: rgba(255,255,255,.65); }
.share-head h1 { color: #fff; font-size: var(--text-2xl); margin-top: .4rem; }
.whatif { border: 2px solid var(--accent-fill); background: var(--accent-soft); border-radius: var(--radius-lg); padding: .95rem 1rem; }
.assume { border: 1px solid var(--hairline); border-radius: var(--radius-md); background: var(--card); margin-bottom: .5rem; }
.assume summary { padding: .75rem 1rem; font-weight: 600; cursor: pointer; min-height: 44px; }
.assume .rows { padding: 0 1rem .7rem; }
.assume-row { display: flex; gap: .7rem; align-items: baseline; padding: .4rem 0; border-top: 1px solid var(--hairline); font-size: var(--text-sm); }
.assume-row .lbl { flex: 1; color: var(--ink-secondary); }
.assume-row .val { font-variant-numeric: tabular-nums; font-weight: 600; }
.assume-row .pill { font-size: var(--text-xs); color: var(--ink-secondary); }
.cta-band { background: var(--bar); color: var(--on-bar); border-radius: var(--radius-lg); padding: 1.6rem 1.2rem; text-align: center; margin-top: 1.8rem; }
.cta-band h2 { color: #fff; font-size: var(--text-xl); }

/* ---------- the ramp (S2) ---------- */
.ramp-grid { display: grid; gap: .9rem; }
@media (min-width: 800px) { .ramp-grid { grid-template-columns: 1fr 1fr; } }
.plane-card { display: block; padding: 1.05rem 1.1rem; text-decoration: none; color: inherit; }
.plane-card:hover { box-shadow: var(--shadow-md); }
.plane-card h2 { font-size: var(--text-xl); margin: .15rem 0 .45rem; }
.scenario-pill {
  display: inline-flex; align-items: center; border: 1.5px solid var(--hairline);
  color: var(--ink-secondary); border-radius: var(--radius-full);
  padding: .15rem .65rem; font: 600 var(--text-xs) var(--font-body);
}
.plane-card .headline { margin-top: .75rem; }
.plane-card .nums { display: flex; gap: 1.6rem; flex-wrap: wrap; margin-top: .3rem; }
.plane-card .num {
  font-family: var(--font-display); font-size: var(--text-lg);
  font-variant-numeric: tabular-nums; color: var(--ink-strong);
}
.empty-ramp {
  display: flex; flex-direction: column; gap: .5rem; align-items: center;
  border: 2px dashed light-dark(rgba(26,35,50,.35), rgba(236,231,223,.35));
  border-radius: var(--radius-lg); padding: 2.4rem 1.2rem; text-align: center;
  text-decoration: none; color: var(--ink);
}
.empty-ramp strong { font-family: var(--font-display); font-size: var(--text-xl); color: var(--ink-strong); }
.empty-ramp .fine { margin: 0; max-width: 24rem; }

/* ---------- airplane page ---------- */
.btn-danger { background: transparent; color: var(--error-text); border-color: currentColor; margin-top: .4rem; }
.btn-danger:hover { background: var(--error-soft); }
.facts { display: grid; gap: .7rem; margin: 0; }
@media (min-width: 640px) { .facts { grid-template-columns: 1fr 1fr; } }
.fact dd, .fact .value { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- footer ---------- */
.footer { color: var(--ink-muted); font-size: var(--text-sm); text-align: center; padding: 2rem 1rem 6rem; }
.footer a { color: var(--ink-secondary); }


/* ---------- print ---------- */
@media print {
  :root, html[data-theme] { color-scheme: light; }
  .appbar, .results-bar, .menu-btn, .more, .theme-switch { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .partner { box-shadow: none; border: 1px solid #000; }
}

/* ---------- shared component modifiers (DHH review, PR 1) ---------- */
.page--narrow { max-width: 26rem; }
.page--narrow h1 { font-size: var(--text-2xl); margin: 1.2rem 0 .3rem; }
.page--narrow .lede { color: var(--ink-secondary); margin: 0 0 1.2rem; }
.hero { text-align: center; padding-top: 4rem; }
.hero h1 { font-size: var(--text-3xl); margin-top: 1rem; }
.hero .lede { color: var(--ink-secondary); max-width: 28rem; margin: .8rem auto 0; }
.hero .saved-note { margin-top: 2rem; }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: .3rem 1rem; }
main a { color: var(--accent-text); }
.appbar form { display: contents; }
.appbar a.link.essential { display: inline-block; }
.fine { margin-top: 1rem; font-size: var(--text-sm); color: var(--ink-secondary); }
