/* ============================================================
   ANESTHEO DESIGN TOKENS  ·  one identity, three surfaces
   ------------------------------------------------------------
   WHY THIS FILE EXISTS

   The product's appearance used to be written down in 215 places.
   `--teal` was defined twenty times with four different values, so
   the brand colour depended on which page you were standing on.
   Corners drifted across eighteen values between 2px and 30px.
   Nothing was broken — it was simply impossible to change how
   Anestheo looks in one move.

   WHERE THE IDENTITY COMES FROM

   From the homepage as it RENDERS, measured in a browser, not from
   the values declared at the top of its stylesheet. Those two had
   diverged: index.html declares a warm paper palette at :root and
   then paints over it, so #FAFAF8 is real in the source and has
   never once reached a screen. The palette below is the one a
   visitor actually sees:

       ground   #0B1620   deep bluish graphite, never pure black
       raised   #0E1C27
       ink      #F2F6F8 · #93A6B4 · #6D8091
       teal     #2FA88C lifted for the dark ground, #7ECFC0 to read
       hairline rgba(255,255,255,.09)
       card     rgba(255,255,255,.035)

   HOW IT IS ORGANISED

     1. BRAND     the teal family, the radius scale, the spacing
                  rhythm, the type hierarchy, the motion. Identical
                  everywhere. This shared half is what makes the
                  public site and the clinical product read as one
                  product rather than two.

     2. GRAPHITE  the default, and the identity above. The public
                  site, the patient application, and anything that
                  does not ask for something else.

     3. CLINICAL  <html class="theme-clinical">. The same graphite
                  identity, one step deeper and one step denser: a
                  full-screen instrument read for hours needs more
                  contrast between a row and its neighbour than a
                  marketing page does, and it keeps the teal
                  hairline that separates its panels.

     4. LIGHT     <html class="theme-light">. A complete light
                  surface, kept and maintained but assigned to no
                  page. It exists for a surface that one day has a
                  readability reason to be light — print, daylight,
                  a shared screen. Assigning it is a design
                  decision, not a default.

   HOW TO USE IT

   Write components against the SEMANTIC names — --ground, --surface,
   --line, --ink, --ink-muted, --brand — and the same rule renders
   correctly on every surface. The older names (--dark, --text,
   --muted, --accent …) are kept as aliases and redefined per
   surface, so a page that still speaks the old vocabulary follows
   whichever surface it is on.

   A page may still override any token locally; this file is loaded
   before any page's own <style>, so a deliberate local decision
   continues to win. What is no longer possible is *accidentally*
   holding a different opinion about the brand.
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   1 · BRAND — shared by every surface, never themed
   ════════════════════════════════════════════════════════════ */
:root{

  /* ── The teal ─────────────────────────────────────────────
     One hue at three weights, in the hierarchy the homepage
     established. --brand is the deep teal a solid fill is made
     of, where white text needs the contrast. --brand-mid is the
     accent lifted for a dark ground — the homepage's own
     --teal. --brand-lift is the weight that READS: links,
     eyebrows, emphasis. */
  --brand:        #1B6B5A;
  --brand-deep:   #155646;
  --brand-mid:    #2FA88C;
  --brand-lift:   #7ECFC0;
  --brand-lift-2: #9FF0CF;
  --on-brand:     #ffffff;

  /* The homepage's primary action is a teal gradient, and its
     secondary is light-on-graphite. Both are here so a button
     anywhere in the product can be the same button. */
  --brand-grad:       linear-gradient(135deg,#2FA88C,#1B6B5A);
  --brand-grad-hover: linear-gradient(135deg,#37bd9c,#22826d);
  --brand-grad-shadow: 0 12px 30px rgba(47,168,140,.26);

  /* ── Radius ───────────────────────────────────────────────
     A 4px grid, replacing the eighteen ad-hoc values the site
     had accumulated. Every one of 6, 7, 8 and 9px was in use at
     once; so were 10, 11, 12 and 13. Nobody can see a 1px
     difference in a corner, which is exactly why they
     multiplied — and why no two components ever agreed.
     Anything under 4px is left alone: at that size a radius is a
     detail of a specific shape (an accent bar, a focus ring)
     rather than a component's corner. */
  --radius-xs:   4px;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-2xl:  26px;
  --radius-pill: 999px;

  /* ── Spacing ──────────────────────────────────────────────
     A 4px base. Layout code may still use raw px where a value
     is genuinely bespoke; these exist so the common rhythm is
     shared rather than re-guessed. */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 22px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  /* ── Type ─────────────────────────────────────────────────
     Inter, because that is the homepage's voice and the homepage
     is the identity. --serif stays defined for the few places
     that still deliberately ask for it; nothing shared does.
     --mono is for values that must line up. */
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font:  var(--sans);
  --serif: 'Playfair Display', Georgia, serif;
  --mono:  ui-monospace, SFMono-Regular, Menlo, monospace;

  /* ── Motion ───────────────────────────────────────────────
     Two durations. Anything slower than --dur-2 on a hover
     reads as lag rather than polish. */
  --dur-1: .14s;
  --dur-2: .22s;

  /* ── Measure ──────────────────────────────────────────────*/
  --max:  1060px;
  --maxw: 1160px;
}

/* ════════════════════════════════════════════════════════════
   2 · GRAPHITE — the default, and the homepage's identity
   ════════════════════════════════════════════════════════════ */
:root, .theme-graphite{

  /* ── Ground ───────────────────────────────────────────────*/
  --ground:        #0B1620;
  --ground-2:      #0E1C27;   /* a raised region: drawer, sticky header */
  --ground-3:      #14232F;   /* a solid raised block: table head, active row */
  --ground-nav:    rgba(11,22,32,.72);
  --ground-sunken: #08111A;

  /* The homepage's two glows, kept as tokens so any page can sit
     on the same light. Never a repeating pattern, never neon. */
  --ground-glow:
    radial-gradient(ellipse 80% 55% at 72% -8%, rgba(47,168,140,.16), transparent 60%),
    radial-gradient(ellipse 60% 45% at 8% 4%, rgba(60,110,160,.10), transparent 62%);

  /* ── Surfaces ─────────────────────────────────────────────
     Cards are light lifted off the graphite, never a separate
     colour. Three weights: resting, hover, active. */
  --surface:   rgba(255,255,255,.035);
  --surface-2: rgba(255,255,255,.05);
  --surface-3: rgba(255,255,255,.08);

  /* ── Lines ────────────────────────────────────────────────*/
  --line:   rgba(255,255,255,.09);
  --line-2: rgba(255,255,255,.16);
  --hair:   rgba(255,255,255,.09);
  --hair-2: rgba(255,255,255,.16);

  /* ── Ink ──────────────────────────────────────────────────
     A hierarchy rather than a palette: heading, body,
     supporting, and the barely-there label. */
  --ink:       #F2F6F8;
  --ink-2:     #C7D3DB;
  --ink-muted: #93A6B4;
  --ink-faint: #6D8091;

  /* ── Brand on this ground ─────────────────────────────────
     --brand-read is whichever weight of the teal is legible as
     TEXT here, so a component never has to know which surface
     it is on. */
  --brand-read:   var(--brand-lift);
  --brand-tint:   rgba(47,168,140,.10);
  --brand-tint-2: rgba(47,168,140,.20);
  --brand-glow:   rgba(126,207,192,.10);

  --elev-1: 0 2px 10px rgba(0,0,0,.25);
  --elev-2: 0 12px 30px rgba(0,0,0,.35);
  --elev-3: 0 24px 60px rgba(0,0,0,.45);

  /* The wash behind a modal. Neutral-cold, because a scrim tinted toward the
     ground it covers is how a dark theme starts to look like one colour. */
  --scrim:      rgba(4,8,12,.78);
  --scrim-soft: rgba(4,8,12,.62);
  /* Ink for a chip whose fill is a bright accent — a count on a teal pill, a
     label on an amber flag. Near-black with the graphite cast rather than the
     old green one, so it belongs to the same family as the ground. */
  --on-accent:  #06121C;

  /* ── Functional colour ────────────────────────────────────
     These carry clinical and procedural meaning and must never
     be rebalanced for looks. Each has a foreground, a fill and
     an edge, so a state can be shown as text, as a badge, or as
     a whole panel without anyone re-deriving the tint. */
  --success:    #5EE393;
  --success-bg: rgba(94,227,147,.10);
  --success-bd: rgba(94,227,147,.28);

  --warning:    #E8A838;
  --warning-bg: rgba(232,168,56,.10);
  --warning-bd: rgba(232,168,56,.28);

  --danger:        #FF9B86;
  --danger-strong: #C0392B;
  --danger-bg:     rgba(255,155,134,.10);
  --danger-bd:     rgba(255,155,134,.30);

  --info:    #5BA8FF;
  --info-bg: rgba(91,168,255,.12);
  --info-bd: rgba(91,168,255,.32);

  /* ── Care lifecycle ───────────────────────────────────────
     The four states a patient's journey can be in. Both the
     doctor dashboard and the patient dashboard render them, and
     they had drifted apart: the same state was tinted .12/.32 on
     one surface and .13/.34 on the other. A patient and their
     clinician must be looking at the same colour when they are
     looking at the same state. */
  --done:    #34D399; --done-bg:   rgba(52,211,153,.12); --done-bd:   rgba(52,211,153,.32);
  --action:  #FFB347; --action-bg: rgba(255,179,71,.12); --action-bd: rgba(255,179,71,.34);
  --urgent:  #FF6B6B; --urgent-bg: rgba(255,107,107,.12);--urgent-bd: rgba(255,107,107,.32);

  /* ── Legacy vocabulary ────────────────────────────────────
     The names most of the product's CSS already speaks. Aliases
     now, not separate opinions, and redefined on every surface
     below so a page written in this vocabulary follows the
     surface it is on. */
  --dark:          var(--ground);
  --dark2:         var(--ground-2);
  --dark3:         var(--ground-3);
  --surface-1:     var(--surface);
  --text:          var(--ink);
  --text-2:        var(--ink-2);
  --muted:         var(--ink-muted);
  --hint:          var(--ink-faint);
  --border:        var(--line);
  --border-strong: var(--line-2);
  --teal:          var(--brand);
  --teal2:         var(--brand-mid);
  --accent:        var(--brand-lift);
  --accent-soft:   var(--brand-lift-2);
  --teal-tint:     var(--brand-tint);
  --teal-tint-2:   var(--brand-tint-2);
  --accent-tint:   var(--brand-glow);

  color-scheme: dark;
}

/* ════════════════════════════════════════════════════════════
   3 · CLINICAL — the same identity, deeper and denser
   ------------------------------------------------------------
   Opt in with <html class="theme-clinical">.

   The doctor workspace, Live Tools, Live Chart, the anesthesia
   record and Admin Center are instruments. They are read for
   hours, often in a dim theatre, and they put far more rows on a
   screen than any marketing page does.

   So this surface takes the graphite identity and asks two things
   of it: a ground one step deeper, so a full screen of it does not
   glare, and a hairline with the brand in it, because a teal edge
   is how a panel has always announced where it ends here and
   removing it would cost real legibility for the sake of tidiness.

   Density and contrast come first. Everything else — the teal
   hierarchy, the radii, the rhythm, the type — is the shared set.
   ════════════════════════════════════════════════════════════ */
.theme-clinical{
  --ground:        #0A141C;
  --ground-2:      #0D1A24;
  --ground-3:      #12202B;
  --ground-nav:    #070F16;
  --ground-sunken: #070E14;

  /* No wash. A gradient behind a vitals trace is noise. */
  --ground-glow: none;

  --surface:   rgba(255,255,255,.04);
  --surface-2: rgba(255,255,255,.065);
  --surface-3: rgba(255,255,255,.09);

  /* The brand hairline, in the homepage's teal rather than the
     old green-black one. */
  --line:   rgba(47,168,140,.22);
  --line-2: rgba(47,168,140,.34);
  --hair:   rgba(255,255,255,.08);
  --hair-2: rgba(255,255,255,.16);

  /* One step brighter than the public surface at every level: a
     dense table needs its supporting text to survive being small. */
  --ink:       #FFFFFF;
  --ink-2:     rgba(255,255,255,.78);
  --ink-muted: #9FB3C0;
  --ink-faint: #748795;
}

/* ════════════════════════════════════════════════════════════
   4 · LIGHT — maintained, assigned to nothing
   ------------------------------------------------------------
   Opt in with <html class="theme-light">.

   Warm paper rather than white: #FAFAF8 has enough yellow in it
   to stop a full page of text glaring. Cards are true white so
   they lift off it without needing a border to prove they are
   there.

   No page currently uses this. It is kept because the moment a
   surface has a genuine readability reason to be light — a page
   read outdoors, a page that is printed, a screen shared across a
   table — the decision should be one class, not a redesign. Note
   what does not change even then: the teal, the radius scale, the
   spacing rhythm, the type, the motion.
   ════════════════════════════════════════════════════════════ */
.theme-light{
  --ground:        #FAFAF8;
  --ground-2:      #F3F3EF;
  --ground-3:      #EDEDE8;
  --ground-nav:    rgba(250,250,248,.88);
  --ground-sunken: #F3F3EF;
  --ground-glow:   none;

  --surface:   #FFFFFF;
  --surface-2: #FBFBF9;
  --surface-3: #F5F5F1;

  --line:   rgba(20,24,26,.10);
  --line-2: rgba(20,24,26,.16);
  --hair:   rgba(20,24,26,.08);
  --hair-2: rgba(20,24,26,.14);

  --ink:       #14181A;
  --ink-2:     #3A4144;
  --ink-muted: #5A6360;
  --ink-faint: #6B726E;

  /* On paper the brand teal is legible as text at full strength,
     so nothing needs lifting. */
  --brand-read:   var(--brand);
  --brand-tint:   rgba(27,107,90,.06);
  --brand-tint-2: rgba(27,107,90,.12);
  --brand-glow:   rgba(27,107,90,.08);

  /* Restrained. A light interface earns depth from the hairline
     and the ground, not from a drop shadow. */
  --elev-1: 0 1px 2px rgba(20,24,26,.05);
  --elev-2: 0 4px 16px rgba(20,24,26,.07);
  --elev-3: 0 18px 44px rgba(20,24,26,.10);

  --scrim:      rgba(20,24,26,.42);
  --scrim-soft: rgba(20,24,26,.28);
  --on-accent:  #FFFFFF;

  /* The functional hues, re-struck for a light ground. The dark
     surface's pale greens and corals disappear on paper, so each
     one moves to a weight that carries the same meaning at the
     contrast this ground needs. The MEANING is unchanged; only
     the luminance is. */
  --success:    #0F7A4A;
  --success-bg: rgba(15,122,74,.07);
  --success-bd: rgba(15,122,74,.22);

  --warning:    #8A5A00;
  --warning-bg: rgba(232,168,56,.13);
  --warning-bd: rgba(232,168,56,.36);

  --danger:        #B3261E;
  --danger-strong: #8C1D18;
  --danger-bg:     rgba(179,38,30,.06);
  --danger-bd:     rgba(179,38,30,.22);

  --info:    #1B5FA8;
  --info-bg: rgba(27,95,168,.06);
  --info-bd: rgba(27,95,168,.22);

  --done:    #0F7A4A; --done-bg:   rgba(15,122,74,.07);  --done-bd:   rgba(15,122,74,.22);
  --action:  #8A5A00; --action-bg: rgba(232,168,56,.13); --action-bd: rgba(232,168,56,.36);
  --urgent:  #B3261E; --urgent-bg: rgba(179,38,30,.06);  --urgent-bd: rgba(179,38,30,.22);

  --teal:        var(--brand);
  --teal2:       var(--brand);
  --accent:      var(--brand);
  --accent-soft: var(--brand-deep);

  color-scheme: light;
}

/* ── FOCUS ──────────────────────────────────────────────────
   One visible focus treatment for the whole product, in the
   brand weight that is legible on whichever ground it lands on.

   Deliberately no border-radius: rounding the outline would mean
   overriding the corner of whatever is focused, and a 26px card
   would snap to a hard edge for exactly as long as it held
   focus. */
:focus-visible{
  outline: 2px solid var(--brand-read);
  outline-offset: 2px;
}

/* Honour a stated preference for less movement. The transitions
   in this system are all short colour and border fades, so
   removing them costs nothing and stops the interface from
   moving for someone who asked it not to. */
@media (prefers-reduced-motion: reduce){
  :root{ --dur-1: .001s; --dur-2: .001s; }
}
