/* Site layout — brand values come from assets/rar-brand.css */
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--rar-paper-soft); overflow-x: hidden; }
.wrap { max-width: var(--rar-container); margin: 0 auto; padding: 0 var(--rar-space-4); }

/* --- Top bar + scroll progress (yellow on navy only) ------------------- */
.rar-topbar { position: sticky; top: 0; z-index: 20; }
.rar-topbar nav { margin-left: auto; display: flex; gap: var(--rar-space-4); }
.rar-topbar nav a { color: #fff; text-decoration: none; font-weight: 500; padding: 8px 4px; }
.rar-topbar nav a:hover { color: var(--rar-yellow); }
@media (max-width: 700px) { .rar-topbar .rar-product, .rar-topbar nav a.opt { display: none; } .rar-topbar nav { gap: 8px; } }

/* --- Hero -------------------------------------------------------------- */
.hero { background: var(--rar-navy); color: #fff; position: relative; overflow: hidden; padding: 56px 0 0; }
.hero .eyebrow { font-family: var(--rar-font-display); text-transform: uppercase; letter-spacing: .12em; color: var(--rar-on-dark-soft); font-weight: 500; margin: 0 0 12px; }
.hero h1 { font-size: clamp(2.75rem, 11vw, 7.5rem); line-height: .95; text-transform: uppercase; letter-spacing: -.005em; margin: 0 0 24px; }
.hero h1 .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .06em; }
.hero h1 .w > span { display: inline-block; }
.hero h1 .y { color: var(--rar-yellow); }
.hero p.lead { font-size: var(--rar-text-lg); color: #E2E8F0; max-width: 56ch; margin: 0 0 28px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 40px; }
.hero .rar-btn--secondary { color: #fff; border-color: #fff; }
.rar-btn { transition: transform .15s ease, background-color .15s ease; }
.rar-btn:hover { transform: translateY(-2px); }
.rar-btn--accent:hover { background: #fff; }
.rar-btn--secondary:hover { background: var(--rar-navy-2, #1E293B); }
.hero .rar-btn--secondary:hover { background: #1E293B; }

/* Race strip: lane ropes, racing swimmers, clock */
.race { border-top: 1px solid #1E293B; background: #0B1222; }
.race .wrap { display: grid; gap: 16px; padding-top: 20px; padding-bottom: 20px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .race .wrap { grid-template-columns: 1fr 220px; align-items: center; } }
.clock { text-align: left; }
@media (min-width: 800px) { .clock { text-align: right; } }
.clock .label { font: 500 var(--rar-text-xs)/1 var(--rar-font-display); text-transform: uppercase; letter-spacing: .12em; color: var(--rar-on-dark-soft); display: flex; gap: 8px; align-items: center; }
@media (min-width: 800px) { .clock .label { justify-content: flex-end; } }
.clock .digits { font: 700 clamp(2.5rem, 8vw, 3.75rem)/1 var(--rar-font-display); color: var(--rar-yellow); font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* --- Pool ---------------------------------------------------------------- */
.race { position: relative; }
.race::before { content: ""; display: block; height: 8px; background: repeating-linear-gradient(90deg, #1E293B 0 22px, #0F172A 22px 24px); }
.lanes { position: relative; display: grid; gap: 4px; overflow: hidden; border-radius: 6px; }
/* Caustic light shimmer on the water, two drifting layers */
.lanes::before, .lanes::after { content: ""; position: absolute; top: -40%; left: -20%; width: 140%; height: 180%; pointer-events: none; z-index: 2; }
.lanes::before { background: repeating-radial-gradient(circle at 20% 30%, transparent 0 16px, rgba(203,213,225,.07) 17px 19px, transparent 20px 38px); animation: caustic-a 9s ease-in-out infinite alternate; }
.lanes::after { background: repeating-radial-gradient(circle at 70% 60%, transparent 0 22px, rgba(148,163,184,.08) 23px 25px, transparent 26px 50px); animation: caustic-b 13s ease-in-out infinite alternate; }
@keyframes caustic-a { to { transform: translate(60px, 24px) scale(1.08); } }
@keyframes caustic-b { to { transform: translate(-70px, -18px) scale(1.12); } }

.lane { position: relative; height: 30px; padding-left: 28px; container-type: inline-size; overflow: hidden;
  background:
    linear-gradient(#0B1222, #0B1222) 34px center / calc(100% - 46px) 3px no-repeat,       /* black line on the pool floor */
    linear-gradient(#0B1222, #0B1222) right 6px center / 3px 14px no-repeat,                /* T at the far wall */
    linear-gradient(#0B1222, #0B1222) 34px center / 3px 14px no-repeat,                     /* T at the start wall */
    linear-gradient(180deg, #1A2740, #14203A); }
.lane::before { content: attr(data-lane); position: absolute; left: 0; top: 0; bottom: 0; width: 22px; display: grid; place-items: center; background: #1E293B; color: #fff; font: 700 12px/1 var(--rar-font-display); z-index: 3; }
/* lane rope floats along the lane line */
.lane::after { content: ""; position: absolute; left: 22px; right: 0; bottom: 0; height: 5px; background: radial-gradient(circle at 5px 2.5px, var(--rar-yellow) 0 2px, transparent 2.5px) 0 0 / 12px 5px repeat-x; opacity: .85; z-index: 1; }

.swimmer { position: absolute; top: 4px; left: 28px; width: 54px; height: 22px; z-index: 1; animation: swim var(--t) cubic-bezier(.45,.05,.55,.95) infinite alternate; animation-delay: var(--d, 0s); }
/* Turn at each wall: the swimmer faces the way it is travelling */
.swimmer .fig { display: block; fill: var(--rar-yellow); overflow: visible; transform-origin: 50% 50%;
  animation: turn calc(var(--t) * 2) linear infinite; animation-delay: var(--d, 0s); }
@keyframes turn { 0%, 49.99% { transform: scaleX(1); } 50%, 100% { transform: scaleX(-1); } }
.swimmer .arm { transform-box: view-box; transform-origin: 30px 9px; animation: stroke .7s ease-in-out infinite alternate; }
.swimmer .kick { transform-box: view-box; transform-origin: 10px 11px; animation: kick .16s linear infinite alternate; }
/* wake and splash trailing behind the swimmer */
.swimmer .wake { fill: none; stroke: rgba(203,213,225,.55); stroke-width: 1.4; stroke-linecap: round; animation: wake .9s ease-out infinite; }
.swimmer .wake.b { animation-delay: .3s; }
.swimmer .wake.c { animation-delay: .6s; }
@keyframes wake { 0% { transform: translateX(0) scale(.6); opacity: .9; } 100% { transform: translateX(-16px) scale(1.4); opacity: 0; } }
@keyframes stroke { from { transform: rotate(-35deg); } to { transform: rotate(40deg); } }
@keyframes kick { from { transform: rotate(-10deg); } to { transform: rotate(14deg); } }
@keyframes swim { to { transform: translateX(calc(100cqw - 82px)); } }

.hero .wrap { position: relative; z-index: 1; }

/* --- Ticker ------------------------------------------------------------- */
.ticker { background: var(--rar-yellow); color: var(--rar-navy); overflow: hidden; white-space: nowrap; }
.ticker .track { display: inline-flex; gap: 48px; padding: 12px 0; animation: marquee 38s linear infinite; font: 700 var(--rar-text-md)/1 var(--rar-font-display); text-transform: uppercase; letter-spacing: .06em; }
.ticker span::before { content: "●"; margin-right: 12px; font-size: .6em; vertical-align: middle; }
.ticker:hover .track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* --- Sections ------------------------------------------------------------ */
section { padding: 72px 0; }
section.alt { background: var(--rar-paper); border-block: 1px solid var(--rar-line); }
h2 { font-size: clamp(2rem, 6vw, 3.5rem); line-height: 1; text-transform: uppercase; margin: 0 0 12px; }
.sub { color: var(--rar-ink-soft); margin: 0 0 36px; max-width: 60ch; font-size: var(--rar-text-lg); }

/* Bento grid */
.bento { display: grid; gap: var(--rar-space-4); grid-template-columns: repeat(6, 1fr); }
.tile { background: var(--rar-paper); border: 1px solid var(--rar-line); border-radius: var(--rar-radius-lg); padding: var(--rar-space-6); grid-column: span 2; position: relative; overflow: hidden; transition: transform .2s ease, border-color .2s ease; }
.tile:hover { transform: translateY(-4px); border-color: var(--rar-ink); }
.tile h3 { margin: 0 0 8px; font-size: 1.5rem; text-transform: uppercase; }
.tile p { margin: 0; color: var(--rar-ink-soft); }
.tile.wide { grid-column: span 4; }
.tile.dark { background: var(--rar-navy); border-color: var(--rar-navy); color: #fff; }
.tile.dark p { color: #CBD5E1; }
.tile.dark .num { color: var(--rar-yellow); }
.tile .num { font: 700 var(--rar-text-sm)/1 var(--rar-font-display); letter-spacing: .12em; color: var(--rar-ink-soft); margin-bottom: 20px; display: block; }
@media (max-width: 800px) { .tile, .tile.wide { grid-column: span 6; } }
@media (min-width: 801px) and (max-width: 1000px) { .tile { grid-column: span 3; } .tile.wide { grid-column: span 6; } }

/* Products */
.products { display: grid; gap: var(--rar-space-4); grid-template-columns: 1fr; }
@media (min-width: 560px) { .products { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .products { grid-template-columns: repeat(4, 1fr); } }
.product { background: var(--rar-paper); border: 1px solid var(--rar-line); border-radius: var(--rar-radius-lg); padding: var(--rar-space-6); display: flex; flex-direction: column; transition: transform .2s ease, border-color .2s ease; }
.product:hover { transform: translateY(-4px); border-color: var(--rar-ink); }
.product img { width: 72px; height: 72px; border-radius: var(--rar-radius); margin-bottom: 20px; transition: transform .3s ease; }
.product:hover img { transform: rotate(-6deg) scale(1.06); }
.product h3 { margin: 0 0 8px; font-size: 1.75rem; text-transform: uppercase; }
.product p { margin: 0 0 20px; color: var(--rar-ink-soft); flex: 1; }
.product .rar-btn { align-self: flex-start; }
.product .rar-btn span { display: inline-block; transition: transform .2s ease; }
.product .rar-btn:hover span { transform: translateX(4px); }

/* Results demo */
.demo { border: 1px solid var(--rar-line); border-radius: var(--rar-radius-lg); background: var(--rar-paper); overflow: hidden; }
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--rar-navy); color: #fff; padding: 14px 16px; }
.demo-head h3 { margin: 0; font-size: var(--rar-text-md); }
.demo .rar-table { margin: 0; }
.demo-note { padding: 12px 16px; color: var(--rar-muted); font-size: var(--rar-text-sm); margin: 0; }
.demo tbody tr { opacity: 0; transform: translateX(-16px); transition: opacity .5s ease, transform .5s ease; }
.demo.in tbody tr { opacity: 1; transform: none; transition-delay: calc(var(--i) * 140ms); }

/* Steps */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; position: relative; }
.steps li { counter-increment: s; display: flex; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--rar-line); font-size: var(--rar-text-lg); }
.steps li::before { content: counter(s); flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--rar-navy); color: var(--rar-yellow); display: grid; place-items: center; font: 700 1.25rem/1 var(--rar-font-display); }
.steps strong { display: block; font: 700 1.5rem/1.2 var(--rar-font-display); text-transform: uppercase; }
.steps li div { color: var(--rar-ink-soft); }

/* Contact */
.contact { background: var(--rar-navy); color: #fff; border-radius: var(--rar-radius-lg); padding: 56px var(--rar-space-6); position: relative; overflow: hidden; }
.contact h2 { color: #fff; max-width: 14ch; }
.contact h2 .y { color: var(--rar-yellow); }
.contact p { color: #E2E8F0; max-width: 56ch; font-size: var(--rar-text-lg); }
.contact a.mail { color: var(--rar-yellow); font-weight: 700; font-size: var(--rar-text-xl); }

footer { background: var(--rar-navy); color: var(--rar-on-dark-soft); padding: 32px 0; font-size: var(--rar-text-sm); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
footer img { height: 44px; }

/* --- Motion ------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); transition-delay: var(--rd, 0ms); }
.reveal.in { opacity: 1; transform: none; }
.hero h1 .w > span { transform: translateY(105%); animation: rise .8s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(var(--n) * 90ms + 150ms); }
@keyframes rise { to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .demo tbody tr, .hero h1 .w > span { opacity: 1; transform: none; transition: none; animation: none; }
  .swimmer { animation: none; transform: translateX(calc(var(--p, 50) * 1cqw - 82px)); }
  .swimmer .arm, .swimmer .kick, .swimmer .wake, .swimmer .fig, .lanes::before, .lanes::after { animation: none; }
  .swimmer .wake { opacity: 0; }
  .ticker .track { animation: none; }
  .tile, .product, .rar-btn, .product img { transition: none; }
  .tile:hover, .product:hover, .rar-btn:hover { transform: none; }
}


/* =========================================================================
   Effects: header swimmer, ripples, WebGL water, live table, story
   ========================================================================= */

/* Scroll progress: bar + swimmer (native scroll timeline where supported) */
.progress { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--rar-yellow); transform: scaleX(var(--p, 0)); transform-origin: left; }
.rider-track { position: absolute; left: 0; right: 0; bottom: 3px; height: 18px; pointer-events: none; container-type: inline-size; overflow: hidden; }
.rider { width: 44px; height: 18px; transform: translateX(calc(var(--p, 0) * (100cqw - 44px))); }
.rider .fig { width: 44px; height: 18px; }
.rider .fig { display: block; fill: var(--rar-yellow); overflow: visible; }
.rider .arm, .story-swimmer .arm { transform-box: view-box; transform-origin: 30px 9px; animation: stroke .7s ease-in-out infinite alternate; }
.rider .kick, .story-swimmer .kick { transform-box: view-box; transform-origin: 10px 11px; animation: kick .16s linear infinite alternate; }
.rider .wake, .story-swimmer .wake { fill: none; stroke: rgba(203,213,225,.55); stroke-width: 1.4; stroke-linecap: round; animation: wake .9s ease-out infinite; }
.rider .wake.b, .story-swimmer .wake.b { animation-delay: .3s; }
.rider .wake.c, .story-swimmer .wake.c { animation-delay: .6s; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ride { to { transform: translateX(calc(100cqw - 44px)); } }
@supports (animation-timeline: scroll()) {
  .progress { transform: none; animation: grow linear both; animation-timeline: scroll(root); }
  .rider { transform: none; animation: ride linear both; animation-timeline: scroll(root); }
}

/* Pointer ripples and WebGL caustics in the pool */
.ripple { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 1.5px solid rgba(226,232,240,.75); pointer-events: none; z-index: 4; animation: ripple-out 1.1s ease-out forwards; }
@keyframes ripple-out { to { width: 110px; height: 110px; margin: -55px 0 0 -55px; opacity: 0; } }
.water-gl { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; mix-blend-mode: screen; }
.lanes.gl::before, .lanes.gl::after { display: none; }

/* Live results table */
.demo.live-ready tbody tr { opacity: 1; transform: none; transition: none; }
.demo tbody tr.flash td { animation: flash 1.3s ease-out; }
@keyframes flash { from { background: var(--rar-yellow-tint); } }

/* How a gala works: connectors fill as you scroll */
.steps li { position: relative; }
.steps li::before { position: relative; z-index: 1; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 21px; top: 62px; height: calc(100% - 44px); width: 2px; background: var(--rar-navy); transform-origin: top; }
@supports (animation-timeline: view()) {
  .steps li:not(:last-child)::after { transform: scaleY(0); animation: fill linear both; animation-timeline: view(); animation-range: entry 30% entry 110%; }
}
@keyframes fill { to { transform: scaleY(1); } }

/* Sticky story panel (wide screens) */
.story-side { display: none; }
@media (min-width: 900px) {
  .story { display: grid; grid-template-columns: 5fr 7fr; gap: 48px; align-items: start; }
  .story-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 110px; background: var(--rar-navy); color: #fff; border-radius: var(--rar-radius-lg); padding: 32px; overflow: hidden; }
  .story-num { font: 700 clamp(5rem, 11vw, 9rem)/.9 var(--rar-font-display); color: var(--rar-yellow); font-variant-numeric: tabular-nums; }
  .story-title { font: 700 1.75rem/1.1 var(--rar-font-display); text-transform: uppercase; min-height: 2.2em; }
  .story-lane { position: relative; height: 30px; margin-top: 8px; container-type: inline-size; border-radius: 4px; background:
      linear-gradient(#0B1222, #0B1222) 0 center / 100% 3px no-repeat, linear-gradient(180deg, #1A2740, #14203A); }
  .story-lane::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: radial-gradient(circle at 5px 2.5px, var(--rar-yellow) 0 2px, transparent 2.5px) 0 0 / 12px 5px repeat-x; opacity: .85; }
  .story-swimmer { position: absolute; top: 4px; left: 0; width: 54px; height: 22px; transform: translateX(calc(var(--k, 0) * (100cqw - 54px))); transition: transform .8s cubic-bezier(.45,.05,.55,.95); }
  .story-swimmer .fig { display: block; fill: var(--rar-yellow); overflow: visible; }
  .js .steps li > div, .js .steps li::before { transition: opacity .35s ease; }
  .js .steps li:not(.active) > div { opacity: .5; }
  .js .steps li:not(.active)::before { opacity: .5; }
}

@media (prefers-reduced-motion: reduce) {
  .progress, .rider, .steps li::after { animation: none; }
  .progress { transform: scaleX(0); }
  .rider-track { display: none; }
  .steps li:not(:last-child)::after { transform: none; }
  .story-swimmer { transition: none; }
  .story-swimmer .arm, .story-swimmer .kick, .story-swimmer .wake { animation: none; }
  .ripple, .water-gl { display: none; }
  .js .steps li:not(.active) > div, .js .steps li:not(.active)::before { opacity: 1; }
}

.bento .tile.wide:last-child { grid-column: span 6; }

.product .note { align-self: flex-start; padding: 10px 0; font-weight: 500; color: var(--rar-ink); border-top: 2px solid var(--rar-ink); width: 100%; }
