/* Rise Co member app (web). Colours, spacing and corners mirror the iPhone app's
   Shared/Design/Palette.swift, Metrics.swift and Typography.swift. A view that hardcodes a colour is a bug. */

:root {
  --page: #FBFBFA; --sunken: #F2F3F3; --rule: #E2E5E5;
  --ink: #101314; --ink2: #4A5153; --ink3: #6E787A;
  --accent: #0B7F76; --on-accent: #FFFFFF;
  --ring-training: #0B7F76; --ring-steps: #1F6FD0; --ring-nutrition: #B8780A; --ring-habits: #7A4FE0;
  --good: #1E7A46; --warn: #B45309; --danger: #C0262D;
  --sp-xs: 4px; --sp-sm: 8px; --sp-md: 12px; --sp-lg: 16px; --sp-xl: 24px; --sp-xxl: 40px; --gutter: 20px;
  --r-control: 12px; --r-card: 18px; --r-sheet: 28px;
  --tabbar: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0B0D0E; --sunken: #1B2022; --rule: #242A2C;
    --ink: #F4F6F6; --ink2: #A6AFB1; --ink3: #7C8486;
    --accent: #3FD3C0; --on-accent: #06201D;
    --ring-training: #3FD3C0; --ring-steps: #5FA8FF; --ring-nutrition: #F2B950; --ring-habits: #B48CFF;
    --good: #4ADE80; --warn: #FBBF24; --danger: #F87171;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page); color: var(--ink); font-family: var(--font);
  font-size: 17px; line-height: 1.4; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
img { max-width: 100%; }

/* Layout */
#app { min-height: 100dvh; }
.boot { min-height: 100dvh; display: grid; place-items: center; opacity: .9; }
.shell { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + var(--sp-lg)) var(--gutter) calc(var(--tabbar) + env(safe-area-inset-bottom) + var(--sp-xl)); }
.shell.no-tabs { padding-bottom: calc(env(safe-area-inset-bottom) + var(--sp-xl)); }
.stack > * + * { margin-top: var(--sp-md); }
.stack-lg > * + * { margin-top: var(--sp-xl); }
.row { display: flex; align-items: center; gap: var(--sp-md); }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.hidden { display: none !important; }

/* Type (Typo) */
.title { font-size: 32px; font-weight: 600; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
.heading { font-size: 20px; font-weight: 600; margin: 0; }
.row-title { font-weight: 500; }
.label { font-size: 15px; color: var(--ink2); }
.caption { font-size: 13px; color: var(--ink3); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink3); }
.value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
p { margin: 0; }

/* Cards (riseCard) */
.card { background: var(--sunken); border: 1px solid var(--rule); border-radius: var(--r-card); padding: var(--sp-lg); }
.card.tight { padding: var(--sp-md); }
.card.accent { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.list { background: var(--sunken); border: 1px solid var(--rule); border-radius: var(--r-card); overflow: hidden; }
.list > .item { display: flex; align-items: center; gap: var(--sp-md); padding: var(--sp-md) var(--sp-lg); min-height: 52px; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--rule); cursor: pointer; }
.list > .item:first-child { border-top: 0; }
.list > .item:active { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.chev::after { content: "›"; color: var(--ink3); font-size: 22px; margin-left: auto; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-sm); min-height: 50px; padding: 0 var(--sp-xl); border-radius: var(--r-control); border: 0; background: var(--accent); color: var(--on-accent); font-weight: 600; cursor: pointer; width: 100%; transition: transform .12s ease, opacity .12s ease; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn.secondary { background: var(--sunken); color: var(--ink); border: 1px solid var(--rule); }
.btn.plain { background: none; color: var(--accent); min-height: 44px; width: auto; padding: 0 var(--sp-sm); }
.btn.danger { background: none; color: var(--danger); border: 1px solid var(--rule); }
.btn.small { min-height: 36px; padding: 0 var(--sp-md); width: auto; font-size: 15px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms */
.field { display: block; }
.field > .label { display: block; margin-bottom: var(--sp-xs); }
.input, .textarea, .select { width: 100%; min-height: 50px; padding: var(--sp-md); border-radius: var(--r-control); border: 1px solid var(--rule); background: var(--sunken); }
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.code-input { letter-spacing: .4em; font-size: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.choices { display: grid; gap: var(--sp-sm); }
.choice { display: flex; align-items: center; gap: var(--sp-md); padding: var(--sp-md) var(--sp-lg); min-height: 52px; border-radius: var(--r-control); border: 1px solid var(--rule); background: var(--sunken); cursor: pointer; text-align: left; width: 100%; }
.choice[aria-pressed="true"], .choice.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ink3); flex: none; display: grid; place-items: center; }
.on > .check, [aria-pressed="true"] > .check, .check.on { background: var(--accent); border-color: var(--accent); }
.on > .check::after, [aria-pressed="true"] > .check::after, .check.on::after { content: ""; width: 10px; height: 6px; border: 2px solid var(--on-accent); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.error { color: var(--danger); font-size: 15px; }
.note { font-size: 15px; color: var(--ink2); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

/* Header */
.topbar { display: flex; align-items: center; gap: var(--sp-sm); min-height: 44px; margin-bottom: var(--sp-md); }
.back { background: none; border: 0; color: var(--accent); font-size: 17px; padding: var(--sp-sm) 0; cursor: pointer; }
.back::before { content: "‹ "; font-size: 22px; }
.steps { font-size: 13px; color: var(--ink3); }

/* Tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; background: color-mix(in srgb, var(--page) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); }
.tabbar nav { display: flex; width: 100%; max-width: 560px; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--tabbar); color: var(--ink3); text-decoration: none; font-size: 11px; font-weight: 500; position: relative; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar svg { width: 24px; height: 24px; }
.badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* Loading skeletons (MomentumLoading): the shape of what is coming, never a spinner. */
.skel { background: var(--sunken); border: 1px solid var(--rule); border-radius: var(--r-card); position: relative; overflow: hidden; }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink) 5%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.skel.card-h { height: 112px; } .skel.row-h { height: 56px; }

/* Arrival (rise) */
.rise { animation: rise .34s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rise, .skel::after, .spinner { animation: none; } .btn { transition: none; } }

/* Toast */
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 14px; font-size: 15px; max-width: calc(100vw - 40px); transition: opacity .2s, transform .2s; z-index: 50; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Sheets (modal) */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--page); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: var(--r-sheet) var(--r-sheet) 0 0; padding: var(--sp-xl) var(--gutter) calc(env(safe-area-inset-bottom) + var(--sp-xl)); animation: up .28s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Sign-in */
.signin-logo { width: 140px; margin: var(--sp-xxl) auto var(--sp-xl); display: block; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-light { display: none; } .logo-dark { display: block; } }
.noscript { padding: 24px; }
.prose { color: var(--ink2); white-space: pre-wrap; }
.terms-body { max-height: 46dvh; overflow: auto; padding: var(--sp-lg); border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--sunken); font-size: 15px; line-height: 1.5; }
.terms-body h1, .terms-body h2, .terms-body h3 { font-size: 17px; margin: 1em 0 .4em; }
