/* ============================================================
   HURON — Human–Robot Interaction Lab, McMaster University
   Direction A "Precision" — design system
   ============================================================ */

/* ---- Design tokens ---------------------------------------- */
:root {
  /* color */
  --ink:          #14242b;
  --ink-soft:     #42565d;
  --muted:        #52656c;
  --muted-2:      #5c6f76;
  --bg:           #f6f8f9;
  --surface:      #ffffff;
  --line:         #dde5e8;
  --line-strong:  #c5d1d5;
  --accent:       #0e7c86;
  --accent-dark:  #0a5f67;
  --dark:         #0e2a30;
  --dark-ink:     #e7f1f2;
  --dark-muted:   #9fc0c4;
  --bright:       #35d6c0;
  --bright-ink:   #06262b;

  /* type */
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans:  'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono:  'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* layout */
  --container: 1180px;
  --gutter: 56px;
}

/* ---- Reset ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
::selection { background: #b8e6df; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---- Layout primitives ------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding: 64px 0; }
.section--tight { padding: 48px 0; }

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 14px 28px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); }
.btn--ghost { border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--bright { background: var(--bright); color: var(--bright-ink); font-weight: 500; white-space: nowrap; }
.btn--bright:hover { background: #5fe3d2; }

.textlink {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-decoration: none;
}
.textlink:hover { text-decoration: underline; }

/* ---- Header ----------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 248, 249, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
}
.brand-logo {
  height: 30px;
  width: auto;
  display: block;
}
.brand-divider { width: 1px; height: 16px; background: var(--line-strong); }
.brand-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  text-transform: uppercase;
}
.nav {
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: 14px;
}
.nav a {
  color: #33464d;
  text-decoration: none;
  transition: color .15s ease;
}
.nav a:hover,
.nav a.is-active { color: var(--accent); }
.nav .nav-cta {
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 8px 16px;
  font-size: 13px;
}
.nav .nav-cta:hover { background: var(--accent); color: #fff; }
.nav .nav-cta.is-active { background: var(--accent); color: #fff; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  margin-inline: auto;
  background: var(--ink);
  transition: transform .2s ease, opacity .2s ease;
}

/* ---- Hero ------------------------------------------------- */
.hero { padding: 80px 0 64px; }
.hero .kicker { margin-bottom: 26px; }
.hero h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.06;
  letter-spacing: -0.015em;
  max-width: 16ch;
  margin-bottom: 28px;
}
.hero .lead {
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 640px;
  margin-bottom: 40px;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 16px; }

/* ---- Hero media / carousel -------------------------------- */
.hero-grid {
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  gap: 56px;
  align-items: center;
}
.hero-copy { min-width: 0; }
.hero-media { min-width: 0; }

.carousel { position: relative; }
.carousel-viewport {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .7s ease;
}
.slide.is-current { opacity: 1; z-index: 2; }
/* Self-heal: if the environment doesn't animate, swaps become instant
   (set by JS) so a slide can never be frozen mid-fade. */
.carousel.is-static .slide { transition: none; }

.slide-photo {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(45deg, #dde6e8 0 12px, #e9f0f1 12px 24px);
  color: #7e93a0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}
/* Drop-in for real imagery: <img class="slide-img" src=… alt=…> */
.slide-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.carousel-cap {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
  margin: 0;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #fff;
  background: rgba(14, 42, 48, 0.72);
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.carousel-arrow:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.carousel-arrow--prev { left: 12px; }
.carousel-arrow--next { right: 12px; }

.carousel-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--line-strong);
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.carousel-dot.is-current { background: var(--accent); transform: scale(1.25); }

/* ---- Hero with full-bleed carousel background -------------- */
.hero--media {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: clamp(540px, 80vh, 760px);
  padding: 96px 0;
}
.hero--media .container { position: relative; z-index: 2; width: 100%; }
.hero--media .hero-copy { max-width: 660px; }

.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-bg .carousel,
.hero-bg .carousel-viewport {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  height: 100%;
  border: none;
}
.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8, 24, 28, 0.88) 0%, rgba(8, 24, 28, 0.55) 48%, rgba(8, 24, 28, 0.22) 100%),
    linear-gradient(0deg, rgba(8, 24, 28, 0.45) 0%, rgba(8, 24, 28, 0) 38%);
}

/* Darker placeholder so light text reads before real photos are added */
.hero--media .slide-photo {
  background: repeating-linear-gradient(45deg, #16343b 0 16px, #1c3f47 16px 32px);
  color: rgba(255, 255, 255, 0.4);
}

/* Light text over the imagery */
.hero--media .kicker { color: #7fded2; }
.hero--media h1 { color: #fff; }
.hero--media .lead { color: rgba(255, 255, 255, 0.86); }
.hero--media .btn--ghost { border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.hero--media .btn--ghost:hover { background: #fff; color: var(--ink); border-color: #fff; }

/* Controls over the background */
.hero--media .carousel-arrow { display: none; }
.hero--media .carousel-dots {
  position: absolute;
  z-index: 4;
  bottom: 22px;
  left: var(--gutter);
  margin: 0;
  justify-content: flex-start;
}
.hero--media .carousel-dot { background: rgba(255, 255, 255, 0.45); }
.hero--media .carousel-dot.is-current { background: #fff; transform: scale(1.25); }

/* ---- Stats strip ------------------------------------------ */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat { padding: 28px 32px; border-right: 1px solid var(--line); }
.stat:first-child { padding-left: 0; }
.stat:last-child { border-right: none; }
.stat .num {
  font-family: var(--font-serif);
  font-size: 34px;
  line-height: 1.1;
}
.stat .num--sm { font-size: 28px; }
.stat .lbl {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-top: 8px;
}

/* ---- Section heading -------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
}
.section-head h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 34px);
}

/* ---- Cards ------------------------------------------------ */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.cards--three { grid-template-columns: repeat(3, 1fr); }
.card {
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.card-body { padding: 26px 26px 30px; }
.card .idx {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.card h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 23px;
  margin: 8px 0 10px;
}
.card p { font-size: 15px; line-height: 1.6; color: var(--muted); }

/* ---- Placeholders (drop real imagery here) ---------------- */
.ph {
  background: repeating-linear-gradient(45deg, #dde6e8 0 10px, #e9f0f1 10px 20px);
  display: grid;
  place-items: center;
  color: #869aa1;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: center;
  overflow: hidden;
}
.ph--fig    { aspect-ratio: 16 / 9; }
.ph--wide   { aspect-ratio: 24 / 7; }
.ph--avatar { aspect-ratio: 1; border-radius: 50%; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Publications list ------------------------------------ */
.pub-group + .pub-group { margin-top: 8px; }
.pub-year-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 26px 0 10px;
}
.pubs { border-top: 1px solid var(--line); }
.pub {
  display: grid;
  grid-template-columns: 84px 1fr 180px;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.pub .yr { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.pub .ttl { font-size: 16px; line-height: 1.5; }
.pub .ttl a {
  color: inherit;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.pub .ttl a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.pub .venue { font-family: var(--font-mono); font-size: 12px; color: var(--muted-2); }

/* ---- People ----------------------------------------------- */
.people-group { margin-bottom: 56px; }
.people-group > h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 28px;
  margin-bottom: 28px;
}
.people-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 28px 24px;
}
.person { text-align: left; }
.person .ph--avatar { margin-bottom: 14px; }
.person .name { font-size: 15px; font-weight: 500; }
.person .role {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-top: 4px;
}

/* ---- Page hero (subpages) --------------------------------- */
.page-hero { padding: 72px 0 8px; }
.page-hero .kicker { margin-bottom: 22px; }
.page-hero h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(36px, 4.4vw, 54px);
  line-height: 1.07;
  letter-spacing: -0.01em;
}
.page-hero .lead {
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 620px;
  margin-top: 22px;
}

/* ---- CTA band --------------------------------------------- */
.cta { background: var(--dark); color: var(--dark-ink); }
.cta .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding-block: 64px;
}
.cta h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(28px, 3.2vw, 36px);
  line-height: 1.12;
  margin-bottom: 12px;
}
.cta p { font-size: 16px; color: var(--dark-muted); max-width: 600px; }

/* ---- Contact ---------------------------------------------- */
.contact-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 64px;
  align-items: start;
}
.contact-detail { margin-bottom: 26px; }
.contact-detail .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 6px;
}
.contact-detail .value { font-size: 17px; }
.contact-detail a { color: var(--accent); text-decoration: none; }
.contact-detail a:hover { text-decoration: underline; }

/* ---- Footer ----------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 40px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}

/* ---- Scroll reveal ----------------------------------------
   Hidden state only applies when JS is on (.js set in <head>
   before first paint, so there's no flash). Reduced-motion
   users see everything immediately. */
.js .hero-copy > *,
.js .page-hero .container > *,
.js .stats,
.js .section-head,
.js .card,
.js .pub-year-label,
.js .pub,
.js .people-group > h2,
.js .person,
.js .lead-note,
.js .cta .container > *,
.js .contact-grid > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s cubic-bezier(.22, .61, .36, 1),
              transform .6s cubic-bezier(.22, .61, .36, 1);
  will-change: opacity, transform;
}
.js .is-visible { opacity: 1 !important; transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  .js .hero-copy > *, .js .page-hero .container > *, .js .stats, .js .section-head,
  .js .card, .js .pub-year-label, .js .pub, .js .people-group > h2,
  .js .person, .js .lead-note, .js .cta .container > *, .js .contact-grid > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ---- Utilities -------------------------------------------- */
.lead-note {
  font-size: 15px;
  color: var(--muted);
  margin-top: 28px;
}
.lead-note a { color: var(--accent); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  :root { --gutter: 40px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { border-bottom: 1px solid var(--line); }
  .stat:nth-child(2) { border-right: none; }
  .stat:first-child { padding-left: 32px; }
  .people-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .brand-sub, .brand-divider { display: none; }
  .nav-toggle { display: flex; }
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 20px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
  }
  .nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav a { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav .nav-cta {
    border: none;
    color: var(--accent);
    padding: 14px 0;
  }
  .nav .nav-cta:hover,
  .nav .nav-cta.is-active { background: none; color: var(--accent-dark); }
  .cards, .cards--three { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; gap: 40px; }
  .cta .container { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 620px) {
  :root { --gutter: 24px; }
  .hero { padding: 56px 0 48px; }
  .stats { grid-template-columns: 1fr; }
  .stat { border-right: none; padding: 24px 0 !important; }
  .people-grid { grid-template-columns: repeat(2, 1fr); }
  .pub { grid-template-columns: 1fr; gap: 6px; }
  .pub .venue { color: var(--muted); }
  .section-head { flex-direction: column; gap: 10px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
}
