/* EpiSight LLC — site styles
   Single stylesheet, no build step. Edit directly.
   Direction: precise & editorial. Sans display type, warm ground,
   square corners, hairline rules instead of cards. */

/* ---------- Tokens ---------- */
:root {
  --coral:        #ff5050;   /* logo colour — graphic accents only */
  --coral-ink:    #c0332e;   /* darkened for text/links; passes contrast on warm ground */
  --coral-wash:   #fbf1ee;

  --ink:          #16191d;
  --ink-2:        #4a4f57;
  --ink-3:        #676c75;   /* 4.5:1 minimum on --ground, --band and --surface */
  --rule:         #e3dfd8;   /* warm hairline */
  --rule-strong:  #d2ccc2;

  --ground:       #faf9f7;   /* warm off-white page */
  --surface:      #ffffff;
  --band:         #f2f0eb;   /* alternating section */
  --deep:         #191713;   /* warm near-black */

  color-scheme: light dark;

  --measure:      66ch;
  --shell:        1120px;
  --gut:          clamp(1.25rem, 5vw, 3.5rem);

  --on-ink:       #ffffff;   /* text on an --ink-coloured surface (buttons) */
  --header-bg:    rgba(250,249,247,.9);
  --focus-ring:   rgba(22,25,29,.09);
  --ok:           #2f7d5c;   /* success accent */

  --sim-susceptible: #b5afa2;   /* hero simulation */
  --sim-recovered:   #c3bdb0;

  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote, dd { margin: 0; }
ul[class] { list-style: none; padding: 0; }
img, svg { display: block; max-width: 100%; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.62;
  color: var(--ink-2);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--sans);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.35rem, 5.4vw, 3.75rem); }
h2 { font-size: clamp(1.75rem, 3.6vw, 2.5rem); }
h3 { font-size: 1.1875rem; line-height: 1.25; letter-spacing: -0.015em; font-weight: 600; }
p  { text-wrap: pretty; }
p + p { margin-top: 1em; }

a { color: var(--coral-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--coral-ink); outline-offset: 3px; border-radius: 1px; }

.lede {
  font-size: clamp(1.125rem, 1.9vw, 1.375rem);
  line-height: 1.5; color: var(--ink-2); max-width: 44ch; font-weight: 400;
}

/* Small uppercase labels */
.eyebrow {
  display: flex; align-items: center; gap: .7rem;
  font-size: .75rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 1.25rem;
}
.eyebrow::before {
  content: ""; width: 1.75rem; height: 2px;
  background: var(--coral); flex: none;
}

.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.5rem; }
.prose h3 { margin-top: 2rem; margin-bottom: .5rem; }
.prose p, .prose ul { margin-top: 1rem; }
.prose ul { padding-left: 1.15rem; }
.prose li + li { margin-top: .4rem; }

/* ---------- Layout ---------- */
.shell { width: 100%; max-width: var(--shell); margin-inline: auto; padding-inline: var(--gut); }
section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.band { background: var(--band); border-block: 1px solid var(--rule); }
.section-head { max-width: 52ch; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
.section-head p { margin-top: .9rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header > .shell {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; min-height: 66px;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand img { width: 44px; }
.brand span {
  font-family: var(--sans); font-weight: 700; font-size: .9375rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink);
}
.nav { display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 1.9rem); }
.nav a {
  font-size: .9375rem; font-weight: 500; color: var(--ink-2);
  text-decoration: none; white-space: nowrap;
}
.nav a:hover { color: var(--ink); }
/* :not(.btn) — otherwise this rule wins over the button colours and the
   current-page CTA renders near-black text on a near-black button. */
.nav a[aria-current="page"]:not(.btn) { color: var(--ink); font-weight: 600; }

/* ---------- Buttons — square, not pills ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--sans); font-size: .9375rem; font-weight: 600;
  padding: .75rem 1.3rem; border-radius: 3px;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
a.btn-primary, .btn-primary { background: var(--ink); color: var(--on-ink); }
a.btn-primary:hover, .btn-primary:hover { background: var(--coral-ink); color: var(--on-ink); }
a.btn-ghost, .btn-ghost { border-color: var(--rule-strong); color: var(--ink); background: transparent; }
a.btn-ghost:hover, .btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
a.btn-light, .btn-light { background: #f4f1ea; color: #16150f; }
a.btn-light:hover, .btn-light:hover { background: var(--coral); color: #16150f; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2.25rem; }

/* Text link with arrow */
.arrow-link {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .9375rem; font-weight: 600; color: var(--ink);
  text-decoration: none; padding-block: .75rem;
}
.arrow-link::after { content: "\2192"; transition: transform .15s ease; }
.arrow-link:hover { color: var(--coral-ink); }
.arrow-link:hover::after { transform: translateX(3px); }

/* ---------- Hero ---------- */
/* Zero bottom padding: the next section's top padding supplies the gap,
   keeping the hero on the same vertical rhythm as every other section. */
.hero { padding-block: clamp(3.5rem, 9vw, 7rem) 0; }
.hero h1 { margin-bottom: 1.5rem; max-width: 19ch; }

.hero-grid { display: grid; gap: clamp(2.5rem, 6vw, 4rem); grid-template-columns: 1fr; align-items: center; }
@media (min-width: 62rem) { .hero-grid { grid-template-columns: 1.05fr .95fr; } }

.hero-sim { margin: 0; }
/* Canvases keep the simulation's own ratios so nothing is distorted;
   sim.js sizes the backing stores for the device pixel ratio. */
.hero-sim canvas { display: block; width: 100%; }
#hero-sim   { aspect-ratio: 460 / 390; }
#hero-curve { aspect-ratio: 460 / 92; margin-top: .5rem; }
.hero-sim figcaption {
  display: flex; flex-wrap: wrap; gap: .4rem 1.4rem;
  margin-top: .9rem; font-size: .8125rem; color: var(--ink-3);
}
/* Swatches mirror the shapes used on the canvas, so the key is readable
   without relying on telling two similar tones apart. */
.sim-key { display: inline-flex; align-items: center; gap: .45rem; }
.sim-key i { width: .55rem; height: .55rem; border-radius: 50%; flex: none; box-sizing: border-box; }
.sim-key .k-i { background: var(--coral); box-shadow: 0 0 0 3px color-mix(in srgb, var(--coral) 16%, transparent); }
.sim-key .k-s { background: var(--sim-susceptible); }
.sim-key .k-r { background: transparent; border: 1.5px solid var(--sim-recovered); }

/* ---------- Numbered rows (replaces cards) ---------- */
.rows { border-top: 1px solid var(--rule); }
.row-item {
  display: grid; gap: .5rem 2.5rem; grid-template-columns: 1fr;
  padding-block: clamp(1.6rem, 3.5vw, 2.25rem);
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 52rem) {
  .row-item { grid-template-columns: 2.5rem 17rem 1fr; gap: 0 2.5rem; align-items: start; }
}
.row-num {
  font-size: .8125rem; font-weight: 600;
  color: var(--coral-ink); padding-top: .3rem; letter-spacing: .05em;
}
.row-item h3 { font-size: 1.25rem; }
.row-body p { font-size: .96875rem; }
.row-body ul {
  margin-top: .9rem; padding-left: 1.1rem; font-size: .9375rem; color: var(--ink-3);
}
.row-body li + li { margin-top: .35rem; }

/* ---------- Definition list ---------- */
.deflist { border-top: 1px solid var(--rule); }
.deflist > div {
  display: grid; gap: .35rem 2.5rem; grid-template-columns: 1fr;
  padding-block: 1.6rem; border-bottom: 1px solid var(--rule);
}
@media (min-width: 46rem) { .deflist > div { grid-template-columns: 15rem 1fr; } }
.deflist dt { font-size: 1.0625rem; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.deflist dd { font-size: .96875rem; }
.deflist .step {
  font-size: .75rem; font-weight: 600; color: var(--coral-ink);
  letter-spacing: .1em; margin-right: .6rem;
}

/* ---------- Dark CTA ---------- */
.cta { background: var(--deep); color: #b4aea5; border: 0; }
.cta h2 { color: #fff; max-width: 20ch; }
.cta p { margin-top: 1rem; max-width: 50ch; }
.cta .eyebrow { color: #8a8379; }
.cta a.btn-light { margin-top: 2.25rem; }

/* ---------- Contact form ---------- */
.form-wrap { display: grid; gap: clamp(2rem, 5vw, 4.5rem); grid-template-columns: 1fr; }
@media (min-width: 58rem) { .form-wrap { grid-template-columns: 1.15fr .85fr; } }
.field { margin-bottom: 1.15rem; }
.field label {
  display: block; font-size: .875rem; font-weight: 600;
  color: var(--ink); margin-bottom: .4rem;
}
.field .hint { font-weight: 400; color: var(--ink-3); }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  padding: .7rem .85rem; border: 1px solid var(--rule-strong); border-radius: 3px;
  background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 9rem; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.hp { position: absolute; left: -9999px; opacity: 0; }
.form-note { font-size: .875rem; color: var(--ink-3); margin-top: 1.1rem; }

.form-status {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--coral);
  border-radius: 3px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.75rem;
}
.form-status:focus { outline: none; }
.form-status strong { display: block; color: var(--ink); font-weight: 600; }
.form-status p { margin-top: .4rem; font-size: .9375rem; }
.form-status--ok    { border-left-color: var(--ok); }
.form-status--error { border-left-color: var(--coral-ink); }

.aside-panel {
  background: var(--surface); border: 1px solid var(--rule);
  border-top: 2px solid var(--coral);
  border-radius: 3px; padding: 1.85rem; align-self: start;
}
.aside-panel h3 { margin-bottom: .75rem; }
.aside-panel p, .aside-panel ul { font-size: .9375rem; }
.aside-panel ul { margin-top: .85rem; padding-left: 1.1rem; }
.aside-panel li + li { margin-top: .45rem; }

/* ---------- About ---------- */
.bio { display: grid; gap: clamp(2rem, 5vw, 3.5rem); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 56rem) { .bio { grid-template-columns: 15rem 1fr; } }
.bio-photo { border-radius: 3px; width: 100%; }
.bio-photo-placeholder {
  aspect-ratio: 4/5; border-radius: 3px; border: 1px dashed var(--rule-strong);
  background: var(--surface); display: grid; place-items: center;
  font-size: .75rem; color: var(--ink-3);
  text-align: center; padding: 1rem; letter-spacing: .05em;
}
.pubs { border-top: 1px solid var(--rule); margin-top: 1.5rem; }
.pubs li { padding-block: 1.15rem; border-bottom: 1px solid var(--rule); font-size: .9375rem; }
.pubs .pub-title { color: var(--ink); font-weight: 600; text-decoration: none; }
.pubs .pub-title:hover { color: var(--coral-ink); text-decoration: underline; }
.pubs .pub-why {
  display: block; margin-top: .5rem; font-size: .9375rem;
  color: var(--ink-2); max-width: 62ch;
}
.pubs .pub-meta {
  display: block; color: var(--ink-3);
  font-size: .8125rem; margin-top: .35rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule); padding-block: 2.5rem;
  font-size: .875rem; color: var(--ink-3);
}
.site-footer > .shell {
  display: flex; flex-wrap: wrap; gap: 1rem 2rem;
  align-items: center; justify-content: space-between;
}
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.5rem; }

/* ---------- Utilities ---------- */
/* Visually hidden: removed from view, still read by screen readers. */
.vh {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--on-ink); padding: .7rem 1.1rem;
  z-index: 100; font-size: .9375rem;
}
.skip-link:focus { left: 0; color: var(--on-ink); }

/* ---------- Dark theme ----------
   Follows the OS setting. Only tokens are redefined; every component above
   is written against them. --deep stays dark in both themes because the CTA
   band is light-on-dark either way — in dark mode it sits *above* the page
   ground so the band still separates. */
@media (prefers-color-scheme: dark) {
  :root {
    --coral:        #ff6a5c;
    --coral-ink:    #ff8878;   /* lightened: the light-mode value is far too dark here */
    --coral-wash:   #2a201b;

    --ink:          #f4f1ea;
    --ink-2:        #c7c2b8;
    --ink-3:        #968f85;
    --rule:         #302c25;
    --rule-strong:  #453f36;

    --ground:       #181713;
    --surface:      #201e19;
    --band:         #1e1c17;
    --deep:         #272319;

    --on-ink:       #16150f;   /* --ink is now light, so button text must be dark */
    --header-bg:    rgba(24,23,19,.88);
    --focus-ring:   rgba(244,241,234,.15);
    --ok:           #5fb894;

    --sim-susceptible: #5b5449;
    --sim-recovered:   #514a3f;
  }

  /* The mark is a coral line drawing; lift it slightly so the thin strokes
     do not sink into the dark ground. */
  .brand img { filter: saturate(1.08) brightness(1.06); }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 34rem) {
  .site-header > .shell {
    flex-wrap: wrap; justify-content: center;
    gap: .5rem 1.25rem; min-height: 0; padding-block: .7rem;
  }
  .nav { gap: 1.25rem; }
  .nav a { font-size: .875rem; }
  .btn { padding: .65rem 1.1rem; font-size: .875rem; }
  .site-footer > .shell { flex-direction: column; align-items: flex-start; }
  .aside-panel { padding: 1.35rem; }
}
