/* Baymax Records Connect — calm, Apple-like, mobile-first.
   System type, size-specific tracking, generous spacing, restrained color, light + dark. */

:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(118, 118, 128, 0.2);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --separator: rgba(60, 60, 67, 0.14);
  --accent: #0071e3;
  --accent-press: #0062c4;
  --accent-tint: rgba(0, 113, 227, 0.1);
  --on-accent: #ffffff;
  --success: #248a3d;
  --success-tint: rgba(36, 138, 61, 0.12);
  --danger: #d70015;
  --danger-tint: rgba(215, 0, 21, 0.08);
  --warn: #b25000;
  --warn-tint: rgba(255, 149, 0, 0.14);
  --mark: #1d1d1f;
  --mark-ink: #ffffff;
  --bar-bg: rgba(245, 245, 247, 0.72);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --radius-lg: 1.25rem;
  --radius: 0.875rem;
  --radius-sm: 0.625rem;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --focus: 0 0 0 4px rgba(0, 113, 227, 0.35);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --fill: rgba(118, 118, 128, 0.24);
  --fill-strong: rgba(118, 118, 128, 0.36);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #8e8e93;
  --separator: rgba(84, 84, 88, 0.65);
  --accent: #2997ff;
  --accent-press: #4aa8ff;
  --accent-tint: rgba(41, 151, 255, 0.16);
  --on-accent: #ffffff;
  --success: #30d158;
  --success-tint: rgba(48, 209, 88, 0.16);
  --danger: #ff453a;
  --danger-tint: rgba(255, 69, 58, 0.14);
  --warn: #ffb340;
  --warn-tint: rgba(255, 159, 10, 0.16);
  --mark: #f5f5f7;
  --mark-ink: #000000;
  --bar-bg: rgba(0, 0, 0, 0.7);
  --shadow: none;
  --focus: 0 0 0 4px rgba(41, 151, 255, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.36);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --separator: rgba(84, 84, 88, 0.65);
    --accent: #2997ff;
    --accent-press: #4aa8ff;
    --accent-tint: rgba(41, 151, 255, 0.16);
    --success: #30d158;
    --success-tint: rgba(48, 209, 88, 0.16);
    --danger: #ff453a;
    --danger-tint: rgba(255, 69, 58, 0.14);
    --warn: #ffb340;
    --warn-tint: rgba(255, 159, 10, 0.16);
    --mark: #f5f5f7;
    --mark-ink: #000000;
    --bar-bg: rgba(0, 0, 0, 0.7);
    --shadow: none;
    --focus: 0 0 0 4px rgba(41, 151, 255, 0.45);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font: 100%/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  color: var(--text);
  /* ease light/dark changes instead of an abrupt brightness jump */
  transition: background-color 300ms ease, color 300ms ease;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-size: 1.0625rem; /* 17px body, the iOS default */
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.15em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--surface); padding: 0.5rem 1rem; border-radius: var(--radius-sm); z-index: 10; }
.skip:focus { left: 0.5rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* Translucent navigation bar: content scrolls underneath */
.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  padding-top: env(safe-area-inset-top);
}
.bar::after { /* scroll-edge hairline instead of a heavy border */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: var(--separator);
  opacity: 0.6;
}
.bar-inner {
  max-width: 40rem;
  margin: 0 auto;
  height: 3.25rem;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); font-size: 0.9375rem; letter-spacing: -0.012em; }
.brand .mark { color: var(--mark); flex: none; }
.brand strong { font-weight: 600; }
.brand-sep, .brand-sub { color: var(--text-2); }

.theme-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-2);
  width: 2.75rem; height: 2.75rem;
  margin-right: -0.6rem;
  border-radius: 999px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background-color 150ms ease, transform 100ms ease-out;
}
.theme-toggle:hover { background: var(--fill); }
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle .icon { width: 1.3rem; height: 1.3rem; }
.theme-dark { display: none; }
:root[data-theme="dark"] .theme-light { display: none; }
:root[data-theme="dark"] .theme-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-light { display: none; }
  :root:not([data-theme="light"]) .theme-dark { display: block; }
}

.page {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Entrance: short, critically-damped-looking rise. Static content only (no gestures). */
.page > * { animation: rise 520ms var(--ease) both; }
.page > *:nth-child(2) { animation-delay: 40ms; }
.page > *:nth-child(3) { animation-delay: 80ms; }
.page > *:nth-child(4) { animation-delay: 120ms; }
.page > *:nth-child(n + 5) { animation-delay: 160ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Typography: tracking and leading change with size */
h1 {
  font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.125rem);
  line-height: 1.1;
  letter-spacing: -0.028em;
  font-weight: 700;
  margin: 0;
  text-wrap: balance;
}
h2 { font-size: 1.1875rem; line-height: 1.25; letter-spacing: -0.02em; font-weight: 600; margin: 0 0 0.35rem; }
.lede { font-size: 1.0625rem; color: var(--text-2); margin: 0.6rem 0 0; text-wrap: pretty; }
.fine { font-size: 0.8125rem; line-height: 1.38; letter-spacing: -0.004em; color: var(--text-3); margin: 0; text-wrap: pretty; }
.section-title { font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.01em; text-transform: uppercase; color: var(--text-2); margin: 0.5rem 0 -0.5rem 1rem; }
.center { text-align: center; }

.hero { padding-top: 0.5rem; }
.hero.center { display: flex; flex-direction: column; align-items: center; padding-top: 2.5rem; gap: 0.25rem; }
.hero.center .lede { max-width: 26rem; margin-bottom: 1.25rem; }
.hero-icon {
  width: 4rem; height: 4rem;
  border-radius: 1.25rem;
  display: grid; place-items: center;
  background: var(--accent-tint);
  color: var(--accent);
  margin-bottom: 1rem;
}
.hero-icon.ok { background: var(--success-tint); color: var(--success); }
.hero-icon .icon { width: 2rem; height: 2rem; }

.badge {
  display: inline-block;
  margin: 0.9rem 0 0;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.005em;
}
.badge.warn { background: var(--warn-tint); color: var(--warn); }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.5rem; }
.step { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.75rem; color: var(--text-3); letter-spacing: 0; }
.step::before { content: ""; height: 4px; border-radius: 2px; background: var(--fill-strong); transition: background-color 300ms ease; }
.step.done::before, .step.current::before { background: var(--accent); }
.step.current { color: var(--text); font-weight: 600; }
.step .dot { display: none; }

/* Surfaces */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.consent-card { display: grid; grid-template-columns: 2.5rem 1fr; gap: 0.9rem; align-items: start; }
.card-icon { width: 2.5rem; height: 2.5rem; border-radius: 0.75rem; display: grid; place-items: center; background: var(--accent-tint); color: var(--accent); }
.card-icon .icon { width: 1.35rem; height: 1.35rem; }
.prose { color: var(--text-2); font-size: 0.9375rem; line-height: 1.47; letter-spacing: -0.012em; }
.prose p { margin: 0.25rem 0 0.5rem; }
.prose ul { margin: 0.25rem 0 0.5rem; padding-left: 1.1rem; }
.prose li { margin: 0.2rem 0; }
.prose strong { color: var(--text); font-weight: 600; }
.prose blockquote { margin: 0.5rem 0; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); background: var(--warn-tint); color: var(--warn); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form h2 { margin-top: 0.25rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field-label { font-size: 0.875rem; font-weight: 500; color: var(--text-2); letter-spacing: -0.006em; }
.optional { font-weight: 400; color: var(--text-3); }
input[type="text"], input[type="date"], input[type="email"], input[type="tel"], input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 3.25rem;
  padding: 0 1rem;
  font: inherit;
  font-size: 1.0625rem; /* >=16px: no iOS zoom on focus */
  color: var(--text);
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
input::placeholder { color: var(--text-3); }
input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); background: var(--surface); }
input.digits { font-variant-numeric: tabular-nums; letter-spacing: 0.3em; max-width: 9rem; }
input.otp { font-size: 1.75rem; text-align: center; letter-spacing: 0.5em; padding-left: 1.5em; font-variant-numeric: tabular-nums; font-weight: 500; }
input.signature { font-family: "Snell Roundhand", "Segoe Script", "Apple Chancery", cursive; font-size: 1.5rem; letter-spacing: 0; }
input[type="date"] { display: flex; align-items: center; }

.check { display: grid; grid-template-columns: 1.5rem 1fr; gap: 0.75rem; align-items: start; font-size: 0.9375rem; letter-spacing: -0.012em; cursor: pointer; }
.check input { width: 1.375rem; height: 1.375rem; margin: 0.1rem 0 0; accent-color: var(--accent); }

.segmented { border: 0; padding: 0; margin: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; background: var(--fill); border-radius: var(--radius-sm); padding: 2px; }
.segmented legend { margin-bottom: 0.4rem; padding: 0; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; text-align: center; padding: 0.55rem 0.5rem; border-radius: calc(var(--radius-sm) - 2px); font-size: 0.875rem; font-weight: 500; color: var(--text-2); transition: background-color 200ms ease, color 200ms ease; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.segmented input:focus-visible + span { box-shadow: var(--focus); }

.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding: 1.75rem 1rem; border: 1.5px dashed var(--fill-strong); border-radius: var(--radius); color: var(--accent); text-align: center; cursor: pointer; transition: background-color 150ms ease; }
.drop:hover { background: var(--accent-tint); }
.drop .icon { width: 2rem; height: 2rem; }
.drop-title { font-weight: 600; }
.drop-sub { font-size: 0.8125rem; color: var(--text-3); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.search { position: relative; }
.search-icon { position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%); color: var(--text-3); display: flex; pointer-events: none; }
.search-icon .icon { width: 1.2rem; height: 1.2rem; }
.search input { padding-left: 2.6rem; background: var(--surface); box-shadow: var(--shadow); }

/* Buttons: feedback on press, instantly */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3.25rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.016em;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 100ms ease-out, background-color 150ms ease, opacity 150ms ease;
  touch-action: manipulation;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--on-accent); width: 100%; }
.btn.primary:active { background: var(--accent-press); }
.btn.secondary { background: var(--accent-tint); color: var(--accent); width: 100%; }
.btn.plain { background: transparent; color: var(--accent); font-weight: 500; min-height: 2.75rem; align-self: center; }
.btn.destructive { background: var(--danger-tint); color: var(--danger); }
.btn.small { min-height: 2.25rem; padding: 0 0.9rem; font-size: 0.875rem; }
.btn[aria-busy="true"] { opacity: 0.6; pointer-events: none; }
.hero.center .btn.primary { max-width: 20rem; }
.actions { display: flex; flex-direction: column; gap: 0.75rem; }

/* Inset grouped lists */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.list > li + li .row::before { content: ""; position: absolute; top: 0; left: 3.75rem; right: 0; height: 1px; background: var(--separator); }
.list.counts > li + li .row::before { left: 1.25rem; }
.row { position: relative; display: flex; align-items: center; gap: 0.85rem; min-height: 3.5rem; padding: 0.7rem 1.25rem; color: var(--text); text-decoration: none !important; transition: background-color 120ms ease; }
.row.tall { min-height: 4.5rem; }
a.row:active, a.row-card:active { background: var(--fill); }
@media (hover: hover) { a.row:hover { background: var(--surface-2); } }
.row.disabled { color: var(--text-3); }
.row.disabled .row-icon { opacity: 0.5; }
.row-icon { flex: none; width: 2.25rem; height: 2.25rem; border-radius: 0.65rem; display: grid; place-items: center; background: var(--accent-tint); color: var(--accent); }
.row-icon.ok { background: var(--success-tint); color: var(--success); }
.row-icon .icon { width: 1.25rem; height: 1.25rem; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 500; overflow-wrap: anywhere; }
.row-sub { font-size: 0.8125rem; color: var(--text-2); letter-spacing: -0.004em; }
.chevron { flex: none; width: 1rem; height: 1rem; color: var(--text-3); }
.count { font-variant-numeric: tabular-nums; color: var(--text-2); }
.row-card { display: flex; align-items: center; gap: 0.85rem; padding: 0.9rem 1.25rem; color: var(--text); text-decoration: none !important; transition: transform 100ms ease-out; }
.row-card:active { transform: scale(0.985); }
.empty { padding: 1.25rem; color: var(--text-2); text-align: center; font-size: 0.9375rem; }
.empty.more { font-size: 0.8125rem; padding: 0.9rem 1.25rem; }
.row-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }
.row-meta:empty { display: none; }
.vendor-badge, .soon-badge { display: inline-flex; align-items: center; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em; padding: 0.12rem 0.5rem; border-radius: 999px; background: var(--fill); color: var(--text-2); white-space: nowrap; }
.vendor-badge.vendor-epic { background: rgba(196, 30, 58, 0.1); color: #b0203a; }
.vendor-badge.vendor-athena { background: rgba(122, 64, 196, 0.12); color: #6b3fb0; }
.vendor-badge.vendor-ecw { background: rgba(0, 140, 149, 0.12); color: #00727a; }
.vendor-badge.vendor-oracle { background: rgba(199, 70, 52, 0.12); color: #a63a2b; }
:root[data-theme="dark"] .vendor-badge.vendor-epic { color: #ff7d93; }
:root[data-theme="dark"] .vendor-badge.vendor-athena { color: #c7a4ff; }
:root[data-theme="dark"] .vendor-badge.vendor-ecw { color: #5fd3db; }
:root[data-theme="dark"] .vendor-badge.vendor-oracle { color: #ff9a8a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .vendor-badge.vendor-epic { color: #ff7d93; }
  :root:not([data-theme="light"]) .vendor-badge.vendor-athena { color: #c7a4ff; }
  :root:not([data-theme="light"]) .vendor-badge.vendor-ecw { color: #5fd3db; }
  :root:not([data-theme="light"]) .vendor-badge.vendor-oracle { color: #ff9a8a; }
}
.soon-badge { background: var(--warn-tint); color: var(--warn); }
.row.unavailable { flex-wrap: wrap; }
.row.unavailable .row-icon { opacity: 0.6; }
.row-action { flex: none; margin: 0; }
.row-action .btn.secondary { width: auto; }
.notified { flex: none; display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8125rem; font-weight: 500; color: var(--success); }
.notified .icon { width: 1rem; height: 1rem; }
@media (max-width: 30rem) { .row.unavailable .row-action, .row.unavailable .notified { margin-left: 3.1rem; } }

.notice { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.6rem; padding: 0.85rem 1rem; border-radius: var(--radius); font-size: 0.9375rem; }
.notice p { margin: 0; }
.notice .icon { width: 1.3rem; height: 1.3rem; }
.notice.error { background: var(--danger-tint); color: var(--danger); }
.notice.success, .notice.info { background: var(--success-tint); color: var(--success); }

.danger-zone p { color: var(--text-2); font-size: 0.9375rem; margin: 0 0 1rem; }

.spinner { width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 3px solid var(--fill-strong); border-top-color: var(--accent); animation: spin 0.9s linear infinite; margin-bottom: 1.25rem; }
@keyframes spin { to { transform: rotate(360deg); } }

.foot { text-align: center; padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom)); font-size: 0.75rem; color: var(--text-3); letter-spacing: 0; }
.foot p { margin: 0.2rem 0; display: flex; align-items: center; justify-content: center; gap: 0.35rem; }
.foot .icon { width: 0.9rem; height: 0.9rem; }

@media (min-width: 40rem) {
  .page { padding-top: 3rem; gap: 1.5rem; }
  .actions { flex-direction: row-reverse; }
  .card { padding: 1.5rem; }
}

/* Accessibility preferences */
@media (prefers-reduced-motion: reduce) {
  .page > * { animation: fade 200ms ease both; animation-delay: 0ms !important; }
  .btn:active, .row-card:active, .theme-toggle:active { transform: none; }
  .spinner { animation: none; border-top-color: var(--fill-strong); border-right-color: var(--accent); }
  html { transition: none; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-transparency: reduce) {
  .bar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --separator: rgba(0, 0, 0, 0.5); --text-2: #3a3a3c; --text-3: #48484a; }
  .card, .list, input, .search input { border: 1px solid var(--text-2); }
  .btn.secondary, .btn.destructive { border: 1px solid currentColor; }
}
@media (forced-colors: active) {
  .btn, .card, .list, input { border: 1px solid CanvasText; }
}
