/*
 * Blink Vision Center: design tokens for the rebuilt theme.
 *
 * Taken from the old the-philadelphia/sushiya theme (CodeKit SCSS + ACF colour pickers) and
 * corrected for WCAG 2.2 AA. Every colour pair actually used is checked by contrast.mjs, which
 * reads this file. Run `node contrast.mjs` after any change; it exits nonzero on a failure.
 * The pair table, the old-to-new mapping and the reasons are in tokens.md.
 *
 * Units: the old theme set `html { font-size: 18px }`. The rebuild leaves the root at the
 * browser default (100%, normally 16px) so user font-size preferences work, and sets the body
 * to 1.125rem (18px). All rem values below assume a 16px root; px in comments are for reference.
 *
 * Breakpoints (custom properties cannot be used inside @media; copy the literal values).
 * Old SCSS names in brackets. Media-query em/rem is always 16px-based, so these match the old
 * site exactly:
 *   42em  = 672px   [$ipadtall]  footer locations side by side; review logos 4-up; mobile nav text 1.5em
 *   56em  = 896px   [$ipadwide]  desktop nav replaces the menu toggle; home-blocks go two-column;
 *                                team grid goes 3-up/5-up; reviews two-column; section padding fixed
 *   66em  = 1056px  [$laptop]    hero text column narrows (right 40% left for the photo), hero text
 *                                grows 1.15x; footer splits into locations (55%) + contact (45%)
 * Use min-width queries in em: @media (min-width: 56em) { ... }
 */

:root {
  /* ------------------------------------------------------------------
   * 1. Colour primitives
   * ------------------------------------------------------------------ */

  /* Brand teal. ACF options_primary_color. White text on it is 2.55:1, so it is
     DECORATIVE ONLY (fills with no text, the logo in the maps). Never put text on it,
     except --color-on-teal-500 below. */
  --color-teal-500: #63b09f;
  /* Darker teal (same hue/saturation, HSL lightness 54% -> 34%). White on it 5.49:1;
     as text on white 5.49:1, on --color-gray-50 5.13:1. Replaces brand teal behind text
     (footer, sub-footer, mobile menu) and is the link and rating colour. */
  --color-teal-700: #3a7366;
  /* Hover/pressed teal. White 8.04:1. */
  --color-teal-800: #2c584e;

  /* Brand purple. ACF options_button_color. White on it 5.08:1: passes, unchanged. */
  --color-purple-500: #7564a6;
  /* Button hover. White on it 7.63:1. */
  --color-purple-700: #594b82;
  /* Near-black purple, outer focus ring only. White 17.2:1. */
  --color-purple-950: #1d182b;

  --color-white: #ffffff;
  --color-black: #000000;
  /* Neutrals. 50 = ACF options_grayscale ($light), 300 = $lines, 700 = lighten($copy,10%),
     800 = $copy. 600 is new (form/UI borders; the old site had none that passed). */
  --color-gray-50: #f7f7f7;
  --color-gray-300: #c6c6c6;
  --color-gray-600: #767676;
  --color-gray-700: #605f5f;
  --color-gray-800: #464646;
  /* Near-black for text on brand teal, if brand teal must ever carry text (6.83:1). */
  --color-gray-950: #1a1a1a;

  /* ------------------------------------------------------------------
   * 2. Semantic colour roles (use these in components, not the primitives)
   * ------------------------------------------------------------------ */

  /* Page */
  --color-bg: var(--color-white);
  --color-surface: var(--color-gray-50);          /* image backing panels, alt sections */
  --color-text: var(--color-gray-800);             /* body copy, headings */
  --color-heading: var(--color-gray-800);
  --color-text-muted: var(--color-gray-700);       /* home-block / services paragraphs */
  --color-rule: var(--color-gray-300);             /* decorative 1px rules ONLY (2 lines on home-blocks); not for borders that identify a control */
  --color-border-ui: var(--color-gray-600);        /* input/control borders, card outlines that matter: 4.54:1 on white */
  --color-accent-text: var(--color-teal-700);      /* teal-coloured text on light backgrounds (eyebrows, icons) */

  /* Links (body copy, light backgrounds). Always underlined: colour is never the only cue. */
  --color-link: var(--color-teal-700);
  --color-link-hover: var(--color-teal-800);
  --color-link-visited: var(--color-teal-700);     /* old site had no visited style; keep it that way */

  /* Buttons (the old `p.button a`: purple block, white text as authored (lowercase "read more"), square corners) */
  --color-button-bg: var(--color-purple-500);
  --color-button-text: var(--color-white);
  --color-button-bg-hover: var(--color-purple-700);
  --color-button-text-hover: var(--color-white);
  --color-button-border: var(--color-purple-500);  /* boundary vs page: 5.08:1 on white, 4.75:1 on surface */

  /* Header / hero: white text over a photo with a black scrim. 0.6 guarantees >= 5.7:1 for
     white text even over a pure-white pixel (worst case). Do not go below 0.55 (4.76:1). Old
     site: 0.65 below 56em, 0.45 at 56em and up (worst case 3.36:1, fails). */
  --color-header-text: var(--color-white);
  --color-header-scrim: rgba(0, 0, 0, 0.6);
  --color-header-fallback-bg: var(--color-teal-800); /* behind the photo while it loads / if it fails */

  /* Navigation */
  --color-nav-text: var(--color-white);            /* desktop: links sit over the header photo + scrim */
  --color-nav-current: var(--color-white);         /* current page: underline, not colour */
  --color-nav-mobile-bg: var(--color-teal-700);    /* full-screen mobile menu panel (old: brand teal, 2.55:1) */
  --color-nav-mobile-text: var(--color-white);
  --color-nav-mobile-rule: rgba(255, 255, 255, 0.5); /* decorative separators between items (unchanged) */
  --color-nav-toggle: var(--color-white);          /* menu/close button icon over photo or teal-700 */

  /* Footer (old: brand teal + white) */
  --color-footer-bg: var(--color-teal-700);
  --color-footer-text: var(--color-white);
  --color-footer-link: var(--color-white);         /* underlined */
  --color-footer-link-hover: var(--color-white);   /* hover = thicker underline, colour unchanged */
  --color-subfooter-bg: var(--color-teal-700);     /* logo band; old: brand teal */

  /* Copyright bar (old: button colour + button text colour) */
  --color-copyright-bg: var(--color-purple-500);
  --color-copyright-text: var(--color-white);

  /* Reviews: star rating icons (old: brand teal via `path { fill }`, 2.55:1). Also give the
     rating as text ("5 out of 5 stars"); the colour is not the only carrier. */
  --color-rating: var(--color-teal-700);

  /* Only if brand teal has to stay behind text somewhere: use near-black, not white. */
  --color-on-teal-500: var(--color-gray-950);

  /* Focus: two-colour ring (WCAG technique C40). Outer dark ring + inner white ring, each at
     least 2px, 17.2:1 against each other, so one of them always has >= 3:1 against whatever
     is next to it: white, surface, brand teal, teal-700, purple, the photo scrim, black. */
  --color-focus-outer: var(--color-purple-950);
  --color-focus-inner: var(--color-white);

  /* ------------------------------------------------------------------
   * 3. Focus indicator
   *    a:focus-visible, button:focus-visible, ... {
   *      outline: var(--focus-outline);
   *      outline-offset: var(--focus-offset);
   *      box-shadow: var(--focus-shadow);
   *    }
   *    The shadow fills the gap between the element and the outline with white; the outline
   *    paints on top, so 2px of white shows inside 3px of dark. Never remove outlines without
   *    this replacement (the old site's normalize set `a:hover { outline-width: 0 }`).
   *    In forced-colors mode the box-shadow is dropped and the outline takes the system colour,
   *    which is the desired behaviour.
   * ------------------------------------------------------------------ */
  --focus-width: 3px;
  --focus-offset: 2px;
  --focus-outline: var(--focus-width) solid var(--color-focus-outer);
  --focus-shadow: 0 0 0 calc(var(--focus-offset) + 1px) var(--color-focus-inner);

  /* ------------------------------------------------------------------
   * 4. Typography
   *    Lato 400 / 700 / 900 (+ 400 italic), self-hosted: see fonts.css and fonts/OFL.txt.
   *    Old site loaded Lato 400,700,900 from fonts.googleapis.com.
   * ------------------------------------------------------------------ */
  --font-sans: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --font-weight-regular: 400;   /* body, eyebrows, hero h2/h3, nav */
  --font-weight-bold: 700;      /* block titles (h2), <strong>, footer h4 */
  --font-weight-black: 900;     /* <strong> inside the hero tagline only */

  /* Sizes. Old value in brackets (old 1em = 18px). */
  --text-sm: 1rem;              /* 16px  fine print (credit line, file sizes); new, nothing smaller */
  --text-body: 1.125rem;        /* 18px  [html 18px] body, nav (desktop), footer, buttons */
  --text-eyebrow: 1.25rem;      /* 20px  [1.1em = 19.8px] small uppercase title above a block title (.inside h1, .home-block h3) */
  --text-h3: 1.3125rem;         /* 21px  [UA 1.17em = 21.06px] content h3 (For Patients sections) */
  --text-h2: 1.5625rem;         /* 25px  [1.4em = 25.2px] block title, uppercase bold */
  --text-h4: 1.125rem;          /* 18px  [UA 1em] footer "Get in touch" */
  --text-hero-eyebrow: 1.25rem;          /* [1.1em] "Welcome", uppercase */
  --text-hero-eyebrow-lg: 1.4375rem;     /* [1.1em x 1.15 = 22.8px] at 66em+ */
  --text-hero-title: 1.6875rem;          /* [UA h2 1.5em = 27px] tagline, uppercase regular */
  --text-hero-title-lg: 1.9375rem;       /* [27px x 1.15 = 31px] at 66em+ */
  --text-hero-sub: 1.3125rem;            /* [UA h3 1.17em = 21px] sub-tagline */
  --text-hero-sub-lg: 1.5rem;            /* [21px x 1.15 = 24.2px] at 66em+ */
  --text-nav-mobile: clamp(1.125rem, 5vw, 1.6875rem); /* [5vw, 1.5em = 27px at 42em+]; old 5vw was 16px at 320px, now >= 18px */
  --text-nav-desktop: 1.125rem;          /* [1em] */

  --leading-body: 1.5;          /* [$lh] */
  --leading-heading: 1.2;       /* [$hlh] */
  --leading-tight: 1.1;         /* buttons, nav items */

  /* Uppercase is part of the look (eyebrows, block titles, hero, nav). Apply it with
     text-transform in CSS only; keep the source text in sentence case so screen readers do
     not spell it out. */

  /* ------------------------------------------------------------------
   * 5. Spacing (old values were em at 18px; same lengths in rem)
   * ------------------------------------------------------------------ */
  --space-2xs: 0.5625rem;   /*  9px  [0.5em]  team-name gap, input padding */
  --space-xs: 0.84375rem;   /* 13.5px [0.75em] hero tagline padding, mobile nav item padding (0.5em of 27px) */
  --space-s: 1.125rem;      /* 18px  [1em]    header padding, sub-footer/copyright padding, desktop nav gap */
  --space-m: 1.6875rem;     /* 27px  [1.5em]  button side padding, review-logo gap */
  --space-l: 2.25rem;       /* 36px  [2em]    paragraph-button gap, list margins, address top margin */
  --space-xl: 3.375rem;     /* 54px  [3em]    footer padding, review gap, .spacer */
  --space-2xl: 4.5rem;      /* 72px  [4em]    section padding at 56em+ */
  /* Section padding: old was 10vw below 56em, then 4em. Same range, without the jump. */
  --space-section: clamp(2rem, 10vw, 4.5rem);
  /* Home-block indent: the 1px rule and paragraph indent (old 7em = 126px at every width,
     which left ~160px of text at 320px). Scales down on small screens. */
  --space-block-indent: clamp(1.5rem, 14vw, 7.875rem);

  /* ------------------------------------------------------------------
   * 6. Layout
   * ------------------------------------------------------------------ */
  --container-width: 90vw;      /* [.container width: 90vw] = 16px gutters at 320px */
  --container-max: 70.5rem;     /* [62.7rem at 18px root = 1128.6px] */
  --measure: 70ch;              /* max line length for long text; new (old lines ran ~1000px) */
  /* Header logo: the old h1 had max-width 5em of its own 2em (36px) font size, so it rendered at
     180px, and 207px from 66em (measured on the baseline screenshots). Earlier versions of this
     file said 90/104px, which misread the em base. */
  --logo-width: 11.25rem;       /* 180px */
  --logo-width-lg: 12.9375rem;  /* 207px at 66em+ */
  --logo-width-footer: 6.75rem; /* [.subfooter figure max-width 6em = 108px] */

  /* ------------------------------------------------------------------
   * 7. Shape, elevation, motion, targets
   * ------------------------------------------------------------------ */
  --radius-none: 0;             /* buttons, images, panels: the old site is square-cornered */
  --radius-sm: 0.225rem;        /* [0.2em = 3.6px] form inputs and form buttons only */
  --radius-map-card: 0.875rem;  /* 14px, the address card drawn in the map SVGs */
  --shadow-none: none;          /* the old site used no shadows; keep it flat */

  --border-width-rule: 1px;     /* hero tagline top/bottom rules, home-block rules */
  --border-width-ui: 1px;

  --duration-nav: 150ms;        /* [.15s ease-in-out] mobile menu slide */
  --easing-standard: ease-in-out;

  --target-min: 1.5rem;         /* 24px, WCAG 2.5.8 minimum */
  --target-comfortable: 2.75rem;/* 44px, use for the menu toggle, close button, nav items, buttons */
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-nav: 0ms;
  }
}
