/* LINK GLOBAL EDGE + HERO WIDTH LOCK V17
   Purpose: minimal page-edge padding, release constrained public sections,
   restore homepage approved visual panels/hero to near-full viewport width.
   Geometry only: no typography, DB, content, nav labels, or image replacement. */

:root{
  --link-edge-v17: clamp(12px, 1.35vw, 22px);
  --link-max-v17: 1800px;
}

html, body{
  max-width:100%;
  overflow-x:hidden;
}

/* ---------------- PUBLIC SHELL WIDTH ---------------- */
/* Keep full-bleed section backgrounds, but let their inner content use the page. */
:is(
  .nav-shell,
  .link-standard-header-inner,
  .link-approved-header-v6-inner,
  .link-v38-header-inner,
  .link-simple-page,
  .link-story-shell,
  .real-hero-inner,
  .real-section-inner,
  .directory-shell,
  .directory-inner,
  .resource-live-content,
  .resource-story-shell,
  .community-approved-hero,
  .community-real-shell,
  .link-community-impact-hero-inner,
  .services-shell,
  .services-inner,
  .foundation-shell,
  .funding-shell,
  .groups-shell,
  .students-shell,
  .events-shell,
  .opportunities-shell,
  .page-shell,
  .page-inner,
  .content-shell,
  .content-inner,
  .section-shell,
  .section-inner,
  .container,
  .wrap
){
  width: min(calc(100% - (var(--link-edge-v17) * 2)), var(--link-max-v17)) !important;
  max-width: var(--link-max-v17) !important;
  margin-left:auto !important;
  margin-right:auto !important;
  box-sizing:border-box !important;
}

/* Remove legacy side padding on public section wrappers when it is causing a double gutter. */
main > section,
main > div,
.link-public-page main > section,
.resource-page main > section{
  box-sizing:border-box;
}

/* Common page sections should not be trapped in old 800-1100px wrappers. */
:is(
  .engage-section,
  .needs-section,
  .ecosystem-section,
  .participation-recognition,
  .link-story-section,
  .resource-story-section,
  .resource-policy-wrap,
  .link-simple-band,
  .services-v4-band,
  .foundation-page,
  .funding-page,
  .groups-page,
  .students-page,
  .events-page
){
  width:100% !important;
  max-width:none !important;
  margin-left:0 !important;
  margin-right:0 !important;
}

/* ---------------- HOME: APPROVED VISUALS / HERO ---------------- */
body.link-home-v7-panels main,
body.link-home-v7-panels main > *,
#link-home-approved-panels-v7,
#link-home-approved-panels,
.link-home-approved-panels,
.link-home-v7-panels{
  max-width:none !important;
}

#link-home-approved-panels-v7,
#link-home-approved-panels,
.link-home-approved-panels{
  width:calc(100% - (var(--link-edge-v17) * 2)) !important;
  margin:0 auto !important;
  padding:0 !important;
  box-sizing:border-box !important;
}

#link-home-approved-panels-v7 > *,
#link-home-approved-panels > *,
.link-home-approved-panels > *{
  width:100% !important;
  max-width:none !important;
  margin:0 0 14px !important;
  padding:0 !important;
  box-sizing:border-box !important;
}

#link-home-approved-panels-v7 img,
#link-home-approved-panels img,
.link-home-approved-panels img{
  display:block !important;
  width:100% !important;
  max-width:none !important;
  height:auto !important;
  object-fit:contain !important;
  object-position:center !important;
  margin:0 !important;
}

/* Original locked homepage hero, if visible in the current build. */
.link-locked-home-hero,
main > #top.link-locked-home-hero{
  width:calc(100% - (var(--link-edge-v17) * 2)) !important;
  max-width:none !important;
  height:auto !important;
  min-height:0 !important;
  margin:0 auto !important;
  padding:0 !important;
  overflow:visible !important;
  box-sizing:border-box !important;
}

.link-locked-home-hero-image{
  display:block !important;
  width:100% !important;
  max-width:none !important;
  height:auto !important;
  min-height:0 !important;
  object-fit:contain !important;
  object-position:center !important;
  margin:0 !important;
}

/* Homepage legacy content sections: near-edge shell instead of narrow centered column. */
body:has(.link-locked-home-hero) :is(
  .impact-grid,
  .engage-grid,
  .needs-grid,
  .ecosystem-shell,
  .v3-ecosystem-shell,
  .participation-recognition-shell,
  .partner-rail,
  .home-community-bridge-shell,
  .home-partner-separator-inner,
  .footer-shell,
  .link-media-strip__head,
  .link-media-strip__track
){
  width:calc(100% - (var(--link-edge-v17) * 2)) !important;
  max-width:none !important;
  margin-left:auto !important;
  margin-right:auto !important;
  box-sizing:border-box !important;
}

/* ---------------- IMAGE PANELS ---------------- */
/* Text-heavy Canva/site graphics should never be cropped. */
:is(
  .link-v8-placement img,
  .link-visual-placement img,
  .link-story-visual img,
  .services-v4-visual img,
  .foundation-visual img,
  .funding-visual img,
  .groups-visual img,
  .students-visual img,
  .resource-story-visual img
){
  max-width:100% !important;
  height:auto !important;
  object-fit:contain !important;
}

/* ---------------- DESKTOP / TABLET / MOBILE ---------------- */
@media (max-width: 900px){
  :root{ --link-edge-v17: 14px; }

  :is(
    .link-story-shell,
    .real-hero-inner,
    .services-shell,
    .foundation-shell,
    .funding-shell
  ){
    grid-template-columns:1fr !important;
  }
}

@media (max-width: 620px){
  :root{ --link-edge-v17: 10px; }

  #link-home-approved-panels-v7,
  #link-home-approved-panels,
  .link-home-approved-panels,
  .link-locked-home-hero,
  main > #top.link-locked-home-hero{
    width:calc(100% - 20px) !important;
  }
}
