/* ==========================================================================
   coreysmith.ca — site stylesheet
   Mobile-first, no frameworks, no JavaScript required.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --ink: #15202b;
  --muted: #4a5663;
  --line: #d9e0e7;
  --link: #004d80;
  --link-hover: #800e0d;
  --accent: #800e0d;
  --focus: #0b6bcb;
  --chip-bg: transparent;

  --card-1: #004d80;
  --card-2: #052133;
  --card-3: #800e0d;

  --shadow: 0 1px 2px rgb(16 30 44 / 0.06), 0 8px 24px rgb(16 30 44 / 0.07);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(1rem, 4vw, 2rem);
  --maxw: 66rem;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1620;
    --surface: #152231;
    --surface-2: #1b2b3c;
    --ink: #e8eef4;
    --muted: #b0bcc8;
    --line: #2a3b4d;
    --link: #8cc4ff;
    --link-hover: #ffb4ab;
    --accent: #ff9d94;
    --focus: #7ab8ff;
    --chip-bg: #ffffff; /* logos are dark-on-transparent: keep them on white */
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.35);
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem; /* 17px */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 0.14em;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
  color: var(--bg);
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Brand bar (affiliation logos) ---------- */
.brandbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brandbar .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 0.9rem;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
  margin-inline: -0.6rem;
  background: var(--chip-bg);
  border-radius: 10px;
}

.logo-link img {
  display: block;
  height: 3rem;
  width: auto;
}

@media (max-width: 30em) {
  .logo-link img {
    height: 2.35rem;
  }
}

/* ---------- Section navigation ---------- */
.sitenav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.sitenav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.25rem;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
}

.sitenav a {
  display: block;
  padding: 0.7rem 0.8rem;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.sitenav a:hover,
.sitenav a:focus-visible {
  color: var(--link);
  border-bottom-color: var(--accent);
}

@media (min-width: 48em) {
  .sitenav {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .sitenav ul {
    gap: 0 1rem;
  }

  .sitenav a {
    font-size: 1rem;
  }
}

/* ---------- Pills (buttons / profile links) ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem; /* comfortable touch target */
  padding: 0.4rem 1.05rem 0.4rem 0.6rem;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgb(16 30 44 / 0.05);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.pill:hover {
  color: var(--ink);
  border-color: var(--link);
  box-shadow: var(--shadow);
}

.pill img,
.pill svg {
  width: 1.7rem;
  height: 1.7rem;
  flex: none;
  border-radius: 50%;
}

/* ---------- Hero (dark, image-led) ---------- */
.hero {
  --focus: #7ab8ff;
  background: #000; /* matches the black surround of the retinal mosaic exactly */
  color: #fff;
  overflow: hidden;
}

.hero .wrap {
  display: grid;
  gap: 1.5rem;
  align-items: center;
  padding-block: clamp(1.5rem, 5vw, 3.5rem) 1rem;
}

.hero-figure {
  order: -1; /* image first on small screens */
  margin: 0;
  justify-self: center;
  width: min(100%, 30rem);
}

.hero-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.identity {
  display: grid;
  justify-items: center;
  text-align: center;
}

.portrait {
  width: 9rem;
  aspect-ratio: 1;
  margin-bottom: 1.25rem;
  border-radius: 50%;
  background: #1b2630;
  box-shadow: 0 0 0 4px #fff, 0 0 0 5px rgb(255 255 255 / 0.25);
}

.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.hero h1 {
  margin-bottom: 0.6rem;
  color: #fff;
  font-size: clamp(2.1rem, 1.3rem + 3.2vw, 3.3rem);
  letter-spacing: -0.02em;
}

.hero .role {
  margin: 0;
  font-size: 1.05rem;
  color: #c9d4de;
}

.hero .role strong {
  color: #fff;
  font-weight: 650;
}

.hero .affil {
  margin-top: 0.9rem;
}

.hero .mission {
  max-width: 36rem;
  margin: 1.25rem 0 0;
  color: #e8eef4;
  font-size: 1.1rem;
  line-height: 1.6;
}

.actions,
.profile-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}

.hero .pill {
  background: rgb(255 255 255 / 0.08);
  border-color: rgb(255 255 255 / 0.32);
  color: #fff;
  box-shadow: none;
}

.hero .pill:hover {
  background: rgb(255 255 255 / 0.18);
  border-color: #fff;
  color: #fff;
}

.hero .pill--solid {
  padding-left: 1.3rem;
  padding-right: 1.3rem;
  background: #fff;
  border-color: #fff;
  color: #04233a;
}

.hero .pill--solid:hover {
  background: #dcebf7;
  border-color: #dcebf7;
  color: #04233a;
}

.pill--sm {
  min-height: 2.5rem;
  padding: 0.3rem 0.95rem 0.3rem 0.5rem;
  font-size: 0.95rem;
}

.pill--sm:not(:has(img)) {
  padding-left: 0.95rem;
}

/* OCT scan strip under the hero */
.scanband {
  margin: 0;
  padding: 0.5rem var(--gutter) 2.25rem;
}

.scanband img {
  display: block;
  width: 100%;
  max-width: 1004px;
  height: auto;
  margin-inline: auto;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}

@media (min-width: 52em) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 2.5rem;
    padding-block: clamp(2rem, 4vw, 3.5rem) 0.5rem;
  }

  .hero-figure {
    order: 0;
    justify-self: end;
    width: 100%;
    max-width: 38rem;
  }

  .identity {
    justify-items: start;
    text-align: left;
  }

  .hero .mission {
    margin-inline: 0;
  }

  .actions,
  .profile-links {
    justify-content: flex-start;
  }
}

/* ---------- Page sections ---------- */
main > section {
  padding-block: clamp(2.5rem, 6vw, 4rem);
}

main > section + section {
  border-top: 1px solid var(--line);
}

.section-title {
  position: relative;
  margin-bottom: 1.75rem;
  padding-top: 1rem;
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem);
}

.section-title::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3rem;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
}

.prose {
  font-size: 1.1rem;
}

.prose > :last-child {
  margin-bottom: 0;
}

/* Current Projects: a plain numbered list with hairline rules (no boxes) */
.priorities {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: priority;
  border-bottom: 1px solid var(--line);
}

.priorities li {
  position: relative;
  padding: 0.95rem 0 0.95rem 3.25rem;
  border-top: 1px solid var(--line);
  counter-increment: priority;
  font-size: 1.1rem;
  font-weight: 600;
}

.priorities li::before {
  content: counter(priority, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.95rem;
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Sub-heading inside a section */
.subhead {
  margin: 3rem 0 1rem;
  font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem);
}

/* Research themes: coloured cards */
.cards {
  display: grid;
  gap: 1.1rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

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

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 1.75rem 1.5rem 1.6rem;
  color: #fff;
  text-align: center;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.theme-card:nth-child(1) { background: var(--card-1); }
.theme-card:nth-child(2) { background: var(--card-2); }
.theme-card:nth-child(3) { background: var(--card-3); }

.theme-icon {
  width: 5.5rem;
  height: 5.5rem;
  margin-bottom: 1rem;
}

.theme-card h3 {
  margin-bottom: 0.6rem;
  font-size: 1.3rem;
}

.theme-card p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: rgb(255 255 255 / 0.94);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-card {
    border: 1px solid rgb(255 255 255 / 0.12);
  }

  :root:not([data-theme="light"]) .theme-card:nth-child(2) {
    background: #0a3250;
  }
}

/* Callout: a simple accent rule instead of a box */
.callout {
  margin-top: 2.75rem;
  padding: 0.15rem 0 0.15rem 1.25rem;
  border-left: 4px solid var(--accent);
}

.callout > :last-child {
  margin-bottom: 0;
}

/* Team: cards */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.person {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
  padding: 1.2rem 1.3rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.person h3 {
  margin-bottom: 0.3rem;
  font-size: 1.2rem;
}

.person p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

/* Headshot: swap the file in index.html for a real photo (square, 240x240 or larger) */
.headshot {
  flex: none;
  width: 4.75rem;
  height: 4.75rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
  box-shadow: 0 0 0 3px var(--surface);
}

.person--feature {
  display: block;
  background: color-mix(in srgb, var(--link) 8%, var(--bg));
  border-color: color-mix(in srgb, var(--link) 35%, var(--line));
}

.person--feature p {
  margin-top: 0.35rem;
}

/* Publications (grouped by year) */
.pub-year {
  display: grid;
  gap: 0.25rem 2rem;
  padding-block: 1.1rem 0.4rem;
  border-top: 1px solid var(--line);
}

.pub-year:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.pub-year h3 {
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1.3;
}

@media (min-width: 48em) {
  .pub-year {
    grid-template-columns: 8rem minmax(0, 1fr);
  }

  .pub-year h3 {
    position: sticky;
    top: 5rem;
    align-self: start;
    padding-top: 0.5rem;
  }
}

.pubs {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pubs li {
  padding: 0.7rem 0 0.9rem;
  border-bottom: 1px dashed var(--line);
  line-height: 1.6;
  overflow-wrap: anywhere; /* long DOI URLs must never force sideways scroll */
}

.pubs li:last-child {
  border-bottom: 0;
}

.pubs strong {
  font-weight: 700;
}

.pubs a {
  font-size: 0.95em;
}

.pdf-link {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.5rem;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 0.78rem !important;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  vertical-align: 0.1em;
}

.pdf-link:hover {
  background: var(--link-hover);
  border-color: var(--link-hover);
  color: #fff;
}

.pubmed-cta {
  margin-top: 2rem;
}

/* Support logos */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.logo-grid a {
  display: grid;
  place-items: center;
  height: 7.5rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.logo-grid a:hover {
  border-color: var(--link);
  box-shadow: var(--shadow);
}

.logo-grid img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 4.5rem;
}

/* Contact */
.contact-grid {
  display: grid;
  gap: 1.25rem 3rem;
}

@media (min-width: 44em) {
  .contact-grid {
    grid-template-columns: 1.2fr 1fr;
  }
}

.contact-grid h3 {
  margin-bottom: 0.4rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-grid address {
  font-style: normal;
}

.contact-grid p {
  margin-bottom: 0.4rem;
}

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 2rem 2.5rem;
  border-top: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.site-footer p {
  margin: 0 0 0.25rem;
}

.site-footer a {
  color: inherit;
}

/* ---------- Large screens ---------- */

/* ---------- Forced-colors / high-contrast mode ---------- */
@media (forced-colors: active) {
  .theme-card {
    border: 1px solid CanvasText;
  }

  .section-title::before {
    background: CanvasText;
  }
}

/* ---------- Print ---------- */
@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --ink: #000;
    --muted: #333;
    --line: #bbb;
  }

  .skip-link,
  .sitenav,
  .profile-links,
  .pubmed-cta {
    display: none !important;
  }

  body {
    font-size: 11pt;
  }

  .hero {
    background: none;
    color: #000;
  }

  .hero-figure,
  .scanband,
  .actions {
    display: none !important;
  }

  .hero h1,
  .hero .role,
  .hero .role strong,
  .hero .mission {
    color: #000;
  }

  .hero .wrap,
  main > section {
    padding-block: 1rem;
  }

  .theme-card {
    color: #000;
    background: none !important;
    border: 1px solid #999;
    box-shadow: none;
  }

  .theme-card p {
    color: #000;
  }

  .theme-icon {
    filter: invert(1);
  }

  .pubs li,
  .person,
  .theme-card {
    break-inside: avoid;
  }

  a {
    color: #000;
  }
}
