/* =============================================================================================
   "Your week in review" (features.weekInReview, Yowana 11/15): the full-screen story
   (Components/WeekReview/WeekReviewStory.razor, js/weekReview.js) and its Mileage card
   (Components/WeekReview/WeekReviewCard.razor).
   Plain CSS on the sw.css tokens (Tailwind does not compile this file: no app.min.css rebuild).
   Linked after recap.css by Supwell/wwwroot/index.html (app) and Supwell.Web/Components/App.razor
   (web). Unlayered, so these classes beat the kit's layered ones and MAUI's css/mobile.css.
   The slides wear Supwell's share-image look (js/socialShare.js): the yellow and the olive in turn,
   JetBrains Mono labels, Space Grotesk numerals, the wordmark. The story sits over everything but
   sheets and toasts (the share sheet opens over it), so the app's auto-hiding bars never overlap
   it; its own bars and close clear the status bar and notch (--sw-safe-t), its buttons the home
   indicator (--sw-safe-b). On a wide screen (the web, an iPad) it is a 9:16 frame on black.
   Reduced motion: no auto-advance (weekReview.js), the bars show filled, nothing slides or grows.
   ============================================================================================= */

.sw-wir-host { display: contents; }
.sw-wir {
  --sw-wir-dur: 5s;
  --sw-wir-pad: 28px;
  position: fixed; inset: 0; z-index: calc(var(--sw-z-sheet) - 1);
  display: flex; align-items: center; justify-content: center;
  background: #0f110b; color: var(--sw-cream);
  outline: none; overscroll-behavior: contain;
  animation: sw-wir-in calc(240ms / var(--sw-tempo, 1)) var(--sw-out, ease-out) both;
}
@keyframes sw-wir-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }

.sw-wir__frame {
  position: relative; overflow: hidden; width: 100%; height: 100%;
  background: var(--sw-olive);
  transition: transform calc(220ms / var(--sw-tempo, 1)) var(--sw-out, ease-out), opacity calc(220ms / var(--sw-tempo, 1)) ease;
}
/* A pointer is down: the frame follows the finger with no lag. */
.sw-wir.is-paused .sw-wir__frame { transition: none; }
@media (min-width: 640px) and (min-height: 560px) {
  .sw-wir__frame { width: min(100%, calc((100dvh - 48px) * 9 / 16)); height: min(100%, calc(100dvh - 48px)); border-radius: 18px; }
}

/* ---- the top: segmented bars and the close ---------------------------------------------------- */
.sw-wir__top {
  position: absolute; z-index: 3; top: 0; left: 0; right: 0;
  padding: calc(var(--sw-safe-t) + 8px) calc(var(--sw-safe-r) + 10px) 0 calc(var(--sw-safe-l) + 10px);
  pointer-events: none; transition: opacity calc(200ms / var(--sw-tempo, 1)) ease;
}
.sw-wir.is-holding .sw-wir__top, .sw-wir.is-holding .sw-wir__nav { opacity: 0; }
.sw-wir__bars { display: flex; gap: 4px; }
.sw-wir__seg { position: relative; flex: 1 1 0; height: 3px; overflow: hidden; border-radius: 2px; background: rgba(255, 255, 255, .32); }
.sw-wir__seg > i { position: absolute; inset: 0; border-radius: inherit; background: #fff; transform: scaleX(0); transform-origin: left center; }
.sw-wir__seg.is-done > i { transform: scaleX(1); }
.sw-wir__seg.is-active > i { animation: sw-wir-fill var(--sw-wir-dur) linear forwards; }
.sw-wir.is-paused .sw-wir__seg.is-active > i { animation-play-state: paused; }
@keyframes sw-wir-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* On a yellow slide the bars and close go olive. */
.sw-wir__top { color: var(--sw-cream); }
.sw-wir[data-wir-tone="yellow"] .sw-wir__top { color: var(--sw-olive); }
.sw-wir[data-wir-tone="yellow"] .sw-wir__seg { background: rgba(55, 60, 43, .25); }
.sw-wir[data-wir-tone="yellow"] .sw-wir__seg > i { background: var(--sw-olive); }

.sw-wir__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.sw-wir__brand { width: 92px; height: 22px; color: inherit; opacity: .9; transition: opacity calc(200ms / var(--sw-tempo, 1)) ease; }
.sw-wir[data-wir-kind="intro"] .sw-wir__brand, .sw-wir[data-wir-kind="outro"] .sw-wir__brand, .sw-wir[data-wir-kind="empty"] .sw-wir__brand { opacity: 0; }
.sw-wir__close {
  pointer-events: auto; display: grid; place-items: center; width: 44px; height: 44px; margin: -6px -8px 0 0; padding: 0;
  border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.sw-wir__close:focus-visible { outline: 2px solid currentColor; outline-offset: -4px; }

/* The wordmark (share images' SVG, white) as a mask, so it takes the slide's ink. */
.sw-wir-mark {
  display: block; background: currentColor;
  -webkit-mask: url("/_content/Supwell.Shared/images/share/supwell-wordmark.svg") center / contain no-repeat;
  mask: url("/_content/Supwell.Shared/images/share/supwell-wordmark.svg") center / contain no-repeat;
}

/* ---- the stage and its slides ----------------------------------------------------------------- */
.sw-wir__stage {
  position: absolute; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.sw-wir-slide {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: calc(var(--sw-safe-t) + 76px) calc(var(--sw-safe-r) + var(--sw-wir-pad)) calc(var(--sw-safe-b) + 28px) calc(var(--sw-safe-l) + var(--sw-wir-pad));
  opacity: 0; visibility: hidden;
  transition: opacity calc(260ms / var(--sw-tempo, 1)) ease, visibility 0s linear calc(260ms / var(--sw-tempo, 1));
}
.sw-wir-slide.is-active { opacity: 1; visibility: visible; transition: opacity calc(260ms / var(--sw-tempo, 1)) ease, visibility 0s; }
.sw-wir-slide--olive { background: var(--sw-olive); color: var(--sw-cream); --wir-accent: var(--sw-yellow); --wir-muted: rgba(246, 243, 230, .62); --wir-track: rgba(246, 243, 230, .16); --wir-bar: var(--sw-yellow); --wir-bar-dim: rgba(253, 243, 18, .45); --wir-tile: rgba(246, 243, 230, .08); --wir-tile-ink: var(--sw-cream); }
.sw-wir-slide--yellow { background: var(--sw-yellow); color: var(--sw-olive); --wir-accent: var(--sw-olive); --wir-muted: rgba(55, 60, 43, .7); --wir-track: rgba(55, 60, 43, .14); --wir-bar: var(--sw-olive); --wir-bar-dim: rgba(55, 60, 43, .32); --wir-tile: var(--sw-olive); --wir-tile-ink: var(--sw-cream); }

.sw-wir-kicker { margin: 0; font: 500 13px/1.3 var(--sw-font-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--wir-accent); }
.sw-wir-title {
  margin: 10px 0 0; font: 700 clamp(34px, 10.5vw, 52px)/.95 var(--sw-font-head); letter-spacing: -.02em;
  text-transform: uppercase; text-wrap: balance; overflow-wrap: anywhere;
}
.sw-wir-big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin: 14px 0 0; }
.sw-wir-big b { font: 700 clamp(72px, 26vw, 132px)/.85 var(--sw-font-head); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.sw-wir-big span { font: 700 clamp(15px, 4.6vw, 22px)/1 var(--sw-font-mono); letter-spacing: .08em; text-transform: uppercase; }
.sw-wir-big--accent b, .sw-wir-big--accent span { color: var(--wir-accent); }
/* The week's total is the hero number (the share image's 45). */
.sw-wir-slide[data-wir-kind="total"] .sw-wir-big b { font-size: clamp(104px, 36vw, 176px); }
.sw-wir-line { margin: 14px 0 0; font: 600 14px/1.4 var(--sw-font-mono); letter-spacing: .1em; text-transform: uppercase; }
.sw-wir-copy { margin: 16px 0 0; max-width: 30ch; font: 400 17px/1.45 var(--sw-font-ui); color: var(--wir-muted); }
.sw-wir-tag {
  align-self: flex-start; margin: 16px 0 0; padding: 6px 12px; border-radius: var(--sw-r-pill);
  background: var(--wir-accent); color: var(--sw-olive); font: 700 12px/1 var(--sw-font-mono); letter-spacing: .12em;
}
.sw-wir-slide--yellow .sw-wir-tag { color: var(--sw-yellow); }
.sw-wir-note {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin: 18px 0 0; padding: 10px 16px;
  border-radius: var(--sw-r-pill); font: 700 13px/1 var(--sw-font-mono); letter-spacing: .1em; text-transform: uppercase;
  background: var(--wir-accent); color: var(--sw-olive);
}
.sw-wir-slide--yellow .sw-wir-note { color: var(--sw-yellow); }
.sw-wir-spacer { flex: 1 1 auto; min-height: 12px; }

/* Intro and outro: centred, the wordmark on top. */
.sw-wir-slide--center { align-items: center; justify-content: center; text-align: center; }
.sw-wir-slide--center .sw-wir-tag, .sw-wir-slide--center .sw-wir-note { align-self: center; }
.sw-wir-slide--center .sw-wir-big { justify-content: center; }
.sw-wir-hero-mark { width: 168px; height: 40px; margin: 0 0 28px; }
.sw-wir-slide--center .sw-wir-title { font-size: clamp(42px, 13vw, 64px); }

/* Stat tiles (the total slide), the share image's three cards. */
.sw-wir-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin: 22px 0 0; }
.sw-wir-tile { min-width: 0; padding: 12px 12px 14px; border-radius: 14px; background: var(--wir-tile); color: var(--wir-tile-ink); }
.sw-wir-tile span { display: block; font: 600 10px/1.2 var(--sw-font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--sw-yellow); }
.sw-wir-slide--olive .sw-wir-tile span { color: var(--wir-muted); }
.sw-wir-tile b { display: block; margin-top: 8px; font: 700 clamp(20px, 6.4vw, 28px)/1 var(--sw-font-head); letter-spacing: -.02em; white-space: nowrap; }
.sw-wir-tile i { font: 500 10px/1 var(--sw-font-mono); font-style: normal; letter-spacing: .08em; opacity: .7; margin-left: 3px; }

/* Columns: daily and weekly mileage. */
.sw-wir-cols { position: relative; flex: 1 1 auto; min-height: 140px; max-height: 46vh; display: flex; align-items: flex-end; gap: 8px; margin: 22px 0 0; }
.sw-wir-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.sw-wir-col__v { font: 600 12px/1 var(--sw-font-mono); white-space: nowrap; }
.sw-wir-col__bar {
  width: 100%; min-height: 6px; border-radius: 9px 9px 3px 3px; background: var(--wir-bar-dim);
  transform-origin: bottom center;
}
.sw-wir-col.is-hl .sw-wir-col__bar { background: var(--wir-bar); }
.sw-wir-col.is-zero .sw-wir-col__bar { background: var(--wir-track); }
.sw-wir-col__l { font: 600 11px/1 var(--sw-font-mono); letter-spacing: .06em; white-space: nowrap; color: var(--wir-muted); }
.sw-wir-col.is-hl .sw-wir-col__l { color: inherit; }
.sw-wir-avg { position: absolute; left: 0; right: 0; border-top: 2px dashed currentColor; opacity: .55; pointer-events: none; }
/* The bars grow in when their slide comes up. */
.sw-wir-slide.is-active .sw-wir-col__bar { animation: sw-wir-grow calc(520ms / var(--sw-tempo, 1)) var(--sw-out, ease-out) both; }
.sw-wir-slide.is-active .sw-wir-col:nth-child(2) .sw-wir-col__bar { animation-delay: 40ms; }
.sw-wir-slide.is-active .sw-wir-col:nth-child(3) .sw-wir-col__bar { animation-delay: 80ms; }
.sw-wir-slide.is-active .sw-wir-col:nth-child(4) .sw-wir-col__bar { animation-delay: 120ms; }
.sw-wir-slide.is-active .sw-wir-col:nth-child(5) .sw-wir-col__bar { animation-delay: 160ms; }
.sw-wir-slide.is-active .sw-wir-col:nth-child(6) .sw-wir-col__bar { animation-delay: 200ms; }
.sw-wir-slide.is-active .sw-wir-col:nth-child(7) .sw-wir-col__bar { animation-delay: 240ms; }
@keyframes sw-wir-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Shoe rotation: power rankings. */
.sw-wir-ranks { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-direction: column; }
.sw-wir-rank { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 4px 12px; padding: 14px 0; border-top: 1px solid var(--wir-track); }
.sw-wir-rank:first-child { border-top: 0; }
.sw-wir-rank__n { grid-row: span 2; font: 700 44px/.9 var(--sw-font-head); }
.sw-wir-rank.is-hl .sw-wir-rank__n { color: var(--wir-accent); }
.sw-wir-rank__t { font: 700 18px/1.15 var(--sw-font-head); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-wir-rank__row { display: flex; align-items: center; gap: 10px; }
.sw-wir-rank__track { flex: 1 1 auto; height: 10px; border-radius: 5px; background: var(--wir-track); overflow: hidden; }
.sw-wir-rank__track > i { display: block; height: 100%; border-radius: inherit; background: currentColor; opacity: .85; transform-origin: left center; }
.sw-wir-rank.is-hl .sw-wir-rank__track > i { background: var(--wir-accent); opacity: 1; }
.sw-wir-rank__v { flex: none; font: 600 13px/1 var(--sw-font-mono); letter-spacing: .06em; }
.sw-wir-slide.is-active .sw-wir-rank__track > i { animation: sw-wir-widen calc(520ms / var(--sw-tempo, 1)) var(--sw-out, ease-out) both; }
@keyframes sw-wir-widen { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Community: likers as circles (people are circles). */
.sw-wir-faces { display: flex; list-style: none; margin: 22px 0 0; padding: 0; }
.sw-wir-face {
  display: grid; place-items: center; width: 48px; height: 48px; margin-left: -10px; overflow: hidden; border-radius: 50%;
  border: 3px solid var(--sw-olive); background: var(--sw-cream); color: var(--sw-olive); font: 700 18px/1 var(--sw-font-head);
}
.sw-wir-slide--yellow .sw-wir-face { border-color: var(--sw-yellow); }
.sw-wir-faces li:first-child .sw-wir-face { margin-left: 0; }
.sw-wir-face img { width: 100%; height: 100%; object-fit: cover; }

/* The closing slide's buttons (and the empty week's). */
.sw-wir-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 340px; margin: 28px auto 0; }
.sw-wir-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: var(--sw-r-pill); border: 1.5px solid transparent; cursor: pointer; text-decoration: none;
  font: 700 15px/1 var(--sw-font-ui); letter-spacing: -.01em; -webkit-tap-highlight-color: transparent;
}
.sw-wir-btn--primary { background: var(--sw-olive); color: var(--sw-yellow); }
.sw-wir-slide--olive .sw-wir-btn--primary { background: var(--sw-yellow); color: var(--sw-olive); }
.sw-wir-btn--ghost { background: transparent; color: inherit; border-color: currentColor; }
.sw-wir-btn--link { min-height: 40px; background: none; color: inherit; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; font-size: 14px; }
.sw-wir-btn:active { transform: scale(.98); }
.sw-wir-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* Loading and failure inside the frame. */
.sw-wir-wait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 32px; text-align: center; }
.sw-wir-wait .sw-wir-mark { width: 150px; height: 36px; color: var(--sw-yellow); animation: sw-wir-pulse 1.2s ease-in-out infinite alternate; }
.sw-wir-wait p { margin: 0; font: 500 13px/1.4 var(--sw-font-mono); letter-spacing: .14em; text-transform: uppercase; color: rgba(246, 243, 230, .7); }
@keyframes sw-wir-pulse { from { opacity: .45; } to { opacity: 1; } }

/* Keyboard and screen-reader steps: out of sight until focused. */
.sw-wir__nav { position: absolute; z-index: 3; bottom: calc(var(--sw-safe-b) + 8px); left: 50%; translate: -50% 0; display: flex; gap: 8px; }
.sw-wir__nav button {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  padding: 0; border: 0; background: var(--sw-cream); color: var(--sw-olive); border-radius: var(--sw-r-pill);
  font: 600 13px/1 var(--sw-font-ui);
}
.sw-wir__nav button:focus-visible { position: static; width: auto; height: 36px; padding: 0 14px; clip: auto; outline: 2px solid var(--sw-yellow); }

/* Small phones (iPhone SE): tighter type so a slide never scrolls. */
@media (max-height: 700px) {
  .sw-wir { --sw-wir-pad: 22px; }
  .sw-wir-slide { padding-top: calc(var(--sw-safe-t) + 68px); }
  .sw-wir-big b { font-size: clamp(64px, 22vw, 104px); }
  .sw-wir-cols { max-height: 38vh; }
  .sw-wir-rank { padding: 10px 0; }
  .sw-wir-hero-mark { margin-bottom: 18px; }
}

/* The 9:16 frame on a wide screen: the type sizes by the frame, not the window (vw would overflow it). */
@media (min-width: 640px) and (min-height: 560px) {
  .sw-wir-title { font-size: 44px; }
  .sw-wir-slide--center .sw-wir-title { font-size: 54px; }
  .sw-wir-big b { font-size: 112px; }
  .sw-wir-slide[data-wir-kind="total"] .sw-wir-big b { font-size: 150px; }
  .sw-wir-big span { font-size: 20px; }
  .sw-wir-tile b { font-size: 24px; }
}

/* Reduced motion: no auto-advance (weekReview.js), the active bar shows filled, nothing moves. */
.sw-wir.is-reduced .sw-wir__seg.is-active > i { animation: none; transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) {
  .sw-wir, .sw-wir-slide.is-active .sw-wir-col__bar, .sw-wir-slide.is-active .sw-wir-rank__track > i, .sw-wir-wait .sw-wir-mark { animation: none; }
  .sw-wir__seg.is-active > i { animation: none; transform: scaleX(1); }
  .sw-wir-slide, .sw-wir-slide.is-active, .sw-wir__frame { transition: none; }
}

/* ---- the Mileage card (WeekReviewCard) ----------------------------------------------------------
   Above the week hero: the olive card with the yellow play disc, so it reads as "tap to watch". */
.sw-wirc {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 14px 14px 16px;
  border: 0; border-radius: 16px; background: var(--sw-olive); color: var(--sw-cream); text-align: left; cursor: pointer;
  font: inherit; -webkit-tap-highlight-color: transparent; box-shadow: var(--sw-shadow-tile);
}
.sw-wirc:active { transform: scale(.99); }
.sw-wirc:focus-visible { outline: 2px solid var(--sw-yellow); outline-offset: 2px; }
.sw-wirc__play { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--sw-yellow); color: var(--sw-olive); }
.sw-wirc__main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; }
.sw-wirc__kicker { font: 500 10px/1.3 var(--sw-font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--sw-yellow); }
.sw-wirc__title { font: 700 19px/1.1 var(--sw-font-head); letter-spacing: -.01em; }
.sw-wirc__meta { font: 400 13px/1.3 var(--sw-font-ui); color: rgba(246, 243, 230, .72); }
.sw-wirc__close {
  flex: none; align-self: flex-start; display: grid; place-items: center; width: 32px; height: 32px; margin: -6px -6px 0 0; padding: 0;
  border: 0; border-radius: 50%; background: none; color: rgba(246, 243, 230, .7); cursor: pointer;
}
.sw-wirc-wrap { position: relative; }
.sw-wirc-wrap .sw-wirc__close { position: absolute; top: 8px; right: 8px; margin: 0; }

/* The /recap page's "Play your week". */
.sw-rcp__play { align-self: flex-start; margin-top: 4px; }
