/* Glass, buttons, pills, cards, chips, devices.
   Recipes from Figma "00 — Foundations" (1706:143). */

/* ---------- glass ---------- */
.glass {
  position: relative;
  border-radius: var(--r, 28px);
  background:
    linear-gradient(180deg, rgb(255 255 255 / .08), transparent 50%),
    var(--wash, linear-gradient(transparent, transparent)),
    var(--glass);
  -webkit-backdrop-filter: blur(var(--blur, 22px)) saturate(1.1);
  backdrop-filter: blur(var(--blur, 22px)) saturate(1.1);
  box-shadow: var(--shadow);
  isolation: isolate;
}
/* 1px gradient border, lit from the top-left */
.glass::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: var(--bw-px, 1px);
  pointer-events: none;
  background: linear-gradient(135deg, var(--b1, var(--border-hi)), var(--b2, var(--border-mid)) 50%, var(--b3, var(--border-lo)));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  z-index: 2;
}
.glass--accent {
  --wash: radial-gradient(closest-side, rgb(from var(--accent) r g b / var(--wash-a, .2)), transparent);
  --b1: rgb(from var(--accent) r g b / .5);
  --b2: rgb(from var(--accent) r g b / .125);
  --b3: rgb(from var(--accent) r g b / .25);
  --blur: 24px;
}
.glass--tile {
  --wash: linear-gradient(180deg, rgb(from var(--accent) r g b / .14), transparent 65%);
  --b1: rgb(var(--ink) / .30); --b2: rgb(var(--ink) / .06); --b3: rgb(var(--ink) / .12);
  --blur: 20px;
  background-color: var(--glass-tile);
  box-shadow: none;
}
[data-theme="light"] .glass--tile { --b1: rgb(255 255 255 / 1); --b2: rgb(255 255 255 / .35); --b3: rgb(255 255 255 / .8); }
.glass--chrome {
  background: linear-gradient(180deg, rgb(255 255 255 / .08), transparent 50%), var(--chrome);
  --blur: 30px;
  --b1: rgb(255 255 255 / .45); --b2: rgb(255 255 255 / .09); --b3: rgb(255 255 255 / .18);
  box-shadow: var(--shadow-pill);
}
[data-theme="light"] .glass--chrome { --b1: #fff; --b2: rgb(255 255 255 / .35); --b3: rgb(255 255 255 / .8); }
/* HUD glass: tab bar, rank rail, rank chip. Dark in both themes. */
.glass--hud {
  background: linear-gradient(180deg, rgb(255 255 255 / .06), transparent 50%), var(--hud);
  --blur: 30px;
  --b1: rgb(255 255 255 / .45); --b2: rgb(255 255 255 / .04); --b3: rgb(255 255 255 / .12);
  box-shadow: var(--shadow-chrome), inset 0 1px 0 rgb(255 255 255 / .1);
  color: #fff;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background-color: rgb(24 20 40 / .92); }
  [data-theme="light"] .glass { background-color: rgb(255 255 255 / .92); }
}

/* ---------- brand fill ---------- */
.on-brand {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 8px 22px var(--brand-glow), inset 0 1px 0 rgb(255 255 255 / .4);
}

/* ---------- buttons ---------- */
.btn-brand {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 20px;
  border-radius: 22px;
  font-weight: 600; font-size: 14px; line-height: 1;
  white-space: nowrap;
  transition: filter .2s ease, translate .2s ease;
}
.btn-brand .icon { width: 16px; height: 16px; }
.btn-brand--lg { height: 48px; padding: 0 22px; border-radius: 24px; font-size: 15px; }

.btn-store {
  display: inline-flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 24px 0 20px;
  border-radius: 30px;
  white-space: nowrap;
  transition: filter .2s ease, translate .2s ease;
}
.btn-store span { display: flex; flex-direction: column; gap: 1px; line-height: normal; }
.btn-store small {
  font-family: var(--mono); font-weight: 500; font-size: 9px;
  letter-spacing: .12em; text-transform: uppercase;
}
.btn-store b { font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.btn-store.on-brand { box-shadow: 0 10px 24px rgb(124 77 255 / .5), inset 0 1px 0 rgb(255 255 255 / .4); }
.btn-store.on-brand small { color: rgb(18 5 48 / .75); }
.btn-store .i-apple { width: 24px; height: 24px; }
.btn-store .i-play { width: 21px; height: 21px; }
.btn-store.glass { --r: 30px; --blur: 22px; background-color: var(--glass-btn); color: var(--text); }
.btn-store.glass small { color: rgb(var(--ink) / .6); }
[data-theme="light"] .btn-store.glass { box-shadow: 0 12px 30px -10px rgb(91 63 181 / .25); }
.store-row { display: flex; gap: 12px; flex-wrap: wrap; }

@media (hover: hover) {
  .btn-brand:hover, .btn-store:hover, .tabbar a:hover { filter: brightness(1.06); }
  .btn-brand:hover, .btn-store:hover { translate: 0 -1px; }
  .glass--accent:hover { --b2: rgb(from var(--accent) r g b / .35); --b3: rgb(from var(--accent) r g b / .5); }
}

/* ---------- pills, chips ---------- */
.pill-glass {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 10px;
  --r: 999px; --blur: 20px;
  --b1: var(--border-pill); --b2: rgb(var(--ink) / .06); --b3: rgb(var(--ink) / .12);
  box-shadow: none;
  font-weight: 500; font-size: 13px; line-height: normal;
  color: rgb(var(--ink) / .85);
}
[data-theme="light"] .pill-glass { --b1: #fff; --b2: rgb(255 255 255 / .35); --b3: rgb(255 255 255 / .8); box-shadow: 0 8px 20px -10px rgb(91 63 181 / .25); }
.pill-glass .icon { width: 14px; height: 14px; color: rgb(var(--ink) / .6); }
.tag {
  padding: 3px 8px; border-radius: 999px;
  background: rgb(52 211 153 / .16);
  border: 1px solid rgb(52 211 153 / .35);
  color: var(--emerald);
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border-pill);
  background: linear-gradient(180deg, rgb(255 255 255 / .08), transparent 50%), var(--glass);
  font-weight: 500; font-size: 13px; line-height: normal;
  color: rgb(var(--ink) / .85);
}

.icon-chip {
  display: inline-grid; place-items: center; flex: none;
  width: var(--s, 40px); height: var(--s, 40px);
  border-radius: 50%;
  background: rgb(from var(--accent) r g b / .16);
  border: 1px solid rgb(from var(--accent) r g b / .35);
  color: var(--accent);
}
.icon-chip .icon { width: calc(var(--s, 40px) * .45); height: calc(var(--s, 40px) * .45); }

.eyebrow { display: flex; align-items: center; gap: 12px; color: var(--accent, var(--lavender)); }
.eyebrow.mono { font-size: 11px; }

/* checkpoint pill (desktop only) */
.checkpoint {
  position: absolute;
  display: none; align-items: center; gap: 10px;
  padding: 7px 14px 7px 7px;
  --r: 999px; --blur: 20px;
  --b1: rgb(var(--ink) / .32); --b2: rgb(var(--ink) / .32); --b3: rgb(var(--ink) / .32);
  box-shadow: none;
  color: rgb(var(--ink) / .65);
  opacity: 0; scale: .9;
  transition: opacity .25s ease, scale .25s ease;
  z-index: 3;
}
[data-theme="light"] .checkpoint { --b1: #fff; --b2: #fff; --b3: #fff; }
.checkpoint.is-in { opacity: 1; scale: 1; }
.checkpoint .dot {
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgb(52 211 153 / .18); border: 1px solid rgb(52 211 153 / .45);
  color: var(--emerald);
}
.checkpoint .dot .icon { width: 11px; height: 11px; }
.checkpoint .xp { color: var(--amber); }
@media (min-width: 1024px) { .checkpoint { display: inline-flex; } }

/* section heading */
.section-head { display: flex; flex-direction: column; gap: 12px; }
.section-head .mono { font-size: 11px; color: var(--lavender); }
.section-head h2 {
  font-weight: 600; font-size: 40px; line-height: 42px; letter-spacing: -.04em;
}
.section-head .sub { font-size: 15px; line-height: 23px; color: rgb(var(--ink) / .66); max-width: 330px; }
.section-head--center { align-items: center; text-align: center; }

@media (min-width: 1024px) {
  .section-head { gap: 18px; }
  .section-head h2 { font-size: 64px; line-height: 66px; }
  .section-head .sub { font-size: 18px; line-height: 28px; max-width: 560px; }
  .section-head--center .sub { max-width: 620px; }
}

/* text link with arrow */
.link { display: inline-flex; align-items: center; gap: 6px; padding-top: 6px; font-weight: 600; font-size: 14px; color: var(--lavender); }
.link .icon { width: 15px; height: 15px; }

/* ---------- devices (exported app art) ----------
   Each art class gives the image size (--iw) and where the device body sits inside it
   (--bw body width, --l / --t body offset), all in image px. Each use sets the body
   box in design px: --x --y --w (desktop) and --mx --my --mw (phone). */
.device {
  --X: var(--mx); --Y: var(--my); --W: var(--mw);
  position: absolute;
  left: calc(var(--ox, 0px) + (var(--X) - var(--l) * var(--W) / var(--bw)) * 1px);
  top: calc((var(--Y) - var(--t) * var(--W) / var(--bw)) * 1px);
  width: calc(var(--W) * var(--iw) / var(--bw) * 1px);
  height: auto;
  pointer-events: none;
  user-select: none;
}
@media (min-width: 1024px) {
  .device { --X: var(--x); --Y: var(--y); --W: var(--w); --ox: 0px !important; }
}
.art-phone-lift      { --iw: 839; --bw: 673.6; --l: 80; --t: 54; }
.art-phone-coach,
.art-phone-circle,
.art-phone-rewards   { --iw: 808; --bw: 648.7; --l: 77; --t: 52; }
.art-phone-run,
.art-phone-readiness { --iw: 710; --bw: 570; --l: 68; --t: 46; }
.art-phone-war-match { --iw: 634; --bw: 496.7; --l: 21; --t: 111; }
.art-phone-victory   { --iw: 544; --bw: 446.9; --l: 83; --t: 58; }
.art-watch-log-set   { --iw: 452; --bw: 452; --l: 0; --t: 0; }
.art-watch-heart-rate{ --iw: 364; --bw: 364; --l: 0; --t: 0; }
.art-pop-new-pr      { --iw: 430; --bw: 354.3; --l: 61; --t: 37; }
.art-pop-swap        { --iw: 800; --bw: 709.7; --l: 46; --t: 28; }
.art-pop-xp-race     { --iw: 621; --bw: 500.8; --l: 50; --t: 42; }
.art-pop-convert     { --iw: 670; --bw: 538.8; --l: 61; --t: 42; }
.art-pop-level       { --iw: 720; --bw: 614.4; --l: 68; --t: 41; }

/* orbit rings: hairline circles, gradient stroke 135deg (defs in the sprite) */
.orbit { position: absolute; pointer-events: none; overflow: visible; }
.orbit circle { fill: none; stroke-width: 1; vector-effect: non-scaling-stroke; }
.orb-stop-a { stop-color: #C4B5FD; }
.orb-stop-b { stop-color: #818CF8; }
.orb-stop-m { stop-color: #fff; stop-opacity: 0; }
#orb1 .orb-stop-a { stop-opacity: .36; } #orb1 .orb-stop-b { stop-opacity: .18; }
#orb2 .orb-stop-a { stop-opacity: .20; } #orb2 .orb-stop-b { stop-opacity: .10; }
#orb3 .orb-stop-a { stop-opacity: .10; } #orb3 .orb-stop-b { stop-opacity: .05; }
[data-theme="light"] .orb-stop-a,
[data-theme="light"] .orb-stop-b { stop-color: #6D28D9; }
[data-theme="light"] #orb1 .orb-stop-a { stop-opacity: .58; } [data-theme="light"] #orb1 .orb-stop-b { stop-opacity: .29; }
[data-theme="light"] #orb2 .orb-stop-a { stop-opacity: .32; } [data-theme="light"] #orb2 .orb-stop-b { stop-opacity: .16; }
[data-theme="light"] #orb3 .orb-stop-a { stop-opacity: .16; } [data-theme="light"] #orb3 .orb-stop-b { stop-opacity: .08; }

/* =====================================================================
   Fixed chrome (sheet 01): brand pill, theme toggle, Get the app,
   tab bar, rank rail (desktop) / rank chip (phone).
   ===================================================================== */
.chrome-top {
  position: fixed; z-index: 50;
  top: 16px; left: 20px; right: 20px;
  display: flex; align-items: center; justify-content: space-between;
  pointer-events: none;
}
.chrome-top > * { pointer-events: auto; }
.chrome-left { display: flex; align-items: center; gap: 8px; }

.brand-pill {
  display: inline-flex; align-items: center; gap: 9px;
  height: 44px; padding: 0 14px 0 12px;
  --r: 24px;
  color: rgb(var(--ink) / .95);
}
.brand-pill img { width: 25px; height: 25px; }
.brand-pill .wordmark { font-family: var(--mono); font-weight: 500; font-size: 10.8px; letter-spacing: .3em; margin-right: -.3em; }

.theme-toggle {
  position: relative;
  display: inline-flex; align-items: center; gap: 2px;
  height: 44px; padding: 4px;
  --r: 24px;
}
.theme-toggle .seg {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 20px;
  color: rgb(var(--ink) / .7);
  transition: color .2s ease;
}
.theme-toggle .seg .icon { width: 16px; height: 16px; }
.theme-toggle .knob {
  position: absolute; z-index: 0; top: 4px; left: 4px;
  width: 36px; height: 36px; border-radius: 20px;
  background: var(--brand);
  box-shadow: 0 3px 12px rgb(124 77 255 / .5), inset 0 1px 0 rgb(255 255 255 / .5);
  transition: translate .2s ease;
}
[data-theme="dark"] .theme-toggle .knob { translate: 38px 0; }
.theme-toggle .seg.is-active { color: var(--brand-ink); }

.btn-get { display: none; }

.rank-chip {
  display: block; position: relative;
  width: 116px; height: 44px;
  --r: 22px;
}
.rank-chip img { position: absolute; left: 4px; top: 3px; width: 36px; height: 36px; filter: drop-shadow(0 1px 6px rgb(from var(--rank) r g b / .7)); }
.rank-chip output { position: absolute; left: 46px; top: 7px; font-family: var(--mono); font-weight: 500; font-size: 12px; line-height: 15px; color: var(--rank); transition: color .3s ease; }
.rank-chip .xp-label { position: absolute; left: 72px; top: 11px; font-family: var(--mono); font-weight: 500; font-size: 8px; line-height: 10px; letter-spacing: .12em; color: rgb(255 255 255 / .5); }
.rank-chip .bar { position: absolute; left: 46px; top: 29px; width: 56px; height: 3px; border-radius: 1.5px; background: rgb(255 255 255 / .12); }
.rank-chip .bar i { display: block; height: 100%; border-radius: inherit; width: calc(var(--progress, 0) * 100%); background: linear-gradient(90deg, #8B5CF6, var(--rank)); box-shadow: 0 0 6px rgb(from var(--rank) r g b / .7); }

.rank-badge-swap { transition: opacity .3s ease; }

@media (min-width: 1024px) {
  .chrome-top { top: 28px; left: max(40px, calc(50% - 600px)); right: max(40px, calc(50% - 600px)); }
  .chrome-left { gap: 10px; }
  .brand-pill { height: 48px; padding: 0 20px 0 16px; gap: 10.5px; }
  .brand-pill img { width: 29px; height: 29px; }
  .brand-pill .wordmark { font-size: 12.6px; }
  .theme-toggle { height: 48px; }
  .theme-toggle .seg { width: 40px; height: 40px; }
  .theme-toggle .seg .icon { width: 17px; height: 17px; }
  .theme-toggle .knob { width: 40px; height: 40px; }
  [data-theme="dark"] .theme-toggle .knob { translate: 42px 0; }
  .btn-get { display: inline-flex; }
  .chrome-right { display: flex; align-items: center; gap: 10px; }
}
@media (min-width: 1360px) {
  .chrome-top .rank-chip { display: none; }
}

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; z-index: 50;
  left: 50%; translate: -50% 0;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 0;
  width: 350px; height: 64px; padding: 7px;
  --r: 32px;
}
.tabbar a {
  position: relative; z-index: 1;
  flex: 1 1 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: 50px; border-radius: 24px;
  font-weight: 500; font-size: 9.5px; line-height: 1;
  color: rgb(255 255 255 / .7);
  transition: color .3s ease;
}
.tabbar a .icon { width: 19px; height: 19px; }
.tabbar a[aria-current="true"] { color: var(--brand-ink); font-weight: 600; }
.tabbar .tab-pill {
  position: absolute; z-index: 0; top: 7px; left: 0;
  height: 50px; border-radius: 24px;
  background: var(--brand);
  box-shadow: 0 4px 18px rgb(124 77 255 / .55), inset 0 1px 0 rgb(255 255 255 / .5);
  transition: translate .3s cubic-bezier(.3,.7,.2,1), width .3s cubic-bezier(.3,.7,.2,1);
  pointer-events: none;
}
@media (min-width: 1024px) {
  .tabbar { bottom: 26px; width: auto; height: 66px; padding: 8px; gap: 2px; }
  .tabbar a { flex: none; flex-direction: row; gap: 8px; height: 48px; padding: 0 18px 0 16px; font-size: 13px; }
  .tabbar .tab-pill { top: 8px; height: 48px; }
}

/* ---------- rank rail (desktop, wide screens) ---------- */
.rank-rail { display: none; }
@media (min-width: 1360px) {
  .rank-rail {
    display: block;
    position: fixed; z-index: 50; right: 24px; top: 250px;
    width: 60px; height: 380px;
    --r: 30px;
  }
  .rank-rail .badge { position: absolute; left: 5px; top: 7px; width: 48px; height: 48px; filter: drop-shadow(0 2px 8px rgb(from var(--rank) r g b / .7)); }
  .rank-rail output { position: absolute; left: 0; right: 0; top: 61px; text-align: center; font-family: var(--mono); font-weight: 500; font-size: 12px; line-height: 15px; color: var(--rank); transition: color .3s ease; }
  .rank-rail .xp-label { position: absolute; left: 0; right: 0; top: 79px; text-align: center; font-family: var(--mono); font-weight: 500; font-size: 8px; letter-spacing: .12em; color: rgb(255 255 255 / .45); }
  .rank-rail .track { position: absolute; left: 27px; top: 107px; width: 4px; height: 228px; border-radius: 2px; background: rgb(255 255 255 / .1); }
  .rank-rail .fill { position: absolute; left: 0; top: 0; width: 4px; height: calc(var(--progress, 0) * 100%); border-radius: 2px; background: linear-gradient(180deg, #8B5CF6, var(--rank)); box-shadow: 0 0 8px rgb(from var(--rank) r g b / .7); }
  .rank-rail .stop { position: absolute; left: 50%; width: 8px; height: 8px; border-radius: 50%; translate: -50% -50%; background: rgb(255 255 255 / .22); transition: all .3s ease; }
  .rank-rail .stop.is-done { background: rgb(from var(--rank) r g b / .9); }
  .rank-rail .stop.is-current { width: 14px; height: 14px; background: var(--rank); box-shadow: 0 0 0 2px #fff, 0 0 12px var(--rank); }
}

/* orbit rings inside panels (centre in panel px) */
.porbit { left: calc(var(--ox, 0px) + var(--mx) * 1px); top: calc(var(--my) * 1px); width: calc(var(--md) * 1px); height: calc(var(--md) * 1px); translate: -50% -50%; }
.porbit[style*="--md:0"] { display: none; }
@media (min-width: 1024px) {
  .porbit { left: calc(var(--x) * 1px); top: calc(var(--y) * 1px); width: calc(var(--d) * 1px); height: calc(var(--d) * 1px); }
  .porbit[style*="--md:0"] { display: block; }
}
.dev--desk { display: none; }
@media (min-width: 1024px) { .dev--desk { display: block; } }
.art-wear-lift  { --iw: 600; --bw: 600; --l: 0; --t: 0; }
.art-wear-start { --iw: 366; --bw: 366; --l: 0; --t: 0; }
.art-wear-live  { --iw: 446; --bw: 446; --l: 0; --t: 0; }
