/* byrick.app: the brand page. The page itself is neutral and dark; every app brings its own
   ground, light, accent and display face (the same tokens as its own site), and the page
   takes on the colours of whichever app is in view. */

/* Registered so the ambient light can animate between apps. */
@property --amb-a { syntax: "<color>"; inherits: true; initial-value: #AEB6C4; }
@property --amb-b { syntax: "<color>"; inherits: true; initial-value: #5B6CFF; }

:root {
  --page: #050506;
  --ink: #FFFFFF;
  --secondary: #A1A1AA;
  --tertiary: #6E6E76;
  --hairline: rgba(255, 255, 255, 0.12);
  --spring: cubic-bezier(0.22, 1.2, 0.36, 1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sf: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
  color-scheme: dark;
  transition: --amb-a 1.1s ease, --amb-b 1.1s ease;
}

/* ---------- The apps: one block each ----------
   --ground / --glow-a / --glow-b   the card, as on the app's own site
   --light-a / --light-b            what the whole page glows with while this app is in view
   --accent                         eyebrow, hero word, links
   --buzz / --on-buzz               the main button
   --display, --display-*           the app's title face
   --shot-w / --shot-y              screenshot width and lift, so every phone ends up the same size */
[data-app="gym"] {
  --ground: #0B0B0D;
  --glow-a: rgba(212, 255, 74, 0.15);
  --glow-b: rgba(92, 200, 255, 0.16);
  --light-a: #D4FF4A;
  --light-b: #5CC8FF;
  --accent: #D4FF4A;
  --buzz: #D4FF4A;
  --on-buzz: #0B0B0D;
  --display: var(--sf);
  --display-weight: 800;
  --display-spacing: -0.035em;
  --shot-w: 430px;
  --shot-y: -14px;
}

[data-app="philosophy"] {
  --ground: #0F0D0B;
  --glow-a: rgba(255, 181, 71, 0.20);
  --glow-b: rgba(200, 80, 192, 0.12);
  --light-a: #FFB547;
  --light-b: #B8469F;
  --accent: #FFB547;
  --buzz: #FFB547;
  --on-buzz: #0F0D0B;
  --display: "New York", ui-serif, Georgia, serif;
  --display-weight: 800;
  --display-spacing: -0.02em;
  --shot-w: 486px;
  --shot-y: -44px;
}

[data-app="eureka"] {
  --ground: #121110;
  --glow-a: rgba(224, 176, 78, 0.22);
  --glow-b: rgba(31, 58, 138, 0.50);
  --light-a: #E0B04E;
  --light-b: #2F4FB8;
  --accent: #E8C77A;
  --buzz: #FFFFFF;
  --on-buzz: #121110;
  --display: var(--sf);
  --display-weight: 900;
  --display-spacing: -0.01em;
  --display-stretch: condensed;
  --display-case: uppercase;
  --shot-w: 430px;
  --shot-y: -14px;
}

/* ---------- Page ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 55% at 82% 0%, color-mix(in srgb, var(--amb-b) 26%, transparent), transparent 70%),
    radial-gradient(ellipse 80% 60% at 18% 0%, color-mix(in srgb, var(--amb-a) 20%, transparent), transparent 70%),
    radial-gradient(ellipse 70% 40% at 50% 110%, color-mix(in srgb, var(--amb-a) 10%, transparent), transparent 70%);
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1.1fr 1fr auto;
  justify-items: center;
  align-items: start;
  padding: 28px 20px 150px;
  text-align: center;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 700 17px/1 var(--sf);
  letter-spacing: -0.01em;
}
.mark img { display: block; }

.hero h1 {
  display: grid;
  justify-items: center;
  align-self: end;
  font: 800 clamp(64px, 15vw, 190px)/0.95 var(--sf);
  letter-spacing: -0.045em;
}

/* The rolling word: every span sits in the same cell, so the old one can leave while the
   new one arrives (the web's version of .contentTransition(.numericText())). */
.roll { display: grid; justify-items: center; padding: 0.06em 0.1em; margin: -0.06em -0.1em; overflow: hidden; overflow: clip; overflow-clip-margin: 0.2em; }
.word {
  grid-area: 1 / 1;
  white-space: nowrap;
  color: var(--accent, var(--ink));
  font-family: var(--display, var(--sf));
  font-weight: var(--display-weight, 800);
  font-stretch: var(--display-stretch, normal);
  letter-spacing: var(--display-spacing, -0.045em);
  text-transform: var(--display-case, none);
}
.word.in { animation: word-in 0.75s var(--spring) both; }
.word.out { animation: word-out 0.45s ease-in both; }
@keyframes word-in { from { opacity: 0; transform: translateY(0.55em) scale(0.92); filter: blur(14px); } }
@keyframes word-out { to { opacity: 0; transform: translateY(-0.5em) scale(0.92); filter: blur(14px); } }

.by { color: var(--ink); }

.lead {
  max-width: 30em;
  margin-top: 28px;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.45;
  color: var(--secondary);
  text-wrap: balance;
}

.scroll-hint { margin-top: 44px; width: 28px; height: 44px; border: 1.5px solid var(--hairline); border-radius: 999px; display: grid; justify-items: center; padding-top: 9px; }
.scroll-hint span { width: 4px; height: 9px; border-radius: 2px; background: var(--secondary); animation: hint 1.9s var(--ease) infinite; }
@keyframes hint { 0% { opacity: 0; transform: translateY(-3px); } 35% { opacity: 1; } 100% { opacity: 0; transform: translateY(15px); } }

/* ---------- App cards ---------- */
main {
  display: grid;
  gap: 36px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.app {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: 32px;
  min-height: 620px;
  padding: 0 64px;
  border-radius: 48px;
  overflow: hidden;
  isolation: isolate;
  scroll-margin-top: 28px;
  background:
    radial-gradient(ellipse 70% 80% at 92% 0%, var(--glow-b), transparent 70%),
    radial-gradient(ellipse 90% 80% at 12% 0%, var(--glow-a), transparent 70%),
    var(--ground);
  box-shadow: inset 0 0 0 1px var(--hairline), inset 0 1px 0 0 rgba(255, 255, 255, 0.16), 0 40px 80px -40px rgba(0, 0, 0, 0.9);
}
.app:nth-child(even) { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); }
.app:nth-child(even) .shot { order: -1; }

/* A highlight that follows the pointer, like light moving over glass. */
.app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, -40%), rgba(255, 255, 255, 0.07), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.app:hover::after { opacity: 1; }

.copy { align-self: center; padding: 64px 0; position: relative; z-index: 1; }

.icon { display: block; width: 76px; height: 76px; margin-bottom: 26px; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.55)); }

.eyebrow { margin-bottom: 10px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }

.app h2 {
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-stretch: var(--display-stretch, normal);
  letter-spacing: var(--display-spacing);
  text-transform: var(--display-case, none);
  font-size: clamp(40px, 5.4vw, 64px);
  line-height: 1;
}

.pitch { max-width: 27em; margin-top: 18px; font-size: 19px; color: color-mix(in srgb, var(--ink) 66%, var(--ground)); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 30px; }

.go {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--buzz);
  color: var(--on-buzz);
  font-weight: 700;
  transition: transform 0.35s var(--spring), box-shadow 0.35s ease;
}
.go::after { content: "→"; transition: transform 0.35s var(--spring); }
.go:hover { transform: scale(1.04); box-shadow: 0 10px 34px -8px var(--buzz); }
.go:hover::after { transform: translateX(4px); }
.go:active { transform: scale(0.97); }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--ink); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #34C759; box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.18); }
.status.soon { color: var(--secondary); }
.status.soon::before { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); animation: pulse 2.2s ease-in-out infinite; }
a.status:hover { text-decoration: underline; text-underline-offset: 3px; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* The phone runs off the bottom of the card, as on an App Store card. */
.shot { position: relative; height: 100%; min-height: 620px; }
.shot img {
  position: absolute;
  top: calc(56px + var(--shot-y));
  left: 50%;
  width: var(--shot-w);
  max-width: none;
  height: auto;
  translate: -50% 0;
  rotate: 2deg;
  transition: rotate 0.8s var(--spring), translate 0.8s var(--spring);
}
.app:nth-child(even) .shot img { rotate: -2deg; }
.app:hover .shot img { rotate: 0deg; translate: -50% -14px; }

/* Cards rise into place once, as they scroll in. */
.js .app { opacity: 0; transform: translateY(56px) scale(0.955); transition: opacity 0.9s var(--ease), transform 1.1s var(--spring); }
.js .app.seen { opacity: 1; transform: none; }
.js .app .shot { transform: translateY(90px); transition: transform 1.3s var(--spring) 0.12s; }
.js .app.seen .shot { transform: none; }

/* ---------- What comes next ---------- */
.next { max-width: 640px; margin: 0 auto; padding: 120px 20px 40px; text-align: center; }
.slot { width: 76px; height: 76px; margin: 0 auto 26px; display: grid; place-items: center; border-radius: 22.5%; border: 1.5px dashed rgba(255, 255, 255, 0.28); color: var(--secondary); font: 300 34px/1 var(--sf); }
.next h2 { font: 800 clamp(28px, 4vw, 40px)/1.05 var(--sf); letter-spacing: -0.03em; text-wrap: balance; }
.next p { margin-top: 14px; color: var(--secondary); text-wrap: pretty; }

/* ---------- Contact ---------- */
.contact { max-width: 640px; margin: 0 auto; padding: 72px 20px 24px; text-align: center; scroll-margin-top: 28px; }
.contact h2 { font: 800 clamp(28px, 4vw, 40px)/1.05 var(--sf); letter-spacing: -0.03em; }
.contact p { margin-top: 14px; color: var(--secondary); text-wrap: pretty; }
.contact .actions { justify-content: center; margin-top: 26px; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13), inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.35s var(--spring), background 0.3s ease;
}
.pill:hover { transform: scale(1.04); background: rgba(255, 255, 255, 0.14); }
.pill:active { transform: scale(0.97); }

footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 24px; padding: 40px 20px calc(140px + env(safe-area-inset-bottom)); font-size: 14px; color: var(--tertiary); }

/* ---------- The glass bar ----------
   Built by app.js from the cards; the capsule under the current item slides between them. */
.bar {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 10;
  translate: -50% 0;
  max-width: calc(100vw - 24px);
  padding: 5px;
  border-radius: 999px;
  background: rgba(40, 40, 46, 0.55);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 1px 0 0 rgba(255, 255, 255, 0.22), 0 18px 44px -12px rgba(0, 0, 0, 0.8);
  animation: bar-in 0.9s var(--spring) 0.3s both;
}
@keyframes bar-in { from { opacity: 0; transform: translateY(40px) scale(0.9); } }

.bar-track { position: relative; display: flex; overflow-x: auto; scrollbar-width: none; border-radius: 999px; }
.bar-track::-webkit-scrollbar { display: none; }

.bar a {
  position: relative;
  z-index: 1;
  flex: none;
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 74px;
  padding: 8px 18px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--secondary);
  transition: color 0.3s ease;
}
.bar a img { display: block; width: 30px; height: 30px; transition: transform 0.4s var(--spring); }
.bar a:hover img { transform: scale(1.1); }
.bar a:active img { transform: scale(0.92); }
.bar a[aria-current] { color: var(--ink); }

.bar-thumb {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 74px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.55s var(--spring), width 0.55s var(--spring);
}

:focus-visible { outline: 2px solid var(--accent, #FFFFFF); outline-offset: 3px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 860px) {
  main { gap: 20px; padding: 0 12px; }
  .app, .app:nth-child(even) { grid-template-columns: minmax(0, 1fr); gap: 0; min-height: 0; padding: 0 28px; border-radius: 40px; }
  .app:nth-child(even) .shot { order: 0; }
  .copy { padding: 40px 0 8px; }
  .pitch { font-size: 18px; }
  .shot { min-height: 0; height: 430px; }
  .shot img { top: calc(20px + var(--shot-y) * 0.8); width: calc(var(--shot-w) * 0.8); }
  .bar a { min-width: 64px; padding: 8px 15px 7px; }
  .bar-thumb { width: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :root, .bar-thumb, .shot img, .go, .pill { transition: none; }
  .js .app, .js .app .shot { opacity: 1; transform: none; transition: none; }
  .word.in, .word.out { animation: word-fade 0.5s ease both; }
  .word.out { animation-direction: reverse; }
  .scroll-hint span, .status.soon::before, .bar { animation: none; }
  @keyframes word-fade { from { opacity: 0; } }
}
