/* v15 — responsive mobile art direction for the fullscreen portfolio.
   Desktop keeps the fullscreen hover-driven composition; touch screens receive a
   compact menu, visual project index, single-column project pages and touch controls. */

/* Repair the display-heading rule from the previous style layer. */
.variant-fullscreen .stage-intro h1 {
  display: block;
  width: auto;
  height: auto !important;
  min-height: 0;
  transform: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: .82;
}
.variant-fullscreen .stage-intro h1 em {
  letter-spacing: -.025em;
}

.mobile-menu-toggle { display: none; }
.mobile-project-thumb { display: none; }

.scan-controls { display: flex; align-items: center; gap: 8px; }
.scan-zoom-button {
  width: 40px; height: 38px; padding: 0; display: inline-grid; place-items: center;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  font: 19px/1 "DM Mono", monospace; cursor: pointer;
}
.scan-zoom-button:hover { background: var(--ink); color: var(--paper); }

@media (max-width: 760px) {
  html { scroll-padding-top: 14px; }
  body.variant-fullscreen { overflow-x: clip; }

  /* Overlay header: compact brand plus an accessible menu. */
  .variant-fullscreen .site-header {
    position: absolute !important;
    top: 0; left: 0; right: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: calc(13px + env(safe-area-inset-top)) 17px 12px;
    background: linear-gradient(180deg, rgba(10,11,10,.66), rgba(10,11,10,0));
    z-index: 50;
  }
  .variant-fullscreen .wordmark {
    min-width: 0;
    font-size: 12px;
    letter-spacing: .19em;
    line-height: 1.4;
    white-space: normal;
  }
  .variant-fullscreen .wordmark span {
    display: block;
    margin: 5px 0 0;
    font-size: 8px;
    line-height: 1.4;
    letter-spacing: .12em;
    white-space: normal;
  }
  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 88px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid rgba(242,240,233,.55);
    background: rgba(17,18,16,.7);
    color: #f2f0e9;
    font: 10px "DM Mono", monospace;
    text-transform: uppercase;
    letter-spacing: .12em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-menu-glyph { display: grid; gap: 4px; width: 14px; }
  .mobile-menu-glyph i { display: block; height: 1px; width: 14px; background: currentColor; transition: transform .22s ease; }
  .mobile-nav-open .mobile-menu-glyph i:first-child { transform: translateY(2.5px) rotate(45deg); }
  .mobile-nav-open .mobile-menu-glyph i:last-child { transform: translateY(-2.5px) rotate(-45deg); }
  .variant-fullscreen .site-header nav {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 13px;
    right: 13px;
    width: auto;
    margin: 0;
    padding: 9px;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0;
    border: 1px solid rgba(242,240,233,.28);
    background: rgba(17,18,16,.97);
    box-shadow: 0 16px 42px rgba(0,0,0,.28);
    backdrop-filter: blur(18px);
  }
  .variant-fullscreen .site-header.mobile-nav-open nav { display: flex; }
  .variant-fullscreen .site-header nav a {
    display: flex;
    align-items: center;
    min-height: 46px;
    padding: 10px 12px;
    font-size: 11px;
    letter-spacing: .1em;
    border-bottom: 1px solid rgba(242,240,233,.13);
  }
  .variant-fullscreen .site-header nav .motion-toggle {
    width: 100%;
    min-height: 46px;
    margin-top: 5px;
    padding: 10px 12px;
    justify-content: space-between;
    font-size: 10px;
  }

  /* The first screen is a cinematic introduction; the index continues on solid dark
     ground below it so a long project list cannot be cropped by a viewport-height stage. */
  .fullscreen-stage {
    display: block;
    position: relative;
    min-height: 0 !important;
    height: auto;
    overflow: visible;
    background: #111210;
  }
  .fullscreen-stage .stage-visual {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: auto;
    width: 100%;
    height: min(91svh, 800px);
    min-height: 520px;
    transform: none !important;
    transition: opacity .5s ease;
  }
  .fullscreen-stage .stage-visual .hero-shader-fallback,
  .fullscreen-stage .stage-visual .hero-shader-canvas,
  .fullscreen-stage .stage-visual #stage-preview-video {
    object-position: 55% center;
  }
  .fullscreen-stage::after {
    top: 0; left: 0; right: 0; bottom: auto;
    height: min(91svh, 800px);
    background: linear-gradient(180deg, rgba(8,9,8,.14) 0%, rgba(8,9,8,.16) 22%, rgba(8,9,8,.62) 48%, #111210 91%);
  }
  .fullscreen-stage::before {
    top: 0; left: 0; right: 0; bottom: auto;
    height: min(91svh, 800px);
    opacity: .12;
  }
  .stage-content {
    position: relative;
    z-index: 4;
    display: block;
    width: 100%;
    min-height: 0 !important;
    padding: 0 17px;
  }
  .stage-intro {
    display: flex;
    width: 100%;
    max-width: none;
    min-height: 79svh;
    padding: calc(100px + env(safe-area-inset-top)) 0 38px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
  }
  .stage-intro .stage-eyebrow { font-size: 8px; letter-spacing: .14em; }
  .stage-intro h1 {
    font-size: clamp(78px, 22vw, 122px);
    margin: 28px 0 21px;
    line-height: .84;
    letter-spacing: -.025em;
    max-width: 100%;
    height: auto !important;
    transform: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .stage-intro h1 em { letter-spacing: -.012em; }
  .stage-summary {
    max-width: 295px;
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
  }
  .stage-intro-bottom {
    display: flex;
    margin-top: 23px;
    gap: 12px 22px;
    align-items: center;
  }
  .stage-intro-bottom .stage-link { min-height: 34px; padding-bottom: 7px; display: inline-flex; align-items: center; }
  .stage-intro-bottom .stage-eyebrow { font-size: 8px; }

  .stage-list {
    position: relative;
    z-index: 4;
    width: 100%;
    max-width: none;
    padding: 10px 0 28px;
    margin: 0;
    background: #111210;
  }
  .stage-index-heading {
    margin: 0 0 2px;
    padding: 14px 0 10px;
    gap: 10px;
    border-bottom-color: rgba(242,240,233,.38);
  }
  .stage-index-label { font-size: 8px; letter-spacing: .12em; }
  .stage-project-row {
    display: grid;
    grid-template-columns: 22px 52px minmax(0,1fr) 38px 12px;
    gap: 9px;
    align-items: center;
    min-height: 70px;
    padding: 10px 0;
    border-bottom-color: rgba(242,240,233,.2);
    -webkit-tap-highlight-color: transparent;
  }
  .stage-project-row .row-index { font-size: 9px; align-self: center; }
  .mobile-project-thumb {
    display: block;
    width: 52px;
    height: 44px;
    align-self: center;
    overflow: hidden;
    background: #292a27;
    border: 1px solid rgba(242,240,233,.18);
  }
  .mobile-project-thumb img {
    display: block;
    width: 100%; height: 100%;
    object-fit: cover;
  }
  .stage-project-row > span { min-width: 0; }
  .stage-project-row .row-title {
    display: block;
    font-size: clamp(12px, 3.6vw, 14px);
    line-height: 1.3;
    font-weight: 500;
    letter-spacing: -.01em;
    overflow-wrap: anywhere;
  }
  .stage-project-row .row-caption {
    margin-top: 4px;
    font-size: 8px;
    line-height: 1.35;
    letter-spacing: .01em;
    color: rgba(242,240,233,.59);
  }
  .stage-project-row .row-year { font-size: 8px; text-align: right; align-self: center; white-space: nowrap; }
  .stage-project-row .row-arrow { font-size: 11px; text-align: right; align-self: center; }
  .stage-project-row:hover,.stage-project-row:focus-visible,.stage-project-row.is-current { padding-left: 0; }
  .stage-project-row:active { background: rgba(255,255,255,.04); }

  .stage-bottom {
    position: relative;
    inset: auto;
    display: flex;
    flex-wrap: wrap;
    margin: 0 17px;
    padding: 14px 0 calc(18px + env(safe-area-inset-bottom));
    gap: 10px;
    font-size: 8px;
    border-top: 1px solid rgba(242,240,233,.25);
    background: #111210;
  }
  .stage-bottom .stage-live-title { max-width: calc(100% - 100px); white-space: normal; overflow: visible; }
  .stage-bottom .stage-help { display: none; }
  .stage-bottom a { margin-left: auto; }
  .stage-interface-note { display: none; }

  .fullscreen-about,.fullscreen-contact {
    padding: 58px 18px calc(68px + env(safe-area-inset-bottom));
  }
  .fullscreen-about .section-heading,.fullscreen-contact .section-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    margin-bottom: 31px;
  }
  .fullscreen-about .section-heading .section-note,.fullscreen-contact .section-heading .section-note { font-size: 11px; }
  .fullscreen-about .about-content { display: grid; grid-template-columns: minmax(0,1fr); gap: 25px; }
  .fullscreen-about h2,.fullscreen-contact h2 {
    font-size: clamp(43px, 12vw, 64px);
    letter-spacing: -.035em;
    line-height: .93;
  }
  .fullscreen-about .about-copy { max-width: none; font-size: 14px; line-height: 1.65; }
  .fullscreen-about .about-copy>p:first-child { font-size: 16px; line-height: 1.6; }
  .fullscreen-about .skills { font-size: 12px; line-height: 1.75; }
  .fullscreen-contact .contact-content { min-height: 0; gap: 30px; align-items: flex-start; }
  .fullscreen-contact .contact-link {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    font-size: clamp(16px, 4.7vw, 22px);
    line-height: 1.35;
    overflow-wrap: anywhere;
    padding-bottom: 8px;
  }
  .fullscreen-contact .contact-link span { margin-left: 5px; }
  .fullscreen-contact .contact-bottom { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; font-size: 10px; line-height: 1.5; }
  .site-footer {
    padding: 17px 18px calc(20px + env(safe-area-inset-bottom));
    gap: 11px 18px;
    flex-wrap: wrap;
    font-size: 8px;
    letter-spacing: .07em;
  }
  .site-footer span:nth-child(2) { width: 100%; order: 3; }

  /* On mobile a project is a genuine full-screen page, not a small desktop modal. */
  .project-dialog {
    position: fixed;
    inset: 0;
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    padding: 0;
    border: 0;
    box-shadow: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .project-dialog[open] { animation: mobile-dialog-enter .34s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes mobile-dialog-enter { from { opacity: .65; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
  .dialog-top {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    min-height: 58px;
    gap: 12px;
  }
  .dialog-top .eyebrow { max-width: 65%; font-size: 8px; letter-spacing: .08em; line-height: 1.4; }
  .close-dialog { min-width: 76px; min-height: 42px; padding: 10px 12px; font-size: 10px; }
  .dialog-body { padding: 25px 16px 24px; }
  .dialog-body h2 { font-size: clamp(35px, 10vw, 52px); line-height: .99; letter-spacing: -.025em; margin: 9px 0 15px; overflow-wrap: anywhere; }
  .dialog-body .eyebrow { font-size: 8px; letter-spacing: .1em; }
  .dialog-year { margin-top: 7px; font-size: 10px; }
  .dialog-description { font-size: 14px; line-height: 1.65; }
  .dialog-credits { font-size: 9px; line-height: 1.65; margin-top: 18px; overflow-wrap: anywhere; }
  .dialog-scan { padding: 0 12px 24px; }
  .scan-panel-heading,.scan-panel-footer { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 0; }
  .scan-panel-heading p,.scan-panel-footer span,.scan-panel-footer a { font-size: 9px; line-height: 1.6; }
  .scan-controls { display: flex; gap: 8px; width: 100%; }
  .scan-zoom-button { width: 46px; height: 44px; flex: 0 0 46px; }
  .scan-reset-button { min-height: 44px; margin-left: auto; padding: 10px 12px; }
  .scan-viewer { height: min(56svh, 480px); min-height: 300px; max-height: 480px; touch-action: none; }
  .scan-panel-footer a { align-self: flex-start; white-space: normal; }

  /* Single-column galleries preserve the full native aspect ratio of images and clips.
     They do not depend on hover, and native video controls are enabled by mobile-ui.js. */
  .dialog-gallery {
    display: grid;
    grid-template-columns: minmax(0,1fr);
    gap: 13px;
    padding: 0 12px calc(28px + env(safe-area-inset-bottom));
  }
  .dialog-gallery .gallery-item {
    grid-column: 1 / -1 !important;
    width: 100%;
    height: auto;
    aspect-ratio: auto !important;
    overflow: hidden;
    margin: 0;
  }
  .dialog-gallery .gallery-item img,
  .dialog-gallery .gallery-item video {
    display: block;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none;
    object-fit: contain;
    object-position: center;
    background: transparent;
  }
  .dialog-gallery .gallery-item video { aspect-ratio: auto; }

  /* The shader is reduced on touch devices; static image remains a crisp fallback. */
  .hero-shader-ui { font-size: 8px; }
  .hero-shader-canvas { display: none !important; }
}

@media (max-width: 380px) {
  .variant-fullscreen .site-header { padding-left: 13px; padding-right: 13px; }
  .variant-fullscreen .wordmark { font-size: 11px; letter-spacing: .15em; }
  .variant-fullscreen .wordmark span { font-size: 7px; letter-spacing: .1em; }
  .mobile-menu-toggle { min-width: 78px; padding: 0 9px; gap: 8px; }
  .stage-content { padding-left: 13px; padding-right: 13px; }
  .stage-project-row { grid-template-columns: 19px 46px minmax(0,1fr) 33px 10px; gap: 7px; }
  .mobile-project-thumb { width: 46px; height: 40px; }
  .stage-project-row .row-caption { font-size: 7.5px; }
  .stage-bottom { margin-left: 13px; margin-right: 13px; }
}

@media (max-height: 600px) and (max-width: 760px) and (orientation: landscape) {
  .stage-intro { min-height: 130svh; padding-top: 100px; }
  .stage-intro h1 { font-size: clamp(64px, 13vw, 94px); margin: 20px 0 12px; }
  .stage-intro-bottom { margin-top: 14px; }
  .stage-visual,.fullscreen-stage::before,.fullscreen-stage::after { height: 120svh !important; }
}

@media (prefers-reduced-motion: reduce) {
  .variant-fullscreen *, .variant-fullscreen *::before, .variant-fullscreen *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
