/* ============================================================
   Canada Covenant — layout & components
   ============================================================ */

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

.section {
  padding-block: var(--space-6);
}

.section--slim {
  padding-block: var(--space-5);
}

.section--tinted {
  background: var(--paper-dim);
}

.section__head {
  margin-bottom: var(--space-4);
}

.section__title {
  font-size: var(--text-2xl);
  max-width: 22ch;
}

.section__lede {
  margin-top: var(--space-3);
  font-size: var(--text-lg);
  color: var(--ink-soft);
}

/* ============================== Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.3s ease;
}

/* Added by JS once the hero has scrolled past, so the sticky bar
   separates from the light sections beneath it. */
.site-header.is-scrolled {
  box-shadow: 0 2px 16px rgba(9, 21, 64, 0.1);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header {
    background: var(--paper);
  }
}

.site-header__inner {
  width: min(100% - 3rem, var(--container));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 3.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand__mark {
  width: 2rem;
  height: auto;
  color: var(--ink);
  flex: none;
}

.brand__name {
  font-size: var(--text-sm);
  font-weight: var(--w-black);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-header__phone {
  font-size: var(--text-sm);
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.site-header__phone:hover {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

/* ============================== Hero */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper-on-dark);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100svh - 3.5rem);
  padding-block: var(--space-3) 0;
  isolation: isolate;
}

.hero__field {
  position: absolute;
  inset: 0;
  z-index: -2;
  /* Night-city photo anchors the right; navy scrims keep the left
     column and baseline readable. JS may swap --scene (see below).
     --scene-pos travels with the photo so its landmark stays in
     frame when narrow screens crop the width (the CN Tower sits at
     ~66% of the Toronto shot). */
  --scene: url("../assets/background_mississauga.JPG");
  --scene-pos: center right;
  background:
    linear-gradient(to bottom,
      rgba(9, 21, 64, 0) 55%,
      rgba(9, 21, 64, 0.75) 100%),
    linear-gradient(to right,
      rgba(9, 21, 64, 0.88) 0%,
      rgba(9, 21, 64, 0.45) 55%,
      rgba(9, 21, 64, 0.12) 100%),
    var(--scene) var(--scene-pos) / cover no-repeat var(--ink);
}

/* Narrow screens put the towers directly behind the text, so the
   scrim gets a uniform darkening layer on top. */
@media (max-width: 48em) {
  .hero__field {
    background:
      linear-gradient(
        rgba(9, 21, 64, 0.45),
        rgba(9, 21, 64, 0.45)
      ),
      linear-gradient(to bottom,
        rgba(9, 21, 64, 0) 55%,
        rgba(9, 21, 64, 0.75) 100%),
      linear-gradient(to right,
        rgba(9, 21, 64, 0.88) 0%,
        rgba(9, 21, 64, 0.45) 55%,
        rgba(9, 21, 64, 0.12) 100%),
      var(--scene) var(--scene-pos) / cover no-repeat var(--ink);
  }
}

.hero__glyph {
  position: absolute;
  z-index: -1;
  right: -6%;
  bottom: -12%;
  width: clamp(20rem, 55vw, 52rem);
  color: rgba(118, 146, 255, 0.13);
  pointer-events: none;
}

.hero__inner {
  padding-block: var(--space-4);
}

/* Lives inside the h1 so the keyword line is part of the heading */
.hero__eyebrow {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--w-semibold);
  line-height: 1.4;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--navy-on-dark);
  margin-bottom: var(--space-3);
}

.hero__title {
  font-size: var(--text-hero);
  line-height: 0.92;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}

/* Each line is a mask: the inner span rises out of it on load.
   The padding/margin pair gives tight leading some clip headroom
   without changing the layout. */
.hero__line {
  display: block;
  overflow: clip;
  padding-block: 0.06em;
  margin-block: -0.06em;
}

.hero__line-inner {
  display: block;
}

.hero__lede {
  font-size: var(--text-lg);
  color: var(--paper-on-dark-soft);
  margin-bottom: var(--space-4);
}

.hero__baseline {
  margin-top: auto;
  border-top: 1px solid var(--line-on-dark);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  justify-content: space-between;
  width: min(100% - 3rem, var(--container));
  margin-inline: auto;
  padding-block: var(--space-3);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-on-dark-soft);
}

/* ============================== Buttons */
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.75rem;
  font-size: var(--text-base);
  font-weight: var(--w-semibold);
  text-decoration: none;
  border-radius: var(--radius);
  transition: background-color 0.25s ease, color 0.25s ease,
    transform 0.25s ease;
}

.button--light {
  background: var(--paper);
  color: var(--ink);
}

.button--light:hover {
  background: var(--navy);
  color: var(--paper);
}

.button:active {
  transform: translateY(1px);
}

.button__arrow {
  display: inline-block;
  transition: transform 0.25s ease;
}

.button:hover .button__arrow {
  transform: translateX(0.3em);
}

/* ============================== Credentials (bento) */
.credentials__grid {
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 48em) {
  .credentials__grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-areas:
      "ins  ins    wsib"
      "crew radius radius";
  }

  .credential--ins { grid-area: ins; }
  .credential--wsib { grid-area: wsib; }
  .credential--crew { grid-area: crew; }
  .credential--radius { grid-area: radius; }
}

.credential {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: grid;
  gap: var(--space-1);
  align-content: start;
}

/* Top rule as a real element so GSAP can draw it in */
.credential__rule {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--ink);
  transform-origin: left center;
  transition: background-color 0.25s ease;
}

.credential:hover .credential__rule {
  background: var(--navy);
}

.credential__index {
  font-size: var(--text-sm);
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--navy);
  letter-spacing: 0.1em;
}

.credential__value {
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.credential--ins .credential__value {
  font-size: var(--text-2xl);
}

.credential__label {
  color: var(--ink-soft);
  max-width: 40ch;
}

/* Inverted anchor cell */
.credential--invert {
  background: var(--ink);
  border-color: var(--ink);
}

.credential--invert .credential__value { color: var(--paper-on-dark); }
.credential--invert .credential__label { color: var(--paper-on-dark-soft); }
.credential--invert .credential__index { color: var(--navy-on-dark); }
.credential--invert .credential__rule { background: var(--navy-on-dark); }

.credential--invert:hover .credential__rule {
  background: var(--paper-on-dark);
}

/* Radius cell: mini ring graphic echoing the service-area map */
.credential--radius {
  grid-template-columns: 1fr auto;
}

.credential--radius > * {
  grid-column: 1;
}

.credential__rings {
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: center;
  width: clamp(64px, 9vw, 96px);
  color: var(--navy);
  margin-left: var(--space-2);
}

/* ============================== Capabilities */
/* The rows wait offscreen shifted left/right before their reveal;
   clip the section so they never widen the page. */
.capabilities {
  overflow-x: clip;
}

.capabilities__list {
  counter-reset: cap;
  border-top: 1px solid var(--line);
}

.capability {
  position: relative;
  display: grid;
  gap: var(--space-2);
  padding-block: var(--space-4);
}

/* Bottom rule as a real element so GSAP can draw it across,
   mirroring the credential rules. */
.capability__rule {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--line);
  transform-origin: left center;
}

.capability__media {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.capability__media img {
  width: 100%;
  height: auto;
}

@media (min-width: 48em) {
  .capability {
    grid-template-columns: 8rem 1fr;
    grid-template-areas:
      "index body"
      "index media";
    gap: var(--space-3) var(--space-4);
  }

  .capability__index { grid-area: index; }
  .capability__body { grid-area: body; }
  .capability__media { grid-area: media; }
}

/* Wide screens: photo beside the text, alternating sides per row */
@media (min-width: 60em) {
  .capability {
    grid-template-columns: 8rem 1.1fr 1fr;
    grid-template-areas: "index body media";
    align-items: center;
    gap: var(--space-4) var(--space-5);
  }

  .capability--flip {
    grid-template-columns: 8rem 1fr 1.1fr;
    grid-template-areas: "index media body";
  }
}

.capability__index {
  font-size: var(--text-2xl);
  font-weight: var(--w-black);
  line-height: 1;
  letter-spacing: -0.03em;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--navy);
}

@supports not (-webkit-text-stroke: 1px black) {
  .capability__index {
    color: var(--navy);
  }
}

.capability__title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.capability__body p {
  color: var(--ink-soft);
}

.capabilities__invite {
  margin-top: var(--space-4);
  font-size: var(--text-lg);
  font-weight: var(--w-semibold);
}

.capabilities__invite a {
  color: var(--navy);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  transition: color 0.2s ease;
}

.capabilities__invite a:hover {
  color: var(--ink);
}

/* ============================== Training / certifications
   Inverted navy band: a deliberate dark beat between the light
   credentials grid and the tinted map, echoing the hero. */
.certs {
  background: var(--ink);
  color: var(--paper-on-dark);
}

.certs .section__head {
  margin-bottom: var(--space-4);
}

.certs .section__lede {
  color: var(--paper-on-dark-soft);
}

.certs :focus-visible {
  outline-color: var(--navy-on-dark);
}

.certs__grid {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 48em) {
  .certs__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.cert {
  display: grid;
  gap: var(--space-1);
  justify-items: start;
}

.cert__badge {
  width: 5rem;
  height: 5rem;
  margin-bottom: var(--space-2);
}

.cert__ring {
  fill: none;
  stroke: var(--navy-on-dark);
  stroke-width: 2.5;
  transform: rotate(-90deg);
  transform-origin: center;
}

.cert__icon {
  fill: none;
  stroke: var(--paper-on-dark);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cert__dot {
  fill: var(--paper-on-dark);
}

.cert__name {
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
}

.cert__desc {
  color: var(--paper-on-dark-soft);
  max-width: 32ch;
}

/* ============================== About
   The crew photo runs as the zone's background under a navy scrim,
   so the section reads as a scene, not a card. */
.about {
  position: relative;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper-on-dark);
  isolation: isolate;
}

.about__field {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom,
      rgba(9, 21, 64, 0.9) 0%,
      rgba(9, 21, 64, 0.72) 50%,
      rgba(9, 21, 64, 0.82) 100%),
    url("../assets/about-crew.jpg") center / cover no-repeat var(--ink);
}

.about__copy p {
  color: var(--paper-on-dark-soft);
}

.about :focus-visible {
  outline-color: var(--navy-on-dark);
}

.about__grid {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 48em) {
  .about__grid {
    grid-template-columns: 1fr 1.6fr;
  }

  .about__grid .section__head {
    margin-bottom: 0;
  }
}

.about__copy {
  display: grid;
  gap: var(--space-3);
}

/* ============================== Service area map */
.area__grid {
  display: grid;
  gap: var(--space-4);
  align-items: center;
}

@media (min-width: 60em) {
  .area__grid {
    grid-template-columns: 0.9fr 1.25fr;
    gap: var(--space-5);
  }

  .area__grid .section__head {
    margin-bottom: 0;
  }
}

.area__note {
  margin-top: var(--space-3);
  font-weight: var(--w-semibold);
}

.area__map {
  margin: 0;
  min-width: 0;
}

.area__map svg {
  width: 100%;
  height: auto;
}

.area__caption {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.map-lake {
  fill: rgba(171, 210, 250, 0.42);
}

.map-shore {
  fill: none;
  stroke: rgba(27, 44, 193, 0.45);
  stroke-width: 2;
}

.map-ring-faint {
  fill: none;
  stroke: rgba(9, 21, 64, 0.14);
  stroke-width: 1;
}

.map-ring-40 {
  fill: none;
  stroke: var(--navy);
  stroke-width: 2.5;
}

.map-chip rect {
  fill: var(--navy);
}

.map-chip text {
  font-family: var(--font);
  font-size: 15px;
  font-weight: var(--w-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  fill: var(--paper);
}

.map-dot {
  fill: var(--ink);
}

.map-dot--out {
  fill: rgba(9, 21, 64, 0.38);
}

.map-label {
  font-family: var(--font);
  font-size: 18px;
  font-weight: var(--w-semibold);
  fill: var(--ink);
}

.map-label--out {
  fill: rgba(9, 21, 64, 0.5);
}

.map-label--base {
  font-weight: var(--w-black);
  font-size: 20px;
}

.map-sublabel {
  font-family: var(--font);
  font-size: 13px;
  font-weight: var(--w-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  fill: var(--navy);
}

.map-base-dot {
  fill: var(--navy);
}

.map-base-ring,
.map-pulse {
  fill: none;
  stroke: var(--navy);
  stroke-width: 2;
}

.map-pulse {
  opacity: 0;
}

.map-meta line,
.map-meta path {
  stroke: var(--ink-soft);
  stroke-width: 1.5;
}

.map-meta path {
  fill: var(--ink-soft);
}

.map-meta text {
  font-family: var(--font);
  font-size: 14px;
  font-weight: var(--w-semibold);
  letter-spacing: 0.08em;
  fill: var(--ink-soft);
}

/* SVG text scales with the drawing — bump sizes on small screens
   so labels stay legible when the map shrinks. */
@media (max-width: 48em) {
  .map-label { font-size: 28px; }
  .map-label--base { font-size: 31px; }
  .map-sublabel { font-size: 20px; }
  .map-chip text { font-size: 22px; }
  .map-chip rect { x: 90px; width: 234px; y: 144px; height: 44px; }
  .map-meta text { font-size: 22px; }
}

/* ============================== Footer reveal
   On large screens the contact block and footer sit pinned beneath
   the page; the content above lifts away on scroll and uncovers
   them. Below 60em they flow normally (the stacked contact cards
   are taller than the viewport there, so pinning would hide them). */
@media (min-width: 60em) {
  main {
    position: relative;
    z-index: 1;
    background: var(--paper);
    box-shadow: 0 32px 64px rgba(9, 21, 64, 0.35);
  }

  .page-reveal {
    position: sticky;
    bottom: 0;
    z-index: 0;
  }

  /* Slimmer padding so contact + footer fit a laptop viewport;
     anything clipped at the very top during the reveal is padding. */
  .page-reveal .contact {
    padding-block: var(--space-5);
  }
}

/* ============================== Contact */
.contact {
  position: relative;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper-on-dark);
  isolation: isolate;
}

.contact .section__lede {
  color: var(--paper-on-dark-soft);
}

.contact__field {
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Second night-city photo, darker at the top where the section
     head sits. JS may swap --scene (see below); --scene-pos keeps
     the CN Tower (at ~66% of the Toronto shot) in narrow crops. */
  --scene: url("../assets/background_toronto.JPG");
  --scene-pos: 66% bottom;
  background:
    linear-gradient(to bottom,
      rgba(9, 21, 64, 0.9) 0%,
      rgba(9, 21, 64, 0.55) 45%,
      rgba(9, 21, 64, 0.35) 100%),
    var(--scene) var(--scene-pos) / cover no-repeat var(--ink);
}

/* Scene shuffle: main.js flips a coin per visit and may trade the
   two photos (hero ↔ contact). Without JS the default pairing holds. */
.scenes-swapped .hero__field {
  --scene: url("../assets/background_toronto.JPG");
  --scene-pos: 66% center;
}

.scenes-swapped .contact__field {
  --scene: url("../assets/background_mississauga.JPG");
  --scene-pos: center bottom;
}

.contact__glyph {
  position: absolute;
  z-index: -1;
  left: -10%;
  bottom: -16%;
  width: clamp(18rem, 46vw, 44rem);
  color: rgba(118, 146, 255, 0.13);
  pointer-events: none;
}

.contact__channels {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

@media (min-width: 48em) {
  .contact__channels {
    grid-template-columns: repeat(3, 1fr);
  }
}

.contact__channel {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 0.25rem;
  padding: var(--space-3);
  border: 1px solid var(--line-on-dark);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

/* Top rule as a real element so GSAP can draw it in,
   echoing the credential rules. */
.contact__channel-rule {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--navy-on-dark);
  transform-origin: left center;
}

.contact__channel:hover {
  border-color: var(--navy-on-dark);
  background: rgba(27, 44, 193, 0.32);
}

.contact__channel-label {
  font-size: var(--text-sm);
  font-weight: var(--w-semibold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--navy-on-dark);
}

.contact__channel-value {
  font-size: var(--text-xl);
  font-weight: var(--w-black);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

/* Long values (the email address) drop a step so they hold one line
   in a third-width column. */
.contact__channel-value--long {
  font-size: var(--text-lg);
  line-height: 2.2;
}

.contact__area {
  color: var(--paper-on-dark-soft);
  border-top: 1px solid var(--line-on-dark);
  padding-top: var(--space-3);
}

/* ============================== Footer */
.site-footer {
  background: var(--ink);
  color: var(--paper-on-dark-soft);
  border-top: 1px solid var(--line-on-dark);
  padding-block: var(--space-3);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.site-footer__mark {
  width: 1.5rem;
  height: auto;
  color: var(--paper-on-dark);
}

.site-footer__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
}

.site-footer__meta a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.site-footer__meta a:hover {
  color: var(--paper-on-dark);
  border-bottom-color: currentColor;
}
