/* reel-desktop.css — Reel layout on wide screens, hover states and reduced-motion fallbacks.
   Split from app.module.css; load order in app.html preserves the original cascade. */

@media (min-width: 960px) {
  :root {
    --desktop-rail: 232px;
    --desktop-centre-shift: 116px;
    --desktop-study-max: 800px;
    --desktop-study-gutter: 56px;
    --desktop-study-top: 24px;
    --desktop-study-width: min(var(--desktop-study-max), calc(100vw - var(--desktop-rail) - 2 * var(--desktop-study-gutter)));
    --feed-column: var(--desktop-study-width);
  }

  body {
    background: var(--paper);
  }

  /* The reel fills the area beside the rail and centres its own content, so the
     verdict sheet can span the full width while still belonging to its card. A
     fixed sheet would outlive the card and follow the reader down the feed. */
  #reel {
    left: var(--desktop-rail);
    right: 0;
    width: auto;
    transform: none;
  }

  #reel .card .inner {
    margin-inline: auto;
  }

  #reel .card .sheet {
    left: 0;
    right: 0;
    max-height: 46dvh;
    padding: 28px 40px 36px;
  }

  #reel .card .sheet .in {
    max-width: var(--feed-column);
    margin: 0 auto;
  }

  /* YouTube Shorts-style desktop stage: the whole Watch sequence—including
     its check questions—lives in one centred 9:16 player instead of a tall
     black column. The page, not the video, owns the surrounding whitespace. */
  body.watch-mode #reel {
    top: 50%;
    bottom: auto;
    left: calc(50% + var(--desktop-centre-shift));
    right: auto;
    width: min(640px, 54dvh, calc(100vw - var(--desktop-rail) - 160px));
    height: auto;
    aspect-ratio: 9 / 16;
    border: 1px solid rgb(7 24 39 / 24%);
    border-radius: 22px;
    box-shadow: 0 22px 70px rgb(7 24 39 / 22%);
    transform: translate(-50%, -50%);
  }

  body.watch-mode #reel .card {
    height: 100%;
    min-height: 100%;
  }

  body.watch-mode #feedMark {
    display: none;
  }

  body.watch-mode .vcap {
    top: 20px;
  }

  /* Desktop navigation lives beside the reel, not below it. Use the full
     height and preserve every pixel of the authored 9:16 lesson frame. */
  .vcard video {
    height: 100%;
    object-fit: contain;
  }

  #settings,
  #home,
  #practice,
  #learn,
  #cards {
    left: var(--desktop-rail);
    padding: 48px clamp(36px, 5vw, 76px) 56px;
    background: var(--paper);
  }

  #learn .linner,
  #cards .cinner {
    max-width: 1040px;
  }

  /* The hero band runs edge to edge on the phone; on the desk it is a card. */
  .hero {
    margin: -48px 0 24px;
    padding: 32px clamp(24px, 3vw, 40px) 28px;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
  }

  #home h1 {
    max-width: 18ch;
    font-size: clamp(2rem, 3.2vw, 2.6rem);
  }

  #practice h1,
  #learn h1,
  #cards h1 {
    font-size: 2rem;
  }

  .goal {
    padding: 16px 20px;
  }

  .tiles {
    gap: 16px;
  }

  .tile {
    padding: 20px 14px;
  }

  .mockgrid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 14px;
  }

  .mocktile {
    padding: 15px 8px;
  }

  .mocktile b {
    font-size: 1.5rem;
  }

  .mocktile span {
    font-size: 0.92rem;
  }

  .bar {
    left: calc(50% + var(--desktop-centre-shift));
    right: auto;
    width: var(--feed-column);
    transform: translateX(-50%);
  }

  /* One-row header on desktop: the hairline sits just under the chips, and the
     endless-mode infinity shares that row, level with the streak and filter. */
  /* The header keeps its content on the feed column, but its hairline runs from
     the rail to the right edge of the window. */
  .bar.top {
    min-height: calc(66px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
    border-bottom: 0;
  }

  /* The desktop feed column is wider than the phone's, and the header tracks it. */
  .bar.top .session-track { max-width: none; }

  .bar.top::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: calc(var(--desktop-rail) + var(--feed-column) / 2 - var(--desktop-centre-shift) - 50vw);
    width: calc(100vw - var(--desktop-rail));
    height: 2px;
    background: var(--line-1);
    pointer-events: none;
  }

  #feedMark {
    left: calc(50% - 138px);
  }

  .closex {
    right: 34px;
  }
}

@media (hover: hover) {
  .big:not(.disabled):hover {
    filter: brightness(1.05);
  }

  .ghost:hover,
  .chip:hover,
  .why:hover,
  .deck:hover,
  .mode:hover,
  .mocktile:not(.pass):not(.fail):hover,
  .cat:hover,
  .pill:not(.on):hover {
    background: var(--panel);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .cf {
    display: none !important;
  }

  .hint.show,
  .hint.show .hint-thumb,
  .hint.show .hint-trail,
  .pop,
  .opt.right,
  .opt.wrong,
  .scorenum,
  .stamp,
  .panel {
    animation: none !important;
  }

  .sheet,
  #soundToast {
    transition: none !important;
  }
}

body.reduced-motion .cf {
  display: none !important;
}

body.reduced-motion .hint.show,
body.reduced-motion .hint.show .hint-thumb,
body.reduced-motion .hint.show .hint-trail,
body.reduced-motion .pop,
body.reduced-motion .opt.right,
body.reduced-motion .opt.wrong,
body.reduced-motion .scorenum,
body.reduced-motion .stamp,
body.reduced-motion .panel {
  animation: none !important;
}

body.reduced-motion .sheet,
body.reduced-motion #soundToast {
  transition: none !important;
}

/* Routes out of the feed to the pages that answer "what is this, who made it,
   what does it cost". The feed is the front door now, so these need a home. */
.setlinks {
  margin: 16px 0 4px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-3);
}

.setlinks a {
  color: var(--brand-ink);
  text-underline-offset: 3px;
}

/* Same links, but on the Progress screen rather than three taps deep in
   Settings. A sceptical buyer looks for a footer before they look for a
   feature, and finding none reads as "nobody is behind this". */
.setlinks.foot {
  margin: 20px 0 8px;
  padding-top: 16px;
  border-top: 1.5px solid var(--line-1);
}

/* Tap-to-toggle sound confirmation. Sits dead centre over the video for a
   beat, the way every short-video app acknowledges the gesture. Visibility is
   driven by a JS timeout rather than an animation, so it still shows for its
   full duration when prefers-reduced-motion flattens the transition. */
#soundToast {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 40;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 22px 26px;
  border-radius: var(--r-lg);
  background: rgb(0 0 0 / 62%);
  color: #fff;
  backdrop-filter: blur(12px);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.86);
  transition:
    opacity 0.18s var(--ease),
    transform 0.18s var(--ease);
}

#soundToast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#soundToast svg {
  width: 40px;
  height: 40px;
  fill: currentcolor;
}

#soundToast span {
  font-size: 0.875rem;
  font-weight: 700;
}

/* Desktop arrow buttons: a mouse alternative to swiping, floating to the right of
   the feed column (or the 9:16 video stage) at mid-height. Hidden on phones and
   whenever a panel covers the reel. */
.reel-nav { display: none; }
@media (min-width: 960px) {
  .reel-nav {
    position: fixed;
    z-index: 10;
    top: 50%;
    left: calc(50% + var(--desktop-centre-shift) + var(--feed-column) / 2 + 28px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    transform: translateY(-50%);
  }
  body.watch-mode .reel-nav { left: calc(50% + var(--desktop-centre-shift) + var(--journey-stage-width) / 2 + 28px); }
  body:has(#today.show, #home.show, #practice.show, #learn.show, #cards.show, #settings.show) .reel-nav,
  body:has(#reel[inert]) .reel-nav { display: none; }
  .reel-nav button {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--panel-2);
    color: var(--ink);
    box-shadow: none;
    transition: background .15s ease, transform .1s ease;
  }
  .reel-nav button:hover { background: var(--line-2); }
  .reel-nav button:active { transform: scale(.94); }
  .reel-nav button:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
  .reel-nav svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
}

/* Feed content stretches to the wider desktop column. */
@media (min-width: 960px) {
  .card .inner, .quiz-action-bar, .answer-feedback, .sheet .in, #review .inner, .bar { max-width: var(--feed-column); }
  /* Practice cards fill the wider column and read larger, at the Learn path's scale:
     a bigger corgi, a bigger question bubble and taller answer rows. */
  #reel .card .inner:has(.opts) > .q { min-height: 124px; margin-left: 132px; padding: 16px 20px; font-size: 1.35rem; line-height: 1.45; }
  #reel .card .inner:has(.opts) > .q::before { left: -132px; width: 116px; height: 130px; }
  #reel .card .inner > .sub { font-size: 0.95rem; margin-bottom: 16px; }
  #reel .card .opts { gap: 14px; }
  #reel .card .opt { min-height: 68px; padding: 16px 20px; font-size: 1.2rem; gap: 14px; }
  #reel .card .opt .l { width: 34px; height: 34px; font-size: 0.95rem; }
}
