/* ==========================================================================
   SkipperFit Kickstarter — Performance Athletic Design System
   Architecture: Mobile Two-Screen Flow (<860px) / Desktop 40-60 Split (≥860px)
   ========================================================================== */

:root {
  --bg: #0B0B0C;
  --surface: #1A1A1C;
  --surface-2: #222225;
  --surface-3: #2A2A2D;
  --panel: #141416;
  --ink: #F4F4F2;
  --muted: #9C9CA2;
  --faint: #7A7A80;
  --yellow: #EEF58A;
  --yellow-hover: #F5FAA8;
  --pink: #F59CC6;
  --blue: #4FB3F6;
  --dot-off: #3A3A3E;
  --font: 'Archivo', system-ui, -apple-system, sans-serif;
  --split: 860px;

  /* Animation Easings & Durations (Strictly ≤200ms compositor rules) */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-fast: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 150ms;
  --dur-normal: 190ms;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--yellow);
  text-decoration: none;
}
a:hover { color: #FFFFFF; }

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

img { display: block; }

/* Accessible Keyboard Focus Rings */
:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Display type: heavy italic, athletic stretch */
.display, .brand-title, .hero-title, .roadmap-stat, .week-name, .tile-num, .session-title,
.detail-title, .stat-value, .next-title, .btn-start {
  font-style: italic;
  font-weight: 900;
  font-stretch: 110%;
  text-transform: uppercase;
}

.label, .week-kicker, .session-meta, .detail-meta, .next-label, .stat-label, .list-footer {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}

.stat-value, .tile-num, .roadmap-stat, .detail-meta {
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout Containers ---------- */
.app {
  min-height: 100%;
  min-height: 100dvh;
}

.pane-list {
  padding: max(8px, env(safe-area-inset-top)) 20px 48px;
}

.pane-detail {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 130px;
}

/* Mobile Screen Switching with Smooth Compositor Transitions */
@media (max-width: 859.98px) {
  .app[data-view="home"] .pane-detail { display: none; }
  .app[data-view="detail"] .pane-list { display: none; }

  .app[data-view="detail"] .pane-detail {
    display: block;
    animation: mobileSlideIn var(--dur-normal) var(--ease-spring) forwards;
  }

  .app[data-view="home"] .pane-list {
    display: block;
    animation: mobileFadeIn var(--dur-fast) var(--ease-spring) forwards;
  }
}

/* Mobile & Touch: Dots are purely visual indicators; week tile receives 100% of thumb taps */
@media (max-width: 859.98px), (pointer: coarse) {
  .tile-dots {
    pointer-events: none;
  }
  .tile-dot {
    pointer-events: none;
    cursor: default;
    padding: 3px 2px;
  }
}

/* Desktop with mouse: Dots remain interactive with cursor precision */
@media (min-width: 860px) and (pointer: fine) {
  .tile-dots {
    pointer-events: auto;
  }
  .tile-dot {
    pointer-events: auto;
    cursor: pointer;
  }
}

@keyframes mobileSlideIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mobileFadeIn {
  from {
    opacity: 0.75;
    transform: scale(0.99);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------- List Pane (Brand & Hero) ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 52px;
}

.brand-title {
  font-size: 17px;
  letter-spacing: .01em;
  text-transform: none;
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  margin-top: 5px;
}

.hero-title {
  margin: 14px 0 0;
  font-size: 40px;
  line-height: .92;
  letter-spacing: -.01em;
  font-stretch: 105%;
  color: var(--yellow);
  text-wrap: balance;
}

.hero-sub {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--muted);
  text-wrap: pretty;
}

.roadmap-head {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.roadmap-head .label {
  color: var(--muted);
}

.roadmap-stat {
  font-size: 14px;
  color: var(--pink);
}

/* ---------- Week Tiles ---------- */
.week-tiles {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.week-tile {
  cursor: pointer;
  border-radius: 22px;
  padding: 12px 0 8px;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  color: var(--ink);
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast) ease-out, filter var(--dur-fast) ease-out;
}

.week-tile:hover {
  filter: brightness(1.14);
  transform: translateY(-2px);
}

.week-tile:active {
  transform: scale(0.95);
}

.week-tile.is-active {
  background: var(--yellow);
  color: var(--bg);
  transform: translateY(-1px);
}

.tile-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  opacity: .7;
}

.tile-num {
  font-size: 30px;
  line-height: 1;
  margin-top: 2px;
}

.tile-dots {
  display: flex;
  margin-top: 4px;
}

.tile-dot {
  border: 0;
  background: none;
  padding: 6px 3px;
  cursor: pointer;
  display: flex;
  transition: transform var(--dur-fast) var(--ease-spring);
}

.tile-dot span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: block;
  background: var(--dot-off);
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast) ease-out;
}

.tile-dot:hover span {
  transform: scale(1.3);
}

.tile-dot:active span {
  transform: scale(0.9);
}

.week-tile.is-active .tile-dot span {
  background: var(--pink);
}

.tile-dot.is-current span {
  box-shadow: 0 0 0 2px var(--bg);
  transform: scale(1.15);
}

.week-intro {
  margin-top: 30px;
}

.week-kicker {
  color: var(--pink);
}

.week-name {
  margin: 6px 0 0;
  font-size: 30px;
  line-height: .98;
  text-wrap: balance;
}

.week-sub {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- Session Cards List ---------- */
.session-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 14px 10px 10px;
  border: 0;
  border-radius: 26px;
  cursor: pointer;
  text-align: left;
  background: var(--surface);
  transition: transform var(--dur-fast) var(--ease-spring), filter var(--dur-fast) ease-out, background var(--dur-fast) ease-out, box-shadow var(--dur-fast) ease-out;
}

.session-card:hover {
  filter: brightness(1.16);
  transform: translateY(-2px);
}

.session-card:active {
  transform: scale(0.98);
}

.session-thumb {
  position: relative;
  flex: none;
  width: 88px;
  height: 88px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface-3);
}

.session-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.22s ease-out;
}

.session-thumb img.is-loaded {
  opacity: 1;
}

.day-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 10px;
  font-weight: 800;
  color: var(--bg);
}

.session-thumb .day-chip {
  position: absolute;
  left: 7px;
  bottom: 7px;
}

.day-1 { background: var(--blue); }
.day-2 { background: var(--pink); }
.day-3 { background: var(--yellow); }

.session-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.session-meta {
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--faint);
}

.session-title {
  font-size: 17px;
  line-height: 1.08;
  font-stretch: 108%;
  text-transform: none;
  text-wrap: pretty;
}

.arrow-circle {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast) ease-out, color var(--dur-fast) ease-out;
}

.session-card:hover .arrow-circle {
  transform: translateX(2px);
  background: var(--yellow);
  color: var(--bg);
}

.list-footer {
  margin-top: 36px;
  font-size: 11px;
  letter-spacing: .1em;
  color: #4A4A50;
}

/* ---------- Detail Pane ---------- */
.detail-card {
  min-height: 100%;
}

.detail-media {
  position: relative;
  height: 340px;
  background: var(--surface);
  overflow: hidden;
}

.detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.22s ease-out;
}

.detail-media img.is-loaded {
  opacity: 1;
}

.detail-media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(11,11,12,.5) 0%, rgba(11,11,12,0) 30%, rgba(11,11,12,0) 60%, var(--bg) 100%);
}

.detail-topbar {
  position: absolute;
  z-index: 2;
  top: max(14px, env(safe-area-inset-top));
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26,26,28,.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #FFFFFF;
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast) ease-out;
}

.icon-btn:hover {
  transform: scale(1.08);
  background: rgba(38, 38, 42, 0.95);
}

.icon-btn:active {
  transform: scale(0.94);
}

.btn-play {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: var(--yellow);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) ease-out;
}

.btn-play:hover {
  transform: translate(-50%, -50%) scale(1.09);
  box-shadow: 0 0 28px rgba(238, 245, 138, 0.35);
}

.btn-play:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.detail-body {
  position: relative;
  z-index: 1;
  padding: 0 20px;
  margin-top: -30px;
}

.detail-tags {
  display: flex;
  gap: 8px;
  align-items: center;
}

.detail-tags .day-chip {
  height: 26px;
  padding: 0 11px;
  font-size: 11px;
  border-radius: 13px;
}

.detail-meta {
  font-size: 11px;
  color: var(--muted);
}

.detail-title {
  margin: 14px 0 0;
  font-size: 36px;
  line-height: .94;
  font-stretch: 108%;
  text-wrap: balance;
}

.detail-desc {
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--muted);
  text-wrap: pretty;
}

.cta-row {
  position: fixed;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px 20px max(28px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(11,11,12,0), var(--bg) 40%);
  display: flex;
  gap: 10px;
}

.btn-start {
  flex: 1;
  height: 60px;
  border-radius: 30px;
  border: 0;
  cursor: pointer;
  background: var(--yellow);
  color: var(--bg);
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background var(--dur-fast) ease-out, transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) ease-out;
}

.btn-start:hover {
  background: var(--yellow-hover);
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(238, 245, 138, 0.28);
}

.btn-start:active {
  transform: scale(0.98);
}

.cta-row .btn-copy { display: none; }

.btn-copy {
  width: 60px;
  height: 60px;
  flex: none;
  border-radius: 50%;
  border: 0;
  background: #232326;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast) ease-out;
}

.btn-copy:hover {
  background: #2E2E32;
  transform: scale(1.06);
}

.btn-copy:active {
  transform: scale(0.95);
}

.stats {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat {
  background: var(--surface);
  border-radius: 24px;
  padding: 18px;
  transition: transform var(--dur-fast) var(--ease-spring);
}

.stat:hover {
  transform: translateY(-2px);
}

.stat-blob {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.stat-value {
  margin-top: 20px;
  font-size: 28px;
  line-height: 1;
  text-transform: none;
}

.stat-value small {
  font-size: 15px;
  margin-left: 3px;
}

.stat-value small.muted {
  color: var(--faint);
}

.stat-label {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--faint);
}

.next {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 14px 18px;
  border: 0;
  border-radius: 24px;
  cursor: pointer;
  text-align: left;
  background: var(--surface);
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast) ease-out;
}

.next:hover {
  background: var(--surface-2);
  transform: translateY(-2px);
}

.next:active {
  transform: scale(0.98);
}

.next-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.next-label {
  font-size: 11px;
  color: var(--faint);
}

.next-title {
  font-size: 16px;
  font-stretch: 108%;
  text-transform: none;
}

/* ---------- Toast Notification ---------- */
.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  top: 24px;
  transform: translate(-50%, -10px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  height: 42px;
  padding: 0 20px;
  border-radius: 21px;
  background: var(--ink);
  color: var(--bg);
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  transition: opacity var(--dur-normal) var(--ease-spring), transform var(--dur-normal) var(--ease-spring);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* ==========================================================================
   Desktop: 40 / 60 Master-Detail Split (≥860px)
   ========================================================================== */
@media (min-width: 860px) {
  html, body {
    overflow: hidden;
  }

  .app {
    display: grid;
    grid-template-columns: 40% 60%;
    height: 100vh;
    height: 100dvh;
  }

  .app[data-view] .pane-list,
  .app[data-view] .pane-detail {
    display: block;
  }

  .pane-list {
    height: 100%;
    overflow-y: auto;
    scrollbar-width: none;
    padding: 28px 44px 40px;
    border-right: 1px solid var(--surface);
  }
  .pane-list::-webkit-scrollbar { display: none; }

  .hero-title {
    font-size: clamp(32px, 3.6vw, 60px);
  }

  .session-card.is-selected {
    background: var(--surface-2);
    box-shadow: inset 0 0 0 2px var(--yellow);
  }

  .session-card.is-selected .arrow-circle {
    background: var(--yellow);
    color: var(--bg);
  }

  .pane-detail {
    min-height: 0;
    height: 100%;
    padding: 20px;
    display: flex;
  }

  .detail-card {
    flex: 1;
    min-height: 0;
    background: var(--panel);
    border-radius: 36px;
    overflow-y: auto;
    scrollbar-width: none;
    animation: desktopDetailEnter var(--dur-normal) var(--ease-spring) forwards;
  }
  .detail-card::-webkit-scrollbar { display: none; }

  @keyframes desktopDetailEnter {
    from {
      opacity: 0.2;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .detail-media {
    height: auto;
    aspect-ratio: 16 / 8;
  }

  .detail-media::after {
    background: linear-gradient(180deg, rgba(20,20,22,0) 55%, var(--panel) 100%);
  }

  .detail-topbar { display: none; }

  .btn-play {
    width: 84px;
    height: 84px;
  }
  .btn-play svg {
    width: 28px;
    height: 28px;
  }

  .detail-body {
    margin-top: 0;
    padding: 8px 44px 44px;
  }

  .detail-tags .day-chip {
    height: 28px;
    font-size: 12px;
    padding: 0 12px;
    border-radius: 14px;
  }

  .detail-meta { font-size: 12px; }

  .detail-title {
    margin-top: 16px;
    max-width: 720px;
    font-size: 52px;
    line-height: .92;
  }

  .detail-desc {
    margin-top: 16px;
    max-width: 560px;
    font-size: 16px;
  }

  .cta-row {
    position: static;
    padding: 0;
    margin-top: 28px;
    background: none;
  }

  .cta-row .btn-start {
    flex: none;
    padding: 0 34px;
  }

  .cta-row .btn-copy { display: flex; }

  .stats {
    margin-top: 32px;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,2fr);
  }

  .stat, .next { background: #1C1C1F; }

  .stat-blob {
    width: 24px;
    height: 24px;
  }

  .stat-value { margin-top: 18px; }

  .next {
    grid-column: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    padding: 18px;
  }

  .next:hover { background: #252528; }
  .next .arrow-circle { display: none; }
  .next-label { display: flex; justify-content: space-between; }
  .next-title { font-size: 20px; line-height: 1.05; }
}
