/* =============================================================================
   ICD International S.A.L. — layout.css
   Header, primary navigation, footer, section rhythm, grid helpers.
   ========================================================================== */

/* -----------------------------------------------------------------------------
   1. PAGE SHELL
   -------------------------------------------------------------------------- */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
}

/* -----------------------------------------------------------------------------
   2. TOP BAR
   Thin navy strip above the header carrying registration + contact details.
   Hidden below 900px to protect vertical space on mobile.
   -------------------------------------------------------------------------- */
.topbar {
  background: var(--navy-900);
  color: rgba(255, 255, 255, 0.66);
  font-size: var(--fs-xs);
  letter-spacing: 0.01em;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  min-height: 38px;
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.topbar__links {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.topbar a {
  color: rgba(255, 255, 255, 0.82);
  transition: color var(--t-fast) var(--ease);
}

.topbar a:hover {
  color: var(--amber-400);
}

.topbar__dot {
  color: var(--amber-500);
}

@media (max-width: 899px) {
  .topbar {
    display: none;
  }
}

/* -----------------------------------------------------------------------------
   3. HEADER + PRIMARY NAV
   White sticky header so the navy logo reads correctly at all times.
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  transition: box-shadow var(--t-base) var(--ease);
}

/* nav.js toggles this once the page is scrolled past the hero edge */
.site-header.is-stuck {
  box-shadow: var(--shadow-md);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  flex: none;
}

.brand img {
  width: auto;
  height: 48px;
}

@media (max-width: 480px) {
  .brand img {
    height: 40px;
  }
}

/* --- Desktop nav --- */
.nav {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  margin-left: auto;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.nav__link {
  position: relative;
  display: block;
  padding: var(--sp-3) var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--graphite);
  transition: color var(--t-fast) var(--ease);
}

/* Amber underline grows from the left on hover / current page */
.nav__link::after {
  content: "";
  position: absolute;
  left: var(--sp-3);
  right: var(--sp-3);
  bottom: calc(50% - 1.05em);
  height: 2px;
  background: var(--amber-500);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-base) var(--ease);
}

.nav__link:hover {
  color: var(--navy-700);
}

.nav__link:hover::after,
.nav__link[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav__link[aria-current="page"] {
  color: var(--navy-900);
  font-weight: 600;
}

.nav__cta {
  flex: none;
}

/* --- Mobile toggle --- */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-left: auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--navy-900);
  transition:
    border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}

.nav-toggle:hover {
  border-color: var(--navy-700);
  background: var(--paper);
}

.nav-toggle__bars {
  position: relative;
  width: 20px;
  height: 2px;
  background: currentColor;
  transition: background var(--t-fast) var(--ease);
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: currentColor;
  transition: transform var(--t-base) var(--ease);
}

.nav-toggle__bars::before {
  top: -6px;
}

.nav-toggle__bars::after {
  top: 6px;
}

/* Bars collapse into an X while the panel is open */
.nav-toggle[aria-expanded="true"] .nav-toggle__bars {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after {
  transform: translateY(-6px) rotate(-45deg);
}

/* --- Nav breakpoint: six items + CTA stop fitting below 1024px --- */
@media (max-width: 1023px) {
  .nav-toggle {
    display: grid;
  }

  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    margin: 0;
    padding: var(--sp-5) var(--gutter) var(--sp-9);
    background: var(--white);
    border-top: 1px solid var(--line);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(100%);
    visibility: hidden;
    transition:
      transform var(--t-base) var(--ease),
      visibility var(--t-base) var(--ease);
  }

  .nav.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .nav__list {
    display: block;
  }

  .nav__list li + li {
    border-top: 1px solid var(--line);
  }

  .nav__link {
    padding: var(--sp-4) 0;
    font-size: 1.0625rem;
  }

  .nav__link::after {
    left: 0;
    right: auto;
    bottom: var(--sp-2);
    width: 32px;
  }

  .nav__cta {
    display: block;
    margin-top: var(--sp-6);
  }

  .nav__cta .btn {
    width: 100%;
  }
}

/* Locked by nav.js so the page behind the panel cannot scroll */
body.nav-open {
  overflow: hidden;
}

/* -----------------------------------------------------------------------------
   4. SECTIONS
   -------------------------------------------------------------------------- */
.section {
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: calc(var(--section-y) * 0.62);
}

.section--paper {
  background: var(--paper);
}

.section--navy {
  background: var(--navy-900);
}

.section--navy-alt {
  background: var(--navy-800);
}

/* Hairline divider between two same-coloured sections */
.section--bordered {
  border-top: 1px solid var(--line);
}

/* Section intro block: eyebrow + heading + lead */
.section-head {
  max-width: 44rem;
  margin-bottom: var(--sp-8);
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.section-head--center .eyebrow {
  justify-content: center;
}

.section-head p {
  margin-top: var(--sp-4);
}

/* Heading on the left, supporting copy / link on the right */
.section-head--split {
  display: grid;
  gap: var(--sp-5);
  max-width: none;
  align-items: end;
}

@media (min-width: 900px) {
  .section-head--split {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: var(--sp-8);
  }

  .section-head--split p {
    margin-top: 0;
  }
}

/* -----------------------------------------------------------------------------
   5. GRIDS
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  gap: var(--sp-5);
}

/* Mobile-first: 1 col -> 2 col at 640px -> 3 col at 1024px.
   Tracks are minmax(0, 1fr) throughout so long unbreakable content cannot
   push a track past the container width. */
.grid--3,
.grid--2,
.grid--4 {
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 860px) {
  .grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-6);
  }
}

@media (min-width: 1024px) {
  .grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-6);
  }

  .grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Two-column prose + aside layout */
.split {
  display: grid;
  gap: var(--sp-7);
  align-items: start;
}

@media (min-width: 900px) {
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(2.5rem, 1rem + 5vw, 5rem);
  }

  .split--wide-left {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  }

  .split--wide-right {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  }

  .split--sticky > :first-child {
    position: sticky;
    top: calc(var(--header-h) + var(--sp-6));
  }
}

/* Divisions page: sticky index column beside the division sections.
   Collapses to a single column (with a horizontal index) below 900px. */
.divisions-layout {
  display: grid;
  /* minmax(0, …) rather than a bare 1fr: the division index uses nowrap
     labels, and an auto-sized track would stretch to their max-content
     width and blow the page out horizontally on narrow screens. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-6);
}

@media (min-width: 900px) {
  .divisions-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: clamp(2.5rem, 1rem + 4vw, 4.5rem);
    align-items: start;
  }
}

/* -----------------------------------------------------------------------------
   6. FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--navy-900);
  color: rgba(255, 255, 255, 0.68);
  font-size: var(--fs-sm);
}

.site-footer__main {
  display: grid;
  gap: var(--sp-8);
  padding-block: var(--sp-9);
}

@media (min-width: 720px) {
  .site-footer__main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .site-footer__main {
    grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
    gap: var(--sp-7);
  }
}

/* Reversed logo — the brand artwork is navy, so the footer uses the white
   variant produced by assets/img/build-logo.py. */
.footer-logo {
  width: auto;
  height: 62px;
}

.site-footer__blurb {
  max-width: 34ch;
  margin-top: var(--sp-5);
  line-height: 1.7;
}

.footer-heading {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: var(--sp-4);
}

.footer-list li + li {
  margin-top: var(--sp-3);
}

.footer-list a {
  color: rgba(255, 255, 255, 0.68);
  transition: color var(--t-fast) var(--ease);
}

.footer-list a:hover {
  color: var(--amber-400);
}

.footer-contact li {
  display: flex;
  gap: var(--sp-3);
  line-height: 1.6;
}

.footer-contact li + li {
  margin-top: var(--sp-4);
}

.footer-contact svg {
  flex: none;
  margin-top: 4px;
  color: var(--amber-500);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-block: var(--sp-5);
  border-top: 1px solid var(--line-dark);
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.5);
}

.site-footer__bottom a:hover {
  color: var(--amber-400);
}

.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-5);
}
