/*
  Handheld Flow Layout v1
  Desktop keeps the existing immersive stage. At <= 760px the same content
  becomes a fixed particle hero + fixed navigation/footer + independently
  scrollable copy/card viewport.
*/

@media (max-width: 760px) {
  :root {
    --mobile-topbar-height: 60px;
    --mobile-footer-height: 56px;
    --mobile-origin-nav-height: 68px;
    --mobile-focus-content-top: clamp(344px, 54svh, 390px);
    --mobile-side-padding: 18px;
    --mobile-stage-bg: #080808;
  }

  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body {
    min-height: 100svh;
    background: var(--mobile-stage-bg);
  }

  .stage {
    position: relative;
    width: 100%;
    height: 100svh;
    min-height: 100svh;
    overflow: hidden;
    padding: 0;
  }

  @supports (height: 100dvh) {
    .stage {
      height: 100dvh;
      min-height: 100dvh;
    }
  }

  #particle-canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
    transform-origin: 50% 42%;
    transition: transform 1.05s cubic-bezier(.16, 1, .3, 1), opacity .7s ease;
  }

  body.is-origin #particle-canvas {
    transform: translate3d(0, -2svh, 0) scale(.98);
  }

  body.is-transitioning #particle-canvas,
  body.is-focused #particle-canvas {
    transform: translate3d(0, clamp(-150px, -16svh, -105px), 0) scale(.96);
  }

  .brand-center {
    z-index: 5;
    top: 34%;
    width: calc(100vw - 36px);
    transform: translate(-50%, -50%);
    transition: opacity .72s ease, filter .72s ease, transform .9s cubic-bezier(.16, 1, .3, 1);
  }

  .brand-center h1 {
    font-size: clamp(56px, 17vw, 76px);
    letter-spacing: -.075em;
  }

  .brand-center p {
    width: min(23em, calc(100vw - 40px));
    margin-top: 14px;
    font-size: 14px;
    line-height: 1.55;
  }

  body.is-transitioning .brand-center,
  body.is-focused .brand-center {
    opacity: 0;
    filter: blur(4px);
    transform: translate(-50%, -58%) scale(.96);
  }

  .origin-fields {
    position: fixed;
    z-index: 12;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: var(--mobile-origin-nav-height);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(14px, 6vw, 30px);
    padding: 0 14px;
    perspective: none;
    pointer-events: auto;
    background: transparent;
    border-bottom: 1px solid transparent;
    transform: translate3d(0, calc(100svh - var(--mobile-footer-height) - var(--mobile-origin-nav-height) - 8px), 0) !important;
    transform-style: flat !important;
    transition:
      transform .9s cubic-bezier(.16, 1, .3, 1),
      background .5s ease,
      border-color .5s ease,
      backdrop-filter .5s ease;
  }

  @supports (height: 100dvh) {
    .origin-fields {
      transform: translate3d(0, calc(100dvh - var(--mobile-footer-height) - var(--mobile-origin-nav-height) - 8px), 0) !important;
    }
  }

  body.is-transitioning .origin-fields,
  body.is-focused .origin-fields {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translate3d(0, env(safe-area-inset-top), 0) !important;
    background: rgba(8, 8, 8, .86);
    border-bottom-color: rgba(255, 255, 255, .08);
    backdrop-filter: blur(18px);
  }

  .field-trigger {
    position: relative;
    inset: auto;
    flex: 0 1 auto;
    min-width: 0;
    padding: 8px 3px;
    transform: none !important;
    filter: none;
    transition: color .35s ease, opacity .35s ease, font-size .8s cubic-bezier(.16, 1, .3, 1) !important;
  }

  .field-trigger span {
    font-size: clamp(34px, 11vw, 46px);
    line-height: 1;
    letter-spacing: -.07em;
    transition: font-size .8s cubic-bezier(.16, 1, .3, 1), opacity .4s ease;
  }

  body.is-transitioning .field-trigger span,
  body.is-focused .field-trigger span {
    font-size: 22px;
    letter-spacing: -.04em;
  }

  .field-trigger.is-dimmed {
    opacity: .28;
    filter: none;
  }

  body.is-focused .field-trigger {
    color: rgba(255, 255, 255, .42);
  }

  body.is-focused .field-trigger.is-active,
  body.is-focused .field-trigger:focus-visible {
    color: #fff;
  }

  .focus-panel {
    position: static !important;
    display: contents;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: none;
  }

  .focus-controls {
    display: contents;
  }

  .focus-menu {
    display: none !important;
  }

  .origin-reset {
    position: fixed;
    z-index: 14;
    top: calc(env(safe-area-inset-top) + 13px);
    left: 10px;
    margin: 0;
    padding: 7px 9px;
    border-color: rgba(255, 255, 255, .16);
    background: rgba(8, 8, 8, .72);
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    transform: translate3d(-12px, 0, 0);
    pointer-events: none;
    transition: opacity .38s ease, transform .55s cubic-bezier(.16, 1, .3, 1);
  }

  body.is-focused .origin-reset {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
  }

  .mobile-content-viewport {
    position: fixed;
    z-index: 8;
    top: var(--mobile-focus-content-top);
    left: 0;
    right: 0;
    bottom: calc(var(--mobile-footer-height) + env(safe-area-inset-bottom));
    min-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translate3d(0, 24px, 0);
    pointer-events: none;
    background: var(--mobile-stage-bg);
    transition: opacity .55s .12s ease, transform .8s .08s cubic-bezier(.16, 1, .3, 1);
  }

  body.is-focused .mobile-content-viewport {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
  }

  .mobile-content-viewport::before,
  .mobile-content-viewport::after {
    content: "";
    position: absolute;
    z-index: 4;
    left: 0;
    right: 0;
    height: 28px;
    pointer-events: none;
  }

  .mobile-content-viewport::before {
    top: 0;
    background: linear-gradient(to bottom, var(--mobile-stage-bg) 0%, rgba(8, 8, 8, .88) 28%, transparent 100%);
  }

  .mobile-content-viewport::after {
    bottom: 0;
    background: linear-gradient(to top, var(--mobile-stage-bg) 0%, rgba(8, 8, 8, .88) 28%, transparent 100%);
  }

  .mobile-content-scroll {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 20px var(--mobile-side-padding) 46px;
    background: linear-gradient(to bottom, rgba(8, 8, 8, .96), var(--mobile-stage-bg) 70%);
  }

  .mobile-content-scroll::-webkit-scrollbar {
    display: none;
  }

  .focus-copy {
    position: relative;
    width: 100%;
    min-height: 0;
    margin: 0 !important;
    padding: 6px 2px 4px 22px;
    transition: none !important;
  }

  .focus-line {
    width: 2px;
  }

  .focus-label {
    font-size: 10px;
    letter-spacing: .14em;
  }

  .focus-description {
    max-width: none;
    margin-top: 12px;
    font-size: 16px;
    line-height: 1.55;
  }

  .focus-cta-group {
    gap: 8px 16px;
    margin-top: 14px;
  }

  .focus-copy a {
    margin-top: 0;
    padding-bottom: 4px;
    font-size: 13px;
  }

  .featured-evidence {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    margin: 18px 0 0;
    opacity: 0;
    transform: translate3d(0, 18px, 0);
    filter: blur(4px);
    pointer-events: none;
    transition: opacity .42s ease, transform .62s cubic-bezier(.16, 1, .3, 1), filter .42s ease;
  }

  body.is-focused.is-featured-visible .featured-evidence {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
    pointer-events: auto;
  }

  .featured-heading {
    display: block;
    margin-bottom: 10px;
  }

  .featured-heading p {
    font-size: 9px;
  }

  .featured-heading span {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    color: rgba(255, 255, 255, .42);
    font-size: 10px;
    line-height: 1.35;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .featured-rail {
    display: flex;
    gap: 12px;
    width: calc(100% + var(--mobile-side-padding));
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 var(--mobile-side-padding) 8px 0;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 0;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .featured-rail::-webkit-scrollbar {
    display: none;
  }

  .evidence-card {
    flex: 0 0 min(82vw, 306px);
    min-width: min(82vw, 306px);
    min-height: 176px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .evidence-card-inner {
    min-height: 176px;
    padding: 16px;
  }

  .evidence-title {
    margin-top: 13px;
    font-size: 18px;
  }

  .evidence-summary {
    margin: 9px 0 16px;
    font-size: 12px;
    line-height: 1.55;
  }

  .global-info {
    position: fixed;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(var(--mobile-footer-height) + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 0 16px env(safe-area-inset-bottom);
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(8, 8, 8, .94);
    backdrop-filter: blur(18px);
    color: rgba(255, 255, 255, .58);
    font-size: 11px;
    transition: height .58s cubic-bezier(.16, 1, .3, 1), padding .58s cubic-bezier(.16, 1, .3, 1), background .35s ease;
  }

  .global-name {
    min-width: 0;
    margin: 0;
  }

  .global-name strong {
    color: rgba(255, 255, 255, .84);
    font-size: 12px;
  }

  .global-name span,
  .global-info-item {
    display: none;
  }

  .mobile-contact-toggle {
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, .035);
    color: rgba(255, 255, 255, .76);
    cursor: pointer;
  }

  body.is-contact-open .global-info {
    height: min(58dvh, 360px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 18px;
    padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
    background: rgba(12, 11, 10, .985);
  }

  body.is-contact-open .global-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-right: 72px;
  }

  body.is-contact-open .global-name strong {
    font-size: 22px;
  }

  body.is-contact-open .global-name span,
  body.is-contact-open .global-info-item {
    display: block;
  }

  body.is-contact-open .global-name span {
    color: rgba(255, 255, 255, .42);
    font-size: 11px;
  }

  body.is-contact-open .global-info-item {
    width: 100%;
    padding: 11px 0;
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .68);
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  body.is-contact-open .mobile-contact-toggle {
    position: absolute;
    top: 20px;
    right: 16px;
  }

  .mobile-contact-backdrop {
    position: fixed;
    z-index: 19;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, .58);
    opacity: 0;
    pointer-events: none;
    transition: opacity .32s ease;
  }

  body.is-contact-open .mobile-contact-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .status {
    bottom: calc(var(--mobile-footer-height) + env(safe-area-inset-bottom) + 8px);
  }

  @media (max-height: 667px) {
    :root {
      --mobile-topbar-height: 56px;
      --mobile-footer-height: 52px;
      --mobile-origin-nav-height: 62px;
      --mobile-focus-content-top: 350px;
    }

    .brand-center {
      top: 32%;
    }

    .brand-center h1 {
      font-size: 58px;
    }

    .brand-center p {
      font-size: 13px;
    }

    .field-trigger span {
      font-size: 36px;
    }

    body.is-transitioning .field-trigger span,
    body.is-focused .field-trigger span {
      font-size: 20px;
    }

    .mobile-content-scroll {
      padding-top: 16px;
    }

    .focus-description {
      font-size: 15px;
      line-height: 1.48;
    }

    .focus-cta-group {
      margin-top: 11px;
    }

    .featured-evidence {
      margin-top: 14px;
    }

    .evidence-card,
    .evidence-card-inner {
      min-height: 164px;
    }
  }

  @media (orientation: landscape) and (max-height: 520px) {
    .stage {
      overflow-y: auto;
    }

    .mobile-content-viewport {
      top: 46vh;
    }
  }
}
