/* Aulama Anime — motion and tablet layer.
 *
 * Pairs with aulama-motion.js. Loaded after the main stylesheet and the phone-landscape
 * layer. Nothing here changes the bundle's transforms or transition lists; motion is added
 * by the script with the individual `scale` / `translate` properties and Web Animations.
 */

/* ------------------------------------------------------------------ motion support */

/* An overlay fading out after React removed it: visible, never interactive. */
[data-aulama-leaving] {
  pointer-events: none !important;
}

/* While the native picture and the page frame fly together, the frame's black backdrop
   stays out of sight, so a sub-frame difference between the two can never show an edge. */
html[data-aulama-mini-sync] .persistent-watch[data-mini-transition] :is(.player-shell, .player-view, .player-stage) {
  background: transparent !important;
}

/* Just after flying back to the watch page: the glow stays out until the page has settled
   (see settleGlow in aulama-motion.js). */
.persistent-watch[data-aulama-settling] :is(.player-edge-ambient, .player-ambient-canvas),
.persistent-watch[data-aulama-settling] .watch-player-frame::before {
  opacity: 0 !important;
}

/* Height changes between a fixed size and auto (expanding text, panels) can animate. */
@supports (interpolate-size: allow-keywords) {
  .anime-app {
    interpolate-size: allow-keywords;
  }
}

/* ------------------------------------------------------------------ tablets held upright
   The phone layout stretched to 800px kept phone gutters and type, and centred the home
   actions under left-aligned copy. Give the page tablet gutters, a title that reads at arm's
   length, wider episode buttons, and line the actions up with the copy. */
@media (orientation: portrait) and (min-width: 600px) and (min-height: 800px) {
  :root .anime-app.anime-app.anime-app:is(.is-native-shell, .is-touch-web) .watch-details-scroll {
    padding-inline: clamp(24px, 4vw, 40px) !important;
  }
  :root .anime-app.anime-app.anime-app:is(.is-native-shell, .is-touch-web) .watch-work-info h1 {
    font-size: clamp(30px, 4.2vw, 38px) !important;
    line-height: 1.25 !important;
  }
  :root .anime-app.anime-app.anime-app:is(.is-native-shell, .is-touch-web) .watch-episode-panel .watch-episode-list {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)) !important;
    gap: 10px !important;
  }
  :root .anime-app.anime-app.anime-app:is(.is-touch-surface, .is-native-shell) .today-focus-copy .feature-actions {
    justify-content: flex-start !important;
  }
}

/* ------------------------------------------------------------------ history, wide screens
   Sideways (phones, tablets) and near-square foldables: "continue watching" was a
   poster-height hero that filled the first screen. It becomes a slim banner — small poster,
   title and progress, the resume button on the right — and the list starts right below. */
@media (orientation: landscape), (min-width: 600px) and (min-aspect-ratio: 4/5) {
  :root .anime-app.anime-app.anime-app .history-redesigned .history-feature {
    --history-card-poster: clamp(72px, 8vw, 108px) !important;
    border-radius: 22px !important;
  }
  :root .anime-app.anime-app.anime-app .history-redesigned .history-feature .history-main {
    grid-template-columns: var(--history-card-poster) minmax(0, 1fr) !important;
    gap: clamp(14px, 2vw, 22px) !important;
    padding: 12px !important;
    align-items: center !important;
  }
  :root .anime-app.anime-app.anime-app .history-redesigned .history-feature .history-poster {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 2 / 3;
    border-radius: 12px !important;
  }
  :root .anime-app.anime-app.anime-app .history-redesigned .history-feature .history-copy {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: clamp(16px, 3vw, 32px);
    row-gap: 6px !important;
    align-items: center !important;
    align-content: center !important;
    justify-content: stretch !important;
    max-width: none !important;
    padding: 4px clamp(14px, 2.4vw, 28px) 4px 0 !important;
  }
  :root .anime-app.anime-app.anime-app .history-redesigned .history-feature .history-copy > * {
    grid-column: 1;
    min-width: 0;
  }
  :root .anime-app.anime-app.anime-app .history-redesigned .history-feature .history-copy > .history-feature-play {
    grid-column: 2;
    grid-row: 1 / span 6;
    align-self: center;
    margin: 0 !important;
  }
  :root .anime-app.anime-app.anime-app .history-redesigned .history-feature .history-title-row strong {
    font-size: clamp(18px, 2vw, 24px) !important;
    line-height: 1.3 !important;
  }
  :root .anime-app.anime-app.anime-app .history-redesigned .history-feature :is(.history-timing, .history-progress) {
    width: min(440px, 100%) !important;
  }
  :root .anime-app.anime-app.anime-app .history-feature-wrap {
    margin-bottom: 22px !important;
  }
}

/* ------------------------------------------------------------------ tablets held sideways
   The details column beside the player is narrow; keep long titles to two short lines. */
@media (orientation: landscape) and (min-width: 1000px) and (min-height: 600px) {
  :root .anime-app.anime-app.anime-app:is(.is-native-shell, .is-touch-web) .watch-work-info h1 {
    font-size: clamp(24px, 2.2vw, 28px) !important;
    line-height: 1.3 !important;
  }
}
