/*
  Shared styles for the content pages (About, Publications, Educational Resources, Contact).
  The theme tokens, header, IF/BF toggle, buttons and footer are copied verbatim from Kira's
  services.html so every page renders the same immunofluorescence (IF) and brightfield (BF) system.

  Each page sets its own "stain channel" on <body>:
    --page-if   colour of the page in IF mode (the fluorophore)
    --page-bf   colour of the page in BF mode (the histology stain)
    --page-ink-if / --page-ink-bf  optional readable variant for small text when the channel
                                   colour itself is too dark/low-contrast (e.g. DAPI blue on black)
*/

:root {
  --bg: #000000;
  --fg: #f2f2f2;
  --muted: rgba(242, 242, 242, 0.62);
  --line: rgba(242, 242, 242, 0.16);
  --panel: rgba(8, 8, 10, 0.76);
  --accent: #d14cff;
  --contact-title: #2edb45;
  --cta-fill: #ff2d2d;
  --cta-text: #ffffff;
  --button-glow: rgba(255, 255, 255, 0.34);
  --overlay: rgba(0, 0, 0, 0.76);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: rgba(26, 26, 26, 0.62);
  --line: rgba(26, 26, 26, 0.14);
  --panel: rgba(255, 255, 255, 0.82);
  --accent: #5e50b5;
  --contact-title: #6b3f1f;
  --cta-fill: #5e50b5;
  --cta-text: #ffffff;
  --button-glow: rgba(120, 120, 120, 0.26);
  --overlay: rgba(255, 255, 255, 0.9);
  color-scheme: light;
}

body {
  --page: var(--page-if, var(--accent));
  --page-ink: var(--page-ink-if, var(--page));
}

:root[data-theme="light"] body {
  --page: var(--page-bf, var(--accent));
  --page-ink: var(--page-ink-bf, var(--page));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--fg);
  transition: background 420ms ease, color 420ms ease;
}

img {
  max-width: 100%;
}

/* ---------- Header (Kira) ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 91%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  pointer-events: none;
}

.brand {
  color: var(--fg);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
  pointer-events: auto;
}

/* Segmented-M logo mark: IF version in dark mode, BF version in light mode */
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark { flex: none; width: 36px; height: 36px; border-radius: 9px; }
.brand-mark-bf { display: none; box-shadow: 0 0 0 1px rgba(26, 26, 26, 0.12); }
:root[data-theme="light"] .brand-mark-if { display: none; }
:root[data-theme="light"] .brand-mark-bf { display: block; }
@media (max-width: 520px) { .brand { gap: 9px; } .brand-mark { width: 30px; height: 30px; border-radius: 8px; } .brand-text { font-size: 11px; letter-spacing: 0.1em; } }

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vw, 28px);
  pointer-events: auto;
}

.site-nav a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.72;
  transition: color 200ms ease, opacity 200ms ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--nav-if, var(--fg));
  opacity: 1;
}

:root[data-theme="light"] .site-nav a:hover,
:root[data-theme="light"] .site-nav a[aria-current="page"] {
  color: var(--nav-bf, var(--fg));
}

.theme-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  width: 128px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  color: var(--fg);
  pointer-events: auto;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.theme-toggle::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: var(--fg);
  content: "";
  transition: transform 260ms ease;
}

:root[data-theme="light"] .theme-toggle::before {
  transform: translateX(100%);
}

.theme-toggle button {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
  transition: color 260ms ease;
}

:root:not([data-theme="light"]) .theme-toggle button:first-child,
:root[data-theme="light"] .theme-toggle button:last-child {
  color: var(--bg);
}

main {
  padding-top: 74px;
}

/* ---------- Page hero ---------- */

.page-hero {
  padding: clamp(54px, 8vw, 88px) clamp(22px, 7vw, 96px) clamp(34px, 5vw, 54px);
}

.section {
  padding: 0 clamp(22px, 7vw, 96px) clamp(64px, 7vw, 96px);
}

.inner {
  max-width: 1180px;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--page-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  max-width: 980px;
  margin: 0;
  color: var(--fg);
  font-size: clamp(38px, 5.5vw, 76px);
  font-weight: 820;
  line-height: 0.98;
  letter-spacing: 0;
}

.page-subtitle {
  margin: 20px 0 0;
  color: var(--page-ink);
  font-size: clamp(17px, 1.8vw, 24px);
  font-weight: 760;
  line-height: 1.35;
}

.page-lede {
  max-width: 760px;
  margin: 22px 0 0;
  color: var(--fg);
  font-size: clamp(16px, 1.45vw, 20px);
  line-height: 1.5;
}

.section-title {
  margin: 0 0 clamp(20px, 3vw, 30px);
  color: var(--fg);
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 800;
  line-height: 1.05;
}

.section-title em {
  color: var(--page);
  font-style: normal;
}

.prose p {
  margin: 0 0 16px;
  color: var(--fg);
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.65;
}

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

/* ---------- Stain-channel surfaces (derived from Kira's service cards) ---------- */

.panel {
  padding: clamp(22px, 3vw, 30px);
  border: 1px solid color-mix(in srgb, var(--page) 42%, var(--line));
  border-radius: 8px;
  background:
    radial-gradient(circle at 14% 18%, color-mix(in srgb, var(--page) 24%, transparent), transparent 34%),
    color-mix(in srgb, var(--bg) 76%, transparent);
  box-shadow: 0 24px 80px color-mix(in srgb, var(--page) 16%, transparent);
}

.media-frame {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--page) 28%, var(--line));
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 16%, color-mix(in srgb, var(--page) 26%, transparent), transparent 40%),
    color-mix(in srgb, var(--bg) 72%, transparent);
  transition: border-color 240ms ease, box-shadow 240ms ease, transform 240ms ease;
}

.media-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 360ms ease, filter 360ms ease;
}

.lift {
  transition: transform 240ms ease;
}

.lift:hover,
.lift:focus-within {
  transform: translateY(-6px);
}

.lift:hover .media-frame,
.lift:focus-within .media-frame {
  border-color: var(--page);
  box-shadow: 0 24px 80px color-mix(in srgb, var(--page) 18%, transparent);
}

.lift:hover .media-frame img,
.lift:focus-within .media-frame img {
  transform: scale(1.04);
  filter: saturate(1.08);
}

.kicker {
  margin: 0;
  color: var(--page-ink);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.check-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
}

.check-list li {
  padding-left: 1.4em;
  text-indent: -1.4em;
}

.check-list li::before {
  color: var(--page-ink);
  content: "✓  ";
  font-weight: 900;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--page) 46%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--page) 10%, transparent);
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
}

/* Image pair that swaps with the IF/BF toggle, like Kira's homepage hero */
.theme-swap {
  position: relative;
}

.theme-swap img {
  position: absolute;
  inset: 0;
  transition: opacity 420ms ease, transform 360ms ease, filter 360ms ease;
}

.theme-swap .if-image {
  opacity: 1;
}

.theme-swap .bf-image {
  opacity: 0;
}

:root[data-theme="light"] .theme-swap .if-image {
  opacity: 0;
}

:root[data-theme="light"] .theme-swap .bf-image {
  opacity: 1;
}

/* ---------- Buttons (Kira) ---------- */

.service-cta,
.ghost-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--cta-fill);
  border-radius: 999px;
  background: var(--cta-fill);
  box-shadow: 0 0 54px var(--button-glow), 0 0 18px color-mix(in srgb, var(--cta-fill) 34%, transparent);
  color: var(--cta-text);
  font-size: 13px;
  font-weight: 820;
  text-decoration: none;
  transition: box-shadow 220ms ease, transform 220ms ease;
}

.service-cta:hover,
.ghost-cta:hover {
  box-shadow: 0 0 68px var(--button-glow), 0 0 24px color-mix(in srgb, var(--cta-fill) 42%, transparent);
  transform: translateY(-1px);
}

.ghost-cta {
  border-color: color-mix(in srgb, var(--page) 60%, var(--line));
  background: transparent;
  box-shadow: none;
  color: var(--fg);
}

.ghost-cta:hover {
  border-color: var(--page);
  box-shadow: 0 0 24px color-mix(in srgb, var(--page) 30%, transparent);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  min-height: 58px;
  padding: 0 22px;
  border: 1px solid var(--cta-fill);
  border-radius: 999px;
  background: var(--cta-fill);
  box-shadow: 0 0 54px var(--button-glow), 0 0 18px color-mix(in srgb, var(--cta-fill) 34%, transparent);
  color: var(--cta-text);
  font-size: 16px;
  font-weight: 820;
  text-decoration: none;
  transition: box-shadow 220ms ease, transform 220ms ease;
}

.button-link:hover {
  box-shadow: 0 0 68px var(--button-glow), 0 0 24px color-mix(in srgb, var(--cta-fill) 42%, transparent);
  transform: translateY(-1px);
}

/* ---------- Closing call to action (Kira) ---------- */

.contact-section {
  display: grid;
  min-height: 46vh;
  align-items: center;
  padding: 84px clamp(22px, 7vw, 96px);
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.contact-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
}

.contact-copy {
  max-width: 760px;
}

.contact-inner h2 {
  max-width: 720px;
  margin: 0;
  color: var(--contact-title);
  font-size: clamp(34px, 4.8vw, 68px);
  line-height: 0.98;
  letter-spacing: 0;
}

.contact-inner p {
  max-width: 640px;
  margin: 20px 0 0;
  color: var(--fg);
  font-size: clamp(16px, 1.45vw, 20px);
  line-height: 1.45;
}

.contact-actions {
  display: flex;
  justify-content: center;
}

/* ---------- Footer (Kira) ---------- */

footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px 24px;
  align-items: center;
  padding: 24px clamp(22px, 7vw, 96px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.footer-social {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.footer-social a {
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.footer-social a:hover {
  color: var(--accent);
}

footer span:last-child {
  justify-self: end;
}

/* ---------- Responsive (Kira's breakpoints) ---------- */

@media (max-width: 820px) {
  main {
    padding-top: 116px;
  }

  .site-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .theme-toggle {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 16px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .contact-inner {
    grid-template-columns: 1fr;
  }

  .contact-actions {
    justify-content: flex-start;
  }

  footer {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  footer span:last-child {
    justify-self: center;
  }
}

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