/*
 * Meridian web — the component set drawn on the web handoff's `#2a` sheet
 * (WEB-002). Loaded after meridian.css, which already carries the button base,
 * inputs, fields, spinner, disc and the legal layout from the companion
 * handoff; this file adds what the site screens need on top.
 *
 * Every colour is a token from tokens.css. Sizes are the handoff's px. The
 * gallery at `/_components/` renders every state of everything here.
 */

:root {
  --r-tile: 16px;
  --r-cell: 14px;
  --r-poster: 12px;
}

/* ---------------------------------------------------------------- buttons */

.btn--destructive { border-color: var(--danger-border); color: var(--danger); }
.btn--destructive:hover { background: var(--danger-fill); }
.btn--secondary { height: 48px; }
.btn--row { height: 34px; padding: 0 14px; font-family: var(--font-body); font-size: 13px; font-weight: 500; }
/* Loading is aria-disabled too, but must not read as disabled. */
.btn--loading,
.btn--loading[aria-disabled="true"] {
  background: var(--accent-tint);
  border-color: var(--accent-line);
  color: var(--accent-text);
  cursor: default;
}
.btn { transition: background-color 180ms ease-out, border-color 180ms ease-out, color 180ms ease-out; }

/* ---------------------------------------------------------------- eyebrow */

.eyebrow-label {
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* ------------------------------------------------------------- tier card */

.tier {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border-radius: var(--r-card);
  background: var(--panel);
  border: 1px solid var(--border);
}
.tier--recommended { border-color: var(--border-emphasis); box-shadow: var(--shadow-recommended); }
.tier__badge {
  position: absolute;
  top: -12px; left: 24px;
  height: 24px;
  padding: 0 11px;
  display: inline-flex; align-items: center;
  border-radius: var(--r-pill);
  background: var(--badge-fill);
  color: var(--badge-ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.tier__name { font-family: var(--font-display); font-weight: 600; font-size: 20px; }
.tier__pitch { font-size: 14.5px; color: var(--text-2); }
.tier__price { display: flex; align-items: baseline; gap: 8px; }
.tier__amount {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 38px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.tier--recommended .tier__amount { color: var(--price); }
.tier__period { font-size: 14px; color: var(--text-2); }
.tier__sub { font-size: 13.5px; color: var(--text-2); }
.tier__rule { height: 1px; background: var(--border); border: 0; margin: 4px 0; }
.tier__features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 14.5px; color: var(--text-2); }
.tier__features li:nth-child(-n + 2) { color: var(--text); }

/* -------------------------------------------------------- billing toggle */

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: var(--r-pill);
  background: var(--panel);
  border: 1px solid var(--border);
}
.segmented button {
  height: 42px;
  flex: 1;
  padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: var(--raised);
  border-color: var(--border-strong);
  color: var(--text);
}
.save-badge {
  height: 20px;
  padding: 0 8px;
  display: inline-flex; align-items: center;
  border-radius: var(--r-pill);
  background: var(--raised);
  border: 1px solid var(--border-strong);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

/* -------------------------------------------------------- region selector */

.region {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.region select {
  appearance: none;
  height: 44px;
  padding: 0 40px 0 16px;
  border-radius: var(--r-pill);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}
.region::after {
  content: "";
  position: absolute;
  right: 18px;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--text-2);
  border-bottom: 1.5px solid var(--text-2);
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
}

/* ------------------------------------------------------- comparison table */

.compare {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-tile);
  overflow: hidden;
  font-size: 14px;
}
.compare th, .compare td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.compare tr:last-child td { border-bottom: 0; }
.compare thead th {
  background: var(--raised);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.compare tbody tr:nth-child(even) td { background: var(--zebra); }
.compare td:not(:first-child), .compare th:not(:first-child) { text-align: center; }
.compare .tick { color: var(--text); }
.compare .none { color: var(--text-2); }

/* ----------------------------------------------------------- code entry */

.code-entry { position: relative; display: flex; flex-direction: column; gap: 10px; }
/* The real field covers the cells so a tap anywhere focuses it; it is
   transparent, the cells draw the value. */
.code-entry__input {
  position: absolute;
  inset: 0 0 auto 0;
  height: 58px;
  width: 100%;
  opacity: 0;
  font-size: 16px;
  text-transform: uppercase;
  cursor: text;
}
.code-entry__cells { display: flex; gap: 8px; }
.code-entry__cell {
  flex: 1;
  height: 58px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-cell);
  background: var(--panel);
  border: 1px solid var(--border);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  color: var(--text);
  transition: border-color 150ms ease-out;
}
.code-entry__cell.is-caret {
  border-color: var(--focus);
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}
.code-entry.is-error .code-entry__cell { background: var(--danger-fill); border-color: var(--danger); }
.code-entry__hint { font-size: 12.5px; color: var(--text-2); min-height: 1lh; }
.code-entry.is-error .code-entry__hint { color: var(--danger); }

/* ------------------------------------------------------------- device row */

.device {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--r-tile);
  background: var(--panel);
  border: 1px solid var(--border);
}
.panel .device { background: var(--raised); }
.device__icon {
  width: 40px; height: 40px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--raised);
  color: var(--text-2);
}
.device__icon svg { width: 18px; height: 18px; }
.device__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.device__name { font-size: 15px; color: var(--text); }
.device__meta { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device--empty { border-style: dashed; background: none; color: var(--text-2); font-size: 13.5px; }

/* -------------------------------------------------------------- trust row */

.trust-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trust-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 13px;
  border-radius: var(--r-cell);
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text);
}
.trust-chip svg { width: 14px; height: 14px; color: var(--text-2); flex: none; }
.trust-inline { font-size: 13px; color: var(--text-2); }

/* ---------------------------------------------------------- status banner */

.banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 20px;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--raised);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.banner svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.banner--context svg { color: var(--accent); }
.banner--warning { background: var(--warning-fill); border-color: var(--warning-line); }
.banner--warning svg { color: var(--warning); }
.banner--danger { background: var(--danger-fill); border-color: var(--danger-border); }
.banner--danger svg { color: var(--danger); }

/* -------------------------------------------------------- scarcity counter */

.scarcity {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px;
  border-radius: var(--r-tile);
  background: var(--raised);
  border: 1px solid var(--border-strong);
}
.scarcity__line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.scarcity__line span:last-child { font-size: 13px; color: var(--text-2); }
.scarcity__bar { height: 6px; border-radius: var(--r-pill); background: var(--progress-track); overflow: hidden; }
.scarcity__fill { height: 100%; border-radius: inherit; background: var(--progress-fill); }

/* ------------------------------------------------------------ bottom sheet */

.sheet {
  margin: auto auto 0;
  width: 100%;
  max-width: 560px;
  padding: 28px 22px calc(22px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: var(--r-panel) var(--r-panel) 0 0;
  background: var(--panel);
  color: var(--text);
}
.sheet[open] { display: flex; flex-direction: column; gap: 16px; animation: sheet-in 200ms ease-out; }
.sheet::backdrop { background: var(--backdrop); }
.sheet h2 { font-size: 22px; }
.sheet p { font-size: 15px; color: var(--text-2); }
.sheet__actions { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
@keyframes sheet-in { from { transform: translateY(16px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .sheet[open] { animation: none; }
  .btn, .code-entry__cell { transition: none; }
}

/* --------------------------------------------------------------- skeleton */

.skeleton { border-radius: 10px; background: var(--skeleton); }
.skeleton--line { height: 12px; }
.skeleton--block { height: 72px; border-radius: var(--r-tile); }

/* -------------------------------------------------------- promise panel */

.promise,
.legal .promise {
  margin: 8px 0 4px;
  padding: 22px 24px;
  border-radius: var(--r-card);
  background: var(--raised);
  border: 1px solid var(--border-strong);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.45;
  color: var(--text);
}

/* ---------------------------------------------------------- sticky action */

.action-bar {
  position: sticky;
  bottom: 0;
  padding: 16px 20px calc(26px + env(safe-area-inset-bottom));
  background: var(--ground);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}

/* ---------------------------------------------------------------- /support */

.support { padding: 32px var(--gutter) 48px; display: flex; flex-direction: column; gap: 32px; max-width: 1312px; margin: 0 auto; }
.support__head { display: flex; flex-direction: column; gap: 12px; }
.support__head h1 { font-size: 34px; line-height: 1.08; letter-spacing: -0.02em; }
.support__search { margin-top: 8px; max-width: 560px; }
.support-topics { display: grid; gap: 14px; }
.support-topic {
  padding: 22px;
  border-radius: var(--r-card);
  background: var(--panel);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
}
.support-topic h2 { font-size: 18px; }
.support-topic ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 14.5px; color: var(--text-2); }
.support-empty { font-size: 14.5px; color: var(--text-2); }
.support-faq { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; border-top: 1px solid var(--border); }
.support-faq h2, .support-stuck h2 { font-size: 22px; padding-top: 24px; }
.support-faq__list { display: grid; gap: 14px; }
.support-faq__item { padding: 20px 22px; border-radius: var(--r-card); background: var(--panel); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.support-faq__item h3 { font-size: 16.5px; }
.support-faq__item p, .support-stuck p { font-size: 14.5px; line-height: 1.6; color: var(--text-2); }
.support-stuck { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); }

/* "Coming" / "When accounts launch" — a neutral tag, never accent (R2). */
.tag-coming {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  margin-inline-start: 6px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  vertical-align: 2px;
}

/* ================================================================ tablet+ */

@media (min-width: 768px) {
  .tier { padding: 30px; }
  .tier__badge { left: 30px; }
  .tier__amount { font-size: 44px; }
  .tier__name { font-size: 21px; }
  .segmented button { height: 40px; flex: none; }
  .code-entry__input { height: 76px; }
  .code-entry__cells { gap: 10px; }
  .code-entry__cell { flex: none; width: 64px; height: 76px; font-size: 30px; }
  .compare th, .compare td { padding: 14px 24px; }
  .trust-grid { gap: 10px; }
  .trust-chip { padding: 12px 14px; font-size: 13px; }
  .sheet { margin: auto; border-radius: var(--r-panel); }
  .promise, .legal .promise { padding: 26px 30px; font-size: 20px; line-height: 1.45; }
  .support { padding: 72px var(--gutter) 88px; gap: 44px; }
  .support__head h1 { font-size: 48px; letter-spacing: -0.022em; }
  .support__head > p { font-size: 17px; }
  .support-topics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .support-topic { padding: 28px; }
  .support-topic h2 { font-size: 20px; }
  .support-faq { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 40px; align-items: start; }
  .support-faq__list { gap: 16px; }
  .support-faq h2, .support-stuck h2 { font-size: 30px; line-height: 1.15; }
}

/* `hidden` must win over the flex/grid display above. */
.support [hidden] { display: none !important; }
