/* ============================================================
   kaimckinnon.dev — styles
   Plain hand-written CSS. No framework, no build step.
   Design notes:
   - Palette: deep "ink" navy, warm paper, teal + amber accents.
     A nod to lab notebooks and clinical data — Kai's world.
   - Type: Fraunces (serif, for display) + Inter (for text),
     loaded from Google Fonts in each page's <head>.
   ============================================================ */

:root {
  --ink: #0c1a2b;          /* deep navy — hero, header band, footer */
  --ink-2: #132a44;        /* lighter ink for gradients */
  --paper: #faf6ef;        /* warm off-white page background */
  --card: #fffdf8;         /* card background */
  --text: #1d2733;         /* body text on light */
  --muted: #5a6a7a;        /* secondary text on light */
  --teal: #0f766e;         /* accent on light backgrounds */
  --teal-bright: #2dd4bf;  /* accent on dark backgrounds */
  --amber: #d97706;        /* second accent, used sparingly */
  --line: #e4dccb;         /* hairlines on paper */
  --radius: 14px;
  --shadow: 0 10px 30px rgba(12, 26, 43, 0.10);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

a { color: var(--teal); }
a:hover { color: var(--amber); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 246, 239, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

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

.monogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 2px solid transparent;
  background-image: linear-gradient(var(--ink), var(--ink)),
                    linear-gradient(135deg, var(--teal-bright), #2563eb);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  color: #f5efe3;
  font-size: 1.05rem;
  line-height: 1;
}

.site-nav { display: flex; gap: 6px; }

.site-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.98rem;
}

.site-nav a:hover { background: #f0e9da; color: var(--ink); }

.site-nav a.active {
  background: var(--ink);
  color: #f5efe3;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1.15rem;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--ink);
}

/* ---------- Hero (homepage + page banners) ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 70%, #1b3a5c 100%);
  color: #e9eef4;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
  z-index: 0;
}

/* The hero's navy fades out into the paper background below it,
   so the dark band melts into the page instead of ending in a hard line.
   The fade stays low: it only begins in the hero's last stretch, so
   most of the hero stays full navy. */
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  background: linear-gradient(to bottom, rgba(250, 246, 239, 0) 0%, rgba(250, 246, 239, 0.45) 60%, var(--paper) 100%);
  pointer-events: none;
  z-index: 1;
}

.page-banner::after { height: 40px; }

.hero-inner {
  position: relative;
  z-index: 2;
  padding: 84px 24px 120px;
}

/* On the homepage the navy fills nearly the whole first screen
   before fading into the paper below. */
.hero:not(.page-banner) .hero-inner {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-bright);
  border: 1px solid rgba(45, 212, 191, 0.45);
  padding: 5px 12px;
  border-radius: 999px;
  margin: 0 0 20px;
}

.hero h1 {
  color: #fdfbf7;
  font-size: 3.4rem;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}

.hero .tagline {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-style: italic;
  margin: 0 0 20px;
  background: linear-gradient(90deg, var(--teal-bright), #7dd3fc 60%, var(--teal-bright));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--teal-bright);
}

.hero .intro { max-width: 56ch; margin: 0 0 26px; color: #f2f7fb; }

/* White intro text inside a subpage's navy banner */
.banner-intro { max-width: 62ch; margin: 16px 0 0; color: #f2f7fb; font-size: 1.05rem; }
.banner-intro a { color: var(--teal-bright); }

/* Portrait "specimen card": photo on a paper card, slightly rotated,
   with a label strip — like a labelled figure in a lab notebook. */
.portrait-card {
  background: var(--paper);
  padding: 12px 12px 0;
  border-radius: 10px;
  transform: rotate(2deg);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
  max-width: 320px;
  justify-self: end;
  margin: 0;
}

.portrait-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 5px;
}

.portrait-card figcaption {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink);
  font-size: 0.95rem;
  text-align: center;
  padding: 10px 4px 12px;
}

/* Link pills on the dark hero */
.link-pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.link-pills a {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid rgba(233, 238, 244, 0.35);
  border-radius: 999px;
  color: #e9eef4;
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.18s ease;
}

.link-pills a:hover {
  border-color: var(--teal-bright);
  color: var(--teal-bright);
  transform: translateY(-2px);
}

/* Stat strip under the hero text */
.stat-strip {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid rgba(233, 238, 244, 0.18);
  margin-top: 48px;
  padding-top: 26px;
}

.stat { padding-right: 44px; margin-right: 44px; border-right: 1px solid rgba(233, 238, 244, 0.18); }
.stat:last-child { border-right: none; margin-right: 0; padding-right: 0; }

.stat .stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: #fdfbf7;
}

.stat .stat-num em { color: var(--teal-bright); font-style: normal; }

.stat .stat-label { font-size: 0.88rem; color: #c9d8e6; }

.section-lede { color: var(--muted); font-size: 1.05rem; margin: 8px 0 0; max-width: 62ch; }

/* Slim banner for subpages */
.page-banner .hero-inner { padding: 44px 24px 40px; }
.page-banner h1 { font-size: 2.5rem; margin: 0; }
.page-banner .tagline { margin-bottom: 0; }

/* ---------- Sections & cards ---------- */

.section { padding: 56px 0 8px; }

.section-head { margin-bottom: 26px; }

.section-head .kicker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 6px;
}

.section-head h2 { font-size: 2rem; margin: 0; }

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: var(--radius);
  padding: 26px 26px 22px;
  box-shadow: 0 2px 8px rgba(12, 26, 43, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:nth-child(2) { border-top-color: var(--amber); }

.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.card h3 { margin: 0 0 8px; font-size: 1.4rem; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--teal); }
.card p { margin: 0 0 14px; color: var(--muted); }

.card-link { font-weight: 600; text-decoration: none; }
.card-link::after { content: " \2192"; }

/* Featured-work cards borrow each product's own colours:
   Moleculeo's purple, Common Denominator's light blue. */
.card.moleculeo {
  background: linear-gradient(135deg, #2e1065 0%, #5b21b6 55%, #7c3aed 100%);
  border: none;
  color: #f4f0ff;
}
.card.moleculeo h3 a { color: #ffffff; }
.card.moleculeo h3 a:hover { color: #ddd3fb; }
.card.moleculeo p { color: #ddd3fb; }
.card.moleculeo .card-link {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  padding: 7px 14px;
  border-radius: 999px;
  display: inline-block;
}
.card.moleculeo .card-link:hover { background: rgba(255, 255, 255, 0.28); color: #ffffff; }

.card.cdmath {
  background: linear-gradient(135deg, #e0f2fe 0%, #aedcfb 55%, #7cc4f5 100%);
  border: none;
  color: var(--ink);
}
.card.cdmath p { color: #33506b; }
.card.cdmath .card-link {
  color: #075985;
  background: rgba(255, 255, 255, 0.55);
  padding: 7px 14px;
  border-radius: 999px;
  display: inline-block;
}
.card.cdmath .card-link:hover { background: rgba(255, 255, 255, 0.85); color: #0c4a6e; }

.more-link { margin-top: 22px; font-weight: 600; }

/* Projects page */
.project {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-bottom: 26px;
  box-shadow: 0 2px 8px rgba(12, 26, 43, 0.05);
}

.project.amber { border-left-color: var(--amber); }
.project h2 { margin: 0 0 4px; font-size: 1.7rem; }

.project-meta {
  color: var(--amber);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  margin: 0 0 14px;
}

.project img, .project video { max-width: 100%; border-radius: 8px; }

/* About page */
.about-intro { display: grid; grid-template-columns: 170px 1fr; gap: 28px; align-items: start; }
.about-top { display: grid; grid-template-columns: 200px 1fr; gap: 36px; align-items: start; }
.about-top .about-photo { width: 200px; height: 200px; }

/* Contact page */
.contact-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-bottom: 26px;
  box-shadow: 0 2px 8px rgba(12, 26, 43, 0.05);
}
.contact-card:nth-of-type(2) { border-left-color: var(--amber); }
.contact-card h2 { margin: 0 0 10px; font-size: 1.6rem; }

.email-button {
  display: inline-block;
  background: var(--ink);
  color: #f5efe3;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 999px;
  text-decoration: none;
  margin: 8px 0 4px;
}
.email-button:hover { background: var(--teal); color: #ffffff; }

.contact-alt { color: var(--muted); }

.about-photo {
  width: 170px;
  height: 170px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--card);
  outline: 2px solid var(--teal-bright);
  box-shadow: var(--shadow);
}

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

.timeline li {
  position: relative;
  padding: 0 0 20px 26px;
  border-left: 2px solid var(--line);
  margin-left: 6px;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal-bright);
  border: 2px solid var(--ink);
}

.plain-list { padding-left: 20px; }
.plain-list li { margin-bottom: 8px; }

/* Link list on light background */
.link-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.link-list a {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}
.link-list a:hover { background: var(--teal); color: #fff; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 72px;
  background: var(--ink);
  color: #a9bccd;
  padding: 34px 0;
  font-size: 0.95rem;
}

.site-footer a { color: #e9eef4; text-decoration: none; }
.site-footer a:hover { color: var(--teal-bright); }
.site-footer p { margin: 4px 0; }

/* ---------- Services, steps, CTA (homepage) ---------- */

.service-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.service {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: 0 2px 8px rgba(12, 26, 43, 0.05);
}

.service-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--amber);
}

.service h3 { margin: 4px 0 8px; font-size: 1.3rem; }
.service p { margin: 0; color: var(--muted); }

.steps {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 22px;
}

.step h3 { margin: 10px 0 6px; font-size: 1.25rem; }
.step p { margin: 0; color: var(--muted); }

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--teal-bright);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.cta {
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 70%, #1b3a5c 100%);
  border-radius: 18px;
  padding: 44px 36px;
  text-align: center;
  color: #e9eef4;
}

.cta h2 { color: #fdfbf7; margin: 0 0 10px; font-size: 2rem; }
.cta p { color: #cfdae6; max-width: 52ch; margin: 0 auto 24px; }
.cta-pills { justify-content: center; }

/* Case-study bits on the Projects page */
.project h3 {
  font-size: 1.05rem;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 20px 0 6px;
}

.outcomes { padding-left: 0; list-style: none; margin: 8px 0 14px; }
.outcomes li { position: relative; padding-left: 24px; margin-bottom: 8px; }
.outcomes li::before {
  content: "\2192";
  position: absolute;
  left: 0;
  color: var(--amber);
  font-weight: 700;
}

/* ---------- Scroll-in animation ----------
   main.js adds .js to <html> first, so content is never
   hidden for visitors without JavaScript. */

.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero h1 { font-size: 2.5rem; }
  .portrait-card { justify-self: start; max-width: 260px; }
  .card-grid { grid-template-columns: 1fr; }
  .service-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .about-intro { grid-template-columns: 1fr; }
  .about-top { grid-template-columns: 1fr; }
  .stat { padding-right: 22px; margin-right: 22px; margin-bottom: 14px; }

  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    right: 16px;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .card, .link-pills a { transition: none; }
}
