/* ==========================================================================
   Components — reusable pieces: brand, nav, buttons, marquee, photo shapes,
   service rows, work tiles, the quote form and the decorative geometry.
   ========================================================================== */

/* --- Brand -------------------------------------------------------------- */

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.brand__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--brand-mark-size);
  height: var(--brand-mark-size);
  border-radius: var(--radius-mark);
  background: var(--color-accent);
  color: var(--color-on-accent);
  /* The mark sits on the orange hero band, so an orange tile would disappear
     into it. The ink ring is what separates the two oranges; the footer sits
     on the dark background and turns it back off. */
  box-shadow: inset 0 0 0 2px var(--color-on-accent);
  font-size: var(--fs-700);
  font-weight: var(--fw-black);
}

.brand__name {
  font-size: var(--fs-700);
  font-weight: var(--fw-black);
  letter-spacing: var(--tracking-brand);
  text-transform: uppercase;
}

/* Footer variant: orange mark on the dark background */
.brand--footer .brand__mark {
  width: var(--brand-mark-size-sm);
  height: var(--brand-mark-size-sm);
  border-radius: var(--radius-mark-sm);
  background: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: none;
  font-size: var(--fs-600);
}

.brand--footer .brand__name {
  color: var(--color-text-strong);
}


/* --- Navigation --------------------------------------------------------- */

.nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--gutter);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(20px, 2.6vw, 36px);
}

.nav__link {
  color: var(--color-on-accent-strong);
  font-size: var(--fs-500);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

.nav__link:hover {
  color: var(--color-on-accent);
}

/* Below this width only the call-to-action stays in the bar */
@media (max-width: 680px) {
  .nav__link {
    display: none;
  }
}

/* "Repin Contracting" set at --fs-700 with brand tracking is ~220px wide, and
   next to the quote pill it outgrows a 360–390px bar. Tighten both rather
   than dropping the wordmark, which is the one thing that has to stay. */
@media (max-width: 520px) {
  .nav {
    gap: var(--space-sm);
    padding-inline: var(--gutter-tight);
  }

  .brand__name {
    font-size: var(--fs-500);
    letter-spacing: 0.04em;
  }

  .btn--sm {
    padding: var(--space-2xs) var(--space-sm);
    font-size: var(--fs-400);
  }
}


/* --- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius-pill);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--fs-600);
  font-weight: var(--fw-bold);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

/* Dark pill on an orange background */
.btn--ink {
  background: var(--color-on-accent);
  color: var(--color-accent);
}

.btn--ink:hover {
  color: var(--color-accent);
  opacity: 0.9;
}

/* Orange pill on a dark background */
.btn--accent {
  align-self: flex-start;
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.btn--accent:hover {
  background: var(--color-accent-dark);
  color: var(--color-on-accent);
}

/* Outlined pill, ink on orange */
.btn--outline {
  border: var(--stroke) solid var(--color-on-accent);
  padding: 14px 30px;
  background: none;
  color: var(--color-on-accent);
}

.btn--outline:hover {
  color: var(--color-on-accent);
  background: rgb(var(--color-ink-rgb) / 0.08);
}

/* Compact size for the nav bar */
.btn--sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--fs-500);
}


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

.marquee {
  overflow: hidden;
  padding: clamp(22px, 3vh, 34px) 0;
  border-bottom: 1px solid var(--color-accent-rule);
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee var(--marquee-duration) linear infinite;
}

/* Two identical groups; the track slides exactly one group's width */
.marquee__group {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--gap-marquee);
  padding-right: var(--gap-marquee);
}

.marquee__word {
  color: var(--color-accent);
  font-size: var(--fs-marquee);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  text-transform: uppercase;
  white-space: nowrap;
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee__track {
    animation: none;
  }
}


/* --- Photo shapes -------------------------------------------------------
   Asymmetric corners, alternated down the page. `a` rounds the top-left /
   bottom-right pair, `b` mirrors it. Size modifiers match the photo scale. */

.shape-a {
  border-radius: var(--blob-md) var(--blob-xs) var(--blob-md) var(--blob-xs);
}

.shape-b {
  border-radius: var(--blob-xs) var(--blob-md) var(--blob-xs) var(--blob-md);
}

.shape-a--tall {
  border-radius: var(--blob-md) var(--blob-sm) var(--blob-md) var(--blob-sm);
}

.shape-b--tall {
  border-radius: var(--blob-sm) var(--blob-md) var(--blob-sm) var(--blob-md);
}

.shape-a--wide {
  border-radius: var(--blob-lg) var(--blob-sm) var(--blob-lg) var(--blob-sm);
}

.shape-b--wide {
  border-radius: var(--blob-sm) var(--blob-lg) var(--blob-sm) var(--blob-lg);
}


/* --- Service row -------------------------------------------------------- */

.service {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) var(--service-media-width);
  gap: var(--gap-service);
  align-items: center;
  border-top: 1px solid var(--color-rule);
  padding: clamp(24px, 4vh, 42px) 0;
}

.service__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 0;
}

.service__heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--gap-service-heading);
}

.service__num {
  font-size: var(--fs-numeral);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
}

.service__title {
  margin: 0;
  color: var(--color-text-strong);
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  text-transform: uppercase;
}

.service__text {
  margin: 0;
  max-width: var(--measure-text);
  color: var(--color-text-soft);
  font-size: var(--fs-600);
  line-height: var(--lh-normal);
}

.service__media {
  justify-self: end;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Photo drops below the copy once the column would be too narrow */
@media (max-width: 560px) {
  .service {
    grid-template-columns: 1fr;
  }

  .service__media {
    justify-self: stretch;
  }
}


/* --- Work tile ---------------------------------------------------------- */

.tile {
  margin: 0;
}

.tile--wide {
  grid-column: span 2;
}

.tile--tall {
  grid-column: span 1;
}

/* A button, not a div: pressing it opens the photo in the lightbox, and the
   native element is what makes that reachable by keyboard. */
.tile__frame {
  display: block;
  width: 100%;
  overflow: hidden;
  border: none;
  padding: 0;
  background: var(--color-surface);
  cursor: zoom-in;
}

.tile--wide .tile__frame {
  aspect-ratio: 16 / 9;
}

.tile--tall .tile__frame {
  aspect-ratio: 4 / 5;
}

.tile__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile__caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

/* Inside the phone rail (see .grid-tiles in layout.css) the tiles are flex
   items, so the wide/tall column spans no longer apply. Every card takes the
   same width and the same portrait frame, otherwise the row would step up and
   down in height as it scrolled. */
@media (max-width: 720px) {
  .tile {
    flex: 0 0 min(76vw, 300px);
    scroll-snap-align: start;
  }

  .tile--wide .tile__frame,
  .tile--tall .tile__frame {
    aspect-ratio: 4 / 5;
  }

  /* The two 16:9 sources get centre-cropped hardest here, and both have
     their subject dead centre */
  .tile__img {
    object-position: center;
  }

  /* Title and town no longer fit on one line at card width */
  .tile__caption {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3xs);
  }
}

.tile__tag {
  color: var(--color-accent);
  font-size: var(--fs-100);
  font-weight: var(--fw-black);
  letter-spacing: var(--tracking-tag);
  text-transform: uppercase;
}

.tile__title {
  color: var(--color-text-strong);
  font-size: var(--fs-500);
  font-weight: var(--fw-semibold);
}

.tile__place {
  color: var(--color-text-subtle);
  font-size: var(--fs-400);
  font-weight: var(--fw-medium);
}


/* --- Quote form --------------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.form__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

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

/* Two fields share a row, then wrap to full width */
.field--half {
  flex: 1 1 200px;
}

.field__label {
  color: var(--color-text-soft);
  font-size: var(--fs-400);
  font-weight: var(--fw-semibold);
}

.field__control {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px var(--space-sm);
  background: var(--color-surface);
  color: var(--color-text-strong);
  font-size: var(--fs-600);
  outline: none;
  transition: border-color var(--transition-fast);
}

.field__control:focus {
  border-color: var(--color-accent);
}

.field__control--select {
  appearance: none;
}

.field__control--textarea {
  resize: vertical;
  font-family: inherit;
}

/* Confirmation panel swapped in once the mail app has been handed the message */
.notice {
  border-radius: var(--radius-md);
  padding: clamp(32px, 4vw, 48px);
  background: var(--color-surface);
  text-align: center;
}

.notice__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin: 0 auto var(--space-sm);
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: var(--fs-900);
}

.notice__title {
  margin: 0 0 var(--space-2xs);
  color: var(--color-text-strong);
  font-size: var(--fs-900);
  font-weight: var(--fw-black);
  letter-spacing: var(--tracking-tight);
}

.notice__text {
  margin: 0 0 var(--space-sm);
  color: var(--color-text-soft);
  font-size: var(--fs-600);
}

.notice__fallback {
  margin: 0;
  color: var(--color-text-subtle);
  font-size: var(--fs-500);
  line-height: var(--lh-body);
}


/* --- Lightbox -----------------------------------------------------------
   Full-screen view of a work photo. Sits outside .page (whose `overflow-x:
   clip` would trim a fixed child) and blurs everything behind it.
   js/lightbox.js toggles the `hidden` attribute, which base.css turns into
   `display: none`, so the entry animation runs on every open. */

.lightbox {
  position: fixed;
  inset: 0;
  /* On phones `inset: 0` resolves against the large viewport, so the bottom of
     the overlay hides under the browser's collapsing toolbar. dvh tracks the
     visible height instead; browsers without the unit drop this line and keep
     the inset height. */
  height: 100dvh;
  z-index: var(--z-lightbox);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--gutter-tight) + 44px) var(--gutter-tight) var(--gutter-tight);
  background: var(--color-overlay);
  -webkit-backdrop-filter: blur(var(--blur-overlay));
  backdrop-filter: blur(var(--blur-overlay));
  animation: lightbox-in var(--transition-fast);
}

.lightbox__figure {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin: 0;
  max-width: min(100%, 1080px);
  max-height: 100%;
}

.lightbox__img {
  /* `min-height: 0` lets the flex child shrink past its intrinsic height, so
     a tall photo stays inside the viewport instead of pushing the caption
     off the bottom. */
  min-height: 0;
  margin-inline: auto;
  width: auto;
  max-height: 100%;
  object-fit: contain;
}

.lightbox__caption {
  flex: none;
  color: var(--color-text-muted);
  font-size: var(--fs-500);
  font-weight: var(--fw-semibold);
  text-align: center;
}

/* Same orange tile as the brand mark, sized for a thumb */
.lightbox__close {
  position: absolute;
  top: var(--gutter-tight);
  right: var(--gutter-tight);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: var(--fs-900);
  font-weight: var(--fw-black);
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.lightbox__close:hover {
  background: var(--color-link-hover);
}

/* Phones, same threshold as the tile rail: the photo takes the full width of
   the screen, the padding shrinks to the space the close button and caption
   actually need, and both clear the notch / home-bar insets. */
@media (max-width: 720px) {
  .lightbox {
    padding: calc(var(--space-xl) + env(safe-area-inset-top)) var(--space-sm) calc(var(--space-md) + env(safe-area-inset-bottom));
  }

  .lightbox__figure {
    gap: var(--space-xs);
  }

  .lightbox__close {
    top: calc(var(--space-2xs) + env(safe-area-inset-top));
    right: var(--space-2xs);
  }

  .lightbox__caption {
    font-size: var(--fs-400);
  }
}

/* Landscape phones have no vertical room for a caption under the photo */
@media (max-width: 900px) and (max-height: 460px) {
  .lightbox__caption {
    display: none;
  }
}

@keyframes lightbox-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox {
    animation: none;
  }
}


/* --- Decorative geometry ------------------------------------------------
   Outlined shapes behind the content. Purely visual, so the markup is a set
   of empty spans and every position lives here. */

/* Fixed, whole-page pattern that drifts on scroll (see js/parallax.js) */
.pattern {
  position: fixed;
  inset: 0;
  overflow: hidden;
  opacity: var(--pattern-opacity);
  pointer-events: none;
}

.pattern__row {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--pattern-row-height);
  will-change: transform;
}

.pattern__row--0 {
  top: 8%;
}

.pattern__row--1 {
  top: 34%;
}

.pattern__row--2 {
  top: 62%;
}

.pattern__row--3 {
  top: 88%;
}

/* Shared shape body; each row places its four shapes below */
.pattern__shape,
.deco__shape {
  position: absolute;
  display: block;
  border: var(--stroke) solid var(--color-accent);
}

.pattern__row--0 .pattern__shape:nth-child(1),
.pattern__row--3 .pattern__shape:nth-child(1) {
  left: -4%;
  width: 220px;
  height: 150px;
  border-radius: var(--radius-lg);
}

.pattern__row--0 .pattern__shape:nth-child(2) {
  left: 32%;
  width: 150px;
  height: 150px;
  border-radius: 0 0 100% 0;
}

.pattern__row--0 .pattern__shape:nth-child(3) {
  left: 62%;
  width: 190px;
  height: 140px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 var(--radius-lg);
}

.pattern__row--0 .pattern__shape:nth-child(4),
.pattern__row--3 .pattern__shape:nth-child(4) {
  left: 92%;
  width: 180px;
  height: 180px;
  border-radius: 100% 0 0 0;
}

.pattern__row--1 .pattern__shape:nth-child(1) {
  left: 4%;
  width: 200px;
  height: 140px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 var(--radius-lg);
}

.pattern__row--1 .pattern__shape:nth-child(2) {
  left: 40%;
  width: 130px;
  height: 130px;
  border-radius: 100% 0 100% 0;
}

.pattern__row--1 .pattern__shape:nth-child(3) {
  left: 68%;
  width: 240px;
  height: 160px;
  border-radius: 48px;
}

.pattern__row--1 .pattern__shape:nth-child(4) {
  left: -6%;
  width: 160px;
  height: 160px;
  border-radius: 0 100% 0 0;
}

.pattern__row--2 .pattern__shape:nth-child(1) {
  left: 6%;
  width: 180px;
  height: 180px;
  border-radius: 0 100% 0 0;
}

.pattern__row--2 .pattern__shape:nth-child(2) {
  left: 38%;
  width: 200px;
  height: 130px;
  border-radius: 40px;
}

.pattern__row--2 .pattern__shape:nth-child(3) {
  left: 70%;
  width: 150px;
  height: 150px;
  border-radius: 100% 0 100% 0;
}

.pattern__row--2 .pattern__shape:nth-child(4) {
  left: 94%;
  width: 210px;
  height: 150px;
  border-radius: 48px;
}

.pattern__row--3 .pattern__shape:nth-child(2) {
  left: 30%;
  width: 150px;
  height: 150px;
  border-radius: 0 0 100% 0;
}

.pattern__row--3 .pattern__shape:nth-child(3) {
  left: 58%;
  width: 190px;
  height: 140px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 var(--radius-lg);
}

/* Static shapes inside the orange bands, stroked in ink instead of accent */
.deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.deco__shape {
  border-color: var(--color-on-accent);
}

.deco--hero {
  opacity: var(--deco-opacity);
}

.deco--hero .deco__shape:nth-child(1) {
  top: -70px;
  left: 30%;
  width: 260px;
  height: 170px;
  border-radius: 50px;
}

.deco--hero .deco__shape:nth-child(2) {
  top: 18%;
  right: -70px;
  width: 220px;
  height: 220px;
  border-radius: 100% 0 0 0;
}

.deco--hero .deco__shape:nth-child(3) {
  top: 44%;
  left: 4%;
  width: 150px;
  height: 150px;
  border-radius: 100% 0 100% 0;
}

.deco--hero .deco__shape:nth-child(4) {
  bottom: -90px;
  left: -60px;
  width: 240px;
  height: 240px;
  border-radius: 0 100% 0 0;
}

.deco--hero .deco__shape:nth-child(5) {
  bottom: 8%;
  right: 26%;
  width: 210px;
  height: 140px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 var(--radius-lg);
}

.deco--band {
  opacity: var(--deco-opacity-band);
}

.deco--band .deco__shape:nth-child(1) {
  top: -60px;
  right: 12%;
  width: 220px;
  height: 150px;
  border-radius: var(--radius-lg);
}

.deco--band .deco__shape:nth-child(2) {
  bottom: -70px;
  left: -50px;
  width: 190px;
  height: 190px;
  border-radius: 0 100% 0 0;
}

.deco--band .deco__shape:nth-child(3) {
  top: 30%;
  right: -60px;
  width: 170px;
  height: 170px;
  border-radius: 100% 0 0 0;
}

.deco--band .deco__shape:nth-child(4) {
  bottom: -50px;
  left: 42%;
  width: 200px;
  height: 130px;
  border-radius: 40px 40px 0 40px;
}
