/* =========================================================================
   Canadian Science Centre — styles.css

   Structure:
     1. Design tokens (:root)      — carry unchanged into a future Astro build
     2. Reset & base
     3. Layout primitives (.wrap, .section)
     4. Typography helpers
     5. Header & navigation
     6. Hero
     7. Sections, prose, sources
     8. Figures (photos)
     9. Points, cards, callout, contact
    10. Footer
    11. Buttons
    12. Motion & reduced-motion
    13. Responsive breakpoints
   ========================================================================= */

/* 1. Design tokens --------------------------------------------------------- */
:root {
  /* Colour */
  --navy:        #0a1f44;
  --navy-700:    #0c2551;
  --navy-deep:   #071634;
  --red:         #c8102e;
  --red-dark:    #a20c25;
  --ink:         #1b2436;   /* body text on light backgrounds */
  --ink-soft:    #45526b;   /* captions, meta, secondary text */
  --paper:       #ffffff;
  --paper-tint:  #f3f6fc;   /* alternating section background */
  --line:        #d8e0ef;
  --focus:       #1e5bd6;

  /* Type */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;

  --step-eyebrow: clamp(0.75rem, 0.68rem + 0.35vw, 0.9rem);
  --step-body:    clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-lede:    clamp(1.125rem, 1.05rem + 0.5vw, 1.375rem);
  --step-h3:      clamp(1.125rem, 1.03rem + 0.5vw, 1.35rem);
  --step-h2:      clamp(1.6rem, 1.3rem + 1.6vw, 2.5rem);
  --step-h1:      clamp(2.1rem, 1.5rem + 3.2vw, 3.75rem);

  /* Space & shape */
  --space-section: clamp(3.5rem, 2.5rem + 4vw, 6.5rem);
  --wrap-max: 68rem;
  --wrap-pad: clamp(1.25rem, 0.8rem + 2.2vw, 2.5rem);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(10, 31, 68, 0.06), 0 12px 32px rgba(10, 31, 68, 0.10);

  --transition: 220ms ease;
}

/* 2. Reset & base ------------------------------------------------------------ */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
picture,
svg { max-width: 100%; }

img { height: auto; display: block; }

a { color: var(--red-dark); }

a:hover { color: var(--red); }

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  color: var(--navy);
  margin: 0 0 0.5em;
  text-wrap: balance;
}

p { margin: 0 0 1rem; }

ul { margin: 0; padding: 0; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Utilities */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  background: var(--navy);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top var(--transition);
}
.skip-link:focus { top: 1rem; color: #fff; }

/* 3. Layout primitives ---------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--wrap-max);
  margin-inline: auto;
  padding-inline: var(--wrap-pad);
}

.section { padding-block: var(--space-section); }
.section--tint { background: var(--paper-tint); }

/* Text-first blocks keep a comfortable reading measure. */
.section__body > .prose,
.section__body > .callout,
.section__body > .sources,
.section__body > .contact-card,
.section__body > .section__note,
.section__body > .byline,
.section__body > p { max-width: 46rem; }
/* .points, .cards and .context-media use the full container width. */

/* 4. Typography helpers -------------------------------------------------------- */
.eyebrow,
.kicker {
  font-family: var(--font-body);
  font-size: var(--step-eyebrow);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}

.kicker { color: var(--red-dark); }

.kicker--flag {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  letter-spacing: 0.1em;
}

h2 { font-size: var(--step-h2); margin-bottom: 0.75em; }
h3 { font-size: var(--step-h3); }

.prose > p { max-width: 42rem; }
.prose > p:last-child { margin-bottom: 0; }

.section__note {
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 2rem;
}

.byline {
  font-family: var(--font-display);
  font-size: var(--step-h3);
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 1.25rem;
}

/* 5. Header & navigation --------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--navy);
  font-weight: 700;
}
.brand__mark { color: var(--navy); display: inline-flex; }
.brand__name {
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.2rem);
  letter-spacing: 0.01em;
}

.nav { display: flex; align-items: center; }

.nav__menu {
  list-style: none;
  display: flex;
  gap: clamp(1rem, 0.3rem + 2vw, 2.25rem);
}

.nav__menu a {
  text-decoration: none;
  color: var(--navy);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0.4rem 0.15rem;
  border-bottom: 2px solid transparent;
}
.nav__menu a:hover,
.nav__menu a:focus-visible { border-bottom-color: var(--red); color: var(--navy); }

.nav__toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
}
.nav__toggle-bars,
.nav__toggle-bars::before,
.nav__toggle-bars::after {
  content: "";
  display: block;
  width: 20px;
  height: 2px;
  background: var(--navy);
  position: relative;
}
.nav__toggle-bars::before { position: absolute; top: -6px; }
.nav__toggle-bars::after  { position: absolute; top: 6px; }

/* 6. Hero --------------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  background: linear-gradient(160deg, var(--navy-700) 0%, var(--navy) 45%, var(--navy-deep) 100%);
  color: #eef2fb;
  padding-block: clamp(3.5rem, 2rem + 9vw, 8rem);
  overflow: clip;
}
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.hero__motif {
  position: absolute;
  right: -8%;
  top: -14%;
  width: min(58rem, 90%);
  height: auto;
  opacity: 0.9;
}
.hero__inner { position: relative; }
.hero .eyebrow { color: #9db4e3; }
.hero h1 {
  color: #fff;
  font-size: var(--step-h1);
  max-width: 20ch;
  margin-bottom: 0.6em;
}
.hero__lede { max-width: 40rem; }
.hero__lede p { font-size: var(--step-lede); color: #d7e0f4; }
.hero__lede p:last-child { margin-bottom: 0; }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.hero__status {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: #b9c6e6;
  border-left: 3px solid var(--red);
  padding-left: 0.9rem;
  max-width: 40rem;
}

/* 7. Sources ------------------------------------------------------------------ */
.sources {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.section:not(.section--tint) .sources { background: var(--paper-tint); }
.sources__title {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
}
.sources ul { list-style: none; display: grid; gap: 0.5rem; }
.sources li { padding-left: 1.1rem; position: relative; }
.sources li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.62em;
  width: 6px; height: 6px;
  background: var(--red);
  border-radius: 50%;
}
.sources a { color: var(--navy); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.sources a:hover { color: var(--red-dark); }

/* 8. Figures (photos) ------------------------------------------------------- */
.context-media {
  margin-top: 2.75rem;
  display: grid;
  gap: 1.75rem 2rem;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  max-width: 100%;
}

.figure { margin: 0; }
.figure img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.figure figcaption {
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* Building: dominant — full column width, large. */
.figure--prominent img { aspect-ratio: 4 / 3; object-fit: cover; }
.figure--prominent figcaption { font-weight: 600; color: var(--ink); }

/* Ford: secondary — deliberately smaller and quieter. */
.figure--aside { max-width: 15rem; }
.figure--aside img { aspect-ratio: 3 / 4; object-fit: cover; }

/* 9. Points, cards, callout, contact ------------------------------------------ */
.points {
  display: grid;
  gap: 1.5rem;
  margin: 2rem 0;
  align-items: start;
}
.point {
  padding: 1.5rem 1.6rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius);
}
.section:not(.section--tint) .point { background: var(--paper-tint); }
.point h3 { margin-top: 0; }
.point p:last-child { margin-bottom: 0; }
.point__source {
  margin-top: 1rem;
  font-size: 0.88rem;
}
.point__source a { color: var(--ink-soft); }

.cards {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem;
}
.card {
  padding: 1.6rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(10, 31, 68, 0.05);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card h3 { margin-top: 0; }
.card h3::before {
  content: "";
  display: block;
  width: 2rem;
  height: 3px;
  background: var(--red);
  margin-bottom: 0.75rem;
}
.card p:last-child { margin-bottom: 0; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.callout {
  margin: 2rem 0;
  padding: 1.6rem 1.75rem;
  background: var(--navy);
  color: #eef2fb;
  border-radius: var(--radius);
}
.callout__lead { font-weight: 700; color: #fff; margin-bottom: 0.9rem; }
.tick-list { list-style: none; display: grid; gap: 0.65rem; }
.tick-list li { padding-left: 1.6rem; position: relative; }
.tick-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.45em;
  width: 0.7rem; height: 0.4rem;
  border-left: 2px solid var(--red);
  border-bottom: 2px solid var(--red);
  transform: rotate(-45deg);
}

.contact-card {
  margin-top: 2rem;
  padding: 1.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-tint);
}
.section--tint .contact-card { background: var(--paper); }
.contact-card__name { font-weight: 700; color: var(--navy); margin-bottom: 0.25rem; }
.contact-card__email { margin-bottom: 1.25rem; }
.contact-card__email a { font-size: var(--step-lede); overflow-wrap: anywhere; }

/* 10. Footer --------------------------------------------------------------- */
.site-footer {
  background: var(--navy-deep);
  color: #b9c6e6;
  padding-block: clamp(2.5rem, 1.8rem + 3vw, 4rem);
  font-size: 0.92rem;
}
.site-footer__inner { display: grid; gap: 1.75rem; }
.site-footer a { color: #dbe4f7; }
.site-footer a:hover { color: #fff; }
.site-footer__disclaimer p { max-width: 60ch; margin-bottom: 0.6rem; }
.credits__title {
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8fa2cd;
  margin-bottom: 0.6rem;
}
.site-footer__credits ul { list-style: none; display: grid; gap: 0.6rem; }
.site-footer__credits li { max-width: 70ch; }
.site-footer__verified {
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #8fa2cd;
}

/* 11. Buttons ------------------------------------------------------------------ */
.btn {
  display: inline-block;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
}
.btn--primary { background: var(--red); color: #fff; }
.btn--primary:hover { background: var(--red-dark); color: #fff; transform: translateY(-2px); }
.btn--ghost { border-color: rgba(255, 255, 255, 0.55); color: #fff; }
.btn--ghost:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); color: #fff; transform: translateY(-2px); }

.section .btn--primary:focus-visible,
.hero .btn:focus-visible { outline-offset: 4px; }

/* 12. Motion & reduced-motion -------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  .js .reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 500ms ease, transform 500ms ease;
  }
  .js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 13. Responsive breakpoints ------------------------------------------------- */

/* Two-up photo layout once there is room — building stays dominant. */
@media (min-width: 46rem) {
  .context-media {
    grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr);
    align-items: end;
  }
  .figure--aside { max-width: 100%; }
}

/* Collapse primary nav into a disclosure menu. */
@media (max-width: 45rem) {
  .nav { position: relative; }

  .nav__toggle { display: inline-flex; }

  .nav__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.6rem);
    flex-direction: column;
    gap: 0;
    min-width: 12rem;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.4rem;
  }

  .nav__menu:not(.is-open) { display: none; }

  .nav__menu li { width: 100%; }
  .nav__menu a {
    display: block;
    padding: 0.7rem 0.75rem;
    border-bottom: 0;
    border-radius: var(--radius-sm);
  }
  .nav__menu a:hover,
  .nav__menu a:focus-visible { background: var(--paper-tint); border-bottom: 0; }
}

@media (min-width: 52rem) {
  .points { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 58rem) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}
