/* =============================================================================
   Walker Bay Painters -- sections.css
   Navigation (hero overlay), Hero enhancements, About, Services, Gallery
   Design: "Quiet Luxury" by Elena Vasquez
   =============================================================================
   All animations use GPU-compositable properties (transform, opacity).
   Base components (.btn-*, .overline, .section-header, .reveal, .container)
   are in styles.css -- do NOT redeclare them here.
   ============================================================================= */


/* =============================================================================
   1. NAVIGATION -- TRANSPARENT HERO STATE
   The nav defaults to glassmorphism (limestone, blur) in styles.css.
   Before scrolling (no .is-scrolled class), it must be transparent with white
   text so it floats over the dark hero image. JS toggles .is-scrolled at 80px.
   ============================================================================= */

.site-nav:not(.is-scrolled) {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

/* --- White logo on hero --- */
.site-nav:not(.is-scrolled) .site-nav__logo-name,
.site-nav:not(.is-scrolled) .site-nav__logo-sub {
  color: var(--color-white);
}

/* --- White nav links on hero --- */
.site-nav:not(.is-scrolled) .site-nav__link {
  color: rgba(255, 255, 255, 0.85);
}

.site-nav:not(.is-scrolled) .site-nav__link:hover,
.site-nav:not(.is-scrolled) .site-nav__link:focus-visible {
  color: var(--color-white);
}

.site-nav:not(.is-scrolled) .site-nav__link.is-active {
  color: var(--color-white);
}

/* --- Hero CTA: glass button --- */
.site-nav:not(.is-scrolled) .site-nav__cta {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--color-white);
}

.site-nav:not(.is-scrolled) .site-nav__cta:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* --- White hamburger lines on hero --- */
.site-nav:not(.is-scrolled) .hamburger__line {
  background: var(--color-white);
}

.site-nav__cta {
  transition: background 400ms var(--ease-out),
              border-color 400ms var(--ease-out),
              color 400ms var(--ease-out),
              transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

/* --- Nav link hover underline (umber, scaleX directional reveal) --- */
.site-nav__link::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-umber);
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 300ms var(--ease-out);
}

.site-nav__link:hover::after,
.site-nav__link:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left center;
}

/* Active link: permanent umber underline */
.site-nav__link.is-active::after {
  transform: scaleX(1);
  transform-origin: left center;
}


/* =============================================================================
   2. HERO SECTION -- ENHANCEMENTS
   Base hero structure is in styles.css. This adds the diagonal overlay
   from the section spec and the top gradient for nav readability.
   ============================================================================= */

/* Hero overlay, ::before gradient, content/scroll z-index are all in styles.css.
   No overrides needed here -- the base rules are identical. */


/* =============================================================================
   3. ABOUT SECTION
   Limestone bg, 2-column grid (text / portrait image), stats row, decorative
   accent. Mobile: single column, image first with full-bleed treatment.
   ============================================================================= */

.about {
  background: var(--color-bg);
}

/* --- Grid: mobile-first single column --- */
.about__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  align-items: center;
}

/* --- Text Column --- */
.about__text {
  order: 2; /* Text below image on mobile */
}

.about__text .section-header {
  margin-bottom: var(--space-6);
}

.about__text h2 {
  max-width: 20ch; /* Forces elegant line breaks per spec */
}

/* Body prose */
.about__body {
  max-width: 56ch;
}

.about__body p {
  font-family: var(--font-body);
  font-size: var(--text-body-lg);
  font-weight: 400;
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  margin: 0 0 20px;
}

.about__body p:last-child {
  margin-bottom: 0;
}

/* --- Statistics Row --- */
.about__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  margin-top: var(--space-7);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-mist);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat__number {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--color-stone-blue);
}

.stat__label {
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  line-height: 1.3;
}

/* --- Image Column --- */
.about__image-wrapper {
  order: 1; /* Image first on mobile */
  margin-inline: calc(var(--container-padding) * -1); /* Full-bleed on mobile */
}

.about__image {
  position: relative;
}

.about__image img,
.about__image-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0; /* Full-bleed = no radius on mobile */
  box-shadow: var(--shadow-lg);
}

/* Decorative accent -- hidden on mobile */
.about__image::before {
  display: none;
}

/* Image reveal animation (container clips, image zooms to 1) */
.about__image.image-reveal {
  overflow: hidden;
}

.about__image.image-reveal img,
.about__image.image-reveal .about__image-placeholder {
  transform: scale(1.08);
  transition: transform 1.2s var(--ease-out);
}

.about__image.image-reveal.is-visible img,
.about__image.image-reveal.is-visible .about__image-placeholder {
  transform: scale(1);
}

/* --- Tablet (768px+): image gets radius, stats flex row --- */
@media (min-width: 768px) {
  .about__image-wrapper {
    margin-inline: 0;
  }

  .about__image img,
  .about__image-placeholder {
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
  }

  .about__stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-7);
  }
}

/* --- Desktop (1024px+): 2-column side-by-side --- */
@media (min-width: 1024px) {
  .about__grid {
    grid-template-columns: 1fr 1fr;
    gap: clamp(48px, 6vw, 96px);
  }

  .about__text {
    order: 1; /* Text left */
  }

  .about__image-wrapper {
    order: 2; /* Image right */
    margin-top: 40px; /* Editorial offset -- asymmetry per Kinfolk/Cereal style */
  }

  .about__image img,
  .about__image-placeholder {
    aspect-ratio: 3 / 4; /* Portrait crop on desktop */
    border-radius: var(--radius-lg);
  }

  /* Decorative accent frame fragment behind image */
  .about__image::before {
    content: "";
    display: block;
    position: absolute;
    top: -20px;
    left: -20px;
    width: 120px;
    height: 120px;
    border: 2px solid var(--color-umber-200);
    border-radius: var(--radius-lg);
    z-index: -1;
    opacity: 0;
    transition: opacity var(--duration-slower) var(--ease-out) 400ms;
  }

  .about__image.is-visible::before {
    opacity: 1;
  }

  .about__stats {
    display: flex;
    gap: var(--space-7);
  }

  .stat__number {
    font-size: clamp(2.5rem, 4vw, 3.25rem);
  }
}


/* =============================================================================
   4. SERVICES SECTION
   White background, centered header, 6-card grid (3 cols desktop),
   bottom CTA strip. Cards lift on hover with border + shadow shift.
   ============================================================================= */

.services {
  background: var(--color-surface);
}

/* --- Centered Section Header --- */
.services .section-header {
  max-width: 640px;
  margin-inline: auto;
  margin-bottom: var(--space-8);
}

/* Overline: rule ABOVE text, centered (unique to services) */
.services .section-header .overline {
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.services .section-header .overline .overline-rule {
  width: 32px;
}

.services .section-subtitle {
  max-width: 52ch;
}

/* --- Card Grid: mobile-first single column --- */
.services__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 640px) {
  .services__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .services__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- Service Card --- */
.service-card {
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  border: 1px solid var(--color-mist);
  border-radius: var(--radius-md);
  padding: 40px 32px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.service-card:hover {
  border-color: var(--color-stone-blue-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px); /* The sweet spot for subtle lift */
}

.service-card:focus-within {
  outline: 2px solid var(--color-stone-blue);
  outline-offset: 3px;
}

.service-card:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Icon circle: 56x56 with 48x48 icon inside */
.service-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-stone-blue-50);
  color: var(--color-stone-blue);
  flex-shrink: 0;
  margin-bottom: var(--space-5);
  transition: background var(--duration-normal) var(--ease-out);
}

.service-card__icon svg {
  width: 28px;
  height: 28px;
}

.service-card:hover .service-card__icon {
  background: var(--color-stone-blue-100);
}

/* Card title */
.service-card__title {
  font-family: var(--font-display);
  font-size: 1.375rem; /* 22px per spec */
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-charcoal);
  margin: 0 0 var(--space-3);
}

/* Card description */
.service-card__description {
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.65;
  color: var(--color-text-secondary);
  margin: 0;
  flex-grow: 1; /* Pushes "Learn more" link to bottom */
}

/* "Learn more ->" ghost link */
.service-card__link {
  margin-top: var(--space-5);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.service-card__link svg {
  transition: transform var(--duration-fast) var(--ease-out);
}

.service-card:hover .service-card__link svg,
.service-card__link:hover svg {
  transform: translateX(4px);
}

/* --- Bottom CTA Strip --- */
.services__cta {
  text-align: center;
  margin-top: var(--space-8);
  padding-top: var(--space-7);
  border-top: 1px solid var(--color-mist);
}

.services__cta-text {
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--leading-normal);
  color: var(--color-text-secondary);
  max-width: 52ch;
  margin: 0 auto var(--space-5);
}

/* --- Mobile card padding tightened --- */
@media (max-width: 639px) {
  .service-card {
    padding: 32px 24px;
  }
}


/* =============================================================================
   5. GALLERY SECTION
   Limestone bg, asymmetric 12-column grid (desktop), hover overlays with
   gradient + text slide-up. Mobile: single column with always-visible overlay.
   ============================================================================= */

.gallery {
  background: var(--color-bg);
}

.gallery .section-header {
  margin-bottom: var(--space-7);
}

/* --- Grid: mobile-first single column --- */
.gallery__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* --- Gallery Item Base --- */
.gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  display: block;
  text-decoration: none;
  cursor: pointer;
  aspect-ratio: 4 / 3; /* Mobile default */
}

.gallery__item:focus-visible {
  outline: 2px solid var(--color-stone-blue);
  outline-offset: 2px;
}

/* Image fills the grid cell */
.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 600ms var(--ease-out);
}

/* Image zoom on hover -- GPU-composited transform only */
.gallery__item:hover img,
.gallery__item:focus-visible img {
  transform: scale(1.05);
}

/* --- Hover Overlay --- */
.gallery__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  background: linear-gradient(
    to top,
    rgba(26, 37, 45, 0.75) 0%,
    rgba(26, 37, 45, 0.20) 50%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 400ms var(--ease-out);
}

.gallery__item:hover .gallery__overlay,
.gallery__item:focus-visible .gallery__overlay {
  opacity: 1;
}

/* Overlay text slides up 12px on reveal */
.gallery__project-name,
.gallery__project-location,
.gallery__view-link {
  transform: translateY(12px);
  opacity: 0;
  transition: transform 400ms var(--ease-out),
              opacity 400ms var(--ease-out);
}

.gallery__item:hover .gallery__project-name,
.gallery__item:hover .gallery__project-location,
.gallery__item:hover .gallery__view-link,
.gallery__item:focus-visible .gallery__project-name,
.gallery__item:focus-visible .gallery__project-location,
.gallery__item:focus-visible .gallery__view-link {
  transform: translateY(0);
  opacity: 1;
}

/* Staggered text reveal inside overlay */
.gallery__project-location { transition-delay: 50ms; }
.gallery__view-link        { transition-delay: 100ms; }

.gallery__project-name {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-white);
  display: block;
}

.gallery__project-location {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  display: block;
  margin-top: 4px;
}

.gallery__view-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-white);
  margin-top: var(--space-3);
}

.gallery__view-link svg {
  transition: transform var(--duration-fast) var(--ease-out);
}

.gallery__item:hover .gallery__view-link svg {
  transform: translateX(4px);
}

/* --- Gallery CTA --- */
.gallery__cta {
  text-align: center;
  margin-top: var(--space-6);
}

/* --- Mobile: always show overlay (no hover on touch), full-bleed gallery --- */
@media (max-width: 767px) {
  .gallery__grid {
    margin-inline: calc(var(--container-padding) * -1);
  }

  .gallery__item {
    border-radius: 0;
  }

  .gallery__overlay {
    opacity: 1;
  }

  .gallery__project-name,
  .gallery__project-location,
  .gallery__view-link {
    transform: translateY(0);
    opacity: 1;
  }
}

/* --- Tablet: 2-column equal grid --- */
@media (min-width: 768px) {
  .gallery__grid {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 280px;
    gap: 12px;
  }

  .gallery__item {
    aspect-ratio: auto; /* Rows control height now */
  }

  /* Item 1 hero: spans full width on tablet */
  .gallery__item--1 {
    grid-column: 1 / -1;
  }
}

/* --- Desktop: 12-column asymmetric editorial grid --- */
@media (min-width: 1024px) {
  .gallery__grid {
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 260px;
    gap: 16px;
  }

  /* Item 1: large hero -- 7 cols, 2 rows */
  .gallery__item--1 {
    grid-column: 1 / 8;
    grid-row: 1 / 3;
  }

  /* Item 2: 5 cols, row 1 */
  .gallery__item--2 {
    grid-column: 8 / 13;
    grid-row: 1 / 2;
  }

  /* Item 3: 5 cols, row 2 */
  .gallery__item--3 {
    grid-column: 8 / 13;
    grid-row: 2 / 3;
  }

  /* Item 4: tall -- 4 cols, 2 rows */
  .gallery__item--4 {
    grid-column: 1 / 5;
    grid-row: 3 / 5;
  }

  /* Item 5: 4 cols, row 3 */
  .gallery__item--5 {
    grid-column: 5 / 9;
    grid-row: 3 / 4;
  }

  /* Item 6: 4 cols, row 3 */
  .gallery__item--6 {
    grid-column: 9 / 13;
    grid-row: 3 / 4;
  }
}

/* --- Image reveal for gallery items (base in styles.css) --- */
.gallery__item.image-reveal img {
  transform: scale(1.08);
  transition: transform 1.2s var(--ease-out);
}

.gallery__item.image-reveal.is-visible img {
  transform: scale(1);
}

/* When both image-reveal AND hover are active, hover zoom wins */
.gallery__item.image-reveal.is-visible:hover img {
  transform: scale(1.05);
  transition: transform 600ms var(--ease-out);
}


/* =============================================================================
   6. ACCESSIBILITY: REDUCED MOTION
   All section-specific animations disabled. Static experience preserved.
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
  /* Service cards: no lift */
  .service-card {
    transition: none;
  }

  .service-card:hover {
    transform: none;
  }

  .service-card__icon {
    transition: none;
  }

  /* Gallery: no zoom, no overlay slide */
  .gallery__item img {
    transition: none;
  }

  .gallery__item:hover img {
    transform: none;
  }

  .gallery__overlay {
    transition: none;
  }

  .gallery__project-name,
  .gallery__project-location,
  .gallery__view-link {
    transition: none;
  }

  .gallery__item.image-reveal img {
    transform: none;
    transition: none;
  }

  /* About: no image zoom */
  .about__image.image-reveal img,
  .about__image.image-reveal .about__image-placeholder {
    transform: none;
    transition: none;
  }

  /* Nav: instant color changes */
  .site-nav__logo-name,
  .site-nav__logo-sub,
  .site-nav__link,
  .site-nav__cta,
  .hamburger__line {
    transition: none;
  }

  .site-nav__link::after {
    transition: none;
  }
}
