:root {
  --bg-color: #7ea0c0; /* Light pastel blue-grey */
  --text-color: #334155; /* Slate 700 */
  --primary-color: #fff; /* Deep Royal Blue (Premium) */
  --accent-color: #fbbf24; /* Warm Gold */
  --footer-bg-color: #2c3e50;
  --modal-bg-color: #fff;
  /* Hexagon Dimensions (Flat-Topped) */
  /* Width = 15.625rem */
  /* Height = ~13.5rem (sqrt(3)/2 * 15.625rem) */
  --hex-width: 15.625rem;
  --hex-height: 13.5rem;

  /* Spacing */
  --hex-gap: 0.625rem;

  /* Geometry Calculations */
  /* Side Length = Width / 2 = 7.8125rem */
  /* Horizontal: Center to Center = Width * 0.75 = 11.71875rem */
  /* We need items to overlap by Width * 0.25 = 3.90625rem */
  /* Adjusted for gap: Margin Right = -3.4375rem approx */
  --hex-margin-right: -3.4375rem;

  /* Vertical Toggle Offset */
  /* Half Height = 6.75rem + small gap adjustment */
  --row-offset: 7.0625rem;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Roboto", sans-serif;
  background-color: var(--bg-color);
  margin: 0;
  padding: 0;
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

header {
  text-align: center;
  margin: 3.125rem 0 1.25rem 0;
  color: var(--primary-color);
}

header h1 {
  font-family: "Adelle", "Roboto Slab", serif;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.125rem;
  margin: 0;
  text-shadow: 0.125rem 0.125rem 0.25rem rgba(0, 0, 0, 0.5);
  color: var(--primary-color);
  font-style: bold;
}

/* Honeycomb Grid Container */
.honeycomb {
  /* margin top to deal with second column offset */
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
  max-width: 81.25rem;
  margin: var(--row-offset) auto auto;
  padding-block: 1.25rem;
}

.hex-item-wrapper {
  position: relative;
}

/* Hex Item */
.hex-item {
  width: var(--hex-width);
  height: var(--hex-height);
  flex-shrink: 0;
  position: relative;

  /* Flat Topped Hexagon Clip Path */
  /* Points: Left(0, 50%), TopLeft(25%, 0%), TopRight(75%, 0%), Right(100%, 50%), BotRight(75%, 100%), BotLeft(25%, 100%) */
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);

  background: white;
  margin-right: var(--hex-margin-right);
  /* Pull rows up slightly to tighten vertical gap */
  margin-bottom: var(--hex-gap);

  cursor: pointer;
  transition: transform 0.3s ease;

  /* Shadows don't work well on clipped elements directly. 
     We usually need a wrapper or drop-shadow filter on the element itself if supported.
  */
  filter: drop-shadow(0 0.3125rem 0.625rem rgba(0, 0, 0, 0.1));
}

button.hex-item {
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  background: white; /* Default unless overridden */
  appearance: none;
  -webkit-appearance: none;
  text-align: left; /* Reset default center */
}

/* Interlocking Logic: Shift every Even item DOWN to create the "Zig Zag" mesh */
/* .hex-item:nth-child(even),
.hex-item:nth-child(odd) {
  margin-top: calc(var(--row-offset) / 2);
} */

/* Hover Effect */
.hex-item:hover,
button.hex-item:focus-visible {
  outline: none;
  transform: scale(1.05); /* Slight zoom */
  transition-delay: 0s;
  filter: drop-shadow(
    0 0.9375rem 1.25rem rgba(0, 31, 63, 0.2)
  ); /* Deep blue shadow */
}

/* Content Stacking */
.hex-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  object-position: 50% 30%;
}

.hex-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.95),
    rgba(0, 0, 0, 0.7)
  ); /* Primary Gradient */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0.625rem 1.5625rem; /* Stay within hex bounds */
}

.hex-name {
  font-family: "Myriad Pro", "Lucida Sans", "Lato", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: white;
  text-transform: uppercase;
  margin: 0;
  letter-spacing: 0.03125rem;
}

.hex-job {
  font-family: "Myriad Pro", "Lucida Sans", "Lato", sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: #bfdbfe; /* Light blue text */
  margin-top: 0.25rem;
}

/* Star Badge */
.star-badge {
  position: absolute;
  top: -0.625rem;
  right: -0.3125rem;
  color: var(--accent-color);
  font-size: 1.4rem;
  filter: drop-shadow(0 0.3125rem 0.3125rem rgba(0, 0, 0, 0.3));
  z-index: 1;
}

/* Footer & Modal (Keep relatively same but updated colors) */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: var(--footer-bg-color);
  color: white;
  padding: 1.875rem;
  margin-top: auto;
  display: flex;
  justify-content: center;
  font-family: "Arial Rounded MT Bold", "Varela Round", sans-serif;
  z-index: 2;
}

.footer-content {
  display: flex;
  align-items: center;
  gap: 1.875rem;
}

.contact a {
  color: white;
  text-decoration: none;
}

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

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.legend-item i {
  color: var(--accent-color);
}

.social-block {
  display: flex;
  align-items: center;
  gap: 1.875rem;
}

/* Modal Updates */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8); /* Dark Slate overlay */
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s,
    visibility 0.3s;
}

#close-modal {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  cursor: pointer;
  font-size: 2rem;
  color: #000;
  background: transparent;
  border: none;
  padding: 0;
  line-height: 1; /* Fix height issues */
}

.modal.visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  position: relative;
  background: var(--modal-bg-color);
  border-radius: 0.5rem; /* Sharper corners for modern look */
  max-width: 43.75rem;
  box-shadow: 0 1.5625rem 3.125rem -0.75rem rgba(0, 0, 0, 0.25);
  display: flex;
  overflow: hidden;
  color: #000;
}

.modal-img-wrapper {
  width: 100%;
  height: 31.25rem;
  overflow: hidden;
}

.modal-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 15%;
}

.modal-info {
  padding: 1.25rem;
}

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

#honeycomb-grid .col-2 {
  margin-top: calc(var(--row-offset) * -1);
}

#honeycomb-grid .col-3 {
  margin-top: 0;
}

#honeycomb-grid .col-2 > *:first-child::before,
#honeycomb-grid .col-3 > *:first-child::before,
#honeycomb-grid .col-4 > *:first-child::before,
#honeycomb-grid .col-5 > *:first-child::before {
  content: "";
  position: absolute;
  top: -0.625rem;
  left: -0.625rem;
  width: calc(var(--hex-width) + 1.5625rem);
  height: calc(var(--hex-height) + 1.375rem);
  flex-shrink: 0;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 97% 50%, 73% 3%, 27% 3%);
  background: white;
  border: 0.0625rem solid white;
  margin-bottom: var(--hex-gap);
  z-index: 0;
  cursor: pointer;
  filter: drop-shadow(0 0.3125rem 0.625rem rgba(0, 0, 0, 0.1));
}

#honeycomb-grid .col-4 {
  margin-top: calc(var(--row-offset));
}

#honeycomb-grid .col-5 {
  margin-top: calc(var(--row-offset) * 2);
}

#program-grid .col-2,
#program-grid .col-4 {
  margin-top: calc(var(--row-offset) * -1);
}

#program-grid .col-3,
#program-grid .col-5 {
  margin-top: calc(var(--row-offset) * 2);
  margin-top: 0;
}

/* Responsive Breakpoints - Controlling the "Grid Width" to force correct row wrapping */
/* With -55px margin, effective width is ~195px per item. */

/* Large Screens: 5 items wide (> 1100px) */
@media (min-width: 1100px) {
  .honeycomb {
    width: 65.625rem; /* Forces wrap after 5th item */
  }
}

/* Medium Screens: 4 items wide (850px - 1099px) */
/* Covers standard Landscape Tablets & Small Laptops */
@media (max-width: 1099px) and (min-width: 850px) {
  .honeycomb {
    width: 53.125rem; /* Approx 4 items */
  }

  .col-5 {
    margin-top: 0;
  }

  .col-5 > *:first-child::before {
    display: none;
  }
}

/* Tablet Portrait: 3 items wide (600px - 849px) */
/* Covers standard Portrait Tablets (e.g. iPad at 768px) */
@media (max-width: 849px) and (min-width: 600px) {
  .honeycomb {
    width: 40.625rem;
  }
}

/* Mobile: 2 items wide */
/* Mobile: 2 items wide (< 599px) */
@media (max-width: 599px) {
  :root {
    --hex-width: 12rem;
    --hex-height: 10.3923rem;
    --hex-margin-right: -2.76rem;
    --row-offset: 5.4rem;
  }

  .honeycomb {
    width: 22rem;
    margin-top: 5.4rem;
  }

  /* Adjust modal image height for mobile */
  .modal-img-wrapper {
    height: 18.75rem;
  }

  header h1 {
    font-size: 2rem;
  }

  .modal {
    padding: 1.25rem;
  }
}

/* Footer Responsiveness (Standard Tablet Breakpoint) */
@media (max-width: 768px) {
  footer {
    padding: 0.9375rem;
  }

  .footer-content {
    flex-direction: column;
    gap: 0.9375rem;
    text-align: center;
  }

  .legend-item {
    justify-content: center;
    font-size: 0.9rem;
  }

  .liste-info {
    font-size: 0.8rem;
  }

  .social-block {
    gap: 0.9375rem;
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* Program Section Specifics */

.program-grid {
  padding-block: 9.375rem;
}
