/* ==========================================================================
   AJIT BAN — RESPONSIVE
   Content-based breakpoints. Mobile-first base lives in other layers.
   Test widths: 320 · 375 · 390 · 430 · 768 · 1024 · 1280 · 1440 · 1920
   ========================================================================== */

/* ---------------------------------------------------------------------
   SMALL TABLETS / LARGE PHONES — below 64rem (1024px)
   --------------------------------------------------------------------- */
@media (max-width: 63.9375em) {
  :root {
    --header-height: 4rem;
  }

  /* Navigation collapses to overlay */
  .site-nav {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .site-header__connect {
    display: none;
  }

  /* Hero stacks */
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
    padding-top: calc(var(--header-height) + var(--space-6));
    gap: var(--space-10);
  }

  .hero__content {
    padding-bottom: 0;
  }

  .hero__media {
    justify-content: center;
    padding-bottom: var(--space-12);
  }

  .hero__portrait {
    width: min(78%, 22rem);
  }

  .hero__scroll {
    display: none;
  }

  /* Editorial splits stack */
  .split,
  .section-head__row,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .split__aside {
    position: static;
  }

  /* Grids collapse */
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Editorial grid — single track. The 12-track + 32px gap system
     needs ≥352px of space; below that the fr tracks collapse to 0 and
     spans force cards past the edge. One column removes the overflow —
     children must sit in that one track (span 12 would still mint
     11 implicit tracks whose 32px gaps alone demand 352px). */
  .grid--editorial {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid--editorial > * {
    grid-column: auto !important;
  }

  /* Side reveals travel vertically on phones — stacked panels must
     never slide past the viewport's horizontal edge */
  [data-reveal="left"],
  [data-reveal="right"] {
    transform: translateY(2rem);
  }

  /* Identity + social rows simplify */
  .identity-row {
    grid-template-columns: 3rem minmax(0, 1fr) auto auto;
  }

  .identity-row__toggle {
    display: grid;
  }

  .identity-row__detail {
    display: none;
  }

  .identity-row__detail.is-open {
    display: flex;
  }

  .social-link {
    grid-template-columns: 3rem minmax(0, 1fr) auto;
  }

  .social-link__handle {
    display: none;
  }

  /* Article reader stacks */
  .article-reader {
    grid-template-columns: 1fr;
  }

  .article-reader__aside {
    position: static;
  }

  /* Footer: brand on its own row, link groups side by side */
  .site-footer__top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-8) var(--space-10);
  }

  .site-footer__top > div:first-child {
    grid-column: 1 / -1;
  }

  .meta-row {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
}

/* ---------------------------------------------------------------------
   PHONES — below 40rem (640px)
   --------------------------------------------------------------------- */
@media (max-width: 39.9375em) {
  :root {
    --section-pad: clamp(4rem, 12vw, 6rem);
  }

  .grid--4,
  .grid--3,
  .grid--2 {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-inline: var(--container-pad);
  }

  .hero__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .hero__meta-divider {
    width: 100%;
  }

  .identity-row {
    grid-template-columns: 2.5rem minmax(0, 1fr) auto auto;
    gap: var(--space-4);
  }

  .social-link {
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    gap: var(--space-4);
  }

  .article-card {
    grid-template-columns: 2.5rem minmax(0, 1fr);
    gap: var(--space-4);
  }

  .timeline {
    padding-left: var(--space-7);
  }

  .timeline__entry {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .timeline__entry::before {
    left: calc(-1 * var(--space-7) - 3px);
  }

  .timeline__year {
    padding-top: 0;
  }

  .work-card__meta {
    flex-direction: column;
    gap: var(--space-1);
  }

  .site-footer__top {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .site-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-footer__links a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem; /* 44px touch target */
  }

  .lightbox,
  .video-panel {
    padding: var(--space-4);
  }

  .contact-block__value {
    overflow-wrap: anywhere;
  }
}

/* ---------------------------------------------------------------------
   VERY SMALL — below 22rem (352px) — ensure 320px works
   --------------------------------------------------------------------- */
@media (max-width: 21.9375em) {
  .hero__name {
    font-size: 3.4rem;
  }

  .btn {
    width: 100%;
  }
}

/* ---------------------------------------------------------------------
   LARGE DESKTOPS — above 90rem (1440px)
   --------------------------------------------------------------------- */
@media (min-width: 90em) {
  .hero__portrait {
    width: 26vw;
  }
}

/* ---------------------------------------------------------------------
   SHORT VIEWPORTS — hero comfort
   --------------------------------------------------------------------- */
@media (max-height: 44rem) and (min-width: 64em) {
  .hero {
    min-height: auto;
    padding-top: calc(var(--header-height) + var(--space-10));
    padding-bottom: var(--space-10);
  }

  .hero__content {
    padding-bottom: var(--space-6);
  }
}

/* ---------------------------------------------------------------------
   PRINT — archive-friendly output
   --------------------------------------------------------------------- */
@media print {
  .site-header,
  .mobile-nav,
  .loader,
  .hero__scroll,
  .dock,
  .lightbox,
  .video-panel {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .page-body {
    opacity: 1 !important;
    transform: none !important;
  }
}
