/* ==========================================================================
   ClinStat AI — product site stylesheet
   Self-contained: system fonts only, no external requests.
   Palette: deep clinical blue accent on near-white neutrals; every
   foreground/background pair listed here meets WCAG 2.1 AA (>= 4.5:1).
   ========================================================================== */

/* ----- design tokens ------------------------------------------------- */

:root {
  color-scheme: light dark;

  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-2: #edf2f6;
  --ink: #1b2833;
  --muted: #51616f;
  --accent: #0e5c8f;
  --accent-strong: #0b4a74;
  --accent-soft: #e3eef6;
  --border: #d9e1e8;
  --footer-bg: #16232f;
  --footer-ink: #e7edf3;
  --footer-muted: #b9c8d4;
  --footer-accent: #8ec7ec;
  --on-accent: #ffffff;

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

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(27, 40, 51, 0.06), 0 8px 24px rgba(27, 40, 51, 0.07);
  --wrap: 68rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d141b;
    --surface: #141e29;
    --surface-2: #1a2735;
    --ink: #e7edf3;
    --muted: #a6b7c5;
    --accent: #8ec7ec;
    --accent-strong: #b7dbf4;
    --accent-soft: #1c3040;
    --border: #29394a;
    --footer-bg: #101a24;
    --footer-ink: #e7edf3;
    --footer-muted: #b9c8d4;
    --footer-accent: #8ec7ec;
    --on-accent: #0b141d;
  }
}

/* ----- base ----------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
}

/* keep anchored headings clear of the sticky header after in-page jumps */
[id] {
  scroll-margin-top: 4.75rem;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  font-weight: 650;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.9rem, 4.2vw, 2.9rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.12rem;
}

p {
  margin: 0 0 1em;
}

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

ul,
ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
}

li {
  margin-bottom: 0.35em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-strong);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* ----- layout primitives --------------------------------------------- */

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3.5rem;
  z-index: 100;
  background: var(--surface);
  color: var(--accent);
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0.75rem;
}

/* ----- header --------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.9rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  flex: none;
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.nav a:not(.btn) {
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
  font-size: 0.95rem;
}

.nav a:not(.btn):hover {
  color: var(--ink);
}

/* ----- buttons --------------------------------------------------------- */

.btn {
  display: inline-block;
  padding: 0.62rem 1.25rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: var(--on-accent);
}

@media (prefers-color-scheme: dark) {
  .btn-primary:hover {
    background: #a9d6f2;
  }
}

.btn-ghost {
  border-color: var(--border);
  color: var(--ink);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

.hero {
  padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2.5rem, 5vw, 4rem);
  text-align: center;
}

.hero .wrap {
  max-width: 52rem;
}

.hero .eyebrow {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.28rem 0.9rem;
  margin-bottom: 1.3rem;
}

.hero .lede {
  font-size: clamp(1.05rem, 1.8vw, 1.22rem);
  color: var(--muted);
  max-width: 42rem;
  margin: 0 auto 2rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}

/* screenshot in a framed panel */

.hero-figure {
  margin: clamp(2rem, 5vw, 3.5rem) auto 0;
  max-width: 56rem;
  padding-inline: 1.5rem;
}

.shot-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.55rem;
}

.shot-frame img {
  border-radius: calc(var(--radius) - 5px);
  border: 1px solid var(--border);
}

.fig-caption {
  font-size: 0.86rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.75rem;
}

/* ----- sections -------------------------------------------------------- */

.section {
  padding: clamp(2.6rem, 6vw, 4.5rem) 0;
}

.section-alt {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.section-head {
  max-width: 40rem;
  margin-bottom: 2.2rem;
}

.section-head p {
  color: var(--muted);
  font-size: 1.02rem;
}

/* ----- feature cards ---------------------------------------------------- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.4rem;
}

.card .icon {
  display: inline-flex;
  width: 2.4rem;
  height: 2.4rem;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 1rem;
}

.card h3 {
  margin-bottom: 0.45rem;
}

.card p {
  color: var(--muted);
  font-size: 0.94rem;
  margin: 0;
}

/* ----- how it works ------------------------------------------------------ */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem;
  counter-reset: step;
}

.step {
  position: relative;
  padding-top: 0.4rem;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.9rem;
}

.step h3 {
  margin-bottom: 0.35rem;
}

.step p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

/* ----- audience strip ---------------------------------------------------- */

.audience {
  color: var(--muted);
  text-align: center;
  font-size: 0.97rem;
}

/* ----- footer ------------------------------------------------------------ */

.site-footer {
  background: var(--footer-bg);
  color: var(--footer-ink);
  padding: 2.6rem 0 2.2rem;
  margin-top: clamp(2.6rem, 6vw, 4.5rem);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  align-items: flex-start;
  justify-content: space-between;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  color: var(--footer-ink);
}

.footer-brand .brand-mark {
  color: var(--footer-accent);
}

.site-footer p {
  color: var(--footer-muted);
  font-size: 0.9rem;
  margin: 0.6rem 0 0;
  max-width: 34rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.93rem;
}

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

/* ----- manual page -------------------------------------------------------- */

.manual-layout {
  display: grid;
  grid-template-columns: 14.5rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  padding: clamp(2rem, 5vw, 3.5rem) 0;
  align-items: start;
}

.toc {
  position: sticky;
  top: 4.5rem;
  font-size: 0.92rem;
}

.toc h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

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

.toc a {
  display: block;
  padding: 0.32rem 0.75rem;
  border-left: 2px solid var(--border);
  color: var(--muted);
  text-decoration: none;
}

.toc a:hover,
.toc a[aria-current] {
  color: var(--accent);
  border-left-color: var(--accent);
}

.manual-body {
  max-width: 46rem;
}

.manual-body > section {
  margin-bottom: clamp(2.4rem, 5vw, 3.5rem);
}

.manual-body section + section {
  border-top: 1px solid var(--border);
  padding-top: clamp(2.4rem, 5vw, 3.5rem);
}

.manual-body h2 {
  margin-bottom: 0.7rem;
}

.manual-body h3 {
  margin-top: 1.8rem;
}

.manual-body p,
.manual-body li {
  color: var(--ink);
}

.manual-body .section-lede {
  color: var(--muted);
  font-size: 1.03rem;
}

.figure {
  margin: 1.6rem 0;
}

.figure .shot-frame {
  padding: 0.45rem;
}

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
  font-size: 0.95rem;
}

.callout p {
  margin: 0;
}

.callout .callout-title {
  font-weight: 650;
  display: block;
  margin-bottom: 0.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  margin: 1.2rem 0;
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 650;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

kbd {
  font-family: inherit;
  font-size: 0.85em;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.08em 0.45em;
  white-space: nowrap;
}

/* ----- responsive ---------------------------------------------------------- */

@media (max-width: 60rem) {
  .manual-layout {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 1rem 1.2rem;
  }

  .toc ol {
    columns: 2;
    column-gap: 1.5rem;
  }

  .site-header .nav {
    gap: 0.8rem;
  }
}

@media (max-width: 34rem) {
  .toc ol {
    columns: 1;
  }

  /* keep the header on one line on narrow phones; the section links
     duplicate in-page anchors that are also reachable by scrolling */
  .nav a:not(.btn) {
    display: none;
  }

  .hero-cta .btn {
    width: 100%;
    max-width: 20rem;
    text-align: center;
  }
}

/* ----- print ---------------------------------------------------------------- */

@media print {
  .site-header,
  .site-footer,
  .toc,
  .skip-link,
  .hero-cta {
    display: none;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 11pt;
  }

  .manual-layout {
    display: block;
  }

  .manual-body {
    max-width: none;
  }

  .figure,
  .callout,
  table {
    break-inside: avoid;
  }

  .manual-body section + section {
    border-top: none;
    padding-top: 0;
  }

  a {
    color: #000000;
    text-decoration: none;
  }
}
