/*
  Main app locks html/body to overflow:hidden (canvas). Subpages need a real
  document scroll so long grids (gallery) are reachable above the fixed dock.
*/
html:has(body.static-subpage) {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

html:has(body.static-subpage) body {
  height: auto;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: visible;
}

/* Subpages (gallery, learn): shared layout + dock-as-link */
body.static-subpage {
  margin: 0;
  min-height: 100vh;
  padding-bottom: calc(var(--dock-height) + 1.25rem);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
}

/* Fixed dock on gallery/learn: readable bar over the grid */
nav.dock.dock-static {
  background: rgba(40, 40, 40, 0.5);
}

.subpage-header {
  padding: 1rem 1rem 0;
  max-width: 72rem;
  margin: 0 auto;
}

.subpage-back {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: none;
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-color: rgba(209, 219, 231, 0.42);
}

.subpage-back:hover,
.subpage-back:focus-visible {
  text-decoration-color: rgba(209, 219, 231, 0.88);
}

.subpage-title {
  margin: 0.75rem 0 0;
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: none;
}

.gallery-beta-cta-wrap {
  margin: 0.5rem 0 0;
  font-size: 14px;
}

.subpage-main {
  padding: 1rem 1rem 2rem;
  max-width: 56rem;
  margin: 0 auto;
}

.subpage-lede {
  margin: 0 0 1rem;
  font-size: 18px;
  line-height: 1.55;
  letter-spacing: 0.1em;
  color: rgba(209, 219, 231, 0.88);
}

.dock-static .dock-menu {
  text-decoration: none;
  color: inherit;
}

.dock-static .dock-menu .menu-label {
  position: static;
  opacity: 1;
  transform: none;
}

/* Learn page: copy + responsive portrait video */
.learn-main {
  max-width: 72rem;
}

.learn-layout {
  display: block;
}

.learn-main .learn-intro {
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
}

.learn-main .learn-intro strong,
.learn-main .learn-intro em {
  font-weight: 400;
  font-style: normal;
  color: rgba(209, 219, 231, 0.98);
}

.learn-copy {
  margin: 1rem 0 0;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0.04em;
  color: rgba(209, 219, 231, 0.82);
}

.learn-beta-cta-wrap {
  margin: 1rem 0 0;
  font-size: 15px;
}

/* Contact page — match .subpage-header / .learn-main width so copy lines up with the title */
.subpage-main.contact-main {
  max-width: 72rem;
}

.contact-main {
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
}

.contact-lede {
  margin: 0 0 1.25rem;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0.04em;
  color: rgba(209, 219, 231, 0.88);
}

.contact-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0.04em;
  color: rgba(209, 219, 231, 0.82);
}

.contact-list li {
  margin: 0 0 0.85rem;
}

.contact-list li:last-child {
  margin-bottom: 0;
}

.contact-list .dock-link {
  font-size: inherit;
}

.learn-copy code {
  font-family: var(--font-body);
  font-size: 0.88em;
  letter-spacing: 0;
  color: rgba(144, 206, 255, 0.95);
}

.learn-video-figure {
  margin: 1.75rem 0 0;
  padding: 0;
}

@media (min-width: 900px) {
  .learn-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
    gap: 2rem 3rem;
    align-items: start;
  }

  .learn-column--text {
    padding-top: 0.15rem;
  }

  .learn-column--media .learn-video-figure {
    margin-top: 0;
  }

  .learn-column--media .learn-video-shell {
    max-width: 100%;
    margin-inline: 0;
  }
}

/*
  Portrait app capture: cap width so it feels like a phone on desktop,
  full width on narrow phones. max-height avoids a single video eating
  the entire viewport on short screens.
*/
.learn-video-shell {
  width: 100%;
  max-width: min(420px, 100%);
  margin-inline: auto;
  border-radius: 0.4rem;
  overflow: hidden;
  background: #0a0a0c;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.learn-video {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(75vh, 900px);
  object-fit: contain;
  vertical-align: bottom;
}

.learn-video-caption {
  margin: 0.65rem 0 0;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: 0.05em;
  color: rgba(209, 219, 231, 0.55);
}

.learn-footer-link {
  margin: 2rem 0 0;
  font-family: var(--font-heading);
  font-size: 14px;
  letter-spacing: 0.06em;
}

.learn-footer-sep {
  margin: 0 0.35rem;
  color: rgba(209, 219, 231, 0.35);
}

/* Gallery grid */
.gallery-main {
  padding: 0 1rem 2rem;
  max-width: 72rem;
  margin: 0 auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  width: 100%;
}

.gallery-item {
  display: block;
  border-radius: 4px;
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 4px;
  vertical-align: middle;
  transition: opacity 0.2s ease;
}

.gallery-item:hover img,
.gallery-item:focus-visible img {
  opacity: 0.82;
}

.gallery-item:focus-visible {
  outline: 2px solid rgba(122, 189, 255, 0.85);
  outline-offset: 3px;
}

.gallery-status {
  margin: 1rem 0;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: rgba(209, 219, 231, 0.72);
}

/* Lightbox */
#lightbox {
  position: relative;
  border: none;
  background: rgba(17, 17, 20, 0.95);
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

#lightbox.is-loading {
  cursor: progress;
}

#lightbox.is-loading #lightbox-img {
  opacity: 0.65;
  transition: opacity 0.2s ease;
}

#lightbox:not(.is-loading) #lightbox-img {
  opacity: 1;
  transition: opacity 0.15s ease;
}

#lightbox.is-loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 2px solid rgba(209, 219, 231, 0.2);
  border-top-color: rgba(209, 219, 231, 0.92);
  animation: lightbox-spin 0.65s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes lightbox-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  #lightbox.is-loading::after {
    animation: none;
    opacity: 0.9;
  }
}

#lightbox::backdrop {
  background: rgba(0, 0, 0, 0.8);
}

#lightbox-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  margin: 0;
  padding: 0.35rem 0.55rem;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(209, 219, 231, 0.35);
  border-radius: 4px;
  background: rgba(23, 23, 28, 0.55);
  color: rgba(209, 219, 231, 0.95);
  font-size: 1.75rem;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  background: rgba(23, 23, 28, 0.85);
  border-color: rgba(209, 219, 235, 0.65);
  color: #fff;
}

.lightbox-nav:focus-visible {
  outline: 2px solid rgba(122, 189, 255, 0.85);
  outline-offset: 3px;
}

#lightbox-prev {
  left: max(12px, env(safe-area-inset-left, 0px));
}

#lightbox-next {
  right: max(12px, env(safe-area-inset-right, 0px));
}

#close-lightbox {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  background: none;
  border: none;
  color: rgba(209, 219, 231, 0.95);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.45rem;
  font-family: inherit;
}

#close-lightbox:hover,
#close-lightbox:focus-visible {
  color: #fff;
}

#close-lightbox:focus-visible {
  outline: 2px solid rgba(122, 189, 255, 0.85);
  outline-offset: 3px;
}
