/* OncoPrint — the design system, shared by the public site and the portal.
 *
 * ZERO DEPENDENCIES. No Tailwind, no reset package, no webfont from a CDN.
 * Every value here is either a brand token from `brand/README.md` or derived
 * from one, and the file is served from our own origin like everything else.
 *
 * ## On the typeface
 *
 * The brand is set in Switzer, and Switzer is NOT used here. The Fontshare
 * licence permits using it to make logo artwork but forbids redistributing the
 * font files — and serving a webfont IS redistribution. The logo keeps Switzer
 * because it is outlined vector art baked at build time; running text uses a
 * system grotesque stack chosen to sit in the same Swiss-neutral register.
 *
 * The practical effect is that the wordmark renders identically everywhere and
 * the body text renders natively on every device, which is also faster than any
 * webfont would have been.
 */

/* ── brand tokens ─────────────────────────────────────────────────────────── */
:root {
  --ink:            #0E1720;
  --accent:         #0F7D74;
  --accent-on-dark: #46BFB2;
  --muted:          #64757F;
  --muted-on-dark:  #8FA3AE;
  --paper:          #FFFFFF;

  /* Derived. The pale track is the accent at 22% (28% on dark) — the same
   * relationship the mark itself uses, so tints on a page and tints in the logo
   * are the same idea rather than two idioms. */
  --accent-22:      rgba(15, 125, 116, 0.22);
  --accent-12:      rgba(15, 125, 116, 0.12);
  --accent-06:      rgba(15, 125, 116, 0.06);
  --dark-28:        rgba(70, 191, 178, 0.28);
  --dark-14:        rgba(70, 191, 178, 0.14);

  --wash:           #F6F8F8;   /* section band on light */
  --line:           #E2E8E8;   /* hairline on light */
  --line-on-dark:   rgba(255, 255, 255, 0.13);

  /* Status. Chart/state colours, deliberately NOT brand colours — the brand is
   * one accent and the README says so. */
  --ok:             #17794A;
  --warn:           #A8641A;
  --bad:            #B3372F;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Fluid type. One scale for both sites; clamp() means no breakpoint has to
   * restate a size, which is where responsive typography usually rots. */
  --t-hero:  clamp(2.25rem, 1.25rem + 4.4vw, 4.5rem);
  --t-h1:    clamp(1.9rem,  1.25rem + 2.6vw, 3rem);
  --t-h2:    clamp(1.45rem, 1.15rem + 1.4vw, 2.1rem);
  --t-h3:    clamp(1.1rem,  1rem + 0.5vw,    1.35rem);
  --t-body:  clamp(1rem,    0.97rem + 0.16vw, 1.125rem);
  --t-small: 0.875rem;
  --t-micro: 0.78rem;

  --gap:     clamp(1rem, 0.6rem + 1.6vw, 2rem);
  --pad-y:   clamp(3rem, 1.5rem + 6vw, 7rem);
  --measure: 68ch;
  --wide:    1200px;
  --radius:  14px;
  --radius-sm: 9px;

  --shadow: 0 1px 2px rgba(14, 23, 32, .05), 0 8px 24px -12px rgba(14, 23, 32, .18);
  --shadow-lg: 0 2px 4px rgba(14, 23, 32, .05), 0 24px 56px -24px rgba(14, 23, 32, .28);
}

/* ── reset, kept to what is actually needed ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;   /* iOS inflates text in landscape without it */
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* The iOS safe area, so a fixed header does not sit under the notch. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* `hidden` BEATS a class. The UA stylesheet says `[hidden] { display: none }`,
 * and any component rule that sets `display` — `.org-chip { display: flex }`,
 * `.app { display: flex }` — overrides it on specificity and source order. The
 * symptom is a "hidden" element that is simply visible, which reads as a broken
 * script rather than a CSS precedence problem. Both of those actually shipped
 * here: the whole signed-in application shell rendered under the sign-in page.
 */
[hidden] { display: none !important; }

img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; text-wrap: balance; }
h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); letter-spacing: -0.01em; }
p  { text-wrap: pretty; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

/* One visible focus ring everywhere. Never removed — a keyboard user on a
 * hospital workstation is a real user of this product. */
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection { background: var(--accent-22); }

/* ── layout primitives ────────────────────────────────────────────────────── */
.wrap { width: min(100% - 2.5rem, var(--wide)); margin-inline: auto; }
@media (max-width: 560px) { .wrap { width: min(100% - 2rem, var(--wide)); } }

.section { padding-block: var(--pad-y); }
.section--wash { background: var(--wash); }
.section--ink  { background: var(--ink); color: #E8EDF1; }
.section--ink h1, .section--ink h2, .section--ink h3 { color: var(--paper); }
.section--ink a { color: var(--accent-on-dark); }

.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 2rem; }

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }

.lede { font-size: clamp(1.05rem, 1rem + 0.5vw, 1.3rem); color: var(--muted); max-width: var(--measure); }
.section--ink .lede { color: var(--muted-on-dark); }

.eyebrow {
  font-size: var(--t-micro); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--accent);
}
.section--ink .eyebrow { color: var(--accent-on-dark); }

/* ── the mark, as a reusable element ──────────────────────────────────────── */
.logo { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.logo svg, .logo img { height: 2rem; width: auto; }
.logo--sm svg, .logo--sm img { height: 1.6rem; }

/* ── buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.25rem;
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  font-weight: 600; font-size: var(--t-body);
  text-decoration: none; white-space: nowrap;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
  /* 44px is the accessible minimum touch target, and this product is used on
   * phones in wards. */
  min-height: 44px;
}
.btn-primary { background: var(--accent); color: var(--paper); }
.btn-primary:hover { background: #0C6A62; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.section--ink .btn-ghost { border-color: var(--line-on-dark); color: var(--paper); }
.section--ink .btn-ghost:hover { border-color: var(--accent-on-dark); color: var(--accent-on-dark); }
.btn-block { width: 100%; }

/* ── form fields ──────────────────────────────────────────────────────────
 * Shared: the sign-in form and the enquiry form are the same control set, and
 * this lived in the public site's stylesheet — so the portal, which does not
 * load it, rendered its labels inline beside the inputs.
 */
.field { display: block; }
.field + .field { margin-top: 1rem; }
.field > span {
  display: block; font-size: var(--t-small); font-weight: 600;
  margin-bottom: .35rem;
}
.field input, .field textarea, .field select {
  width: 100%; padding: .7rem .85rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink);
  min-height: 44px;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px var(--accent-12);
}
.field textarea { min-height: 8rem; resize: vertical; }

/* ── cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 1rem + 1vw, 1.9rem);
}
.card--raised { box-shadow: var(--shadow); border-color: transparent; }
.section--ink .card {
  background: rgba(255,255,255,.04);
  border-color: var(--line-on-dark);
}

/* ── utilities ────────────────────────────────────────────────────────────── */
.center { text-align: center; margin-inline: auto; }
.muted { color: var(--muted); }
.section--ink .muted { color: var(--muted-on-dark); }
.small { font-size: var(--t-small); }
.micro { font-size: var(--t-micro); }
.mono  { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Its opposite, and its sibling in shape so the pair reads as one idiom. */
.notice {
  border-left: 3px solid var(--accent);
  background: var(--accent-06);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--t-small);
}

/* A refusal, shared by both sites: the enquiry form's failure and the sign-in
 * page's. One definition, because "the thing went wrong" should look the same
 * whichever surface a person is on. */
.refusal {
  background: rgba(179, 55, 47, .07);
  border-left: 3px solid var(--bad);
  color: #7E2A24;
  padding: .8rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--t-small); margin-top: 1rem;
}

/* Visible only to a screen reader. Used for the skip link and for icon-only
 * controls, both of which are otherwise silent. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: .5rem; top: -4rem; z-index: 100;
  background: var(--accent); color: var(--paper);
  padding: .6rem 1rem; border-radius: var(--radius-sm); text-decoration: none;
  transition: top .16s ease;
}
.skip:focus { top: .5rem; }
