/* Shared layout repairs. Original desktop presentation is retained. */
html { height: auto !important; overflow-x: clip !important; overflow-y: auto !important; }
body { overflow: visible !important; }
.project-media-link {
  display: block !important;
  width: 100% !important;
  min-width: 0;
  color: inherit !important;
  text-decoration: none !important;
}
.project-media-link .stack-media { width: 100% !important; }
.project-media-link:focus-visible,
.menu-toggle:focus-visible { outline: 3px solid #6b41a3; outline-offset: 4px; }

/* This component uses only .menu-open. No competing menu state classes. */
body .site-header .menu-toggle {
  display: none !important;
  width: 44px !important;
  height: 44px !important;
  flex: 0 0 44px;
  padding: 0 !important;
  align-items: center !important;
  justify-content: center !important;
  border: 0 !important;
  background: transparent !important;
  color: #111;
  cursor: pointer;
}
.hamburger-icon {
  width: 22px;
  height: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.hamburger-icon span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: #111;
  transition: transform .2s ease, opacity .2s ease;
}
.site-header.menu-open .hamburger-icon span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.menu-open .hamburger-icon span:nth-child(2) { opacity: 0; }
.site-header.menu-open .hamburger-icon span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  body { padding: 0 !important; }
  body .site-header.reference-header .reference-nav {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-height: 56px !important;
    padding: 6px 12px !important;
    gap: 8px !important;
  }
  body .site-header.reference-header .reference-brand { flex: 0 0 auto !important; }
  body .site-header.nav-ready .menu-toggle { display: inline-flex !important; margin-left: auto; }
  body .site-header.reference-header #main-nav {
    display: flex !important;
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    padding: 10px !important;
    margin: 0 !important;
    background: #f8f8f5 !important;
    border: 1px solid rgba(17,17,17,.09) !important;
    border-radius: 16px !important;
    box-shadow: 0 14px 30px rgba(0,0,0,.08) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    transition: none !important;
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
    z-index: 1001 !important;
  }
  body .site-header.reference-header.nav-ready #main-nav {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 0 !important;
    right: 0 !important;
    display: none !important;
  }
  body .site-header.reference-header.nav-ready.menu-open #main-nav { display: flex !important; }
  body .site-header.reference-header #main-nav a {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 12px !important;
    margin: 0 !important;
    font-size: .94rem !important;
    line-height: 1.3 !important;
    text-align: left !important;
    white-space: normal !important;
  }
  /* With scripting disabled, navigation stays visible in normal document flow. */
  body .site-header.reference-header:not(.nav-ready) { position: relative !important; }
  body .site-header.reference-header:not(.nav-ready) .reference-nav { flex-wrap: wrap !important; }

  body.homepage-v4 .hero.portfolio-reference-hero {
    height: auto !important;
    min-height: 0 !important;
    padding: 104px 0 56px !important;
  }
  body.homepage-v4 .hero.portfolio-reference-hero .hero-reference-shell {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    min-height: 0 !important;
    height: auto !important;
    gap: 36px !important;
    padding: 0 !important;
  }
  body.homepage-v4 .hero.portfolio-reference-hero .hero-copy,
  body.homepage-v4 .hero.portfolio-reference-hero .hero-right {
    position: static !important;
    inset: auto !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.homepage-v4 .hero.portfolio-reference-hero h1 {
    max-width: 100% !important;
    margin: 0 !important;
    font-size: clamp(2.1rem, 8vw, 3.6rem) !important;
    line-height: 1.12 !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }
  body.homepage-v4 .hero .hero-skills { max-width: 100%; }
  body.homepage-v4 .hero .hero-actions { margin-top: 24px !important; flex-wrap: wrap !important; }
  body.homepage-v4 .hero .hero-btn { max-width: 100% !important; min-height: 48px !important; white-space: normal !important; }
  body.homepage-v4 .hero .hero-right .mypic { width: 100px; height: 100px; }
  body.homepage-v4 .hero .hero-right .mypic img { width: 100% !important; height: 100% !important; object-fit: cover !important; }
  body.homepage-v4 .hero .hero-scroll-cue { display: none !important; }
  main, main section, .shell > *, .case-hero-grid > *, .story-row > *,
  .summary-grid > *, .workflow-path > *, .cap-grid > *, .stack-card, .stack-content { min-width: 0; }
  .case-facts dd, .contact-rail-item strong { overflow-wrap: anywhere; }
}

@media (max-width: 640px) {
  body.homepage-v4 .hero .hero-actions { flex-direction: column !important; align-items: stretch !important; }
  body.homepage-v4 .hero .hero-btn { width: 100% !important; justify-content: center !important; }
  body .footer > .shell { grid-template-columns: minmax(0, 1fr) !important; gap: 18px !important; }
  body .footer .footer-right { display: contents !important; }
  body .footer .footer-brand, body .footer .footer-menu, body .footer .footer-copy {
    grid-column: 1 !important;
    min-width: 0 !important;
    justify-self: start !important;
    text-align: left !important;
  }
  body .footer .footer-menu { flex-wrap: wrap !important; justify-content: flex-start !important; gap: 12px 18px !important; }
  body .footer .footer-copy { white-space: normal !important; }
}
@media (prefers-reduced-motion: reduce) {
  .hamburger-icon span { transition: none !important; }
}
