/* MagnesiaGaz reference components. Deliberately scoped; no theme reset. */
.mgref-section,
.mgref-project-page {
  --mgref-navy: #092d45;
  --mgref-orange: #ec6b23;
  --mgref-ink: #203d50;
  --mgref-muted: #536675;
  --mgref-line: #dce5eb;
  --mgref-pale: #f3f6f8;
  color: var(--mgref-ink);
  margin-block: 0;
  font-family: inherit;
}

.mgref-section *,
.mgref-project-page *,
.mgref-gallery *,
.mgref-gallery *::before,
.mgref-gallery *::after,
.mgref-lightbox *,
.mgref-lightbox *::before,
.mgref-lightbox *::after {
  box-sizing: border-box;
}

.mgref-section .mgref-section-heading :is(h2, h3), .mgref-project-page .mgref-project-intro h2 {
  color: var(--mgref-navy);
  margin: 0 0 .75rem;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.2;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.mgref-section .mgref-eyebrow, .mgref-project-page .mgref-eyebrow {
  margin: 0 0 .65rem;
  color: var(--mgref-navy);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.mgref-section .mgref-section-heading p, .mgref-project-page .mgref-project-intro p {
  max-width: 70ch;
  margin: 0 0 1.6rem;
  color: var(--mgref-muted);
  font-size: 1rem;
  line-height: 1.7;
}

.mgref-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(.9rem, 2vw, 1.4rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.mgref-gallery .mgref-card {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--mgref-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 18px rgb(9 45 69 / 4%);
}

.mgref-gallery .mgref-image-link {
  position: relative;
  display: block;
  overflow: hidden;
  color: var(--mgref-navy);
  background: var(--mgref-pale);
  text-decoration: none;
  border: 0;
  border-radius: 13px 13px 0 0;
}

.mgref-gallery .mgref-image-link img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 3 / 4;
  margin: 0;
  padding: .45rem;
  object-fit: contain;
  background: var(--mgref-pale);
  border: 0;
  border-radius: 0;
}

.mgref-gallery .mgref-zoom {
  position: absolute;
  right: .7rem;
  bottom: .7rem;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  gap: .4rem;
  padding: .35rem .65rem;
  color: #fff;
  background: var(--mgref-navy);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.2;
  pointer-events: none;
}

.mgref-section figcaption {
  display: block;
  margin: 0;
  padding: 1rem 1rem 1.05rem;
  color: var(--mgref-navy);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mgref-section .mgref-duration {
  display: block;
  margin-top: .4rem;
  color: var(--mgref-muted);
  font-size: .82rem;
  font-weight: 400;
  line-height: 1.5;
}

/* Optional horizontal feature above the regular eight-photo grid. */
.mgref-project-page .mgref-project-feature {
  margin: 0 0 1.4rem;
  border: 1px solid var(--mgref-line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.mgref-project-page .mgref-project-feature .mgref-image-link img {
  aspect-ratio: 4 / 3;
  max-height: 540px;
}

.mgref-project-page .mgref-project-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.mgref-project-page .mgref-project-intro > * { min-width: 0; }
.mgref-project-page .mgref-project-intro .mgref-feature { margin: 0; }

.mgref-gallery .mgref-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.mgref-gallery .mgref-facts > div {
  padding-top: .85rem;
  border-top: 2px solid var(--mgref-orange);
}

.mgref-gallery .mgref-facts dt {
  margin: 0 0 .25rem;
  color: var(--mgref-muted);
  font-size: .8rem;
}

.mgref-gallery .mgref-facts dd {
  margin: 0;
  color: var(--mgref-navy);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.4;
}

.mgref-section .mgref-videos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(.9rem, 2vw, 1.4rem);
  margin: 1.5rem 0 0;
}

.mgref-section .mgref-video-card {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--mgref-line);
  border-radius: 14px;
}

.mgref-section .mgref-video-card video {
  display: block;
  width: 100%;
  height: 360px;
  max-width: 100%;
  margin: 0;
  object-fit: contain;
  background: #09131b;
  border-radius: 0;
}

.mgref-section .mgref-project-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem 2rem;
  margin-top: 2rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  color: #fff;
  background: var(--mgref-navy);
  border-radius: 16px;
}

.mgref-section .mgref-project-callout p {
  flex: 1 1 22rem;
  margin: 0;
  color: #fff;
  line-height: 1.6;
}

.mgref-section .mgref-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: .75rem 1.15rem;
  color: var(--mgref-navy);
  background: #fff;
  border: 2px solid var(--mgref-orange);
  border-radius: 8px;
  box-shadow: none;
  font: inherit;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}

.mgref-section .mgref-button:hover {
  color: var(--mgref-navy);
  background: #fff4ed;
  text-decoration: none;
}

.mgref-gallery .mgref-image-link:hover .mgref-zoom {
  color: var(--mgref-navy);
  background: #fff;
  box-shadow: 0 0 0 2px var(--mgref-orange);
}

.mgref-section a:focus-visible, .mgref-project-page a:focus-visible,
.mgref-section video:focus-visible,
.mgref-lightbox button:focus-visible,
.mgref-lightbox a:focus-visible {
  outline: 3px solid #ec6b23;
  outline-offset: 4px;
}

.mgref-gallery .mgref-image-link:focus-visible {
  outline-offset: -4px;
}

.mgref-gallery .mgref-sr-only,
.mgref-lightbox .mgref-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mgref-lightbox {
  width: min(1100px, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  overflow: auto;
  color: #fff;
  background: #092d45;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 14px;
  box-shadow: 0 20px 70px rgb(0 0 0 / 40%);
  font-family: inherit;
}

.mgref-lightbox::backdrop { background: rgb(3 16 26 / 85%); }
.mgref-lightbox:not([open]) { display: none; }

.mgref-lightbox .mgref-lightbox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 1rem;
}

.mgref-lightbox .mgref-lightbox-title {
  margin: 0;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.mgref-lightbox .mgref-lightbox-button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: .6rem .8rem;
  color: #fff;
  background: transparent;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 7px;
  box-shadow: none;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.mgref-lightbox .mgref-lightbox-button:hover { background: rgb(255 255 255 / 12%); }
.mgref-lightbox .mgref-lightbox-button:disabled { opacity: .4; cursor: default; }

.mgref-lightbox .mgref-lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  height: min(72vh, 780px);
  height: min(72dvh, 780px);
  background: #07131c;
}

.mgref-lightbox .mgref-lightbox-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: .5rem;
  object-fit: contain;
  border: 0;
  border-radius: 0;
}

.mgref-lightbox .mgref-lightbox-bottom {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .8rem;
  padding: .8rem 1rem 1rem;
}

.mgref-lightbox .mgref-lightbox-caption {
  margin: 0;
  color: #fff;
  font-size: .95rem;
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
}

.mgref-lightbox .mgref-lightbox-original {
  display: block;
  margin-top: .35rem;
  color: #fff;
  font-size: .8rem;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: .18em;
}

@media (max-width: 1000px) {
  .mgref-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mgref-project-page .mgref-project-intro { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .mgref-section .mgref-videos { grid-template-columns: 1fr; }
  .mgref-section .mgref-video-card video { height: 360px; }
}

@media (max-width: 560px) {
  .mgref-gallery { grid-template-columns: 1fr; }
  .mgref-gallery .mgref-image-link img { max-height: 520px; }
  .mgref-section figcaption { padding: .9rem 1rem; }
  .mgref-section .mgref-project-callout { align-items: stretch; }
  .mgref-section .mgref-project-callout .mgref-button { width: 100%; }
  .mgref-lightbox { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); }
  .mgref-lightbox .mgref-lightbox-top { padding: .6rem .7rem; }
  .mgref-lightbox .mgref-lightbox-stage { height: 62vh; height: 62dvh; }
  .mgref-lightbox .mgref-lightbox-bottom { gap: .5rem; padding: .7rem; }
  .mgref-lightbox .mgref-lightbox-caption { font-size: .83rem; }
  .mgref-lightbox .mgref-lightbox-button { padding: .5rem; }
}

@media (forced-colors: active) {
  .mgref-gallery .mgref-card,
  .mgref-section .mgref-video-card,
  .mgref-lightbox { border: 1px solid CanvasText; }
  .mgref-gallery .mgref-zoom { border: 1px solid ButtonText; }
}

/* Selectors below align with the WordPress component markup. */
.mgref-section { padding-block: clamp(2.5rem, 5vw, 4.5rem); }
.mgref-section .mgref-section-heading { max-width: 820px; margin-bottom: 1.7rem; }
.mgref-section .mgref-eyebrow, .mgref-project-page .mgref-eyebrow { display: block; line-height: 1.45; }
.mgref-section .mgref-project-callout > div { flex: 1 1 24rem; min-width: 0; }
.mgref-section .mgref-project-callout .mgref-eyebrow { color: #ffbd92; }
.mgref-section .mgref-project-callout :is(h2,h3) { margin: 0 0 .65rem; color: #fff; font-size: clamp(1.3rem, 2.4vw, 1.65rem); line-height: 1.3; }
.mgref-section .mgref-project-callout p { color: #e1eaf0; }
.mgref-section.mgref-clips { padding-bottom: 0; }
.mgref-project-page .mgref-project-hero { padding-block: clamp(2.5rem, 5vw, 4.5rem); background: #092d45; color: #fff; }
.mgref-project-page .mgref-project-hero .mgref-eyebrow { color: #ffbd92; }
.mgref-project-page .mgref-project-hero h1 { max-width: 940px; margin: .8rem 0 1rem; color: #fff; font-size: clamp(2rem, 4.5vw, 3.8rem); line-height: 1.13; letter-spacing: -.025em; }
.mgref-project-page .mgref-project-hero h1 br { display: initial; }
.mgref-project-page .mgref-project-hero p { max-width: 720px; margin: 0; color: #e1eaf0; font-size: 1.08rem; line-height: 1.7; }
.mgref-project-page .mgref-breadcrumbs { display: flex; flex-wrap: wrap; gap: .5rem .65rem; margin-bottom: 2rem; color: #d2e0e9; font-size: .8rem; line-height: 1.5; }
.mgref-project-page .mgref-breadcrumbs a { color: #fff; text-decoration: underline; text-underline-offset: .18em; }
.mgref-project-page .mgref-project-intro { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); margin-bottom: 0; }
.mgref-project-page .mgref-project-feature img { display: block; width: 100%; height: auto; max-width: 100%; max-height: 560px; aspect-ratio: 4 / 3; margin: 0; padding: .6rem; object-fit: contain; background: #f3f6f8; }
.mgref-project-page .mgref-project-points { display: grid; gap: .7rem; margin: 1.4rem 0 1.7rem; padding-left: 1.2rem; color: #203d50; line-height: 1.5; }
.mgref-project-page .mgref-project-points li::marker { color: #ec6b23; }
.mgref-project-detail { background: #f3f6f8; }
.mgref-project-detail .mgref-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 940px; }
.mgref-project-detail .mgref-gallery .mgref-image-link img { max-height: 540px; }
.v18-project-card.mgref-home-project img { object-fit: contain; background: #092d45; }
@media (max-width: 1000px) { .mgref-project-page .mgref-project-intro { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .mgref-project-detail .mgref-gallery { grid-template-columns: 1fr; } }
.mgref-jumplink { padding-block: 10px; }
.mgref-jumplink a { display: inline-flex; align-items: center; gap: .7rem; min-height: 44px; padding: .55rem .85rem; color: #092d45; background: #fff7f1; border: 1px solid #ec6b23; border-radius: 7px; font: inherit; font-size: .95rem; font-weight: 600; line-height: 1.4; text-decoration: none; }
.mgref-jumplink a:hover { color: #092d45; background: #ffeadb; text-decoration: none; }
.mgref-jumplink a:focus-visible { outline: 3px solid #092d45; outline-offset: 3px; }
.mgref-section .mgref-button { gap: .7rem; }
