/* styles.css */

/* Local font files */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/PlusJakartaSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/PlusJakartaSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}

/* Colour scheme: #001A72 navy + white, navy highlights */
:root {
  --navy: #001A72;
  --navy-rgb: 0, 26, 114;
  --white: #fff;
}

/* Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
html.no-scroll {
  overflow: hidden;
}
body {
  margin: 0;
  background-color: var(--white);
  color: var(--navy);
  font-family: "Plus Jakarta Sans", sans-serif;
  overflow-x: hidden;
}
img {
  display: block;
  max-width: 100%;
}
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  color: var(--navy);
}

/* Container */
.container {
  width: 100%;
  max-width: 1110px;
  margin: 0 auto;
}

/* ✅ IMPORTANT: add padding on small screens so text never touches edges */
@media (max-width: 767px) {
  .container {
    padding-left: 18px;
    padding-right: 18px;
  }
}
@media (min-width: 768px) {
  .container {
    padding: 0 15px;
  }
}

/* Headings */
h1,
h2 {
  margin: 0;
  text-transform: uppercase;
}
h1,
h2 {
  font-size: 40px;
  font-weight: 400;
  line-height: 45px;
}
@media (min-width: 768px) {
  h1,
  h2 {
    font-size: 45px;
    line-height: 84px;
  }
}
h1 {
  letter-spacing: 5px;
}
h4 {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  font-weight: 600;
}

/* =========================
   Header
========================= */
header {
  position: fixed;
  inset: 0 0 auto 0;
  width: 100%;
  z-index: 777;
  padding: 10px 0;
  background: var(--white);
  box-shadow: 0 2px 18px rgba(var(--navy-rgb), 0.12);
}
header .header-wrapper {
  display: flex;
  align-items: center;
  padding: 0; /* uses container padding now */
}
@media (min-width: 768px) {
  header .header-wrapper {
    justify-content: space-between;
    padding: 0;
  }
}

/* Logo float */
@keyframes logoFloat {
  0% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}
header .logo {
  width: 30vw;
  max-width: 130px;
  margin-right: auto;
  animation: logoFloat 6s ease-in-out infinite;
  transition: transform 300ms ease, filter 300ms ease;
}
header .logo:hover {
  transform: translateY(-3px) scale(1.05);
  filter: drop-shadow(0 0 14px rgba(var(--navy-rgb), 0.6));
}
@media (max-width: 767px) {
  header .logo a svg {
    width: 24vw;
  }
}

/* =========================
   Desktop nav
========================= */
header nav {
  display: none;
  margin-top: 28px;
}
@media (min-width: 768px) {
  header nav {
    display: block;
    margin-top: 0;
  }
}
header nav .navbar-nav {
  display: flex;
  align-items: center;
}
header nav .nav-item {
  margin-right: 19px;
}
@media (min-width: 992px) {
  header nav .nav-item {
    margin-right: 36px;
  }
  header nav .nav-item:last-child {
    margin-right: 0;
  }
}

/* Link style */
header nav .nav-link {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 10px 6px;
  display: inline-block;
  position: relative;
  transition: transform 180ms ease, color 180ms ease, text-shadow 180ms ease;
}
header nav .nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 4px;
  width: 100%;
  height: 2px;
  background: var(--navy);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}
header nav .nav-link:hover {
  color: var(--navy);
  transform: translateY(-2px);
}
header nav .nav-link:hover::after {
  transform: scaleX(1);
}

/* Join Us desktop button */
header nav .nav-item:last-child .nav-link::after {
  display: none;
}
header nav .nav-item:last-child .nav-link {
  padding: 10px 18px;
  border-radius: 999px;
  background-color: var(--navy);
  color: var(--white);
  border: 2px solid var(--navy);
  overflow: hidden;
}
header nav .nav-item:last-child .nav-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #00000000;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 320ms ease;
  z-index: 0;
}
header nav .nav-item:last-child .nav-link > * {
  position: relative;
  z-index: 1;
}
header nav .nav-item:last-child .nav-link:hover {
  background-color: transparent;
  color: var(--navy);
  border-color: var(--navy);
  box-shadow: 0 0 18px rgba(var(--navy-rgb), 0.45);
}
header nav .nav-item:last-child .nav-link:hover::before {
  transform: scaleX(1);
}

/* =========================
   Mobile hamburger
========================= */
#mobile-menu-toggle {
  width: 30px;
  height: 22px;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  z-index: 3000;
}
@media (min-width: 768px) {
  #mobile-menu-toggle {
    display: none;
  }
}
#mobile-menu-toggle .line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--navy);
  border-radius: 2px;
  transition: transform 280ms ease, opacity 220ms ease, top 280ms ease,
    background-color 220ms ease;
}
#mobile-menu-toggle .line-1 { top: 2px; }
#mobile-menu-toggle .line-2 { top: 10px; width: 70%; }
#mobile-menu-toggle .line-3 { top: 18px; }
#mobile-menu-toggle.toggled .line { background-color: var(--navy); }
#mobile-menu-toggle.toggled .line-1 { top: 10px; transform: rotate(45deg); }
#mobile-menu-toggle.toggled .line-2 { opacity: 0; }
#mobile-menu-toggle.toggled .line-3 { top: 10px; transform: rotate(-45deg); }

/* =========================
   Mobile menu overlay (covers header too)
========================= */
@media (max-width: 767px) {
  header nav {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);

    max-height: 0;
    overflow: hidden;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(-8px);
    transition:
      max-height 360ms ease,
      opacity 240ms ease,
      transform 300ms ease,
      background 300ms ease,
      visibility 0s linear 360ms;

    z-index: 2000;
  }

  header nav .navbar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 110px 20px 28px;
  }

  header nav .nav-item {
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 260ms ease, transform 260ms ease;
    border-bottom: 1px solid rgba(var(--navy-rgb), 0.18);
    padding: 6px 0;
  }
  header nav .nav-item:first-child {
    border-top: 1px solid rgba(var(--navy-rgb), 0.18);
  }

  header nav .nav-link {
    font-size: 18px;
    padding: 14px 8px;
    width: 100%;
  }

  header.mobile-menu-opened nav {
    max-height: 100vh;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);

    background: var(--white);

    transition:
      max-height 420ms ease,
      opacity 240ms ease,
      transform 300ms ease,
      background 300ms ease,
      visibility 0s;
  }

  header.mobile-menu-opened nav .nav-item {
    opacity: 1;
    transform: translateY(0);
  }
  header.mobile-menu-opened nav .nav-item:nth-child(1) { transition-delay: 80ms; }
  header.mobile-menu-opened nav .nav-item:nth-child(2) { transition-delay: 140ms; }
  header.mobile-menu-opened nav .nav-item:nth-child(3) { transition-delay: 200ms; }
  header.mobile-menu-opened nav .nav-item:nth-child(4) { transition-delay: 260ms; }
  header.mobile-menu-opened nav .nav-item:nth-child(5) { transition-delay: 320ms; }
  header.mobile-menu-opened nav .nav-item:nth-child(6) { transition-delay: 380ms; }

  header nav .nav-item:last-child .nav-link {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 14px 8px;
    color: var(--navy);
  }
  header nav .nav-item:last-child .nav-link::before {
    display: none;
  }
}

/* =========================
   Banner
========================= */
.header-banner {
  max-height: 100vh;
  overflow: hidden;
  position: relative;
  /* start below the solid fixed header (logo height + padding) so the top of the photo isn't hidden */
  margin-top: calc(24vw * 324 / 520 + 23px);
}
@media (min-width: 768px) {
  .header-banner {
    margin-top: 105px;
  }
}
.header-banner img {
  width: 100%;
  height: 50vh;
  object-fit: cover;
}
@media (min-width: 768px) {
  .header-banner img {
    height: 50vw;
  }
}
.header-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, var(--white), transparent 40%);
}

/* =========================
   Sections
========================= */
.page-formula2 {
  position: relative;
  margin-bottom: -160px;
}
@media (min-width: 768px) {
  .page-formula2 {
    top: -180px;
  }
}

.page-formula2 section.section-1 {
  background: linear-gradient(90deg, transparent 50%, var(--white) 0);
}
.page-formula2 section.section-1 .container {
  background-color: var(--white);
  position: relative;
}
@media (min-width: 768px) {
  .page-formula2 section.section-1 .expertise {
    display: flex;
    gap: 62px;
  }
}

.page-formula2 section.section-1 .block-left {
  padding-top: 60px;
}

/* ✅ Mobile: center the hero text + keep margins */
@media (max-width: 767px) {
  .page-formula2 section.section-1 .block-left {
    text-align: center;
  }
  .page-formula2 section.section-1 .description {
    margin-left: auto;
    margin-right: auto;
    max-width: 42ch;
  }
}

@media (min-width: 768px) {
  .page-formula2 section.section-1 .block-left {
    width: 50%;
    padding-left: 40px;
    text-align: left;
  }
}

.page-formula2 section.section-1 .description {
  font-size: 16px;
  line-height: 24px;
}

.page-formula2 section.section-1 .season-tag {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.page-formula2 section.section-1 .controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 80px;
}

.page-formula2 section.section-1 .block-right {
  position: relative;
}
@media (min-width: 768px) {
  .page-formula2 section.section-1 .block-right {
    width: 50%;
  }
}

.page-formula2 section.section-1 .img-wrapper {
  position: absolute;
  top: 60px;
  bottom: 0;
}
.page-formula2 section.section-1 .img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Countdown */
#countdown {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(15px, 3vw, 40px);
  margin-top: 25px;
  pointer-events: none;
}
.countdown-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.countdown-item span {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 700;
}
.countdown-item p {
  margin: 5px 0 0;
  font-size: clamp(0.9rem, 1.8vw, 1.2rem);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
  color: rgba(var(--navy-rgb), 0.7);
}

/* Title */
.title h2 {
  margin-top: 30px;
  margin-bottom: 20px;
  text-align: center;
}

/* =========================
   ✅ Our Partners (responsive + centered)
========================= */
.partners-section {
  padding: clamp(28px, 4vw, 56px) 0;
}

/* Grid that centers and wraps nicely */
.partners-section .sponsors-logos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2.5vw, 22px);
  align-items: center;
  justify-items: center;

  width: 100%;
  margin: 0 auto;
  padding: 10px 0 0;
}

/* 3 across on small tablets */
@media (min-width: 560px) {
  .partners-section .sponsors-logos {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 4 across on desktop */
@media (min-width: 900px) {
  .partners-section .sponsors-logos {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Logo “card” */
.partners-section .sponsor-logo {
  position: relative;
  width: 100%;
  max-width: 260px;
  height: clamp(86px, 12vw, 120px);

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 16px;
  background: var(--navy);
  border: 1px solid var(--navy);
  backdrop-filter: blur(6px);

  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  overflow: hidden;
}

/* Accessible focus ring */
.partners-section .sponsor-logo:focus-within {
  outline: 2px solid rgba(var(--navy-rgb), 0.75);
  outline-offset: 3px;
}

/* Full clickable area */
.partners-section .sponsor-logo > a {
  position: absolute;
  inset: 0;
  display: block;
}

/* Keep images centered */
.partners-section .sponsor-logo img {
  max-width: 78%;
  max-height: 70%;
  width: auto;
  height: auto;

  transition: opacity 200ms ease, transform 200ms ease;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Hover swap (BW -> Color) */
.partners-section .sponsor-logo .colorimage {
  opacity: 0;
  z-index: 2;
}
.partners-section .sponsor-logo .bw {
  opacity: 1;
  z-index: 1;
}

@media (hover: hover) {
  .partners-section .sponsor-logo:hover {
    transform: translateY(-2px);
    border-color: var(--navy);
    box-shadow: 0 10px 24px rgba(var(--navy-rgb), 0.3);
  }
  .partners-section .sponsor-logo:hover .colorimage {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
  }
  .partners-section .sponsor-logo:hover .bw {
    opacity: 0;
  }
}

/* Touch devices: don't hide the color version on tap-only screens */
@media (hover: none) {
  .partners-section .sponsor-logo .colorimage {
    opacity: 1;
  }
  .partners-section .sponsor-logo .bw {
    opacity: 0;
  }
}

/* =========================
   Footer
========================= */
.footer {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 0;
  background: var(--navy);
  color: var(--white);
}
.footer a:hover {
  color: var(--white);
  text-decoration: underline;
}
.footer-column {
  flex: 0 0 200px;
  margin: 0 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.unilogo {
  height: 70px;
  width: auto;
}
/* blue university crest -> white so it reads on the navy footer */
.unilogo[src$="Swansea.png"] {
  filter: brightness(0) invert(1);
}
.footer-column .social-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 0.9rem;
}
@media (max-width: 768px) {
  .footer {
    flex-direction: column;
    align-items: center;
  }
  .footer-column {
    margin: 10px 0;
  }
}
/* =========================
   TEAM GRID (add-only)
========================= */
/* Optional: section spacing on the team page */
.team-section {
  padding: clamp(28px, 5vw, 70px) 0;
}

/* Title like your screenshot */
.team-title h2 {
  text-align: center;
  letter-spacing: 4px;
  font-weight: 700;
  font-size: clamp(28px, 4vw, 46px);
  margin: 10px 0 34px;
}

/* Responsive grid:
   1 col phone, 2 col small, 3 col tablet, 4 col desktop */
.team-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(18px, 2.6vw, 28px);
  align-items: start;
}

@media (min-width: 560px) {
  .team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 900px) {
  .team-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1150px) {
  .team-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.team-card {
  display: flex;
  flex-direction: column;
}

/* Blue square behind PNG headshots */
.team-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--navy);
  border-radius: 0px; /* set to 16px if you prefer rounded */
  overflow: hidden;
  display: grid;
  place-items: center;

  box-shadow: 0 12px 26px rgba(var(--navy-rgb), 0.15);
}

/* PNG stays centred and clean */
.team-photo img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;      /* fills the square */
  object-position: center top !important;
  filter: none !important;           /* optional: remove shadow if you want cleaner edges */
}


/* Name + role */
.team-name {
  margin-top: 20px; /* was larger before */
  margin: 14px 0 0;
  font-size: 18px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-weight: 800;
}

.team-role {
  margin: 4px 0 0;
  color: rgba(var(--navy-rgb), 0.78);
  font-size: 14px;
  font-weight: 500;
}

/* Extra info list */
.team-meta {
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.team-meta-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}

.team-meta dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(var(--navy-rgb), 0.62);
  font-weight: 700;
}

.team-meta dd {
  margin: 0;
  font-size: 14px;
  color: rgba(var(--navy-rgb), 0.88);
  font-weight: 500;
}

/* Subtle hover */
@media (hover: hover) {
  .team-photo {
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  }
  .team-card:hover .team-photo {
    transform: translateY(-3px);
    border-color: rgba(var(--navy-rgb), 0.14);
    box-shadow: 0 18px 34px rgba(var(--navy-rgb), 0.22);
  }
}
/* === HARD RESET spacing under team image === */
.team-photo {
  margin-bottom: 0 !important;
}

.team-card h3,
.team-name {
  margin-top: 4px !important;
  margin-bottom: 0 !important;
  line-height: 1.15;
}

.team-role {
  margin-top: 2px !important;
}
/* === Remove any border/gap inside the blue team square === */
.team-photo {
  padding: 0 !important;
  line-height: 0 !important;
}

.team-photo img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  object-fit: cover !important;
  object-position: center top !important;
}
/* =========================
   GALLERY (Instagram grid + Load More)
   Paste at bottom of styles.css
========================= */

/* Keeps content below your fixed header */
.gallery-page {
  padding-top: clamp(110px, 16vw, 150px);
  padding-bottom: clamp(40px, 7vw, 80px);
}

/* Title styling to match your vibe */
.gallery-title {
  text-align: center;
  letter-spacing: 4px;
  font-weight: 700;
  font-size: clamp(28px, 4vw, 46px);
  margin: 0 0 clamp(22px, 4vw, 40px);
}

/* Grid: 1 col phone, 2 col tablet, 3 col desktop */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(14px, 2vw, 22px);
}

@media (min-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Tile */
.gallery-item {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; /* Instagram square look */
  overflow: hidden;
  background: rgba(var(--navy-rgb), 0.04);
  border: 1px solid rgba(var(--navy-rgb), 0.10);
  box-shadow: 0 18px 30px rgba(var(--navy-rgb), 0.15);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

/* Image fills tile */
.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scale(1.01);
  transition: transform 240ms ease, filter 240ms ease;
}

/* Hover effect */
@media (hover: hover) {
  .gallery-item:hover {
    transform: translateY(-3px);
    border-color: rgba(var(--navy-rgb), 0.35);
    box-shadow: 0 24px 40px rgba(var(--navy-rgb), 0.22);
  }
  .gallery-item:hover img {
    transform: scale(1.05);
    filter: contrast(1.02) saturate(1.05);
  }
  /* subtle overlay */
  .gallery-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(var(--navy-rgb), 0.32), rgba(0,0,0,0));
    opacity: 0;
    transition: opacity 220ms ease;
    pointer-events: none;
  }
  .gallery-item:hover::after {
    opacity: 1;
  }
}

/* Hidden items for "Load more" */
.gallery-item.is-hidden {
  display: none;
}

/* Button area */
.gallery-actions {
  display: flex;
  justify-content: center;
  margin-top: clamp(22px, 4vw, 36px);
}

/* Load more button */
.gallery-load-more {
  appearance: none;
  border: 2px solid var(--navy);
  background: transparent;
  color: var(--navy);
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}

@media (hover: hover) {
  .gallery-load-more:hover {
    transform: translateY(-2px);
    background: var(--navy);
    color: var(--white);
    box-shadow: 0 0 18px rgba(var(--navy-rgb), 0.35);
  }
}

.gallery-load-more:active {
  transform: translateY(0);
}
/* =========================
   HISTORY TIMELINE (paste at bottom)
========================= */

.history-page {
  padding-top: clamp(110px, 16vw, 150px); /* space under fixed header */
  padding-bottom: clamp(50px, 7vw, 90px);
}

.history-hero {
  text-align: center;
  margin-bottom: clamp(22px, 4vw, 38px);
}

.history-title {
  letter-spacing: 4px;
  font-weight: 700;
  font-size: clamp(28px, 4vw, 46px);
  margin: 0 0 10px;
}

.history-subtitle {
  margin: 0 auto;
  max-width: 70ch;
  color: rgba(var(--navy-rgb), 0.78);
  line-height: 1.6;
}

.history-footnote {
  margin-top: 26px;
  text-align: center;
  color: rgba(var(--navy-rgb), 0.65);
  font-size: 0.95rem;
}
.history-footnote code {
  color: rgba(var(--navy-rgb), 0.85);
}

/* Timeline container */
.timeline {
  position: relative;
  padding: 10px 0;
}

/* The center line (sticky feeling) */
.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(var(--navy-rgb), 0.12);
}

/* The “fill” that grows as you scroll */
.timeline-line-fill {
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 0%;
  background: var(--navy);
  box-shadow: 0 0 18px rgba(var(--navy-rgb), 0.35);
}

/* Each item */
.timeline-item {
  position: relative;
  scroll-margin-top: 120px; /* jump-to-year lands below the fixed header */
  display: grid;
  grid-template-columns: 1fr 80px 1fr; /* left | line | right */
  align-items: start;
  padding: clamp(16px, 2.4vw, 24px) 0;
}

/* Dot on the line */
.timeline-dot {
  grid-column: 2;
  justify-self: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--navy);
  box-shadow: 0 0 0 6px rgba(var(--navy-rgb), 0.18);
  margin-top: 18px;
}

/* Card */
.timeline-card {
  background: rgba(var(--navy-rgb), 0.04);
  border: 1px solid rgba(var(--navy-rgb), 0.10);
  box-shadow: 0 18px 30px rgba(var(--navy-rgb), 0.15);
  overflow: hidden;
  padding: 14px;
  max-width: 520px;
}

/* Alternate left/right on desktop */
.timeline-item:nth-child(odd) .timeline-card {
  grid-column: 1;
  justify-self: end;
  margin-right: 10px;
}
.timeline-item:nth-child(even) .timeline-card {
  grid-column: 3;
  justify-self: start;
  margin-left: 10px;
}

/* Year label */
.timeline-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.timeline-year {
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 1.1rem;
}
.timeline-carname {
  color: rgba(var(--navy-rgb), 0.7);
  font-weight: 700;
  letter-spacing: 1px;
}

/* Image */
.timeline-media {
  display: block;
  aspect-ratio: 16 / 9;
  background: rgba(var(--navy-rgb), 0.06);
  border: 1px solid rgba(var(--navy-rgb), 0.10);
  overflow: hidden;
  margin-bottom: 12px;
}
.timeline-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
/* portrait photos and programme scans: show the whole image */
.timeline-media.is-portrait img {
  object-fit: contain;
}

/* Extra images for a car */
.timeline-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 12px;
}
.timeline-thumb {
  appearance: none;
  width: 72px;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 2px solid transparent;
  background: rgba(var(--navy-rgb), 0.06);
  overflow: hidden;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 160ms ease, border-color 160ms ease;
}
.timeline-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.timeline-thumb:hover,
.timeline-thumb.is-active {
  opacity: 1;
  border-color: var(--navy);
}

/* Info rows */
.timeline-info {
  display: grid;
  gap: 8px;
}
.info-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.info-label {
  color: rgba(var(--navy-rgb), 0.62);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}
.info-value {
  color: rgba(var(--navy-rgb), 0.88);
  font-weight: 600;
  font-size: 0.95rem;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(var(--navy-rgb), 0.08);
  font-size: 0.85rem;
}

.timeline-notes {
  margin: 6px 0 0;
  color: rgba(var(--navy-rgb), 0.72);
  line-height: 1.5;
}

/* Hover polish */
@media (hover: hover) {
  .timeline-card {
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  }
  .timeline-card:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--navy-rgb), 0.35);
    box-shadow: 0 26px 40px rgba(var(--navy-rgb), 0.22);
  }
}

/* Mobile: single column, line on the left */
@media (max-width: 900px) {
  .timeline-line {
    left: 18px;
    transform: none;
  }

  .timeline-item {
    grid-template-columns: 40px 1fr;
    padding: 18px 0;
  }

  .timeline-dot {
    grid-column: 1;
    justify-self: center;
    margin-top: 20px;
  }

  .timeline-item .timeline-card {
    grid-column: 2;
    justify-self: stretch;
    max-width: 100%;
    margin: 0 0 0 10px;
  }

  .timeline-item:nth-child(odd) .timeline-card,
  .timeline-item:nth-child(even) .timeline-card {
    grid-column: 2;
    justify-self: stretch;
    margin-left: 10px;
    margin-right: 0;
  }
}
  

/* Floating jump-to-year / back-to-top controls */
.history-controls {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid rgba(var(--navy-rgb), 0.15);
  box-shadow: 0 10px 24px rgba(var(--navy-rgb), 0.18);
  font-size: 14px;
}
.history-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.history-control select {
  font: inherit;
  color: var(--navy);
  background: var(--white);
  border: 1px solid rgba(var(--navy-rgb), 0.3);
  border-radius: 999px;
  padding: 4px 10px;
}
.history-control-btn {
  appearance: none;
  font: inherit;
  font-weight: 700;
  color: var(--white);
  background: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
@media (hover: hover) {
  .history-control-btn:hover {
    background: transparent;
    color: var(--navy);
  }
}
