/*
 * Zordew — dedicated mobile layout
 * This file only runs at <= 768px. Desktop styles are untouched.
 */

@media screen and (max-width: 768px) {
  :root {
    --mobile-gutter: clamp(14px, 4.8vw, 22px);
    --mobile-panel: rgba(10, 15, 22, 0.94);
    --mobile-line: rgba(255, 255, 255, 0.12);
    --mobile-muted: rgba(226, 231, 238, 0.68);
    --mobile-radius: 16px;
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html,
  body {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 15px;
  }

  body,
  .site-shell,
  main {
    width: 100%;
  }

  .site-shell {
    overflow: clip;
  }

  img,
  video,
  svg,
  canvas {
    display: block;
    max-width: 100%;
  }

  /* Header: independent mobile bar and menu. */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    padding: max(8px, env(safe-area-inset-top)) var(--mobile-gutter) 8px;
    background: linear-gradient(180deg, rgba(4, 7, 11, 0.98), rgba(4, 7, 11, 0.82));
  }

  .topbar__inner {
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: 8px 10px 8px 14px;
    border: 1px solid var(--mobile-line);
    border-radius: 13px;
    background: rgba(11, 16, 23, 0.92);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  }

  .brand {
    min-width: 0;
  }

  .brand strong {
    font-size: 14px;
    letter-spacing: 0.05em;
  }

  .brand small {
    display: none;
  }

  .mobile-nav-toggle {
    display: inline-grid;
    place-content: center;
    gap: 4px;
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--mobile-line);
    border-radius: 10px;
    background: transparent;
  }

  .mobile-nav-toggle span {
    display: block;
    width: 17px;
    height: 1px;
    background: currentColor;
    transition: transform 220ms ease, opacity 220ms ease;
  }

  html.nav-open .mobile-nav-toggle span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
  html.nav-open .mobile-nav-toggle span:nth-child(2) { opacity: 0; }
  html.nav-open .mobile-nav-toggle span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

  .nav {
    position: fixed;
    top: calc(max(8px, env(safe-area-inset-top)) + 68px);
    right: var(--mobile-gutter);
    left: var(--mobile-gutter);
    z-index: 110;
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--mobile-line);
    border-radius: 15px;
    background: var(--mobile-panel);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
  }

  .nav a {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 0 15px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    font-size: 12px;
    letter-spacing: 0.14em;
  }

  html.nav-open,
  html.nav-open body {
    overflow: hidden;
  }

  html.nav-open .nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  /* All sections use one page column. */
  .hero-reel,
  .capability-board,
  .films-board,
  .selected-projects,
  .contact-board,
  .footer__inner {
    width: calc(100% - (var(--mobile-gutter) * 2));
    margin-right: auto;
    margin-left: auto;
  }

  .hero-reel,
  .capability-board,
  .films-board,
  .selected-projects,
  .contact-board {
    margin-top: 0;
    margin-bottom: 12px;
    border-radius: var(--mobile-radius);
    overflow: hidden;
  }

  /* Hero: text, visual, metadata. No desktop overlay geometry. */
  .hero-reel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #080d14;
  }

  .hero-reel__content {
    position: relative;
    inset: auto;
    z-index: 8;
    order: 1;
    width: 100%;
    min-height: 0;
    padding: 52px 18px 24px;
  }

  .hero-reel__copy {
    width: 100%;
    max-width: 100%;
  }

  .hero-reel__label {
    margin: 0 0 14px;
    color: var(--mobile-muted);
    font-size: 9px;
    letter-spacing: 0.16em;
    line-height: 1.4;
  }

  .hero-reel h1 {
    max-width: 10ch;
    margin: 0;
    font-size: clamp(38px, 11vw, 56px);
    line-height: 0.96;
    letter-spacing: -0.045em;
  }

  .hero-reel__headline {
    min-height: 0;
  }

  .hero-reel__summary {
    max-width: 34rem;
    margin: 20px 0 0;
    color: var(--mobile-muted);
    font-size: 14px;
    line-height: 1.65;
  }

  .hero-reel__actions {
    display: inline-flex;
    align-items: center;
    margin-top: 22px;
  }

  .hero-reel__link {
    min-height: 46px;
    padding: 0 17px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 11px;
    letter-spacing: 0.12em;
  }

  .hero-reel__link-arrow {
    margin-left: 10px;
  }

  .hero-reel__media {
    position: relative;
    inset: auto;
    z-index: 1;
    order: 2;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .hero-reel__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 62% center;
  }

  .hero-reel__frame {
    position: absolute;
    inset: 0;
    z-index: 9;
    pointer-events: none;
  }

  .hero-reel__corner {
    width: 28px;
    height: 28px;
  }

  .hero-reel__hud {
    position: absolute;
    inset: 18px 18px auto;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
  }

  .hero-reel__eyebrow,
  .hero-reel__meta {
    max-width: 46%;
    margin: 0;
    font-size: 9px;
    line-height: 1.35;
    letter-spacing: 0.1em;
  }

  .hero-reel__meta {
    justify-content: flex-end;
    text-align: right;
  }

  .hero-reel__footer {
    position: relative;
    inset: auto;
    order: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding: 0 18px;
    border-top: 1px solid var(--mobile-line);
  }

  .hero-reel__scroll,
  .hero-reel__copyright {
    font-size: 8px;
    letter-spacing: 0.1em;
  }

  .hero-reel__scroll { margin: 0; }
  .hero-reel__playback { margin: 0; }

  .hero-reel__info {
    position: relative;
    inset: auto;
    order: 4;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .hero-reel__info-block {
    min-height: 70px;
    padding: 12px 14px;
    border-top: 1px solid var(--mobile-line);
  }

  .hero-reel__info-label {
    font-size: 8px;
    letter-spacing: 0.08em;
  }

  .hero-reel__info-block strong {
    max-width: none;
    font-size: 11px;
    line-height: 1.35;
  }

  /* Board intro. */
  .board-intro {
    min-height: 0;
    padding: 27px 18px 23px;
  }

  .board-intro__eyebrow,
  .selected-projects__eyebrow {
    font-size: 9px;
    letter-spacing: 0.14em;
  }

  .board-intro h2 {
    max-width: 13ch;
    margin-top: 16px;
    font-size: clamp(31px, 9vw, 46px);
    line-height: 0.98;
    letter-spacing: -0.04em;
  }

  .board-intro p {
    max-width: 34rem;
    margin-top: 17px;
    color: var(--mobile-muted);
    font-size: 14px;
    line-height: 1.65;
  }

  .board-link {
    min-height: 45px;
    padding: 0;
    font-size: 11px;
  }

  .capability-board__intro .board-link,
  .films-board__intro .board-link {
    display: inline-flex;
    margin-top: 18px;
  }

  .contact-board__intro .board-link {
    display: none;
  }

  .capability-board__blueprint {
    min-height: 70px;
    margin-top: 18px;
  }

  .capability-board__list,
  .films-board__stage {
    display: grid;
    gap: 12px;
    padding: 10px;
  }

  /* Capabilities: one visual card per row. */
  .capability-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    min-height: 0;
    padding: 14px;
    border-radius: 13px;
  }

  .capability-row__copy {
    gap: 10px;
  }

  .capability-row__copy h3 {
    max-width: 14ch;
    font-size: clamp(24px, 7vw, 34px);
    line-height: 1;
  }

  .capability-row__copy p {
    font-size: 13px;
    line-height: 1.6;
  }

  .capability-row__visual {
    min-height: 0;
    aspect-ratio: 4 / 3;
    padding: 0;
  }

  .capability-row__visual-shell {
    width: 100%;
    transform: none;
  }

  .capability-row__visual-blur {
    display: none;
  }

  /* Films. */
  .films-featured {
    display: grid;
    gap: 13px;
  }

  .films-featured__media {
    aspect-ratio: 4 / 3;
    border-radius: 12px;
  }

  .films-featured__frame {
    inset: 8px;
  }

  .films-featured__volume-slider {
    display: none;
  }

  .films-featured__playpause,
  .films-featured__volume,
  .films-featured__fullscreen {
    min-width: 42px;
    min-height: 42px;
  }

  .films-featured__copy h3 {
    font-size: clamp(28px, 8vw, 40px);
    line-height: 1;
  }

  .films-featured__copy p,
  .film-card__body p {
    font-size: 13px;
    line-height: 1.6;
  }

  .film-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 13px;
  }

  .film-card__copy {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .film-card__preview {
    aspect-ratio: 16 / 9;
  }

  /* Projects: vertical portfolio feed. */
  .selected-projects__hero {
    min-height: 0;
    padding: 0;
  }

  .selected-projects__hero-copy {
    position: relative;
    inset: auto;
    z-index: 2;
    display: grid;
    gap: 14px;
    padding: 27px 18px 25px;
    background: #0a1018;
  }

  .selected-projects__hero-media,
  .selected-projects__hero-overlay {
    display: none;
  }

  .selected-projects__hero h2 {
    max-width: 12ch;
    font-size: clamp(31px, 9.5vw, 46px);
    line-height: 0.98;
    letter-spacing: -0.04em;
  }

  .selected-projects__hero p {
    max-width: 34rem;
    font-size: 14px;
    line-height: 1.6;
  }

  .selected-projects__cta {
    width: 100%;
    min-height: 48px;
    justify-content: space-between;
    padding: 0 14px;
    border: 1px solid var(--mobile-line);
    border-radius: 10px;
    font-size: 11px;
  }

  .selected-projects__panel {
    padding: 10px;
  }

  .selected-projects__stage {
    display: grid;
    gap: 12px;
  }

  .selected-project-card {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
    border-radius: 13px;
  }

  .selected-project-card__media {
    order: 1;
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .selected-project-card__copy {
    order: 2;
    gap: 13px;
    padding: 17px 15px 18px;
  }

  .selected-project-card__heading h3 {
    max-width: 15ch;
    font-size: clamp(24px, 7vw, 34px);
    line-height: 1;
  }

  .selected-project-card__description {
    font-size: 13px;
    line-height: 1.6;
  }

  .selected-project-card__meta {
    gap: 9px;
  }

  .selected-project-card__meta dt,
  .selected-project-card__meta dd {
    font-size: 9px;
  }

  .selected-project-card__thumbs {
    flex-wrap: wrap;
    gap: 7px;
    overflow: hidden;
  }

  .selected-project-card__thumb {
    flex: 0 0 58px;
    width: 58px;
  }

  .selected-project-card__link {
    width: 100%;
    min-height: 46px;
    justify-content: space-between;
  }

  /* Contact and footer. */
  .contact-board__form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .field--full {
    grid-column: auto;
    grid-row: auto;
  }

  .field span {
    font-size: 9px;
  }

  .field input,
  .field textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px;
    border-radius: 9px;
    font-size: 14px;
  }

  .field textarea {
    min-height: 140px;
  }

  .contact-board__submit {
    width: 100%;
    min-height: 48px;
    justify-content: space-between;
    padding: 0 14px;
    font-size: 11px;
  }

  .footer {
    padding: 0 0 max(12px, env(safe-area-inset-bottom));
  }

  .footer__inner {
    display: grid;
    gap: 14px;
    padding: 17px 15px;
    border-radius: 13px;
  }

  .footer__brand,
  .footer__links,
  .footer__copy {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px 13px;
    font-size: 9px;
    line-height: 1.4;
  }

  .footer__links a {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }

  /* Dialog. */
  dialog {
    width: calc(100% - (var(--mobile-gutter) * 2));
    max-width: none;
    max-height: calc(100svh - 24px);
    margin: auto;
    border-radius: 14px;
  }

  .dialog-shell {
    padding: 9px;
  }

  .dialog-project__intro h3 {
    font-size: clamp(28px, 8vw, 40px);
    line-height: 1;
  }

  .dialog-project__intro p {
    font-size: 13px;
    line-height: 1.6;
  }

  .dialog-project__frame img {
    max-height: 58svh;
  }

  /* Touch and motion. */
  .hero-reel__link,
  .board-link,
  .selected-projects__cta,
  .selected-project-card__link,
  .contact-board__submit,
  .nav a,
  .footer__links a,
  .mobile-nav-toggle {
    touch-action: manipulation;
  }

  .capability-row:hover,
  .selected-project-card:hover,
  .film-card:hover,
  .films-featured__media:hover {
    transform: none;
  }

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

@media screen and (max-width: 360px) {
  .hero-reel__content,
  .board-intro,
  .selected-projects__hero-copy {
    padding-right: 15px;
    padding-left: 15px;
  }

  .hero-reel h1 {
    font-size: clamp(35px, 11vw, 44px);
  }

  .hero-reel__info-block {
    padding-right: 10px;
    padding-left: 10px;
  }

  .hero-reel__info-block strong {
    font-size: 10px;
  }
}

/* Mobile focus mode: hero + contact only. Desktop remains unchanged. */
@media screen and (max-width: 768px) {
  #capabilities,
  #films,
  #work {
    display: none !important;
  }

  .nav a[href="#work"],
  .nav a[href="#about"],
  .nav a[href="#capabilities"] {
    display: none;
  }

  main {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .hero-reel,
  .contact-board {
    margin-bottom: 0;
  }

  .contact-board {
    margin-top: 0;
  }
}

/* Mobile hero: title + playing reel + project availability only. */
@media screen and (max-width: 768px) {
  .hero-reel__label,
  .hero-reel__summary,
  .hero-reel__actions,
  .hero-reel__hud,
  .hero-reel__footer,
  .hero-reel__frame,
  .hero-reel__scrim,
  .hero-reel__grain {
    display: none !important;
  }

  .hero-reel__content {
    padding-top: 30px;
    padding-bottom: 28px;
  }

  .hero-reel__media {
    order: 2;
  }

  .hero-reel__info {
    order: 3;
  }
}
