/* ------------------------------------------------------------------ */
/* Fonts & tokens                                                     */
/* ------------------------------------------------------------------ */

@font-face {
  font-family: "Moderna";
  src: url("../fonts/moderna.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Desire";
  src: url("../fonts/desire.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --color-cream: #f5efe1;
  --color-sand: #d3bcac;
  --color-gold: #b49461;
  --color-gold-dark: #98774a;
  --color-forest: #212614;
  --color-forest-deep: #1d2612;
  --color-sage: #9da8a9;
  --color-sage-light: #9ca7a8;
  --color-burgundy: #532417;

  --font-display: "Moderna", Georgia, serif;
  --font-body: "Desire", Georgia, serif;

  --header-height: 3.25rem;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 3rem;
  --space-xl: 5rem;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-base: 0.35s var(--ease-out);
  --contact-move-duration: 1.1s;

  --contact-gradient: linear-gradient(
    135deg,
    var(--color-burgundy),
    var(--color-gold),
    var(--color-gold-dark),
    var(--color-forest),
    var(--color-burgundy)
  );

  --client-grid-gap: clamp(0.75rem, 1.5vw, 1.25rem);
}

/* ------------------------------------------------------------------ */
/* Reset & base                                                       */
/* ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  overflow-x: clip;
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.6;
  color: var(--color-forest-deep);
  background-color: var(--color-cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  margin: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-sm);
  z-index: 1000;
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-cream);
  color: var(--color-forest-deep);
  border-radius: 0 0 4px 4px;

  &:focus {
    top: 0;
  }
}

/* ------------------------------------------------------------------ */
/* Header / nav                                                       */
/* ------------------------------------------------------------------ */

.site-header {
  --header-theme: 0;
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background-color: rgb(245 239 225 / calc(var(--header-theme) * 0.92));
  backdrop-filter: blur(calc(var(--header-theme) * 8px));
  transition:
    background-color 0.45s var(--ease-out),
    backdrop-filter 0.45s var(--ease-out);
}

.site-nav {
  display: flex;
  gap: clamp(2rem, 6vw, 4rem);
  padding: var(--space-xs) var(--space-md);
  pointer-events: auto;

  .site-nav__link {
    font-family: var(--font-display);
    font-size: clamp(0.75rem, 1.2vw, 0.875rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-forest-deep);
    opacity: 0.85;
    transition: opacity var(--transition-base);

    &:hover,
    &:focus-visible {
      opacity: 1;
    }

    &:focus-visible {
      outline: 1px solid var(--color-forest-deep);
      outline-offset: 4px;
    }
  }
}

/* ------------------------------------------------------------------ */
/* Hero                                                               */
/* ------------------------------------------------------------------ */

@keyframes hero-image-focus {
  from {
    filter: blur(28px);
    transform: scale(1.04);
  }

  to {
    filter: blur(0);
    transform: scale(1);
  }
}

@keyframes hero-logo-rise {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 32rem;
  overflow: hidden;
  display: grid;
  place-items: center;

  .hero__media {
    position: absolute;
    inset: 0;
  }

  .hero__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  .hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      180deg,
      rgb(245 239 225 / 0.4) 0%,
      rgb(245 239 225 / 0.12) 45%,
      rgb(245 239 225 / 0.3) 100%
    );
  }

  .hero__content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(88vw, 60rem);
    padding: var(--space-md);
  }

  .hero__logo {
    width: 100%;
    height: auto;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero__image {
    animation: hero-image-focus 3s var(--ease-out) both;
  }

  .hero__logo {
    opacity: 0;
    animation: hero-logo-rise 2.1s var(--ease-out) 0.15s both;
  }
}

/* ------------------------------------------------------------------ */
/* Clients ? grid section                                             */
/* ------------------------------------------------------------------ */
.clients {
  background-color: var(--color-cream);
  padding: clamp(1.25rem, 4vw, 3rem);
  overflow-x: clip;

  .clients__grid {
    position: relative;
  }
}

.client-card {
  width: 100%;
  position: relative;
  contain: inline-size;
  min-width: 0;

  &:hover,
  &:focus-within {
    z-index: 5;
  }

  .client-card__slideshow {
    position: relative;
    width: 100%;
    overflow: visible;
  }

  .client-card__slide {
    display: block;
    max-width: none;
    height: auto;
    opacity: 0;
    pointer-events: none;
    filter: grayscale(1) contrast(0.7) brightness(0.92);
    transition:
      opacity 0.35s var(--ease-out),
      filter 0.4s var(--ease-out),
      transform 0.8s var(--ease-out);

    &.is-active {
      opacity: 1;
      pointer-events: auto;
    }

    &:first-of-type {
      position: relative;
      z-index: 0;
      width: 100%;
    }

    &:not(:first-of-type) {
      position: absolute;
      top: 50%;
      left: 50%;
      width: auto;
      min-height: 50%;
      max-height: 100%;
      transform: translate(-50%, -50%);
      z-index: 1;
    }

    &.is-active:not(:first-of-type) {
      z-index: 2;
    }
  }

  &:hover .client-card__slide.is-active,
  &:focus-within .client-card__slide.is-active {
    filter: grayscale(0) contrast(1.05) brightness(1);
  }

  &:hover .client-card__slide.is-active:first-of-type,
  &:focus-within .client-card__slide.is-active:first-of-type {
    transform: scale(1.06);
  }

  &:hover .client-card__slide.is-active:not(:first-of-type),
  &:focus-within .client-card__slide.is-active:not(:first-of-type) {
    transform: translate(-50%, -50%) scale(1.06);
  }

  .client-card__name {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 3;
    margin: 0;
    padding: clamp(0.75rem, 2vw, 1.25rem);
    font-size: clamp(0.7rem, 1.4vw, 0.95rem);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-cream);
    -webkit-text-stroke: 1px #000;
    paint-order: stroke fill;
    pointer-events: none;
  }

  .client-card__name-numerals {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    transform: translateY(-5%);
    display: inline-block;
  }
}

/* ------------------------------------------------------------------ */
/* About                                                              */
/* ------------------------------------------------------------------ */

.about {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding-block: calc(var(--header-height) + var(--space-md));
  padding-inline: clamp(1.5rem, 5vw, 3rem);
  background-color: var(--color-burgundy);
  color: var(--color-cream);

  .about__content {
    max-width: min(42rem, 88vw);
    /* text-align: center; */
    opacity: 0;
    transition: opacity 0.6s var(--ease-out);

    &.is-visible {
      opacity: 1;
    }
  }

  .about__title {
    margin-bottom: clamp(1rem, 3vw, 1.75rem);
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
  }

  .about__text {
    margin: 0;
    /* font-size: clamp(1rem, 1.8vw, 1.2rem); */
    line-height: 1.75;
    opacity: 0.9;

    & + .about__text {
      margin-top: 1.25em;
    }
  }

  .about__icon {
    margin-inline: auto;
    margin-top: clamp(1rem, 3vw, 1.75rem);
    filter: brightness(0) invert(1);
    opacity: 0.95;
  }
}

.section-icon {
  display: block;
  width: clamp(2.25rem, 4.5vw, 3.25rem);
  height: auto;
}

/* ------------------------------------------------------------------ */
/* Footer                                                             */
/* ------------------------------------------------------------------ */

.site-footer {
  background-color: var(--color-cream);
  color: var(--color-forest-deep);
  border-top: 1px solid color-mix(in srgb, var(--color-sand) 55%, transparent);
  padding: clamp(2.25rem, 6vw, 4rem) clamp(1.5rem, 5vw, 3rem);
  min-height: clamp(9rem, 18vh, 12rem);

  .site-footer__inner {
    max-width: 72rem;
    margin: 0 auto;
    display: grid;
    gap: var(--space-sm);
    align-items: center;
    text-align: center;

    @media (min-width: 48rem) {
      grid-template-columns: 1fr auto 1fr;
      text-align: left;
    }
  }

  .site-footer__brand {
    justify-self: center;

    @media (min-width: 48rem) {
      justify-self: start;
    }

    img {
      width: clamp(6rem, 12vw, 8rem);
      height: auto;
      opacity: 0.95;
    }
  }

  .site-footer__nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(1rem, 3vw, 2rem);

    @media (min-width: 48rem) {
      justify-self: center;
    }
  }

  .site-footer__link {
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.75;
    transition: opacity var(--transition-base);

    &:hover,
    &:focus-visible {
      opacity: 1;
    }

    &:focus-visible {
      outline: 1px solid var(--color-forest-deep);
      outline-offset: 4px;
    }
  }

  .site-footer__copy {
    margin: 0;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    opacity: 0.8;

    @media (min-width: 48rem) {
      justify-self: end;
      text-align: right;
    }
  }
}

/* ------------------------------------------------------------------ */
/* Fixed contact chip                                                 */
/* ------------------------------------------------------------------ */

@keyframes contact-gradient-shift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@property --contact-x-offset {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

.contact-chip {
  position: fixed;
  bottom: clamp(1rem, 3vw, 1.75rem);
  left: 50%;
  z-index: 90;
  padding: 0.65rem 1.1rem;
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1.4vw, 0.95rem);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--color-cream);
  background-color: var(--color-burgundy);
  border-radius: 999px;
  box-shadow: 0 4px 24px rgb(29 38 18 / 0.25);
  isolation: isolate;
  overflow: hidden;
  --contact-x-offset: 0px;
  transform: translateX(calc(-50% + var(--contact-x-offset)));
  transition:
    transform var(--contact-move-duration) var(--ease-out),
    --contact-x-offset var(--contact-move-duration) var(--ease-out);

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background-image: var(--contact-gradient);
    background-size: 300% 300%;
    opacity: 0;
    transition: opacity var(--transition-base);
  }

  &.contact-chip--centered::before {
    opacity: 1;
    animation: contact-gradient-shift 8s ease infinite;
  }

  &:hover,
  &:focus-visible {
    transform: translateX(calc(-50% + var(--contact-x-offset))) translateY(-2px);

    &::before {
      opacity: 1;
      animation: contact-gradient-shift 8s ease infinite;
    }
  }

  &:focus-visible {
    outline: 2px solid var(--color-cream);
    outline-offset: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .contact-chip {
    transition-duration: 0.01ms;
  }

  .contact-chip::before {
    animation: none !important;
    background-position: 50% 50%;
  }
}

/* ------------------------------------------------------------------ */
/* Responsive adjustments                                             */
/* ------------------------------------------------------------------ */

@media (max-width: 40rem) {
  .contact-chip {
    max-width: calc(100% - 2rem);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 30rem) {
  .site-nav {
    gap: 1.5rem;
  }
}
