/* ============================================================
   Shannah Kaye Duffield — Mobile / Responsive Overrides
   Loaded after app.css so these rules win the cascade.

   Breakpoints used:
   - 900px : tablet portrait & below (medium adjustments)
   - 640px : phone (major collapse to single column)
   - 420px : small phone (tighter spacing, smaller titles)
   ============================================================ */

/* ------------------------------------------------------------
   Small touch-target affordance: anything clickable in the nav
   or as a button should hit ~44px minimum for thumbs.
   ------------------------------------------------------------ */
@media (max-width: 900px) {
  .nav__brand,
  .nav__link {
    padding: 8px 0;
  }
}

/* ============================================================
   NAV — collapse to a brand + hamburger on small screens.
   The full <Nav> still renders; we just hide the link strip
   on phones and reveal a menu button + a slide-down panel
   that is populated by the same buttons (CSS-only show/hide
   driven by a checkbox / :target trick is fragile, so we
   keep the markup intact and toggle visibility via a class
   set on body when the user taps the menu button.)
   ============================================================ */
@media (max-width: 720px) {
  .nav {
    padding: 14px 18px;
  }
  .nav__brand {
    font-size: 17px;
  }

  /* Hide the inline link strip; show a menu trigger instead. */
  .nav__links {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-1);
    border-bottom: 1px solid var(--border-1);
    padding: 12px 18px 20px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease, transform 200ms ease;
    max-height: calc(100dvh - 56px);
    overflow-y: auto;
  }

  body.nav-open .nav__links {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav__links .nav__link {
    font-size: 13px;
    padding: 14px 0;
    text-align: left;
    border-bottom: 1px solid var(--border-1);
  }
  .nav__links .nav__link:last-of-type {
    border-bottom: none;
  }
  .nav__links .nav__link.active::after {
    display: none;
  }
  .nav__links .nav__link.active {
    color: var(--blue-ice);
  }
  .nav__links .capsule {
    margin-top: 14px;
    align-self: flex-start;
  }

  /* Menu toggle button (injected by JS). */
  .nav__menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-1);
    background: none;
    border: 1px solid var(--border-2);
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    min-height: 36px;
  }
  .nav__menu-btn .bars {
    display: inline-flex;
    flex-direction: column;
    gap: 3px;
  }
  .nav__menu-btn .bars span {
    display: block;
    width: 14px;
    height: 1.5px;
    background: var(--fg-1);
    transition: transform 200ms ease, opacity 200ms ease;
  }
  body.nav-open .nav__menu-btn .bars span:nth-child(1) {
    transform: translateY(4.5px) rotate(45deg);
  }
  body.nav-open .nav__menu-btn .bars span:nth-child(2) {
    opacity: 0;
  }
  body.nav-open .nav__menu-btn .bars span:nth-child(3) {
    transform: translateY(-4.5px) rotate(-45deg);
  }
}

/* Hide the menu trigger on desktop. */
@media (min-width: 721px) {
  .nav__menu-btn { display: none !important; }
}

/* Lock body scroll while the menu is open. */
body.nav-open {
  overflow: hidden;
}

/* ============================================================
   COVER — relax the 720px min-height that overflows small
   phones, tighten title positions, scale enter button.
   ============================================================ */
@media (max-width: 900px) {
  .cover {
    min-height: 100dvh;
    height: 100dvh;
  }
}
@media (max-width: 640px) {
  .cover {
    min-height: 100dvh;
  }
  .cover__index {
    left: 18px;
    bottom: 120px;
    font-size: 10px;
  }
  .cover__sig {
    right: 18px;
    bottom: 22px;
    text-align: right;
  }
  .cover__sig .name { font-size: 13px; }
  .cover__sig .loc  { font-size: 11px; }
  .cover__enter {
    bottom: 56px;
    padding: 12px 18px;
    font-size: 10px;
    gap: 10px;
  }
  .cover__enter .arrow { width: 18px; }
  .cover__skip {
    right: 18px;
    top: 16px;
    font-size: 10px;
  }
}

/* ============================================================
   PAGE HEAD — collapse 2-column grid to one, scale title
   down so it doesn't break the layout on tiny screens.
   ============================================================ */
@media (max-width: 900px) {
  .page {
    padding-top: 72px;
  }
  .page__head {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 40px 22px 32px;
    align-items: start;
  }
  .page__meta {
    text-align: left;
  }
}
/* Allow the giant display title to scale based on viewport without overflow,
   even if the display font fails to load and a wider fallback is used. */
.page__title,
.section__title,
.detail__title,
.footer__big {
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .page__title {
    font-size: clamp(56px, 12vw, 120px);
  }
}
@media (max-width: 640px) {
  .page__title {
    font-size: clamp(54px, 16vw, 92px);
  }
  .page__eyebrow {
    margin-bottom: 18px;
  }
  .page__eyebrow .line { flex-basis: 36px; }
  .page__blurb {
    font-size: 16px;
    line-height: 1.5;
  }
}

/* ============================================================
   SECTION HEAD — counter under the title on phones.
   ============================================================ */
@media (max-width: 640px) {
  .section {
    padding: 48px 22px;
  }
  .section__head {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 28px;
  }
  .section__count {
    text-align: left;
  }
  .section__title {
    font-size: clamp(36px, 10vw, 56px);
  }
}

/* ============================================================
   WORK CARD — always single column under 640px (already 1000px
   in base CSS but we tighten media + meta sizing here).
   ============================================================ */
@media (max-width: 640px) {
  .work-grid {
    gap: 18px;
  }
  .work-card__media {
    aspect-ratio: 4/3;
  }
  .work-card.span-8 .work-card__media,
  .work-card.span-12 .work-card__media {
    aspect-ratio: 4/3;
  }
  .work-card__meta {
    padding: 14px 14px 16px;
  }
  .work-card__name {
    font-size: 18px;
  }
  .work-card__sub,
  .work-card__year {
    font-size: 11px;
  }
  /* Hover badge looks weird on touch — hide. */
  .work-card__badge {
    display: none;
  }
  .work-card__cursor {
    display: none;
  }
}

/* ============================================================
   WORK DETAIL — stack hero title above meta, single-column
   gallery, larger close button (thumb hit area).
   ============================================================ */
@media (max-width: 640px) {
  .detail__close {
    width: 40px;
    height: 40px;
    top: 14px;
    right: 14px;
    font-size: 22px;
  }
  .detail__hero {
    height: 70dvh;
    min-height: 380px;
  }
  .detail__hero-meta {
    grid-template-columns: 1fr;
    gap: 14px;
    bottom: 24px;
    left: 22px;
    right: 22px;
  }
  .detail__hero-side {
    text-align: left;
    font-size: 10px;
  }
  .detail__title {
    font-size: clamp(40px, 12vw, 72px);
  }
  .detail__info {
    padding: 40px 22px;
    gap: 32px;
  }
  .detail__lead {
    font-size: 17px;
  }
  .detail__gallery {
    padding: 40px 22px 64px;
    gap: 14px;
  }
}

/* ============================================================
   ABOUT — single column under 900 (base CSS does this).
   We further tighten contact rows so labels + values stack
   on very small screens; portrait shrinks reasonably.
   ============================================================ */
@media (max-width: 900px) {
  .about {
    padding: 32px 22px 64px;
  }
  .about__portrait {
    aspect-ratio: 4/5;
    max-width: 480px;
    margin: 0 auto;
  }
}
@media (max-width: 640px) {
  .about__col { gap: 32px; }
  .about__body p { font-size: 15px; }
  .about__off-list li {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 0;
  }
  .about__off-list li .v {
    font-size: 13px;
  }
  .about__find-row {
    grid-template-columns: 90px 1fr;
    gap: 12px;
    padding: 14px 0;
  }
  .about__find-row .v {
    font-size: 14px;
    word-break: break-word;
  }
}
@media (max-width: 420px) {
  .about__find-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ============================================================
   FOOTER — base CSS stacks at 800px. Add typography + alignment
   polish for small screens.
   ============================================================ */
@media (max-width: 800px) {
  .footer {
    padding: 56px 22px 40px;
  }
  .footer__meta {
    text-align: left;
    align-items: flex-start;
  }
  .footer__meta a {
    padding: 8px 0;
  }
}
@media (max-width: 640px) {
  .footer__big {
    font-size: clamp(44px, 13vw, 80px);
  }
}

/* ============================================================
   TWEAKS PANEL — push out of the way on mobile. The tweaks
   panel is a dev/edit affordance and shouldn't obscure
   content on a phone.
   ============================================================ */
@media (max-width: 900px) {
  .tweaks-panel,
  [class*="tweaks"] {
    display: none !important;
  }
}

/* ============================================================
   GENERAL — ensure no horizontal overflow on any screen.
   ============================================================ */
@media (max-width: 640px) {
  html, body {
    overflow-x: hidden;
  }
  img, video {
    max-width: 100%;
    height: auto;
  }
}
