/* Grupo Fénix. Every colour is a semantic token with a light and a dark value: the theme follows
   the visitor's system setting, and the header toggle (js/site.js) overrides it via data-theme. */

@font-face {
  font-family: Archivo;
  src: url("/fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

@font-face {
  font-family: "Public Sans";
  src: url("/fonts/public-sans.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --font-display: archivo, "Arial Narrow", system-ui, sans-serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 6px;
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 48px);

  /* Light theme */
  --bg: #fff;
  --surface: #eef3f9;
  --card: #fff;
  --text: #0c1b2a;
  --muted: #4d5c6b;
  --line: #d6dfe9;
  --accent: #2f63ad;
  --accent-hover: #24508f;
  --on-accent: #fff;
  --gold: #c27400;
  --band: #0b2a4a;
  --band-text: #fff;
  --band-muted: #c4d3e3;
  --band-line: rgb(255 255 255 / 55%);
  --footer: #081f37;
  --footer-text: #c2d1e0;
  --footer-link: #fff;
  --logo: #3871c1;
  --plate: transparent;
  --focus: #2f63ad;

  /* Company colours: the top edge of each card and its sector label (AA on --card). */
  --co-fenix: #2f63ad;
  --co-famx: #c4161c;
  --co-fpi: #2e3192;
  --co-primavera: #005fae;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b141d;
    --surface: #101c28;
    --card: #142231;
    --text: #e8eef4;
    --muted: #a7b5c3;
    --line: #26384b;
    --accent: #8ab0ec;
    --accent-hover: #a9c5f2;
    --on-accent: #0b141d;
    --gold: #f29a1d;
    --band: #0f2a46;
    --band-text: #fff;
    --band-muted: #c4d3e3;
    --band-line: rgb(255 255 255 / 55%);
    --footer: #070f17;
    --footer-text: #a7b5c3;
    --footer-link: #e8eef4;
    --logo: #fff;
    --plate: #fff;
    --focus: #8ab0ec;
    --co-fenix: #8ab0ec;
    --co-famx: #ff8a8d;
    --co-fpi: #a9abf5;
    --co-primavera: #6fb6f5;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b141d;
  --surface: #101c28;
  --card: #142231;
  --text: #e8eef4;
  --muted: #a7b5c3;
  --line: #26384b;
  --accent: #8ab0ec;
  --accent-hover: #a9c5f2;
  --on-accent: #0b141d;
  --gold: #f29a1d;
  --band: #0f2a46;
  --band-text: #fff;
  --band-muted: #c4d3e3;
  --band-line: rgb(255 255 255 / 55%);
  --footer: #070f17;
  --footer-text: #a7b5c3;
  --footer-link: #e8eef4;
  --logo: #fff;
  --plate: #fff;
  --focus: #8ab0ec;
  --co-fenix: #8ab0ec;
  --co-famx: #ff8a8d;
  --co-fpi: #a9abf5;
  --co-primavera: #6fb6f5;

  color-scheme: dark;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  text-size-adjust: 100%;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font-body);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.12;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.1rem, 5.2vw, 4rem);
  font-weight: 800;
  font-stretch: 115%;
  letter-spacing: -0.015em;
  line-height: 1.02;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
  font-stretch: 110%;
}

h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

p,
ul,
ol,
dl,
address {
  margin: 0;
}

address {
  font-style: normal;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-hover);
}

img,
svg {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left, 0))
    max(var(--gutter), env(safe-area-inset-right, 0));
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 60ch;
}

.muted {
  color: var(--muted);
}

/* ---------- Buttons (6px corners, never pills) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
}

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

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

.btn-secondary {
  background: transparent;
  color: var(--accent);
}

.btn-secondary:hover {
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-light {
  border-color: var(--band-line);
  color: var(--band-text);
}

.btn-light:hover {
  border-color: var(--band-text);
  color: var(--band-text);
}

.btn-solid-light {
  background: var(--band-text);
  border-color: var(--band-text);
  color: var(--band);
}

.btn-solid-light:hover {
  background: var(--band-muted);
  border-color: var(--band-muted);
  color: var(--band);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
}

.brand {
  display: inline-flex;
  color: var(--logo);
}

.brand:hover {
  color: var(--logo);
}

.wordmark {
  width: auto;
  height: 46px;
  aspect-ratio: 940.25 / 381.75;
  fill: currentcolor;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
}

.nav-links {
  display: flex;
  gap: clamp(12px, 2.2vw, 28px);
  padding: 0;
  list-style: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav-links a {
  display: inline-block;
  padding-block: 8px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover {
  border-bottom-color: var(--line);
}

.nav-links a[aria-current="page"] {
  border-bottom-color: var(--gold);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-switch,
.theme-toggle,
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: 700 0.85rem/1 var(--font-body);
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}

.lang-switch:hover,
.theme-toggle:hover,
.menu-toggle:hover {
  border-color: var(--muted);
  color: var(--text);
}

/* The toggle needs JavaScript; without it the theme just follows the system setting. */
.theme-toggle {
  display: none;
}

.js .theme-toggle {
  display: inline-flex;
}

.icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

.menu-toggle {
  display: none;
}

.icon-close {
  display: none;
}

.menu-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

.menu-toggle[aria-expanded="true"] .icon-menu {
  display: none;
}

@media (width <= 900px) {
  .wordmark {
    height: 38px;
  }

  .header-inner {
    flex-wrap: wrap;
    min-height: 64px;
    padding-block: 10px;
  }

  /* Without JavaScript the menu stays open below the logo. */
  .site-nav {
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-bottom: 16px;
  }

  .nav-links {
    flex-direction: column;
    gap: 0;
    font-size: 1.05rem;
  }

  .nav-links a {
    display: block;
    padding-block: 12px;
    border-bottom: 1px solid var(--line);
  }

  .nav-links a[aria-current="page"] {
    border-bottom-color: var(--line);
    box-shadow: inset 3px 0 0 var(--gold);
    padding-left: 12px;
  }

  .header-tools .btn {
    flex: 1;
  }

  .js .menu-toggle {
    display: inline-flex;
  }

  .js .site-nav {
    display: none;
  }

  .js .site-nav.is-open {
    display: flex;
  }
}

/* ---------- Page heads and sections ---------- */

.page-head {
  padding-block: clamp(40px, 7vw, 88px) clamp(24px, 4vw, 48px);
}

.page-head .wrap {
  display: grid;
  gap: 18px;
}

.section {
  padding-block: clamp(40px, 6vw, 72px);
}

.section-soft {
  background: var(--surface);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px 32px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.section-head p {
  color: var(--muted);
  max-width: 48ch;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--footer);
  color: var(--footer-text);
  font-size: 0.92rem;
}

.site-footer a {
  color: var(--footer-link);
}

.site-footer .brand {
  color: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
  padding-block: 48px 32px;
}

.footer-about {
  display: grid;
  gap: 14px;
  align-content: start;
  max-width: 38ch;
}

.site-footer h2 {
  margin-bottom: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  font-stretch: normal;
  color: var(--footer-link);
}

.site-footer ul {
  display: grid;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.site-footer ul a,
.site-footer address a {
  text-decoration: none;
}

.site-footer ul a:hover,
.site-footer address a:hover {
  color: var(--footer-link);
  text-decoration: underline;
}

.footer-bottom p {
  padding-block: 16px;
  border-top: 1px solid rgb(255 255 255 / 12%);
}

@media (width <= 820px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-about {
    grid-column: 1 / -1;
  }
}

@media (width <= 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Hero (home) ---------- */

.hero {
  padding-block: clamp(40px, 7vw, 88px) clamp(32px, 5vw, 64px);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: end;
}

.hero-copy {
  display: grid;
  gap: 22px;
}

.accent {
  color: var(--accent);
}

.sectors {
  border-top: 2px solid var(--text);
}

.sectors div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-block: 12px;
  border-bottom: 1px solid var(--line);
}

.sectors dt {
  font-weight: 600;
}

.sectors dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}

@media (width <= 820px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
}

/* ---------- Company cards ---------- */

.co-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  padding: 0;
  list-style: none;
}

.co {
  --co: var(--accent);

  display: grid;
  grid-template-rows: 64px auto 1fr auto;
  gap: 12px;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--co);
  border-radius: 8px;
}

.co-fenix {
  --co: var(--co-fenix);
}

.co-famx {
  --co: var(--co-famx);
}

.co-fpi {
  --co: var(--co-fpi);
}

.co-primavera {
  --co: var(--co-primavera);
}

.co-logo {
  display: flex;
  align-items: center;
}

.co-logo img {
  width: auto;
  max-height: 52px;
}

/* FAMX's black wordmark and FPI's navy logo need a light background in dark mode. */
.co-logo-plate {
  justify-self: start;
  padding: 6px 10px;
  margin-left: -10px;
  background: var(--plate);
  border-radius: var(--radius);
}

.co-fpi .co-logo img {
  max-height: 60px;
}

.co-mark {
  width: auto;
  height: 52px;
  color: var(--co);
}

.co-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 110%;
  font-size: 1.3rem;
  line-height: 1.1;
  color: var(--co);
}

.co-sector {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--co);
}

.co-body {
  display: grid;
  gap: 6px;
  align-content: start;
}

.co-body p {
  color: var(--muted);
  font-size: 0.95rem;
}

.co-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  padding-block: 4px;
  border-bottom: 2px solid var(--co);
  color: var(--text);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
}

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

.co-link .icon {
  width: 16px;
  height: 16px;
}

@media (prefers-reduced-motion: no-preference) {
  .co {
    transition: transform 0.2s ease;
  }

  .co:hover {
    transform: translateY(-3px);
  }
}

/* ---------- Split intro + gold-edged points ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: clamp(24px, 5vw, 64px);
}

.split-intro {
  display: grid;
  gap: 14px;
  align-content: start;
}

.points {
  display: grid;
  gap: 20px;
  padding: 0;
  list-style: none;
}

.points li {
  display: grid;
  gap: 4px;
  padding-left: 18px;
  border-left: 3px solid var(--gold);
}

.points p {
  color: var(--muted);
}

@media (width <= 820px) {
  .split {
    grid-template-columns: 1fr;
  }
}

/* ---------- Contact band ---------- */

.band {
  background: var(--band);
  color: var(--band-text);
  padding-block: clamp(40px, 5vw, 64px);
}

.band-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
}

.band-copy {
  display: grid;
  gap: 14px;
}

.band-copy p {
  color: var(--band-muted);
}

.band a:not(.btn) {
  color: var(--band-text);
}

.contact-list {
  display: grid;
  gap: 10px;
}

.contact-list div {
  display: grid;
  grid-template-columns: 7.5em 1fr;
  gap: 16px;
}

.contact-list dt {
  color: var(--muted);
}

.contact-list dd {
  margin: 0;
}

.contact-list-band dt {
  color: var(--band-muted);
}

@media (width <= 820px) {
  .band-inner {
    grid-template-columns: 1fr;
  }
}

@media (width <= 420px) {
  .contact-list div {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* ---------- Inner pages ---------- */

.section-title {
  margin-bottom: 28px;
}

.section-tight {
  padding-top: 0;
}

.prose {
  display: grid;
  gap: 14px;
  max-width: 62ch;
  font-size: 1.05rem;
}

.people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 0;
  list-style: none;
}

.people li {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.people p {
  color: var(--muted);
}

/* ---------- Logistics: services and steps ---------- */

.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  padding: 0;
  list-style: none;
}

.service {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.service-icon {
  width: 40px;
  height: 40px;
  color: var(--accent);
  stroke-width: 1.5;
}

.service p {
  color: var(--muted);
}

.service .service-for {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

.service-for strong {
  color: var(--text);
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  gap: 6px;
  align-content: start;
  padding-top: 16px;
  border-top: 3px solid var(--gold);
  counter-increment: step;
}

.steps h3::before {
  content: counter(step) ". ";
  color: var(--muted);
}

.steps p {
  color: var(--muted);
}

@media (width <= 820px) {
  .steps {
    grid-template-columns: 1fr 1fr;
  }
}

@media (width <= 480px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

/* ---------- Contact page ---------- */

.office {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
  padding: clamp(20px, 4vw, 40px);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 8px;
}

.office-details {
  display: grid;
  gap: 12px;
}

.office-name {
  font-weight: 700;
}

.office-actions {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.office-actions .btn {
  width: 100%;
  justify-content: flex-start;
}

.co.co-contact {
  grid-template-rows: auto auto 1fr;
}

.contact-list-compact {
  align-content: start;
  font-size: 0.92rem;
}

.contact-list-compact div {
  grid-template-columns: 1fr;
  gap: 0;
}

.contact-list-compact dd {
  overflow-wrap: anywhere;
}

@media (width <= 820px) {
  .office {
    grid-template-columns: 1fr;
  }
}

/* ---------- 404 ---------- */

.not-found {
  min-height: 55vh;
}

.not-found-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 0;
  list-style: none;
  font-weight: 600;
}
