/* ============================================================
   A7mad.me · Responsive
   Breakpoints follow the baseline: 860px is the main fold.
   Mobile keeps hierarchy: title, visual, character+bubble,
   body, tools - never overlapping.
   ============================================================ */

@media (max-width: 1020px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .skill-col:nth-child(odd) {
    border-inline-start: 0;
  }

  .skill-col:nth-child(n+3) {
    border-top: 1px solid var(--border-soft);
  }
}

@media (max-width: 860px) {
  :root {
    --side-pad: 20px;
    --sec-pad: clamp(52px, 9vw, 72px);
  }

  /* Hero stacks: headline block first, then scene */
  .hero {
    padding-block: 48px 60px;
  }

  .hero__grid {
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .hero__def {
    margin-bottom: 30px;
  }

  /* Nav (D-038): brand + menu button; links live in a dropdown panel */
  .nav__inner {
    gap: 14px;
    padding-block: 12px;
  }

  .nav__menu-btn {
    display: flex;
  }

  .nav__links {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 10px 20px 18px;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
    font-size: 16px;
  }

  .nav__links.is-open {
    display: flex;
    animation: menuDrop 0.22s var(--ease-out) both;
  }

  @keyframes menuDrop {
    0% { opacity: 0; transform: translateY(-6px); }
    100% { opacity: 1; transform: none; }
  }

  .nav__links .nav__link {
    padding: 14px 4px;
    border-bottom: 1px solid var(--border-soft);
  }

  .nav__links .btn {
    margin-top: 14px;
  }

  .nav__brand > .px-label {
    font-size: 20px;
  }

  .nav {
    position: sticky;
  }

  /* Splits stack */
  .split {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  /* Project stage becomes a vertical story:
     title(html order) -> visual -> character+bubble -> body */
  .stage__grid,
  .stage--flip .stage__grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .stage__visual,
  .stage--flip .stage__visual {
    order: -1;
    border-inline: 0;
    border-bottom: 1px solid var(--border-soft);
    padding: 28px 20px;
  }

  .stage__body {
    padding: 26px 20px 30px;
  }

  .skills-closing {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .ai-note {
    align-items: flex-start;
  }

  .char-slot--inline {
    width: 120px;
  }

  .cycler {
    min-height: 300px;
  }

  .journey-top {
    align-items: center;
  }

  .marquee__seq {
    gap: 30px;
    padding-inline-end: 30px;
    font-size: 15px;
  }

  .footer .wrap {
    justify-content: center;
    text-align: center;
  }

  /* Touch: hover lifts off (baseline does the same at 860) */
  .btn--primary:hover,
  .btn--ghost:hover,
  .chip:hover,
  .stage:hover .stage__scene {
    transform: none;
  }

  .intro__skip {
    inset-inline-start: 50%;
    transform: translateX(50%);
    bottom: 22px;
  }

  /* Intro stage compact on small screens */
  .intro__stage {
    height: 230px;
  }

  .char-sprite--intro {
    width: clamp(104px, 30vw, 140px);
  }

  /* D-046/D-047: hero character smaller on mobile for breathing room */
  .char-slot--hero {
    width: min(50%, 172px);
  }

  /* Path motif much simpler on mobile (D-027) */
  .path-motif {
    max-width: 62vw;
    height: 26px;
  }

  .path-motif__stone {
    display: none;
  }

  .path-motif--journey {
    max-width: 160px;
  }
}

@media (max-width: 560px) {
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .skill-col + .skill-col {
    border-inline-start: 0;
    border-top: 1px solid var(--border-soft);
  }

  .skill-col:nth-child(n+3) {
    border-top: 1px solid var(--border-soft);
  }

  /* D-031/D-043: stacked, one axis, wordmark stays on one line at 390 */
  .hero__brand-en {
    font-size: clamp(34px, 10.5vw, 48px);
    letter-spacing: 0.02em;
  }

  .hero__brand-ar {
    font-size: clamp(22px, 6.4vw, 28px);
  }

  /* Speech: width bounded by viewport, growth mostly vertical (D-034) */
  .speech {
    max-width: min(100%, 92vw);
  }

  .ai-note {
    flex-direction: column;
    align-items: center;
  }

  .cycler {
    min-height: 340px;
  }
}
