/* ---------- Tokens ---------- */
:root {
  --navy: #061a6b;
  --royal: #0b3fd6;
  --azure: #1486ff;
  --cyan: #22c1ff;
  --white: #ffffff;
  --heavy: -apple-system, "SF Pro Display", "Segoe UI Black", "Arial Black",
    system-ui, Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

html {
  height: 100%;
}

/* Slowly shifting blue gradient behind the canvas; column layout pins the footer down */
body {
  min-height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--body);
  color: var(--white);
  background: linear-gradient(130deg, var(--navy), var(--royal), var(--azure), var(--cyan), var(--royal));
  background-size: 300% 300%;
  animation: drift 20s ease-in-out infinite alternate;
  overflow-x: hidden;
}

/* Canvas fills the viewport and sits behind the content */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ---------- Layout ---------- */
main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2.5vh, 1.75rem);
  padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 5vw, 4rem);
  text-align: center;
}

/* ---------- Title ---------- */
h1 {
  margin: 0;
  max-width: 14ch; /* breaks as "Leading Across / Perspectives" */
  font-family: var(--heavy);
  font-weight: 900;
  font-size: clamp(2.4rem, 8.5vw, 7rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-wrap: balance;
  text-shadow: 0 6px 40px rgba(3, 14, 70, 0.45);
  animation: rise 0.9s var(--ease) both;
}

.subtitle {
  margin: 0;
  font-size: clamp(1.15rem, 2.6vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.92;
  animation: rise 0.9s 0.15s var(--ease) both;
}

/* ---------- Team ---------- */
.team {
  width: 100%;
  max-width: 68rem;
  margin-top: clamp(1.75rem, 6vh, 3.5rem);
  animation: rise 0.9s 0.3s var(--ease) both;
}

/* Four across on wide screens, two on tablets, one on phones */
.team ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.25rem 1.5rem;
}

.team li {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

/* Circular portrait; the initials underneath show if the photo fails to load */
.portrait {
  position: relative;
  width: clamp(104px, 11vw, 136px);
  aspect-ratio: 1;
  margin-bottom: 1rem;
  border: 4px solid var(--white);
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 32px rgba(3, 14, 70, 0.35);
}

.portrait::before {
  content: attr(data-initials);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--heavy);
  font-weight: 900;
  font-size: 2rem;
}

.portrait img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%; /* keep faces in frame */
}

.team h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.team p {
  margin: 0.2rem 0 0.35rem;
  font-size: 0.95rem;
  opacity: 0.88;
}

.team a {
  max-width: 100%;
  color: var(--white);
  font-size: 0.9rem;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.45);
  text-underline-offset: 3px;
  overflow-wrap: anywhere; /* long addresses wrap instead of overflowing */
}

.team a:hover,
.team a:focus-visible {
  text-decoration-color: var(--white);
}

/* ---------- Footer: white logo bar ---------- */
footer {
  position: relative;
  z-index: 1;
  padding: 1.25rem clamp(1.25rem, 5vw, 4rem);
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); /* clear the iPhone home bar */
  background: var(--white);
  box-shadow: 0 -8px 30px rgba(3, 14, 70, 0.25);
}

.logos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.25rem clamp(2rem, 6vw, 4.5rem);
}

.logos a {
  display: block;
  color: var(--navy);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.logos a:hover {
  opacity: 0.7;
}

/* Heights scale with the screen and are set per shape so the logos read as equally prominent */
.logos img {
  display: block;
  width: auto;
  height: clamp(2rem, 10.5vw, 3rem);
}

.logos .logo-rsm {
  height: clamp(1.8rem, 9.5vw, 2.4rem);
}

.logos .logo-tilburg {
  height: clamp(1.8rem, 9.5vw, 2.6rem);
}

.logos .logo-nwo {
  height: clamp(2.9rem, 15vw, 4.25rem); /* upright logo needs more height to be legible */
}

/* Text shown by script.js when a logo file is missing */
.logo-fallback {
  font-weight: 700;
  font-size: 0.95rem;
}

/* ---------- Focus ---------- */
a:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 4px;
  border-radius: 4px;
}

/* ---------- Tablets: two-column team, logos in two tidy rows ---------- */
@media (max-width: 900px) {
  .team ul {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Row 1: Erasmus + Tilburg, row 2: RSM + NWO (the pseudo-element forces the line break) */
  .logos {
    gap: 0.5rem clamp(1.25rem, 6vw, 3rem);
  }

  .logos::before {
    content: "";
    flex-basis: 100%;
    order: 2;
  }

  .logos li:nth-child(1),
  .logos li:nth-child(3) {
    order: 1;
  }

  .logos li:nth-child(2),
  .logos li:nth-child(4) {
    order: 3;
  }
}

/* ---------- Phones: tighter two-by-two team grid ---------- */
@media (max-width: 600px) {
  main {
    padding: 3rem 1rem 2.5rem;
  }

  .team {
    margin-top: 1.75rem;
  }

  .team ul {
    gap: 1.75rem 0.75rem;
  }

  .portrait {
    width: 96px;
    margin-bottom: 0.75rem;
    border-width: 3px;
  }

  .team h2 {
    font-size: 1rem;
    text-wrap: balance;
  }

  .team p {
    font-size: 0.88rem;
  }

  .team a {
    font-size: 0.8rem;
  }
}

/* ---------- Motion ---------- */
@keyframes drift {
  from { background-position: 0% 30%; }
  to   { background-position: 100% 70%; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  body,
  h1,
  .subtitle,
  .team {
    animation: none;
  }

  .logos a {
    transition: none;
  }
}
