/*
 * Premium Gallery refresh — loaded after the legacy gallery sheets.
 * Every rule is scoped to the Gallery body class so the rest of the site is unchanged.
 */

body.gallery-premium {
  --premium-off-white: #f8f9fa;
  --premium-surface: #ffffff;
  --premium-navy: #102b48;
  --premium-blue: #0759c9;
  --premium-muted: #617286;
  --premium-line: rgb(16 43 72 / 13%);
  --premium-shadow: 0 14px 34px rgb(16 43 72 / 8%);
  --premium-footer-height: 6rem;
  min-width: 0;
  overflow-x: clip;
  background: var(--premium-off-white);
  color: var(--premium-navy);
  font-family: "DM Sans", Arial, sans-serif;
  padding-bottom: calc(var(--premium-footer-height) + env(safe-area-inset-bottom, 0px));
}

body.gallery-premium main,
body.gallery-premium .gallery-page {
  min-width: 0;
  background: var(--premium-off-white);
  color: var(--premium-navy);
}

body.gallery-premium .gallery-page,
body.gallery-premium .gallery-page button,
body.gallery-premium .gallery-page input,
body.gallery-premium .gallery-page textarea,
body.gallery-premium .gallery-page select {
  font-family: "DM Sans", Arial, sans-serif;
}

body.gallery-premium .gallery-page *,
body.gallery-premium .gallery-page *::before,
body.gallery-premium .gallery-page *::after {
  box-sizing: border-box;
}

body.gallery-premium .gallery-page h1,
body.gallery-premium .gallery-page h2,
body.gallery-premium .gallery-page h3 {
  color: var(--premium-navy);
  font-family: "Manrope", Arial, sans-serif;
}

/* Keep the existing shell and wording, but give the Gallery a quiet, neutral entry. */
body.gallery-premium .site-header {
  width: min(100% - 48px, 75rem);
  min-height: 96px;
  border-bottom-color: var(--premium-line);
  background: var(--premium-off-white);
}

body.gallery-premium .brand-text,
body.gallery-premium .desktop-nav a {
  color: var(--premium-navy);
}

body.gallery-premium .desktop-nav a::after {
  background: var(--premium-blue);
}

body.gallery-premium .header-call {
  border-color: rgb(7 89 201 / 28%);
  color: var(--premium-blue);
}

body.gallery-premium .header-call:hover {
  border-color: var(--premium-blue);
  background: var(--premium-blue);
  color: #fff;
}

body.gallery-premium .gallery-page__hero {
  overflow: visible;
  background: var(--premium-off-white);
  color: var(--premium-navy);
}

body.gallery-premium .gallery-page__hero-inner {
  width: min(100% - 48px, 75rem);
  max-width: none;
  margin: 0 auto;
  padding: clamp(2.75rem, 5vw, 4.75rem) 0 clamp(2.3rem, 4vw, 3.75rem);
}

body.gallery-premium .gallery-page__hero-inner::after {
  display: none;
}

body.gallery-premium .gallery-page .gallery-eyebrow {
  margin-bottom: 0.8rem;
  color: var(--premium-blue);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}

body.gallery-premium .gallery-page__hero h1,
body.gallery-premium .gallery-page h1 {
  max-width: 13ch;
  margin: 0;
  color: var(--premium-navy);
  font-size: clamp(2.45rem, 5vw, 4.75rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1.03;
  overflow-wrap: anywhere;
}

body.gallery-premium .gallery-page__intro {
  max-width: 43rem;
  margin-top: 1rem;
  color: var(--premium-muted);
  font-size: clamp(1rem, 1.35vw, 1.1rem);
  line-height: 1.65;
}

body.gallery-premium .gallery-page__work {
  padding: clamp(1.75rem, 4vw, 3rem) 0 clamp(4.25rem, 8vw, 7rem);
}

body.gallery-premium .gallery-page__work > .section-wrap {
  width: min(100% - 48px, 75rem);
  max-width: none;
  padding: 0;
}

/* Filter controls sit above the work as a restrained editorial utility bar. */
body.gallery-premium .gallery-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem 1.5rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--premium-line);
}

body.gallery-premium .gallery-filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

body.gallery-premium .gallery-filter {
  min-height: 44px;
  padding: 0.56rem 0.9rem;
  border: 1px solid rgb(16 43 72 / 19%);
  border-radius: 999px;
  background: var(--premium-surface);
  color: var(--premium-navy);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

body.gallery-premium .gallery-filter:hover,
body.gallery-premium .gallery-filter:focus-visible {
  border-color: var(--premium-blue);
  color: var(--premium-blue);
}

body.gallery-premium .gallery-filter[aria-pressed="true"] {
  border-color: var(--premium-blue);
  background: var(--premium-blue);
  color: #fff;
  box-shadow: 0 5px 13px rgb(7 89 201 / 18%);
}

body.gallery-premium .gallery-filter-status,
body.gallery-premium .gallery-provenance {
  margin: 0;
  color: var(--premium-muted);
  line-height: 1.5;
}

body.gallery-premium .gallery-filter-status {
  font-size: 0.84rem;
  font-weight: 650;
  text-align: right;
}

body.gallery-premium .gallery-provenance {
  grid-column: 1 / -1;
  max-width: 70rem;
  margin-top: -0.2rem;
  font-size: 0.875rem;
}

body.gallery-premium .gallery-empty[hidden],
body.gallery-premium .gallery-projects > article.gallery-project[hidden] {
  display: none !important;
}

body.gallery-premium .gallery-empty {
  margin: 0;
  padding: 1.2rem 1.25rem;
  border: 1px solid var(--premium-line);
  border-radius: 12px;
  background: var(--premium-surface);
  color: var(--premium-muted);
}

/* The former staggered gallery is reset into consistent, self-contained project cards. */
body.gallery-premium .gallery-page .gallery-projects {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.25rem, 2.6vw, 2rem);
  width: 100%;
}

body.gallery-premium .gallery-page .gallery-projects > article.gallery-project {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  transform: none;
  border: 1px solid var(--premium-line);
  border-radius: 16px;
  box-shadow: var(--premium-shadow);
  background: var(--premium-surface);
  overflow: hidden;
}

body.gallery-premium .gallery-page .gallery-projects > article.gallery-project > .project-heading {
  padding: clamp(1.2rem, 2.5vw, 1.8rem) clamp(1.2rem, 3vw, 2.1rem) 0;
}

body.gallery-premium .gallery-page .project-category {
  margin: 0 0 0.35rem;
  color: var(--premium-blue);
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  line-height: 1.35;
  text-transform: uppercase;
}

body.gallery-premium .gallery-page .project-title {
  max-width: 28ch;
  margin: 0;
  color: var(--premium-navy);
  font-size: clamp(1.35rem, 2.3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.18;
}

body.gallery-premium .gallery-page .project-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(0.8rem, 2vw, 1.4rem);
  padding: clamp(1rem, 2.7vw, 1.8rem) clamp(1.2rem, 3vw, 2.1rem) clamp(1.25rem, 3vw, 2rem);
}

body.gallery-premium .gallery-page .project-comparison > .gallery-page__tile {
  display: block;
  min-width: 0;
  margin: 0;
}

/* Semantic role labels keep Problem and Solution unmistakable without changing source text. */
body.gallery-premium .gallery-page .project-comparison > .gallery-page__tile[data-gallery-role="problem"] figcaption,
body.gallery-premium .gallery-page .project-comparison > .gallery-page__tile[data-gallery-role="solution"] figcaption {
  position: relative;
  min-width: 0;
  margin-top: 0.7rem;
  padding-left: 0.7rem;
  color: var(--premium-navy);
  font-family: "DM Sans", Arial, sans-serif;
  font-size: clamp(0.79rem, 1.1vw, 0.88rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

body.gallery-premium .gallery-page .project-comparison > .gallery-page__tile[data-gallery-role="problem"] figcaption::before,
body.gallery-premium .gallery-page .project-comparison > .gallery-page__tile[data-gallery-role="solution"] figcaption::before {
  position: absolute;
  top: 0.39em;
  left: 0;
  width: 3px;
  height: 0.9em;
  border-radius: 999px;
  background: var(--premium-blue);
  content: "";
}

body.gallery-premium .gallery-page .project-comparison > .gallery-page__tile[data-gallery-role="problem"] .gallery-role-name,
body.gallery-premium .gallery-page .project-comparison > .gallery-page__tile[data-gallery-role="solution"] .gallery-role-name {
  color: var(--premium-navy);
  font-weight: 800;
}

body.gallery-premium .gallery-page .project-comparison > .gallery-page__tile .gallery-role-note {
  color: var(--premium-muted);
  font-size: 0.94em;
  font-weight: 600;
}

/* Equal, portrait-friendly frames never crop the supplied project images. */
body.gallery-premium .gallery-page .gallery-projects .gallery-page__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgb(16 43 72 / 8%);
  border-radius: 12px;
  background: #f1f3f5;
  box-shadow: none;
  color: var(--premium-navy);
  cursor: zoom-in;
}

body.gallery-premium .gallery-page .gallery-projects .gallery-page__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
  transition: none;
}

body.gallery-premium .gallery-page .gallery-projects .gallery-page__media::after {
  background: rgb(16 43 72 / 0%);
  transition: background-color 180ms ease;
}

body.gallery-premium .gallery-page .gallery-projects .gallery-page__media:hover::after,
body.gallery-premium .gallery-page .gallery-projects .gallery-page__media:focus-visible::after {
  background: rgb(16 43 72 / 8%);
}

/* Replace the old VIEW treatment with the supplied icon-only affordance. */
body.gallery-premium .gallery-page .gallery-projects .gallery-page__expand {
  display: none !important;
}

body.gallery-premium .gallery-page .gallery-projects .gallery-expand-icon {
  position: absolute;
  z-index: 2;
  right: 0.7rem;
  bottom: 0.7rem;
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 58%);
  border-radius: 999px;
  background: rgb(248 249 250 / 78%);
  box-shadow: 0 3px 10px rgb(16 43 72 / 13%);
  color: var(--premium-navy);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.2rem);
  transition: opacity 180ms ease, transform 180ms ease, background-color 180ms ease;
}

body.gallery-premium .gallery-page .gallery-projects .gallery-expand-icon svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.gallery-premium .gallery-page .gallery-projects .gallery-page__media:hover .gallery-expand-icon,
body.gallery-premium .gallery-page .gallery-projects .gallery-page__media:focus-visible .gallery-expand-icon {
  opacity: 1;
  transform: none;
}

body.gallery-premium .gallery-page .gallery-projects .gallery-page__media:focus-visible {
  outline: 3px solid var(--premium-blue);
  outline-offset: 4px;
}

/* Supplemental Zoom or repair photos read as a deliberate post-comparison detail. */
body.gallery-premium .gallery-page .project-extra {
  margin: 0 clamp(1.2rem, 3vw, 2.1rem);
  padding: clamp(1.1rem, 2.5vw, 1.65rem) 0 clamp(1.25rem, 3vw, 2rem);
  border-top: 1px solid var(--premium-line);
}

body.gallery-premium .gallery-page .project-detail-title {
  margin: 0 0 0.8rem;
  color: var(--premium-navy);
  font-family: "Manrope", Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

body.gallery-premium .gallery-page .project-extra .gallery-page__tile {
  display: block;
  width: min(100%, 20rem);
  min-width: 0;
  margin: 0;
}

body.gallery-premium .gallery-page .project-extra .gallery-page__media {
  aspect-ratio: auto;
  background: #f1f3f5;
}

body.gallery-premium .gallery-page .project-extra .gallery-page__media img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}

body.gallery-premium .gallery-page .project-extra figcaption {
  margin-top: 0.65rem;
  color: var(--premium-muted);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.4;
}

/* Retain the existing contact content while aligning it to the refined Gallery palette. */
body.gallery-premium .gallery-page__contact {
  border-top: 1px solid var(--premium-line);
  background: var(--premium-surface);
}

body.gallery-premium .gallery-page__contact-inner {
  width: min(100% - 48px, 75rem);
  max-width: none;
  padding: clamp(3rem, 6vw, 5rem) 0;
}

body.gallery-premium .gallery-page__contact .eyebrow {
  color: var(--premium-blue);
}

body.gallery-premium .gallery-page__contact h2 {
  color: var(--premium-navy);
}

body.gallery-premium .gallery-page .button.gallery-page__cta {
  border-radius: 999px;
  border-color: var(--premium-blue);
  background: var(--premium-blue);
  color: #fff;
}

body.gallery-premium .gallery-page .button.gallery-page__cta:hover,
body.gallery-premium .gallery-page .button.gallery-page__cta:focus-visible {
  border-color: #064aa7;
  background: #064aa7;
  color: #fff;
  transform: translateY(-2px);
}

/* Only the Call/Text action bar is fixed; the business footer stays in normal flow. */
body.gallery-premium .mobile-contact-bar {
  position: fixed;
  z-index: 90;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.7rem max(0.75rem, env(safe-area-inset-right, 0px)) calc(0.7rem + env(safe-area-inset-bottom, 0px)) max(0.75rem, env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--premium-line);
  background: rgb(248 249 250 / 88%);
  box-shadow: 0 -8px 24px rgb(16 43 72 / 6%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.gallery-premium .mobile-contact-bar a {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  max-width: 22rem;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 0.6rem;
  border: 1px solid var(--premium-line);
  border-radius: 10px;
  background: transparent;
  color: var(--premium-navy);
  font-family: "Manrope", Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

body.gallery-premium .mobile-contact-bar a + a {
  border-color: var(--premium-blue);
  background: var(--premium-blue);
  color: #fff;
}

body.gallery-premium .mobile-contact-bar .icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

body.gallery-premium :focus-visible {
  outline: 3px solid var(--premium-blue);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  body.gallery-premium .site-header,
  body.gallery-premium .gallery-page__hero-inner,
  body.gallery-premium .gallery-page__work > .section-wrap,
  body.gallery-premium .gallery-page__contact-inner {
    width: min(100% - 32px, 75rem);
  }

  body.gallery-premium .site-header {
    min-height: 82px;
  }

  body.gallery-premium .gallery-page__hero-inner {
    padding-top: 2.35rem;
    padding-bottom: 1.85rem;
  }

  body.gallery-premium .gallery-page__hero h1,
  body.gallery-premium .gallery-page h1 {
    max-width: 100%;
    font-size: clamp(2.3rem, 11.8vw, 3.4rem);
    line-height: 1.04;
  }

  body.gallery-premium .gallery-page__intro {
    margin-top: 0.85rem;
    font-size: 0.98rem;
  }

  body.gallery-premium .gallery-toolbar {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 0.9rem;
    margin-bottom: 1.25rem;
  }

  body.gallery-premium .gallery-filter-controls {
    gap: 0.45rem;
  }

  body.gallery-premium .gallery-filter {
    min-height: 44px;
    padding-inline: 0.75rem;
    font-size: 0.77rem;
  }

  body.gallery-premium .gallery-filter-status {
    font-size: 0.8rem;
    text-align: left;
  }

  body.gallery-premium .gallery-provenance {
    margin-top: -0.1rem;
    font-size: 0.875rem;
  }

  body.gallery-premium .gallery-page .gallery-projects {
    gap: 1rem;
  }

  body.gallery-premium .gallery-page .gallery-projects > article.gallery-project > .project-heading {
    padding: 1.15rem 1rem 0;
  }

  body.gallery-premium .gallery-page .project-title {
    font-size: clamp(1.25rem, 6.5vw, 1.55rem);
  }

  body.gallery-premium .gallery-page .project-comparison {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.2rem;
    padding: 1rem 1rem 1.25rem;
  }

  body.gallery-premium .gallery-page .project-comparison > .gallery-page__tile[data-gallery-role="problem"] figcaption,
  body.gallery-premium .gallery-page .project-comparison > .gallery-page__tile[data-gallery-role="solution"] figcaption {
    font-size: 0.82rem;
  }

  body.gallery-premium .gallery-page .gallery-projects .gallery-page__media {
    aspect-ratio: 3 / 4;
  }

  body.gallery-premium .gallery-page .gallery-projects .gallery-expand-icon {
    width: 2.15rem;
    height: 2.15rem;
    opacity: 1;
    transform: none;
  }

  body.gallery-premium .gallery-page .project-extra {
    margin-inline: 1rem;
    padding-top: 1rem;
    padding-bottom: 1.25rem;
  }

  body.gallery-premium .gallery-page__contact-inner {
    align-items: flex-start;
    gap: 1.5rem;
    padding-block: 3rem;
  }

  body.gallery-premium .mobile-contact-bar a {
    font-size: 0.78rem;
  }
}

@media (max-width: 380px) {
  body.gallery-premium .site-header,
  body.gallery-premium .gallery-page__hero-inner,
  body.gallery-premium .gallery-page__work > .section-wrap,
  body.gallery-premium .gallery-page__contact-inner {
    width: min(100% - 28px, 75rem);
  }

  body.gallery-premium .gallery-page .project-comparison {
    padding-inline: 0.85rem;
  }

  body.gallery-premium .mobile-contact-bar a {
    font-size: 0.7rem;
  }
}

@media (pointer: coarse) {
  body.gallery-premium .gallery-page .gallery-projects .gallery-expand-icon {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.gallery-premium *,
  body.gallery-premium *::before,
  body.gallery-premium *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
