/* Loaded after the identity styles: shared heading fix and mobile app navigation. */
.mobile-contact,
.mobile-dock {
  display: none;
}

.player > picture,
.player > picture > img {
  display: block;
  width: 100%;
  height: 100%;
}

.player > picture > img { object-fit: cover; }

.player[data-video-format="portrait"] {
  width: min(100%, 420px, max(200px, calc((100svh - var(--app-header-height, 0px) - var(--app-dock-height, 0px) - 32px) * 9 / 16)));
  aspect-ratio: 9 / 16;
  margin-inline: auto;
}

.art-dialog > img,
.environment-dialog img {
  touch-action: pan-y pinch-zoom;
}

.hero .title-mask {
  padding-bottom: .2em;
  margin-bottom: -.12em;
}

.section-head h2 {
  line-height: 1.18;
  padding-bottom: .12em;
}

.section-head.is-revealed > h2 {
  animation-name: app-heading-enter;
  clip-path: none;
}

@keyframes app-heading-enter {
  from { opacity: 0; transform: translateY(14px); clip-path: none; filter: none; }
  to { opacity: 1; transform: none; clip-path: none; filter: none; }
}

@media (max-width: 900px) {
  /* Reserve the vertical frame before JavaScript; a started video keeps its format. */
  .player:not(.is-video-loaded) {
    width: min(100%, 420px, max(200px, calc((100svh - var(--app-header-height, 64px) - var(--app-dock-height, 80px) - 32px) * 9 / 16)));
    aspect-ratio: 9 / 16;
    margin-inline: auto;
  }

  :root {
    --app-header-height: calc(64px + env(safe-area-inset-top, 0px));
    --app-dock-height: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  html {
    scroll-padding-top: calc(var(--app-header-height) + 16px);
    scroll-padding-bottom: calc(var(--app-dock-height) + 20px);
  }

  body {
    font-size: 16px;
    line-height: 1.65;
    padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  }

  .wrap {
    width: calc(100% - max(20px, env(safe-area-inset-left, 0px)) - max(20px, env(safe-area-inset-right, 0px)));
  }

  .skip {
    z-index: 120;
  }

  .top {
    position: sticky;
    top: 0;
    inset-inline: 0;
    z-index: 100;
    height: var(--app-header-height);
    padding-top: env(safe-area-inset-top, 0px);
    border-bottom: 1px solid #ffffff20;
    background: #090909f2;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }

  .top .wrap {
    height: 64px;
    gap: 20px;
  }

  .top .brand {
    display: flex;
    align-items: center;
    min-height: 48px;
    min-width: 76px;
  }

  .top .brand img {
    width: 72px;
  }

  .top nav {
    display: none;
  }

  .top .mobile-contact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 18px;
    border: 1px solid #9ec2df70;
    border-radius: 24px;
    color: #eef3f8;
    text-decoration: none;
    font-size: 13px;
    gap: 8px;
  }

  .mobile-contact svg { width: 16px; height: 16px; flex: none; }

  .mobile-dock {
    position: fixed;
    inset: auto 0 0;
    z-index: 110;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    min-height: var(--app-dock-height);
    padding: 8px max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    border-top: 1px solid #ffffff30;
    background: #090909f5;
    box-shadow: 0 -8px 28px #09090938;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }

  .mobile-dock a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 56px;
    padding: 9px 2px 7px;
    border-radius: 12px;
    color: #bfd0de;
    font-size: 11px;
    line-height: 1.25;
    text-decoration: none;
    transition: color .2s ease, background-color .2s ease;
    touch-action: manipulation;
  }

  .mobile-dock a::before {
    content: '';
    position: absolute;
    top: 3px;
    left: calc(50% - 10px);
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: #9ec2df;
    opacity: 0;
    transform: scaleX(.5);
    transition: opacity .2s ease, transform .2s ease;
  }

  .mobile-dock a[aria-current="location"] {
    color: #eef3f8;
    background: #9ec2df1a;
  }

  .mobile-dock a[aria-current="location"]::before {
    opacity: 1;
    transform: scaleX(1);
  }

  .mobile-dock a:focus-visible {
    outline-offset: -3px;
  }

  .mobile-dock a:active { background: #9ec2df2b; }

  .mobile-dock svg {
    width: 20px;
    height: 20px;
    flex: none;
  }

  .hero {
    min-height: calc(100svh - var(--app-header-height) - var(--app-dock-height));
    padding: 88px 0 40px;
    align-items: end;
  }

  .hero h1 {
    max-width: 100%;
    font-size: clamp(48px, 15.4vw, 68px);
    line-height: 1.12;
    letter-spacing: -.035em;
  }

  .hero .title-mask {
    line-height: 1.12;
    padding-bottom: .18em;
    margin-bottom: -.08em;
  }

  .hero .intro {
    max-width: 34ch;
    margin-top: 24px;
    font-size: 16px;
    line-height: 1.65;
  }

  .hero .actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    max-width: 380px;
    margin-top: 28px;
  }

  .hero .actions .button {
    width: 100%;
    min-height: 50px;
    padding: 13px 18px;
    font-size: 14px;
    white-space: normal;
    text-align: center;
  }

  .hero-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin-top: 24px;
  }

  .hero .year {
    margin-top: 0;
    font-size: 11px;
  }

  .section,
  .story,
  .gallery-story,
  .statement {
    padding-block: 64px;
  }

  .section-head {
    margin-bottom: 28px;
  }

  .section-head h2,
  .gallery-sticky h2,
  .story h2 {
    font-size: clamp(32px, 7.8vw, 48px);
    line-height: 1.18;
  }

  .section-head p,
  .prose,
  .story-step p {
    font-size: 16px;
    line-height: 1.65;
  }

  .section-head p {
    margin-top: 18px;
  }

  .story-sticky,
  .gallery-sticky,
  .motion-paused .story-sticky,
  .motion-paused .gallery-sticky {
    position: relative;
    height: auto;
    padding: 0;
  }

  .story-layout {
    gap: 32px;
  }

  .element-controls {
    gap: 12px;
  }

  .element-tab {
    min-width: 0;
    min-height: 44px;
  }

  .element-tab span {
    font-size: clamp(22px, 4vw, 28px);
  }

  .element-tab small {
    font-size: 12px;
  }

  .signature-toolbar button,
  .weights button,
  .gallery-controls button,
  .background-tabs button {
    min-height: 44px;
  }

  .gallery-story {
    --gallery-gutter: max(20px, env(safe-area-inset-left, 0px));
  }

  .gallery-window {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gallery-gutter);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .gallery-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
  }

  .gallery-controls button {
    padding: 10px 16px;
  }

  .art-overlay {
    opacity: 1;
    transform: none;
    min-height: 36px;
  }

  .background-download-label {
    opacity: 1;
    transform: none;
  }

  .background-card-info strong {
    font-size: 18px;
  }

  .background-tabs {
    margin-bottom: 24px;
  }

  .download {
    min-height: 64px;
    padding-block: 22px;
  }

  .player-foot a,
  .footer nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .footer nav {
    gap: 4px 24px;
  }

  .contact {
    padding-block: 56px;
  }

  .art-dialog {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: 100%;
    max-height: calc(100svh - env(safe-area-inset-top, 0px) - 8px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 8px);
    margin: 0;
    border: 1px solid #ffffff30;
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: #090909;
    overflow: auto;
    overscroll-behavior: contain;
    scroll-padding-block: 72px calc(24px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }

  .art-dialog {
    padding: 0 max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  }

  .art-dialog-toolbar {
    position: sticky;
    top: 0;
    z-index: 3;
    flex: none;
    min-height: 64px;
    padding-block: 10px;
    background: #090909;
  }

  .art-dialog-toolbar p {
    min-width: 0;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .art-dialog > img {
    flex: 0 1 auto;
    width: 100%;
    height: auto;
    max-height: calc(100svh - 200px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 200px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    min-height: 80px;
    object-fit: contain;
    margin-block: 12px 20px;
  }

  .art-dialog-controls {
    flex: none;
    flex-wrap: wrap;
    gap: 8px;
  }

  .art-dialog button,
  .art-dialog-controls a {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 12px;
    text-align: center;
  }
}

@media (max-width: 360px) {

  .background-card-info {
    align-items: flex-start;
    flex-direction: column;
  }

  .background-grid-tv .background-card-info {
    gap: 8px;
  }

  .background-card-info strong {
    font-size: 16px;
  }

  .art-dialog-controls a {
    order: 1;
    width: 100%;
  }

  .art-dialog-controls button {
    flex: 1;
  }
}

@media (hover: none), (pointer: coarse) {
  .context-cursor {
    display: none !important;
  }

  .button,
  .art-open,
  [data-cursor] {
    translate: none !important;
    transform: none !important;
  }

  .art-open:hover img,
  .background-choice:hover .background-download-label svg {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .section-head.is-revealed > h2,
  .art-dialog[open] {
    animation: none;
    clip-path: none;
    filter: none;
    transform: none;
    opacity: 1;
  }

  .mobile-dock a,
  .mobile-dock a::before {
    transition: none;
  }
}
