/* P302: targeted correction from the real host's 666.zip (P301).
   Scope: portrait/identity positioning, compact mobile menu and restoring
   ordinary panel widths. Never resize or restyle the evidence cards. */

/* The full-viewport cover is intentionally wider than the page's grid column.
   A minmax(0,1fr) track prevents the cover from causing other grid items to
   shrink to their contents (works/videos/training/albums/skills). */
body.e3-portfolio-fulltheme main.e3-profile-page {
  grid-template-columns: minmax(0, 1fr) !important;
}
body.e3-portfolio-fulltheme main.e3-profile-page > section.e3-panel:not(#evidence) {
  box-sizing: border-box;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  justify-self: stretch;
}

/* Desktop: keep the existing horizontal positions, but center the *group*
   vertically within the visible part of the cover above the overlapping panel. */
@media (min-width: 681px) {
  body.e3-portfolio-fulltheme .e3-cover-wide > .e3-hero-identity {
    top: calc(50% - 24px) !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    align-items: center !important;
    justify-content: flex-end !important;
  }
  body.e3-portfolio-fulltheme .e3-cover-wide > .e3-hero-identity > .e3-identity-copy {
    background: rgba(2, 31, 26, .58) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
}

/* Phones: the personal portrait is a VERTICAL composition, like the GAS
   portfolio reference — portrait centered ABOVE the text, not beside it. */
@media (max-width: 680px) {
  body.e3-portfolio-fulltheme .e3-cover-wide > .e3-hero-identity {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    display: flex !important;
    flex-direction: column-reverse !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 16px 30px !important;
    margin: -30px 0 0 !important;
    background: var(--e3-accent-soft) !important;
  }
  body.e3-portfolio-fulltheme .e3-cover-wide .e3-profile-photo {
    position: relative !important;
    z-index: 7 !important;
    flex: 0 0 108px !important;
    width: 108px !important;
    height: 108px !important;
    margin: 0 0 -18px !important;
    border: 5px solid #fff !important;
    box-shadow: 0 9px 25px rgba(8,34,33,.18) !important;
  }
  body.e3-portfolio-fulltheme .e3-cover-wide > .e3-hero-identity > .e3-identity-copy {
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 5 !important;
    flex: none !important;
    width: 100% !important;
    max-width: 440px !important;
    min-width: 0 !important;
    padding: 28px 15px 17px !important;
    margin: 0 !important;
    border-radius: 18px !important;
    background: rgba(12, 52, 49, .65) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-align: center !important;
    box-shadow: 0 8px 26px rgba(9,55,50,.12) !important;
  }
  body.e3-portfolio-fulltheme .e3-cover-wide .e3-identity-copy h1,
  body.e3-portfolio-fulltheme .e3-cover-wide .e3-identity-copy p,
  body.e3-portfolio-fulltheme .e3-cover-wide .e3-welcome {
    text-align: center !important;
  }
  body.e3-portfolio-fulltheme .e3-cover-wide .e3-welcome {
    border-left: 0 !important;
    border-right: 0 !important;
  }
  body.e3-portfolio-fulltheme main.e3-profile-page #evidence {
    margin-top: -19px !important;
  }

  /* Keep the hamburger as a 38px icon button in the existing header row,
     with the menu list floating below it only when opened. */
  body.e3-portfolio-fulltheme .e3-mobile-menu {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    grid-row: 1 !important;
    justify-self: end !important;
  }
  body.e3-portfolio-fulltheme .e3-mobile-menu > summary {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 !important;
    border-radius: 11px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.e3-portfolio-fulltheme .e3-cover-wide .e3-profile-photo,
  body.e3-portfolio-fulltheme .e3-cover-wide .e3-identity-copy {transition: none !important;}
}
