/* ============================================================
   footer — section 8 (brief/footer.md). Figma D 3441:2365 · M 3441:2047.
   Mobile-first: base = mobile (anchor 375); 768-1023 pseudo-tablet (no Figma layer,
   FD-BL composition per brief §6); 1024+ desktop (vw-base 1440, cap 1920).
   Gutter / block padding come from .container--wide + page tokens; section-local
   values are --ft-* (brief §2) declared on .footer only.
   ============================================================ */

.footer {
  /* section-local colour (D-FT-13, Figma VariableID:3440:4476) */
  --ft-muted: #AAAAAA;

  /* MOBILE (0-767): clamp(M-min, M + (vw - 375) * 0.015, M-max) */
  --ft-gap-xl: clamp(41px, calc(48px + (var(--max-vw) - 375px) * 0.015), 48px);
  --ft-credits-gap: clamp(27px, calc(32px + (var(--max-vw) - 375px) * 0.015), 48px);
  --ft-brand-gap: clamp(20px, calc(24px + (var(--max-vw) - 375px) * 0.015), 24px);
  --ft-head-gap: clamp(14px, calc(16px + (var(--max-vw) - 375px) * 0.015), 16px);
  --ft-item-py: clamp(7px, calc(8px + (var(--max-vw) - 375px) * 0.015), 8px);
  --ft-icon: clamp(20px, calc(24px + (var(--max-vw) - 375px) * 0.015), 24px);
  --ft-util-gap: clamp(7px, calc(8px + (var(--max-vw) - 375px) * 0.015), 8px);
  --ft-social-gap: clamp(10px, calc(12px + (var(--max-vw) - 375px) * 0.015), 12px);
  --ft-gap-md: clamp(20px, calc(24px + (var(--max-vw) - 375px) * 0.015), 32px);
  --ft-legal-gap: clamp(14px, calc(16px + (var(--max-vw) - 375px) * 0.015), 24px);
  --ft-copy-gap: clamp(27px, calc(32px + (var(--max-vw) - 375px) * 0.015), 32px);
  --ft-cols-stack-gap: clamp(27px, calc(32px + (var(--max-vw) - 375px) * 0.015), 32px);
  --ft-logo-w: clamp(48.59px, calc(56.94px + (var(--max-vw) - 375px) * 0.015), 79.71px);

  display: flex;
  flex-direction: column;
  gap: var(--ft-gap-xl);
  padding-block: var(--section-py-footer);
  color: var(--color-text);
}

/* ---------- top row: brand + links ---------- */
.footer__top {
  display: flex;
  flex-direction: column;
  gap: var(--ft-gap-xl);
}

.footer__brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--ft-brand-gap);
  min-width: 0;
}

.footer__logo {
  width: var(--ft-logo-w);
  height: auto;
}

.footer__tagline {
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.5;
}

.footer__address {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--text-small);
  line-height: 1.5;
}
.footer__address-label { font-weight: 600; }
.footer__address-text { font-weight: 400; }

.footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--ft-cols-stack-gap);
}

.footer__col {
  display: flex;
  flex-direction: column;
  gap: var(--ft-head-gap);
  min-width: 0;
}

.footer__col-title {
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.5;
}

.footer__list {
  display: flex;
  flex-direction: column;
}

.footer__link {
  display: flex;
  align-items: center;
  padding-block: var(--ft-item-py);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.5;
  transition: opacity 0.2s ease;
}

.footer__link-text {
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
}

/* utility row: text first, arrow pinned right */
.footer__link--util { gap: var(--ft-util-gap); }
.footer__link-icon {
  flex: none;
  width: var(--ft-icon);
  height: var(--ft-icon);
}

/* social row: icon first, label fills */
.footer__link--social { gap: var(--ft-social-gap); }
.footer__social-pic { flex: none; }
.footer__social-icon {
  width: var(--ft-icon);
  height: var(--ft-icon);
}

/* ---------- credits: big phone + email ---------- */
.footer__credits {
  display: flex;
  flex-direction: column;
  gap: var(--ft-credits-gap);
}

.footer__contact {
  display: flex;
  flex-direction: column;
  gap: var(--ft-head-gap);
  /* the email string fills the content box; its size is capped by the box width below */
  container-type: inline-size;
}

.footer__phone,
.footer__email {
  display: block;
  font-weight: 600;
  line-height: 1.21; /* Figma "auto" (D-FT-7) */
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.footer__phone {
  font-size: var(--text-footer-phone);
}

.footer__email {
  /* token value, but never wider than the content box. The web Inter face sets this string
     ~11.4x its font-size (Figma: 11.28x), so 116px would overrun 1312 by ~10px at 1440, and below
     ~370px the mobile type formula shrinks slower than the box. 8.75cqi = widest size that fits
     (29px token wins at 375; ~114.8px at 1440). */
  font-size: min(var(--text-footer-email), 8.75cqi);
  text-transform: lowercase; /* D-FT-8 */
  /* Left at every width, overriding D-FT-9 (centred on mobile): the phone line above is left, so
     the centred email drifted right of it as soon as the box outgrew the string (8px at 390,
     159px at 767) and snapped back at 768. */
}

/* ---------- bottom: divider + legal row ---------- */
.footer__bottom {
  border-top: var(--border-width) solid var(--color-divider);
  padding-top: var(--ft-gap-md);
}

.footer__legal-row {
  display: flex;
  flex-direction: column;
  gap: var(--ft-copy-gap);
}

.footer__copy {
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.21; /* credit run is Figma "auto" (D-FT-6) */
  color: var(--color-text);
}
.footer__copy-text {
  color: var(--ft-muted);
  line-height: 1.5;
}
.footer__credit {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-skip-ink: none;
  transition: opacity 0.2s ease;
}

.footer__legal {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--ft-legal-gap);
}

.footer__legal-link {
  font-size: var(--text-legal);
  font-weight: 400;
  line-height: 1.5;
  transition: opacity 0.2s ease;
}

/* Mobile DOM order: legal links FIRST, then copyright (D-FT-10) */
@media (max-width: 767px) {
  .footer__legal { order: -1; }
}

@media (hover: hover) {
  .footer__link:hover,
  .footer__phone:hover,
  .footer__email:hover,
  .footer__credit:hover,
  .footer__legal-link:hover { opacity: 0.7; }
}

/* ============================================================
   PSEUDO-TABLET 768-1023 (no Figma layer — brief §6 Tablet layout)
   top row = brand track + 2 link columns; credits = left stack;
   legal row = desktop-compressed, wraps between its two items.
   ============================================================ */
@media (min-width: 768px) {
  .footer {
    --ft-gap-xl: clamp(48px, calc(48px + (var(--max-vw) - 768px) * 0.025), 48px);
    --ft-credits-gap: clamp(37.88px, calc(37.88px + (var(--max-vw) - 768px) * 0.025), 48px);
    --ft-brand-gap: clamp(24px, calc(24px + (var(--max-vw) - 768px) * 0.025), 24px);
    --ft-head-gap: clamp(16px, calc(16px + (var(--max-vw) - 768px) * 0.025), 16px);
    --ft-item-py: clamp(8px, calc(8px + (var(--max-vw) - 768px) * 0.025), 8px);
    --ft-icon: clamp(24px, calc(24px + (var(--max-vw) - 768px) * 0.025), 24px);
    --ft-util-gap: clamp(8px, calc(8px + (var(--max-vw) - 768px) * 0.025), 8px);
    --ft-social-gap: clamp(12px, calc(12px + (var(--max-vw) - 768px) * 0.025), 12px);
    --ft-gap-md: clamp(29.88px, calc(29.88px + (var(--max-vw) - 768px) * 0.025), 32px);
    --ft-legal-gap: clamp(21.88px, calc(21.88px + (var(--max-vw) - 768px) * 0.025), 24px);
    --ft-logo-w: clamp(62.82px, calc(62.82px + (var(--max-vw) - 768px) * 0.025), 79.71px);
    --ft-col-w: 168px;
    --ft-cols-gap: 40px;
  }

  .footer__top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 48px;
    align-items: start;
  }

  .footer__links {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--ft-cols-gap);
  }

  .footer__col { width: var(--ft-col-w); }

  .footer__legal-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    column-gap: 64px;
    row-gap: 16px;
  }

  .footer__copy { white-space: nowrap; }

  .footer__legal {
    flex-direction: row;
    align-items: center;
    white-space: nowrap;
  }
}

/* ============================================================
   DESKTOP 1024+ (vw-base 1440)
   ============================================================ */
@media (min-width: 1024px) {
  .footer {
    --ft-gap-xl: clamp(34px, calc(48px * (var(--max-vw) / var(--vw-base))), 64px);
    --ft-credits-gap: clamp(34px, calc(48px * (var(--max-vw) / var(--vw-base))), 64px);
    --ft-brand-gap: clamp(17px, calc(24px * (var(--max-vw) / var(--vw-base))), 32px);
    --ft-head-gap: clamp(11px, calc(16px * (var(--max-vw) / var(--vw-base))), 21px);
    --ft-item-py: clamp(6px, calc(8px * (var(--max-vw) / var(--vw-base))), 11px);
    --ft-icon: clamp(17px, calc(24px * (var(--max-vw) / var(--vw-base))), 32px);
    --ft-util-gap: clamp(6px, calc(8px * (var(--max-vw) / var(--vw-base))), 11px);
    --ft-social-gap: clamp(9px, calc(12px * (var(--max-vw) / var(--vw-base))), 16px);
    --ft-gap-md: clamp(23px, calc(32px * (var(--max-vw) / var(--vw-base))), 43px);
    --ft-legal-gap: clamp(17px, calc(24px * (var(--max-vw) / var(--vw-base))), 32px);
    --ft-logo-w: clamp(56.69px, calc(79.71px * (var(--max-vw) / var(--vw-base))), 106.28px);
    --ft-brand-w: clamp(398px, calc(560px * (var(--max-vw) / var(--vw-base))), 747px);
    --ft-col-w: clamp(119px, calc(168px * (var(--max-vw) / var(--vw-base))), 224px);
    --ft-cols-gap: clamp(46px, calc(64px * (var(--max-vw) / var(--vw-base))), 85px);
  }

  .footer__top {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }

  .footer__brand {
    flex: none;
    width: var(--ft-brand-w);
  }

  .footer__links { flex: none; }

  /* The band's fixed min gaps (48 / 64 / 16) would hold full size down to 1024: scale them
     with the frame. Figma min gaps: brand <-> links 120, copyright <-> legal 64 (brief §2).
     Inert at the drawn frame — both rows are space-between with free space left over. */
  .footer__top {
    column-gap: clamp(85px, calc(120px * (var(--max-vw) / var(--vw-base))), 160px);
  }
  .footer__legal-row {
    column-gap: clamp(46px, calc(64px * (var(--max-vw) / var(--vw-base))), 85px);
    row-gap: clamp(11px, calc(16px * (var(--max-vw) / var(--vw-base))), 21px);
  }

  .footer__col-title { font-weight: 700; }

  /* D-FT-4: utility tracking is desktop-only */
  .footer__link--util .footer__link-text { letter-spacing: 0.0625em; }
}
