/**
 * Nanban World Cinema — premium international landing motion
 * Apple / Stripe / Docomo-level polish · driving school identity
 */

@media (prefers-reduced-motion: reduce) {
  .nb-world-scroll-progress,
  .nb-journey-rail,
  .nb-hero-cinema-panel,
  .nb-world-aurora,
  .nb-world-particles,
  .nb-world-tilt,
  .nb-stat-count {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* ── Scroll progress (top hairline) ── */
  .nb-world-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    z-index: 100000;
    background: linear-gradient(90deg, #0d9488, #14b8a6, #d97706);
    box-shadow: 0 0 16px rgba(13, 148, 136, 0.45);
    pointer-events: none;
    transition: width 0.08s linear;
  }

  /* ── Aurora mesh on hero ── */
  #loginScreen .nb-world-aurora {
    position: absolute;
    inset: -20% -10%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.55;
    background:
      radial-gradient(ellipse 55% 45% at 20% 30%, rgba(13, 148, 136, 0.22), transparent 55%),
      radial-gradient(ellipse 50% 40% at 80% 20%, rgba(217, 119, 6, 0.12), transparent 50%),
      radial-gradient(ellipse 60% 50% at 60% 80%, rgba(20, 184, 166, 0.15), transparent 55%);
    animation: nbWorldAuroraShift 18s ease-in-out infinite alternate;
    filter: blur(40px);
  }

  @keyframes nbWorldAuroraShift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(-3%, 2%, 0) scale(1.06); }
  }

  /* ── Hero stage — split layout (world-class) ── */
  #loginScreen .nb-hero {
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-bottom: 0;
  }

  #loginScreen .nb-hero-stage {
    position: relative;
    z-index: 5;
    width: min(1180px, calc(100% - 20px));
    margin: 0 auto;
    padding-top: calc(62px + env(safe-area-inset-top, 0px));
    padding-bottom: 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: stretch;
  }

  @media (min-width: 1024px) {
    #loginScreen .nb-hero-stage {
      grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.85fr);
      gap: clamp(24px, 3vw, 40px);
      align-items: center;
    }
  }

  #loginScreen .nb-hero-content {
    position: relative !important;
    z-index: 2 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  /* Cinema panel — dedicated animation stage */
  #loginScreen .nb-hero-cinema-panel {
    position: relative;
    min-height: clamp(220px, 32vw, 340px);
    border-radius: 28px;
    background:
      linear-gradient(165deg, rgba(255, 255, 255, 0.92) 0%, rgba(236, 253, 245, 0.88) 100%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow:
      0 32px 80px rgba(15, 23, 42, 0.1),
      0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
  }

  #loginScreen .nb-hero-cinema-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
      115deg,
      transparent 40%,
      rgba(255, 255, 255, 0.55) 50%,
      transparent 60%
    );
    transform: translateX(-120%);
    animation: nbWorldShineSweep 6s ease-in-out infinite;
    pointer-events: none;
    z-index: 4;
  }

  @keyframes nbWorldShineSweep {
    0%, 70% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
  }

  #loginScreen .nb-hero-cinema-panel::after {
    content: "LIVE TRAINING";
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 6;
    font-family: "Inter", system-ui, sans-serif;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: #0f766e;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(13, 148, 136, 0.2);
    padding: 5px 10px;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.12);
  }

  #loginScreen .nb-hero-cinema-panel .nb-docomo-scene {
    position: absolute;
    inset: 0;
    z-index: 1;
  }

  #loginScreen .nb-hero-cinema-panel .nb-docomo-scene__inner {
    position: absolute;
    inset: 8% 6% 6% 6%;
    right: auto;
    bottom: auto;
    width: auto;
    height: auto;
    transform: none !important;
  }

  /* ── Journey rail (LLR → License) ── */
  .nb-journey-rail {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0 0 1.25rem;
    padding: 12px 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.06), rgba(255, 255, 255, 0.95));
    border: 1px solid rgba(13, 148, 136, 0.12);
    position: relative;
    overflow: hidden;
  }

  .nb-journey-rail__track {
    position: absolute;
    left: 14px;
    right: 14px;
    top: 50%;
    height: 3px;
    margin-top: -1px;
    background: rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    overflow: hidden;
  }

  .nb-journey-rail__fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0d9488, #14b8a6);
    border-radius: inherit;
    animation: nbJourneyFill 4.5s cubic-bezier(0.22, 1, 0.36, 1) infinite;
    box-shadow: 0 0 12px rgba(13, 148, 136, 0.45);
  }

  @keyframes nbJourneyFill {
    0% { width: 8%; }
    25% { width: 35%; }
    50% { width: 58%; }
    75% { width: 82%; }
    100% { width: 100%; }
  }

  .nb-journey-step {
    flex: 1;
    position: relative;
    z-index: 1;
    text-align: center;
    font-family: "Inter", system-ui, sans-serif;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    transition: color 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .nb-journey-step em {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0 auto 4px;
    border-radius: 50%;
    font-style: normal;
    font-size: 11px;
    background: #fff;
    border: 2px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    transition: inherit;
  }

  .nb-journey-step.is-lit {
    color: #0f766e;
    transform: translateY(-2px);
  }

  .nb-journey-step.is-lit em {
    background: linear-gradient(145deg, #14b8a6, #0d9488);
    border-color: rgba(13, 148, 136, 0.4);
    color: #fff;
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.35);
    animation: nbJourneyStepPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  @keyframes nbJourneyStepPop {
    0% { transform: scale(0.85); }
    60% { transform: scale(1.12); }
    100% { transform: scale(1); }
  }

  /* ── Trust chips — glass lift ── */
  #loginScreen .nb-hero-trust-chip {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
      box-shadow 0.35s ease,
      border-color 0.35s ease;
  }

  #loginScreen .nb-hero-trust-chip:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 28px rgba(13, 148, 136, 0.12);
    border-color: rgba(13, 148, 136, 0.25);
  }

  /* ── Stats — premium cards ── */
  #loginScreen .nb-hero-stat {
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
  }

  #loginScreen .nb-hero-stat:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
  }

  #loginScreen .nb-hero-stat strong.nb-stat-count {
    font-variant-numeric: tabular-nums;
    display: inline-block;
  }

  /* ── Bento 3D tilt ── */
  .nb-world-tilt {
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out, box-shadow 0.35s ease;
    will-change: transform;
  }

  .nb-world-tilt:hover {
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.12);
  }

  /* ── Section cinematic reveal ── */
  #loginScreen .nb-reveal.nb-world-reveal.is-visible {
    animation: nbWorldSectionIn 1s cubic-bezier(0.22, 1, 0.36, 1) both !important;
  }

  @keyframes nbWorldSectionIn {
    from {
      opacity: 0;
      transform: translate3d(0, 48px, 0) scale(0.98);
      filter: blur(8px);
    }
    to {
      opacity: 1;
      transform: translate3d(0, 0, 0) scale(1);
      filter: blur(0);
    }
  }

  /* ── Override landing-world animation kill for our motion ── */
  html.nanban-ready #loginScreen .nb-hero-content .nb-docomo-pop-stagger.is-ready > * {
    animation: nbDocomoPopIn 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both !important;
    opacity: 1 !important;
  }

  html.nanban-ready #loginScreen .nb-hero-content .nb-docomo-pop-stagger.is-ready > *:nth-child(1) { animation-delay: 0.06s !important; }
  html.nanban-ready #loginScreen .nb-hero-content .nb-docomo-pop-stagger.is-ready > *:nth-child(2) { animation-delay: 0.14s !important; }
  html.nanban-ready #loginScreen .nb-hero-content .nb-docomo-pop-stagger.is-ready > *:nth-child(3) { animation-delay: 0.22s !important; }

  html.nanban-ready #loginScreen .nb-journey-rail {
    animation: nbDocomoPopIn 0.85s cubic-bezier(0.34, 1.56, 0.64, 1) 0.18s both !important;
  }

  /* ── Premium car upgrades inside cinema panel ── */
  #loginScreen .nb-hero-cinema-panel .nb-docomo-car-wrap {
    width: min(168px, 42%);
    height: auto;
    animation: nbDocomoCarDrive 6s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  }

  #loginScreen .nb-hero-cinema-panel .nb-docomo-car-svg {
    filter: drop-shadow(0 18px 32px rgba(13, 148, 136, 0.22));
  }

  #loginScreen .nb-hero-cinema-panel .nb-docomo-road__hill {
    background: linear-gradient(180deg, #a7f3d0 0%, #6ee7b7 30%, #34d399 100%);
  }

  /* ── Preloader world-class ── */
  #nanbanPagePreloader.nb-world-preloader {
    background: linear-gradient(165deg, #faf9f7 0%, #ecfdf5 50%, #f3f0eb 100%) !important;
  }

  #nanbanPagePreloader .nb-world-preloader-bar {
    width: min(240px, 70vw);
    height: 4px;
    margin: 12px auto 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
  }

  #nanbanPagePreloader .nb-world-preloader-bar span {
    display: block;
    height: 100%;
    width: 35%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0d9488, #14b8a6);
    animation: nbWorldPreloaderBar 1.4s ease-in-out infinite;
  }

  @keyframes nbWorldPreloaderBar {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(320%); }
  }

  #nanbanPagePreloader .nb-preloader-brand {
    color: #0f172a !important;
    letter-spacing: 0.18em;
  }

  #nanbanPagePreloader .nb-preloader-sub {
    color: #64748b !important;
  }

  /* ── CTA premium glow pulse ── */
  #loginScreen .nb-btn-primary.nb-world-cta {
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(13, 148, 136, 0.35);
  }

  #loginScreen .nb-btn-primary.nb-world-cta::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: translateX(-120%);
    animation: nbWorldCtaShine 3.5s ease-in-out infinite;
  }

  @keyframes nbWorldCtaShine {
    0%, 75% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
  }

  /* ── Marquee premium edge fade ── */
  .nb-marquee-band {
    position: relative;
  }

  .nb-marquee-band::before,
  .nb-marquee-band::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    z-index: 2;
    pointer-events: none;
  }

  .nb-marquee-band::before {
    left: 0;
    background: linear-gradient(90deg, #f3f0eb, transparent);
  }

  .nb-marquee-band::after {
    right: 0;
    background: linear-gradient(270deg, #f3f0eb, transparent);
  }

  @media (max-width: 1023px) {
    #loginScreen .nb-hero-cinema-panel {
      order: 2;
      max-height: 200px;
      aspect-ratio: 2.2 / 1;
      min-height: 0;
    }

    #loginScreen .nb-hero-stage .nb-hero-content {
      order: 1;
    }
  }

  @media (max-width: 640px) {
    .nb-journey-rail {
      padding: 10px 8px;
    }

    .nb-journey-step {
      font-size: 8px;
    }

    .nb-journey-step em {
      width: 24px;
      height: 24px;
      font-size: 10px;
    }
  }
}
