/* ==========================================================================
   FWO — Home page
   Layer 6 of 6: rules for this page's own blocks, in page order:
   loader · hero · marquee · about · services · gallery · credentials ·
   testimonials · contact · lightbox
   ========================================================================== */

/* ---------- Loader ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2rem;
  background: var(--ink);
}
.loader__logo { width: min(15rem, 55vw); opacity: 0; }
.loader__bar {
  width: min(12rem, 45vw);
  height: 2px;
  background: var(--ink-3);
  overflow: hidden;
}
.loader__bar span {
  display: block;
  width: 100%; height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}
.no-motion .loader { display: none; }

/* ---------- B. Hero ---------- */

.hero {
  --hero-foot: clamp(2.5rem, 8vh, 5.5rem); /* shared bottom offset of both corner blocks */
  --hero-h: max(100svh, 36rem);
  /* Figure: head top 0.75rem below the nav, hero's bottom edge at 60% of the image.
     Head top is 4.2% down the image, so the visible part is 55.8% of its height. */
  --figure-h: calc((var(--hero-h) - var(--nav-h) - 0.75rem) / 0.558);
  /* Where the hero's own width cannot fit his torso beside the button row
     (28.4rem with its 1rem clearance), he slides left by the shortfall. */
  --figure-shift: min(0px, calc(50vw - var(--gutter) - 28.4rem - 0.105 * var(--figure-h)));
  /* Chin is 20.7% down the image: distance from the hero's top to the chin */
  --hero-chin: calc(var(--nav-h) + 0.75rem + 0.165 * var(--figure-h));
  position: relative;
  min-height: max(100vh, 36rem);
  min-height: max(100svh, 36rem); /* very short windows scroll instead of squashing */
  overflow: hidden;
  background: var(--canvas);
  isolation: isolate;
}

/* Two identical wordmark layers: solid behind the figure, one letter in front */
.hero__word {
  position: absolute;
  /* ink top hangs 1rem below the nav; paired with the height cap in --step-hero */
  top: calc(var(--nav-h) + 1rem + 0.386 * var(--step-hero));
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  font-family: var(--font-hero);
  font-weight: 800;
  font-size: var(--step-hero);
  line-height: 0.78;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
.hero__word span { display: inline-block; will-change: transform; }
/* Wordmark letters start hidden while JS runs; .no-motion shows them at once */
.js .hero__word span { opacity: 0; }
.no-motion .hero__word span { opacity: 1 !important; transform: none !important; }
.hero__word--back { z-index: 1; color: var(--ink); }
.hero__word--front {
  z-index: 3;
  color: color-mix(in srgb, var(--canvas) 45%, transparent);
  /* Fade the front letter in below the chin so it crosses the torso, never the face */
  --front-from: calc(var(--hero-chin) - var(--nav-h) - 1rem);
  -webkit-mask-image: linear-gradient(to bottom, transparent var(--front-from), #000 calc(var(--front-from) + 7svh));
  mask-image: linear-gradient(to bottom, transparent var(--front-from), #000 calc(var(--front-from) + 7svh));
}
/* Only the middle A shows in front. The other letters keep their space
   (visibility, not display) so both layers stay registered. */
.hero__word--front span:not(:nth-child(3)) { visibility: hidden; }

.hero__figure {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: flex-start; /* pinned by the top; the hero crops what overflows below */
  pointer-events: none;
}
.hero__img {
  flex: none;
  height: var(--figure-h);
  width: auto;
  max-width: none;
  margin-top: calc(var(--nav-h) + 0.75rem - 0.0423 * var(--figure-h));
  translate: var(--figure-shift) 0;
  will-change: transform;
}

.hero__content {
  position: absolute;
  z-index: 4;
  right: var(--gutter);
  bottom: var(--hero-foot);
  max-width: 28.5rem; /* both buttons on one row */
  text-align: right;
}
.hero__eyebrow {
  margin-bottom: 0.5rem;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.hero__title { font-size: inherit; font-weight: inherit; }
.hero__name { /* the giant wordmark carries the name visually */
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.hero__role {
  display: block;
  font-size: var(--step-2);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.hero__role .amp { color: var(--accent-deep); }
.hero__tagline {
  margin-top: 0.9rem;
  color: var(--muted-on-light);
}
.hero__tagline strong { color: var(--ink); font-weight: 700; }
.hero__cta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.9rem; margin-top: 2rem; }

.hero__socials {
  position: absolute;
  z-index: 4;
  left: var(--gutter);
  bottom: var(--hero-foot);
  flex-direction: column;
  margin-bottom: 0;
}
/* The hero only shows socials that have a URL (the contact section shows all) */
.hero__socials li:has(.is-unset),
.hero__socials:not(:has(a)) { display: none; }

/* Tablet & mobile: figure on top, text and buttons on the canvas beneath */
@media (max-width: 1024px) {
  .hero {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    /* Shorter figure, sized so both arms (65.9% of the image height wide) fit */
    --figure-h: min(calc(39svh / 0.558), calc((100vw - 1.5rem) / 0.659));
    --figure-shift: 0px;
    --figure-box: calc(var(--nav-h) + 0.75rem + 0.558 * var(--figure-h));
    padding: calc(var(--figure-box) + 1.5rem) var(--gutter) 2.5rem;
  }
  .hero__word--front { display: none; } /* small screens: the name sits behind only */
  .hero__figure { bottom: auto; height: var(--figure-box); overflow: hidden; } /* clipped at the waist */

  .hero__content { position: static; max-width: none; text-align: left; }
  .hero__cta { justify-content: flex-start; }
  .hero__socials { position: static; flex-direction: row; margin-top: 1.5rem; }
}

@media (max-width: 480px) {
  .hero__cta .btn { flex: 1 1 100%; }
}

/* ---------- Marquee ---------- */

.marquee {
  overflow: hidden;
  background: var(--accent);
  color: var(--ink);
  padding-block: 1.1rem;
}
.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 28s linear infinite;
}
.marquee__track span {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.2vw, 2.6rem);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.marquee__track span::after {
  content: "";
  width: 0.5em; height: 0.5em;
  margin-inline: 1.4em;
  background: var(--ink);
  transform: rotate(45deg);
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- C. About ---------- */

.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 7vw, 7rem);
  align-items: center;
}

.about__media { position: relative; }
.about__media::before { /* gold offset block behind the photo */
  content: "";
  position: absolute;
  inset: 2rem -1.25rem -1.25rem 2rem;
  background: var(--accent);
  border-radius: var(--radius);
}
.about__media img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 30%;
  border-radius: var(--radius);
}
.about__badge {
  position: absolute;
  top: -1.5rem; right: -1rem;
  display: grid;
  place-content: center;
  width: 6.5rem; height: 6.5rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(10deg);
}

.about__text { margin-top: 2rem; display: grid; gap: 1.1rem; max-width: 36rem; color: var(--muted-on-light); }
.about__text strong { color: var(--ink); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 3rem 0 0;
  padding-top: 2rem;
  border-top: 2px solid var(--ink);
}
.stats dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5.5vw, 4.75rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stats__plus { color: var(--accent-deep); }
.stats dt {
  margin-top: 0.6rem;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-on-light);
}
.stats__item { display: flex; flex-direction: column-reverse; justify-content: flex-end; }

@media (max-width: 860px) {
  .about__grid { grid-template-columns: 1fr; }
  .about__media { max-width: 26rem; margin-right: 1.25rem; }
}

/* ---------- D. Services ---------- */

.services__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

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

/* ---------- E. Gallery ---------- */

.gallery { background: var(--ink-deep); overflow: hidden; }
.gallery__canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.gallery .container { position: relative; }

.gallery__grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
/* Staggered columns give the masonry feel */
.gallery__grid li:nth-child(2) { margin-top: clamp(2rem, 7vw, 6rem); }
.gallery__grid li:nth-child(3) { margin-top: clamp(1rem, 3vw, 2.5rem); }

.gallery__item {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: zoom-in;
}
.gallery__item img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  transition: transform 0.9s var(--ease), filter 0.6s var(--ease);
}
.gallery__grid li:first-child img { aspect-ratio: 5 / 6; }
.gallery__item:hover img,
.gallery__item:focus-visible img { transform: scale(1.06); }
.gallery__label {
  position: absolute;
  left: 1rem; bottom: 1rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .gallery__grid { grid-template-columns: 1fr 1fr; }
  .gallery__grid li:first-child { grid-column: 1 / -1; }
  .gallery__grid li:nth-child(2) { margin-top: 0; }
  .gallery__grid li:nth-child(3) { margin-top: 2rem; }
  .gallery__grid li:first-child img { aspect-ratio: 1 / 1; object-position: 50% 15%; }
}

/* ---------- F. Credentials ---------- */

.certs__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2.5rem, 7vw, 7rem);
}
@media (max-width: 760px) { .certs__grid { grid-template-columns: 1fr; } }

/* ---------- G. Testimonials ---------- */

.carousel { max-width: 56rem; }
.carousel__viewport { display: grid; overflow: hidden; }
.slide {
  grid-area: 1 / 1; /* all slides stack; only .is-active shows */
  visibility: hidden;
  opacity: 0;
  transform: translateX(2.5rem);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), visibility 0s 0.6s;
}
.slide.is-active { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
.slide__stars { color: var(--accent); font-size: 1.4rem; letter-spacing: 0.25em; }
.slide blockquote {
  margin-top: 1.25rem;
  font-size: clamp(1.4rem, 1.1rem + 1.6vw, 2.4rem);
  font-weight: 500;
  line-height: 1.3;
  text-wrap: pretty;
}
.slide figcaption {
  margin-top: 1.75rem;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-on-dark);
}

.carousel__controls { display: flex; align-items: center; gap: 1.25rem; margin-top: 3rem; }
.carousel__dots { display: flex; gap: 0.5rem; }
.carousel__dot {
  width: 2rem; height: 1.5rem;
  display: grid;
  place-items: center;
}
.carousel__dot::before {
  content: "";
  width: 100%; height: 3px;
  background: var(--dot-idle);
  transition: background-color 0.3s var(--ease);
}
.carousel__dot[aria-current="true"]::before { background: var(--accent); }

/* ---------- H. Contact ---------- */

.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2.5rem, 7vw, 7rem);
}

.form { display: grid; gap: 1.5rem; align-content: start; justify-items: start; }
.form__field { width: 100%; }
.form label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.form input,
.form textarea {
  width: 100%;
  padding: 0.9rem 0;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--step-1);
  resize: vertical;
}
.form input:focus-visible,
.form textarea:focus-visible { outline: none; border-bottom-color: var(--accent-deep); box-shadow: 0 2px 0 var(--accent-deep); }
.form [aria-invalid="true"] { border-bottom-color: var(--error); }
.form__error { margin-top: 0.4rem; color: var(--error); font-size: var(--step--1); font-weight: 700; }
.form__status { min-height: 1.5em; font-weight: 700; }
.form__status.is-error { color: var(--error); }

.socials { display: flex; gap: 0.75rem; margin-bottom: 2rem; }
.socials__link svg { width: 1.35rem; height: 1.35rem; }
.socials__link.is-unset { border-style: dashed; opacity: 0.45; cursor: not-allowed; }

.map {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, var(--hatch-on-light) 14px 15px),
    var(--paper-2);
}
.map iframe { width: 100%; height: 100%; border: 0; filter: grayscale(1) contrast(1.05); }
.map__empty {
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted-on-light);
  font-weight: 700;
}
.map__empty small { font-weight: 400; }

@media (max-width: 860px) { .contact__grid { grid-template-columns: 1fr; } }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: clamp(1rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--ink-deep) 95%, transparent);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lightbox__figure { display: grid; justify-items: center; gap: 1rem; min-width: 0; }
.lightbox__figure img {
  max-height: 80vh;
  width: auto;
  border-radius: var(--radius-sm);
  transform: scale(0.96);
  transition: transform 0.45s var(--ease);
}
.lightbox.is-open .lightbox__figure img { transform: none; }
.lightbox__figure figcaption { color: var(--muted-on-dark); text-align: center; }
.lightbox__close { position: absolute; top: 1.25rem; right: 1.25rem; font-size: 1.7rem; line-height: 1; }

@media (max-width: 640px) {
  .lightbox { grid-template-columns: 1fr 1fr; align-content: center; }
  .lightbox__figure { grid-column: 1 / -1; grid-row: 1; }
  .lightbox__prev { justify-self: end; }
}
