/* =========================================================
   BRAND PALETTE
   - Dark green base: #1F3431
   - Greys: #435452, #5C6B69, #8E9997, #C3C9C8, #FFFFFF
   - Yellows: #FFD700, #FFE246, #FFEA7E, #FFF5BB
   ========================================================= */

/* ---------------------------------------------------------
   CSS Variables (easy to tweak later)
   --------------------------------------------------------- */
:root {
  --bg-dark: #1F3431;
  --text-light: #FFFFFF;

  --grey-1: #C3C9C8;
  --grey-2: #8E9997;
  --grey-3: #5C6B69;
  --grey-4: #435452;

  --accent-yellow: #FFD700;
  --accent-yellow-2: #FFE246; /* hover */
  --accent-yellow-soft: #FFEA7E;
  --accent-yellow-pale: #FFF5BB;

  --max-width: 1100px;

  /* Layout knobs */
  --section-divider: rgba(0, 0, 0, 0.12);

  /* “Why GeoIntelligence” two-column */
  --who-gap: 1.5rem;
  --who-image-width: 33%;
  --who-radius: 6px;
  --who-fade-start: 0%;
  --who-fade-solid: 75%;
  --who-image-opacity: 0.8;
  --who-image-sat: 0.9;
  --who-image-contrast: 0.97;

  /* Fieldwork strip */
  --fieldwork-copy-max: 58rem;
  --photo-gap: 1rem;
  --photo-radius: 14px;
  --photo-min-h: 220px;
  --photo-shadow: 0 10px 28px rgba(0,0,0,0.10);
  --photo-border: 1px solid rgba(0,0,0,0.08);
  --caption-size: 0.9rem;
  --caption-color: rgba(0,0,0,0.62);
}

/* ---------------------------------------------------------
   Base / Reset-ish
   --------------------------------------------------------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Open Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #FFFFFF;
  color: #111;
  line-height: 1.5;
}

.container {
  width: min(var(--max-width), calc(100% - 2rem));
  margin-inline: auto;
}

.section-divider {
  border: none;
  height: 1px;
  background: var(--section-divider);
  margin: 3rem 0;
}

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */
.site-header {
  background: var(--bg-dark);
  color: var(--text-light);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0;
}

.brand-link {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* Header CTA */
.header-nav .nav-link {
  background: var(--accent-yellow);
  color: var(--bg-dark);
  text-decoration: none;
  font-weight: 700;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  transition: background 0.2s ease, transform 0.15s ease;
}

.header-nav .nav-link:hover,
.header-nav .nav-link:focus {
  background: var(--accent-yellow-2);
  transform: translateY(-1px);
}

/* ---------------------------------------------------------
   HERO
   --------------------------------------------------------- */
.hero {
  background-image: url("../images/leduc_rally.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 72vh;
  position: relative;
  color: var(--text-light);

  display: flex;
  align-items: flex-end;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    to bottom,
    rgba(31, 52, 49, 0.05) 0%,
    rgba(31, 52, 49, 0.95) 52%
  );
}

.hero > .container.hero-content {
  position: relative;
  z-index: 1;
  padding: 3.5rem 0 3rem 0;
}

.hero .hero-title,
.hero .hero-subtitle,
.hero .hero-logo,
.hero .hero-actions {
  max-width: 720px;
}

.hero-title {
  margin: 0 0 0.75rem 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 700;
  line-height: 1.12;
}

.hero-subtitle {
  margin: 0 0 1.25rem 0;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  color: rgba(255, 255, 255, 0.92);
}

.hero-logo { margin-bottom: 1rem; }

.hero-logo img {
  width: 220px;
  max-width: 100%;
  height: auto;
  opacity: 0.95;
}

/* Buttons */
.btn {
  font: inherit;
  display: inline-block;
  text-decoration: none;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.8rem 1.05rem;
  border: 2px solid transparent;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.btn-primary {
  background: var(--accent-yellow);
  color: var(--bg-dark);
  border-color: var(--accent-yellow);
}

.btn-primary:hover {
  background: var(--accent-yellow-2);
  border-color: var(--accent-yellow-2);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-light);
  border-color: rgba(255, 215, 0, 0.85);
}

.btn-ghost:hover {
  background: rgba(255, 215, 0, 0.12);
  transform: translateY(-1px);
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Section Lede */
.platform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.platform-media img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.platform-media figcaption {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.5rem;
  text-align: center;
}

.platform-actions {
  margin-top: 1.5rem;
  text-align: center;
}

@media (max-width: 768px) {
  .platform-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   PROBLEM SECTION – text + map preview (tunable)
   ========================================================= */
.section-problem{
  /* --- TUNING KNOBS (adjust these) --- */
  --problem-gap: 2.25rem;

  /* Column control:
     text gets remaining space, map column fixed/clamped */
  --problem-map-col: clamp(360px, 40vw, 560px);

  /* Map box size control (keeps preview from getting too tall) */
  --problem-map-max-h: 420px;

  /* Your preview ratio (800 / 522 ≈ 1.533) */
  --problem-map-ratio: 800 / 522;

  /* Fade controls (reuse your existing vars or tune here) */
  --problem-fade-start: var(--who-fade-start, 0%);
  --problem-fade-solid: var(--who-fade-solid, 0%);

  /* Image look */
  --problem-img-opacity: var(--who-image-opacity, 0.95);
  --problem-img-sat: var(--who-image-sat, 1);
  --problem-img-contrast: var(--who-image-contrast, 1);
}

.section-problem{
  --problem-fade-enabled: 1; /* fade toggle 1-on 0-off */
}


.section-problem .problem-grid{
  display: grid;
  grid-template-columns: 1fr var(--problem-map-col);
  gap: 1.25; /* gap between columns */
  margin-top: 1.25rem;
  align-items: center; /* vertically center map beside text */
}

.section-problem .problem-text{
  min-width: 0;
}

/* Map container */
.section-problem .problem-media{
  position: relative;
  overflow: hidden;
  border-radius: var(--who-radius, 16px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(31, 52, 49, 0.02);
  margin: 0;

  /* Key: give it a predictable shape + size cap */
  aspect-ratio: var(--problem-map-ratio);
  max-height: var(--problem-map-max-h);
  width: 100%;
  align-self: center;

  /* Fade/mask (same idea as your who-media) */
.section-problem .problem-media{
  -webkit-mask-image: 
    linear-gradient(
      to right,
      rgba(0,0,0,0) calc(var(--problem-fade-enabled) * var(--problem-fade-start)),
      rgba(0,0,0,0.4) 50%,
      rgba(0,0,0,1) calc(var(--problem-fade-enabled) * var(--problem-fade-solid))
    );
  mask-image:
    linear-gradient(
      to right,
      rgba(0,0,0,0) calc(var(--problem-fade-enabled) * var(--problem-fade-start)),
      rgba(0,0,0,0.4) 50%,
      rgba(0,0,0,1) calc(var(--problem-fade-enabled) * var(--problem-fade-solid))
    );
}

}

/* The preview image */
.section-problem .problem-media img{
  width: 100%;
  height: auto;          /* <- change from 100% */
  display: block;
  max-height: 100%;

  object-fit: contain;
  object-position: center; /* same as 50% 50% */

  opacity: var(--problem-img-opacity);
  filter: saturate(var(--problem-img-sat)) contrast(var(--problem-img-contrast));
}

/* Fallback when mask isn't supported */
@supports not (mask-image: linear-gradient(to right, #000, transparent)) {
  .section-problem .problem-media::after{
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
      to right,
      rgba(255,255,255,1) 0%,
      rgba(255,255,255,0) 38%
    );
  }
}

@media (max-width: 768px){

  .section-problem .problem-grid{
    grid-template-columns: 1fr;
    align-items: start;
  }

  .section-problem .problem-media{
    display: block;
    width: 100%;              /* IMPORTANT */
    max-width: 100%;          /* IMPORTANT */
    box-sizing: border-box;   /* IMPORTANT (padding + border stay inside) */

    max-height: none;
    aspect-ratio: auto;

    -webkit-mask-image: none;
    mask-image: none;

    margin-top: 1.25rem;
  }

  .section-problem .problem-media img{
    display: block;
    width: 100%;              /* IMPORTANT */
    max-width: 100%;          /* IMPORTANT */
    height: auto;

    object-fit: contain;
    object-position: center;
  }
}




/* ---------------------------------------------------------
   Why GeoIntelligence (two-column)
   --------------------------------------------------------- */
.who-grid {
  display: grid;
  grid-template-columns: 1fr var(--who-image-width);
  gap: var(--who-gap);
  margin-top: 1.25rem;
  align-items: stretch;
}

.who-text { min-width: 0; }

.who-media {
  position: relative;
  overflow: hidden;
  border-radius: var(--who-radius);
  min-height: 320px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(31, 52, 49, 0.02);

  -webkit-mask-image: linear-gradient(
    to right,
    rgba(0,0,0,0) var(--who-fade-start),
    rgba(0,0,0,0.4) 50%,
    rgba(0,0,0,1) var(--who-fade-solid)
  );
  mask-image: linear-gradient(
    to right,
    rgba(0,0,0,0) var(--who-fade-start),
    rgba(0,0,0,0.4) 50%,
    rgba(0,0,0,1) var(--who-fade-solid)
  );
}

.who-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 55% 55%;
  display: block;

  opacity: var(--who-image-opacity);
  filter: saturate(var(--who-image-sat)) contrast(var(--who-image-contrast));
}

@supports not (mask-image: linear-gradient(to right, #000, transparent)) {
  .who-media::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
      to right,
      rgba(255,255,255,1) 0%,
      rgba(255,255,255,0) 38%
    );
  }
}

@media (max-width: 768px) {
  .who-grid {
    grid-template-columns: 1fr;
  }

  .who-media {
    display: none;
  }
}



/* ---------------------------------------------------------
   Fieldwork (copy + 3-photo strip)
   --------------------------------------------------------- */
.article-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-link:hover { text-decoration-thickness: 2px; }

.fieldwork h2 { margin-bottom: 1rem; }

.fieldwork-intro { max-width: var(--fieldwork-copy-max); margin-bottom: 1rem; }

.fieldwork-intro p { margin: 0 0 0.65rem 0; }

.photo-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--photo-gap);
  margin-top: 1.25rem;
}

.photo-card { margin: 0; }

.photo-card img {
  width: 100%;
  height: var(--photo-min-h);
  object-fit: cover;
  object-position: center;

  display: block;
  border-radius: var(--photo-radius);
  box-shadow: var(--photo-shadow);
  border: var(--photo-border);

  filter: saturate(0.98) contrast(1.02);
}

.photo-card figcaption {
  margin-top: 0.55rem;
  font-size: var(--caption-size);
  color: var(--caption-color);
}

/* Per-image framing tweaks */
.photo-card:nth-child(1) img { object-position: 40% 45%; }
.photo-card:nth-child(2) img { object-position: 50% 35%; }
.photo-card:nth-child(3) img { object-position: 50% 38%; }

/* ---------------------------------------------------------
   FAQ
   --------------------------------------------------------- */
.faq-preview {
  max-width: 820px;
  margin: 4rem auto 0 auto;
  padding: 0 1.5rem;
}

.faq-preview h2 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 2rem;
}

.faq-preview .faq-item { margin-bottom: 1.75rem; }

.faq-preview .faq-item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.4rem 0;
}

.faq-preview .faq-item p {
  margin: 0;
  line-height: 1.55;
  color: rgba(0, 0, 0, 0.8);
}

/* ---------------------------------------------------------
   CONTACT (Centered CTA + Message modal)
   --------------------------------------------------------- */
.section.contact { padding: 4.5rem 0; }

.contact .contact-inner {
  max-width: 1000px; /* FIX: add unit */
  margin: 0 auto;
}

.contact .section-divider {
  background: rgba(0, 0, 0, 0.10);
  margin: 0 0 2.25rem 0;
}

.contact h2 { margin: 0 0 1.25rem 0; }

.contact p {
  margin: 0 0 1rem 0;
  line-height: 1.55;
  color: rgba(0, 0, 0, 0.82);
  max-width: 120ch;
}

/* Centered CTA layout */
.contact-primary {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.contact-card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 16px;
  padding: 1.5rem 1.5rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
}

.contact-card--primary {
  max-width: 520px;
  width: 100%;
  padding: 1.75rem 1.75rem;
}

.contact-card-title {
  margin: 0 0 0.6rem 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.contact-note {
  margin: 0 0 1.25rem 0;
  color: rgba(0, 0, 0, 0.78);
  line-height: 1.5;
}

.contact-cta {
  width: 100%;
  text-align: center;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-radius: 999px;
}

/* Divider between primary and secondary */
.contact-divider {
  margin: 2rem 0 1.5rem 0;
  width: 100%;
  max-width: 420px;
}

.contact-divider span {
  display: block;
  height: 1px;
  background: rgba(0, 0, 0, 0.12);
}

/* Secondary message link */
.contact-secondary {
  font-size: 0.95rem;
  color: rgba(0, 0, 0, 0.7);
  margin: 0;
}

.contact-secondary strong { font-weight: 500; }

.secondary-link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  font: inherit;
}

.secondary-link-btn:hover { text-decoration-thickness: 2px; }

/* ---------------------------------------------------------
   Message Modal (scoped to #messageModal to avoid collisions
   with About modal styles)
   --------------------------------------------------------- */
#messageModal {
  position: fixed;
  inset: 0;
  display: none; /* toggled by JS */
  z-index: 9999;
}

#messageModal.is-open { display: block; }

#messageModal .modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

#messageModal .modal__dialog {
  position: relative;
  width: min(640px, calc(100% - 2rem));
  margin: 6vh auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  padding: 1.25rem 1.25rem 1.35rem 1.25rem;
  max-height: 88vh;
  overflow: auto;
}

#messageModal .modal__close {
  position: absolute;
  top: 0.85rem;
  right: 0.9rem;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: #fff;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#messageModal .modal__title {
  margin: 0 0 1rem 0;
  padding-right: 3rem;
  font-size: 1.25rem;
}

#messageModal #contactForm {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

#messageModal #contactForm input,
#messageModal #contactForm textarea {
  width: 100%;
  font: inherit;
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  outline: none;
}

#messageModal #contactForm textarea {
  resize: vertical;
  min-height: 140px;
}

#messageModal #contactForm input:focus,
#messageModal #contactForm textarea:focus {
  border-color: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
}

#messageModal .submit-btn {
  width: 100%;
  border: 0;
  cursor: pointer;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  background: var(--accent-yellow);
  color: var(--bg-dark);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

#messageModal .submit-btn:hover {
  background: var(--accent-yellow-2);
  transform: translateY(-1px);
}

#messageModal .form-success {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(0, 0, 0, 0.02);
}

#messageModal .form-success h4 { margin: 0 0 0.25rem 0; }
#messageModal .form-success p { margin: 0; }

/* ---------------------------------------------------------
   Footer
   --------------------------------------------------------- */
.site-footer {
  background: var(--bg-dark);
  color: #ffd700;
  padding: 1.75rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.25rem;
}

.footer-col-left { justify-self: start; }

.footer-copy {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.footer-rights {
  margin: 0.25rem 0 0 0;
  font-size: 0.95rem;
}

.footer-col-center {
  justify-self: center;
  text-align: center;
}

.footer-links {
  display: grid;
  gap: 0.45rem;
  justify-items: center;
}

.footer-links a {
  color: #ffd700;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.15px;
  transition: color 140ms ease, transform 120ms ease, text-decoration-color 140ms ease;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: #c3aa23;
  transform: translateY(-1px);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: #c3aa23;
}

.footer-col-right { justify-self: end; }

.footer-logo {
  width: 200px;
  max-width: 100%;
  height: auto;
  opacity: 0.95;
}

/* ---------------------------------------------------------
   About Modal (scoped to #aboutModal; uses aria-hidden toggle)
   --------------------------------------------------------- */
#aboutModal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 1.25rem;
  background: rgba(17, 24, 23, 0.65);
  backdrop-filter: blur(6px);
  z-index: 9999;
}

#aboutModal[aria-hidden="false"] { display: grid; }

#aboutModal .modal-content {
  width: min(760px, 100%);
  max-height: min(82vh, 900px);
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  padding: 1.6rem 2rem 1.4rem 2rem;
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.26);
  position: relative;
}

#aboutModal .close {
  position: sticky;
  top: 0;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.92);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: rgba(0,0,0,0.60);
  z-index: 2;
}

#aboutModal .close:hover { color: rgba(0,0,0,0.85); }

#aboutModal h2 {
  margin: -2.2rem 0 0.75rem 0;
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: 0.2px;
  color: rgba(0,0,0,0.86);
}

#aboutModal p {
  margin: 0 0 0.9rem 0;
  line-height: 1.55;
  color: rgba(0,0,0,0.78);
  max-width: 66ch;
}

#aboutModal p strong { color: rgba(0,0,0,0.88); }

#aboutModal a {
  color: rgba(31, 52, 49, 0.95);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(31, 52, 49, 0.35);
}

#aboutModal a:hover,
#aboutModal a:focus-visible {
  color: var(--accent-yellow);
  text-decoration-color: rgba(255, 215, 0, 0.75);
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
  }

  .footer-col-left,
  .footer-col-center,
  .footer-col-right {
    justify-self: center;
  }

  .footer-col-center { order: 1; }
  .footer-col-right  { order: 2; }
  .footer-col-left   { order: 3; }

  .footer-logo { width: 110px; }
}

@media (max-width: 768px) {
  /* Stack the photo strip */
  .photo-strip {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .photo-card img {
    height: auto;
    aspect-ratio: 1 / 1.2;
    transform: scale(1.01);
    transform-origin: center;
    object-fit: cover;
    filter: saturate(0.95) contrast(0.98);
  }

  /* Fine-tune per image */
  .photo-field img { object-position: 50% 35%; }
  .photo-industry img { object-position: 50% 45%; }
  .photo-public img { object-position: 50% 30%; }

  .photo-card figcaption {
    font-size: 0.85rem;
    margin-top: 0.45rem;
    text-align: left;
  }
}

@media (max-width: 600px) {
  .hero {
    min-height: 78vh;
    background-position: 55% center;
  }

  .header-inner { padding: 0.75rem 0; }

  #messageModal .modal__dialog {
    margin: 3vh auto;
    padding: 1.1rem 1rem 1.15rem 1rem;
  }

  #aboutModal .modal-content {
    padding: 1.1rem 1rem 1rem 1rem;
    border-radius: 16px;
    max-height: 86vh;
  }

  #aboutModal h2 {
    font-size: 1.35rem;
    margin-top: -2.0rem;
  }

  #aboutModal p { max-width: 100%; }
}
