/* ============================================================================
   components.css — the reusable component system (design spec §2.3).
   ========================================================================== */

/* ----------------------------- icons -------------------------------------- */
.ico { display: block; flex: none; }

/* ----------------------------- red bar (the signature motif) -------------- */
.red-bar { display: inline-flex; flex-direction: column; gap: 4px; }
.red-bar[data-align="center"] { align-self: center; }
.red-bar--single .rb,
.red-bar--single::before {
  content: "";
  display: block;
  height: 3px;
  width: var(--bar-w, 56px);
  background: var(--grad-red);
  border-radius: var(--r-bar);
  transform-origin: left center;
  animation: bar-draw var(--d-slow) var(--ease-out) both;
}
.red-bar--double .rb { display: block; height: 3px; border-radius: var(--r-bar); transform-origin: left center; }
.red-bar--double .rb-top { width: 56px; background: var(--red); animation: bar-draw var(--d-slow) var(--ease-out) both; }
.red-bar--double .rb-bot { width: 32px; background: var(--red-deep); animation: bar-draw var(--d-slow) var(--ease-out) .08s both; }
.red-bar[data-align="center"] .rb { margin-inline: auto; transform-origin: center; }
@keyframes bar-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.no-motion .red-bar .rb,
.no-motion .red-bar--single::before { animation: none !important; transform: none !important; }

/* ----------------------------- section heading ---------------------------- */
.section-heading { display: flex; flex-direction: column; gap: 12px; margin-bottom: var(--s-6); }
.section-heading .eyebrow { margin-bottom: -4px; }
.section-heading__title { color: var(--text-on-dark); }

.heading-mini { display: flex; flex-direction: column; gap: 10px; margin-bottom: var(--s-5); }

/* ----------------------------- buttons ------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 26px;
  border-radius: var(--r-pill);
  cursor: pointer;
  user-select: none;
  transition: transform var(--d-fast) var(--ease-out), background var(--d-fast) var(--ease-out),
    box-shadow var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out), color var(--d-fast);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn--full { width: 100%; }
.btn:active { transform: scale(.985); }

.btn-primary {
  background: var(--grad-red);
  color: var(--white);
  box-shadow: var(--sh-red);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(231,29,29,.42); }
.btn-primary:active { background: var(--red-deep); }
.btn-primary.btn--noglow { box-shadow: none; }
.btn-primary[disabled], .btn-primary[aria-disabled="true"] {
  background: var(--surface-2);
  color: var(--text-on-dark-faint);
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
}
/* primary on paper surfaces keeps its red identity */

.btn-ghost {
  background: transparent;
  color: var(--text-on-dark);
  border: 1.5px solid var(--surface-line);
}
.btn-ghost:hover { border-color: rgba(255,255,255,.55); }
.btn-ghost .ico { color: currentColor; }
/* ghost on paper */
.screen--settings .btn-ghost,
.confirm__card .btn-ghost,
.book__panel .btn-ghost {
  border-color: var(--paper-line);
  color: var(--text-on-paper);
}

.btn-text {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 0 2px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--t-button);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-on-dark);
}
.btn-text .ico { transition: transform var(--d-fast) var(--ease-out); }
.btn-text:hover .ico { transform: translateX(3px); }
.btn-text__bar {
  position: absolute;
  left: 2px; bottom: 4px;
  height: 2px; width: 0;
  background: var(--grad-red);
  border-radius: var(--r-bar);
  transition: width var(--d-base) var(--ease-out);
}
.btn-text:hover .btn-text__bar, .btn-text:focus-visible .btn-text__bar { width: calc(100% - 22px); }
/* btn-text on paper */
.confirm__card .btn-text, .book__panel .btn-text { color: var(--text-on-paper); }

/* ----------------------------- photo card --------------------------------- */
.photo-card {
  position: relative;
  display: block;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--sh-card);
  aspect-ratio: 4 / 3;
  background: var(--surface-1);
  isolation: isolate;
}
.photo-card--big { aspect-ratio: 16 / 11; }
.photo-card__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.04);
  transition: transform var(--d-slow) var(--ease-out), filter var(--d-slow) var(--ease-out);
  z-index: 0;
}
.photo-card:active .photo-card__img { transform: scale(1.03); }
.photo-card__scrim { position: absolute; inset: 0; background: var(--scrim-card); z-index: 1; }
.photo-card__content {
  position: absolute; inset: auto 0 0 0;
  z-index: 2;
  padding: var(--s-4) var(--s-4) var(--s-4);
  display: flex; flex-direction: column; gap: 4px;
}
.photo-card__title { color: var(--white); }
.photo-card__meta { margin-top: 2px; }

/* video tile = photo card + play */
.video-tile .photo-card__img { filter: grayscale(1) contrast(1.05) brightness(.92); }
.video-tile__play, .video-tile .video-tile__play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: rgba(11,11,12,.4);
  border: 2px solid rgba(255,255,255,.9);
  color: var(--red);
  backdrop-filter: blur(4px);
  transition: transform var(--d-fast) var(--ease-spring), background var(--d-fast);
}
.video-tile:active .video-tile__play { transform: translate(-50%, -50%) scale(.92); }

/* ----------------------------- quote card --------------------------------- */
.quote-card {
  position: relative;
  display: block;
  border-radius: var(--r-md);
  background: var(--surface-1);
  padding: var(--s-7) var(--s-5) var(--s-5);
  box-shadow: var(--sh-card);
  overflow: hidden;
  isolation: isolate;
}
.quote-card--photo { min-height: 220px; }
.quote-card__bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; filter: grayscale(1) contrast(1.05); opacity: .5; z-index: 0;
}
.quote-card__scrim { position: absolute; inset: 0; background: var(--scrim-flat); z-index: 1; }
.quote-card > :not(.quote-card__bg):not(.quote-card__scrim) { position: relative; z-index: 2; }
.quote-card__mark {
  display: block;
  font-size: 64px; line-height: .6;
  color: var(--gold);
  margin-bottom: 8px;
  height: 30px;
}
.quote-card__body { color: var(--white); font-weight: 300; }
.quote-card__attr { margin-top: var(--s-4); color: var(--text-on-dark-soft); text-transform: uppercase; letter-spacing: .1em; }
.quote-card__meta { margin-top: var(--s-3); }

/* ----------------------------- chips -------------------------------------- */
.chip {
  display: inline-flex; align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-on-dark-soft);
  border: 1px solid transparent;
  transition: background var(--d-fast), color var(--d-fast), transform var(--d-fast) var(--ease-spring);
}
.chip:active { transform: scale(.96); }
.chip--selected { background: var(--grad-red); color: var(--white); }
/* chips on paper (time slots) */
.slots .chip { background: var(--paper-sunk); color: var(--text-on-paper-soft); }
.slots .chip--selected { background: var(--grad-red); color: var(--white); }

/* ----------------------------- segmented control -------------------------- */
.segmented {
  position: relative;
  display: flex;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  padding: 4px;
  margin-bottom: var(--s-6);
}
.segmented__thumb {
  position: absolute;
  top: 4px; left: 0; bottom: 4px;
  border-radius: var(--r-pill);
  background: var(--grad-red);
  box-shadow: var(--sh-red);
  transition: transform var(--d-base) var(--ease-spring), width var(--d-base) var(--ease-spring);
  z-index: 0;
}
.segmented__seg {
  position: relative; z-index: 1;
  flex: 1;
  min-height: 40px;
  border-radius: var(--r-pill);
  color: var(--text-on-dark-faint);
  transition: color var(--d-base);
  letter-spacing: .1em;
}
.segmented__seg.is-active { color: var(--white); }

/* ----------------------------- stepper ------------------------------------ */
.stepper {
  display: flex; align-items: center;
  gap: 0;
  margin: var(--s-3) 0 var(--s-6);
}
.stepper__dot {
  width: 26px; height: 26px; flex: none;
  border-radius: var(--r-pill);
  border: 2px solid var(--surface-line);
  background: var(--surface-1);
  display: grid; place-items: center;
  color: var(--white);
  transition: all var(--d-base) var(--ease-out);
}
.stepper__dot.is-active { border-color: var(--red); box-shadow: 0 0 0 4px rgba(231,29,29,.18); }
.stepper__dot.is-done { background: var(--grad-red); border-color: transparent; }
.stepper__track { flex: 1; height: 3px; background: var(--surface-line); border-radius: var(--r-bar); margin: 0 6px; }
.stepper__track.is-done { background: var(--grad-red); }

/* ----------------------------- input field (paper) ------------------------ */
.field { position: relative; margin-bottom: var(--s-5); }
.field__input {
  width: 100%;
  background: var(--paper-sunk);
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  padding: 22px 16px 10px;
  color: var(--text-on-paper);
  font-family: var(--font-body);
  font-size: 16px; /* >=16 to avoid iOS zoom */
  line-height: 1.4;
  transition: border-color var(--d-fast), box-shadow var(--d-fast), background var(--d-fast);
  resize: vertical;
}
.field textarea.field__input { min-height: 92px; padding-top: 24px; }
.field__input:focus { border-color: var(--red); box-shadow: var(--focus-ring); background: var(--white); outline: none; }
.field__label {
  position: absolute; left: 16px; top: 16px;
  color: var(--text-on-paper-faint);
  font-size: 16px;
  pointer-events: none;
  transition: transform var(--d-fast) var(--ease-out), font-size var(--d-fast), color var(--d-fast);
  transform-origin: left top;
}
.field__input:focus + .field__label,
.field__input:not(:placeholder-shown) + .field__label {
  transform: translateY(-12px) scale(.74);
  color: var(--text-on-paper-soft);
}
.field--error .field__input { border-color: var(--red); background: #FFF5F5; }
.field__error { color: var(--red-deep); margin-top: 6px; padding-left: 4px; }

/* ----------------------------- bottom sheet ------------------------------- */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.55);
  opacity: 0; transition: opacity var(--d-base) var(--ease-out);
}
.sheet-scrim.in { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  max-width: var(--content-max);
  margin-inline: auto;
  background: var(--surface-1);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--sh-sheet);
  padding: 12px var(--page-x) calc(var(--s-7) + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform var(--d-base) var(--ease-out);
}
.sheet.in { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; border-radius: 99px; background: var(--surface-line); margin: 0 auto 16px; }
.sheet-title { margin-bottom: 12px; }
.sheet-body { color: var(--text-on-dark-soft); }
.sheet-quote { font-size: 22px; line-height: 1.4; color: var(--white); }
.sheet-actions { margin-top: var(--s-5); display: flex; gap: 12px; }
.sheet-actions .btn { flex: 1; }

/* ----------------------------- toast -------------------------------------- */
#toast-root {
  position: fixed; left: 0; right: 0; z-index: 70;
  bottom: calc(64px + var(--safe-bottom) + 16px);
  display: flex; justify-content: center;
  pointer-events: none;
  padding-inline: var(--page-x);
}
.toast {
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 88%;
  background: var(--surface-2);
  color: var(--white);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-pill);
  padding: 12px 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  transform: translateY(20px); opacity: 0;
  transition: transform var(--d-base) var(--ease-out), opacity var(--d-base) var(--ease-out);
}
.toast--in { transform: translateY(0); opacity: 1; }
.toast--success { border-left: 3px solid var(--red); }
.toast .ico { color: var(--red); }

/* ----------------------------- top app bar -------------------------------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  height: calc(56px + var(--safe-top));
  padding: var(--safe-top) var(--page-x) 0;
  max-width: var(--content-max); margin-inline: auto;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background var(--d-base) var(--ease-out), border-color var(--d-base);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
#topbar .topbar-wordmark { height: 22px; width: auto; opacity: 0; transform: translateY(-4px); transition: opacity var(--d-base), transform var(--d-base); }
#topbar.scrolled { background: rgba(20,20,22,.92); border-bottom-color: var(--surface-line); backdrop-filter: blur(12px); }
#topbar.scrolled .topbar-wordmark { opacity: 1; transform: none; }
.topbar-action {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  color: var(--white);
  border-radius: var(--r-pill);
}
.topbar-action:active { background: rgba(255,255,255,.08); }
@media (min-width: 480px){ #topbar { padding-inline: var(--page-x-lg); } }

/* ----------------------------- bottom tab bar ----------------------------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex;
  height: calc(64px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface-1);
  border-top: 1px solid var(--surface-line);
  box-shadow: var(--sh-nav);
  max-width: var(--content-max); margin-inline: auto;
}
.tab {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--text-on-dark-faint);
  min-height: 48px;
  transition: color var(--d-fast);
}
.tab .tab-icon { display: grid; place-items: center; height: 24px; }
.tab .tab-label { letter-spacing: .08em; text-transform: uppercase; }
.tab-bar {
  position: absolute; top: 8px;
  height: 2px; width: 22px;
  background: var(--grad-red);
  border-radius: var(--r-bar);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--d-base) var(--ease-out);
}
.tab--active { color: var(--white); }
.tab--active .tab-bar { transform: scaleX(1); }
.tab:active { color: var(--text-on-dark-soft); }

/* ----------------------------- toggle ------------------------------------- */
.toggle {
  width: 52px; height: 32px; flex: none;
  border-radius: var(--r-pill);
  background: var(--paper-line);
  transition: background var(--d-base) var(--ease-out);
  position: relative;
}
.toggle__track { position: absolute; inset: 0; }
.toggle__thumb {
  position: absolute; top: 3px; left: 3px;
  width: 26px; height: 26px;
  border-radius: var(--r-pill);
  background: var(--white);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  transition: transform var(--d-base) var(--ease-spring);
}
.toggle.is-on { background: var(--grad-red); }
.toggle.is-on .toggle__thumb { transform: translateX(20px); }
.toggle[disabled] { opacity: .5; cursor: not-allowed; }
.toggle--busy { opacity: .7; }

/* ----------------------------- status chip -------------------------------- */
.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-caption);
  color: var(--text-on-paper-soft);
  font-weight: 600; letter-spacing: .04em;
}
.status-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--grayLight, #BFBFBF); }
.status-chip.is-on .status-dot { background: #2ecc71; box-shadow: 0 0 0 3px rgba(46,204,113,.18); }

/* ----------------------------- ios install card --------------------------- */
.ios-install-card {
  background: var(--paper-sunk);
  border: 1px solid var(--paper-line);
  border-radius: var(--r-md);
  padding: var(--s-5);
}
.ios-install-card__title { color: var(--text-on-paper); margin-bottom: 6px; }
.ios-steps { display: flex; flex-direction: column; gap: 12px; margin-top: var(--s-4); }
.ios-step { display: flex; align-items: center; gap: 12px; color: var(--text-on-paper); }
.ios-step__n {
  width: 26px; height: 26px; flex: none;
  border-radius: var(--r-pill);
  background: var(--grad-red); color: var(--white);
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
}
.ios-step__t { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-body); }
.ios-step__ic { display: inline-block; vertical-align: middle; color: var(--text-on-paper); }
.ios-step b { font-weight: 600; }

/* ----------------------------- social row --------------------------------- */
.social-list { display: flex; flex-direction: column; }
.social-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--surface-line);
}
.social-row:last-child { border-bottom: 0; }
.social-row__icon { color: var(--text-on-dark); }
.social-row__text { flex: 1; display: flex; flex-direction: column; }
.social-row__chev { color: var(--text-on-dark-faint); }
/* paper variant */
.social-list--paper .social-row { border-bottom-color: var(--paper-line); }
.social-list--paper .social-row__icon,
.screen--settings .social-row__label { color: var(--text-on-paper); }
.screen--settings .social-row__handle { color: var(--text-on-paper-faint); }
.screen--settings .social-row__chev { color: var(--text-on-paper-faint); }
