/* ==========================================================
   Obodly "clay" design tokens (light theme)
   Matte solid surfaces, soft LIGHT outer shadow + thin inner top
   highlight, large radii, pill buttons. No gradients, no glass,
   no backdrop-filter.

   Scoped to .clay so loading this file never changes other pages.
   Step 1: only templates/styleguide.html uses it (body.clay).

   Contrast: every text pair below is WCAG AA (>= 4.5:1, measured);
   UI boundaries of form controls >= 3:1 (WCAG 1.4.11).
   Sunlight: all surfaces are solid and opaque, text is near-black
   (#1E2235, 13.9-15.5:1), so readability does not depend on what
   is behind a surface.
   ========================================================== */

.clay{
  /* --- Surfaces (Halil's palette) ---------------------------------- */
  --bg:#F4F1EC;              /* page background */
  --surface:#FFFDFA;         /* cards, inputs, tables (solid white-ish) */
  --surface-sunken:#EEE8E0;  /* secondary button, pressed rows, disabled fill */
  --border:#E8E1D8;          /* DECORATIVE only: card edges, dividers (1.28:1, not a UI boundary) */

  /* --- Text ----------------------------------------------------------- */
  --text:#1E2235;            /* 13.96 on bg, 15.49 on surface */
  --text-muted:#6B6259;      /* extra token: warm grey, 5.30 on bg, 5.88 on surface */
  --text-disabled:#8C8177;   /* disabled controls only (WCAG exempts disabled) */
  --accent-text:#9A3D0A;     /* extra token: links / active nav. Primary #FFB685 is too light for text (1.68) */

  /* --- Primary (pill buttons) ------------------------------------------ */
  --primary:#FFB685;
  --primary-hover:#FFAC78;   /* between primary and pressed */
  --primary-pressed:#FFA36B;
  --on-primary:#4A1B0C;      /* 8.45 on primary, 7.36 on pressed */

  /* --- Form controls ---------------------------------------------------- */
  --field-border:#8C8177;    /* extra token: input/select/checkbox edge, 3.75 on surface, 3.38 on bg */
  --field-border-hover:#6B6259;
  --field-bg:var(--surface);

  /* --- Focus ring ------------------------------------------------------- */
  /* #FF7A1A alone is 2.32 on bg / 2.57 on surface (< 3:1). So the ring is
     2px gap + 2px orange + 2px #4A1B0C: the dark band is 12.8-14.2 against
     bg/surface and 5.54 against the orange, so the indicator passes 3:1. */
  --focus:#FF7A1A;
  --focus-outer:#4A1B0C;
  --ring-gap:var(--surface);
  --ring:0 0 0 2px var(--ring-gap), 0 0 0 4px var(--focus), 0 0 0 6px var(--focus-outer);

  /* --- Category chips (bg = Halil's hex; text = dark shade of same hue) --- */
  --cat-construction-bg:#FFD9BF; --cat-construction-text:#7A3410; /* 6.85 */
  --cat-finishing-bg:#F9D3EA;    --cat-finishing-text:#7A1F55;    /* 7.21 */
  --cat-furniture-bg:#DCD9FF;    --cat-furniture-text:#3A2F8F;    /* 7.77 */
  --cat-plumbing-bg:#CDEFF2;     --cat-plumbing-text:#0D5560;     /* 6.93 */

  /* --- Alerts / status (bg = Halil's hex; text = dark of same hue) ------- */
  --success-bg:#BFEBD6; --on-success:#12573A; /* 6.56 */
  --warning-bg:#FDE7A6; --on-warning:#6B4A00; /* 6.59 */
  --error-bg:#F6C1C1;   --on-error:#8A1C1C;   /* 5.88 */
  --info-bg:#DCE6F5;    --on-info:#1F3F73;    /* extra token: palette had no info hue; 8.27 */

  /* Status text on white/bg in tables and numbers. Always paired with an
     icon or sign, never colour alone. */
  --status-ok:#12573A;       /* 8.44 on surface, 7.61 on bg */
  --status-bad:#A32020;      /* 7.43 on surface, 6.69 on bg */
  --error-text:#A32020;      /* field error message */
  --error-border:#C0392B;    /* field error edge, 5.36 on surface */

  /* --- Toast / scrim ------------------------------------------------------ */
  --toast-bg:#1E2235; --on-toast:#FFFDFA;     /* 15.49 */
  --scrim:rgba(30,34,53,.45);                 /* plain dim behind modals, no blur */

  /* --- Radii -------------------------------------------------------------- */
  --r-xl:24px;   /* modals, drawer, large cards */
  --r-lg:20px;   /* cards, alerts, table wrapper */
  --r-md:14px;   /* inputs, selects, textarea */
  --r-sm:10px;   /* small tiles, menu rows */
  --r-xs:6px;    /* checkbox */
  --r-pill:999px;/* buttons, chips, badges, tab pills */

  /* --- Shadows (kept LIGHT; warm brown tint, not grey) ------------------- */
  --highlight:inset 0 1px 0 rgba(255,255,255,.7);
  --shadow-sm:0 1px 2px rgba(74,52,30,.06), 0 2px 6px rgba(74,52,30,.05);
  --shadow-md:0 2px 4px rgba(74,52,30,.05), 0 8px 22px rgba(74,52,30,.08);
  --shadow-pressed:inset 0 2px 4px rgba(74,27,12,.14);
  --elev-sm:var(--highlight), var(--shadow-sm);   /* buttons, chips-as-controls, inputs */
  --elev-md:var(--highlight), var(--shadow-md);   /* cards, modal, drawer, tab bar */

  /* --- Spacing scale (4px base) -------------------------------------------- */
  --s-1:4px; --s-2:8px; --s-3:12px; --s-4:16px; --s-5:20px;
  --s-6:24px; --s-8:32px; --s-10:40px; --s-12:48px;
  --tap:44px;    /* minimum tap target */
  --tap-lg:52px; /* main buttons, inputs */

  /* --- Type (existing fonts from base.html, no new web fonts) ------------- */
  --font-display:"Barlow Condensed","Arial Narrow",Arial,sans-serif;
  --font-body:"Inter",-apple-system,"Segoe UI",Roboto,sans-serif;
  --font-mono:"IBM Plex Mono","SF Mono",ui-monospace,monospace;
  --fs-xs:12px;    /* eyebrow, captions */
  --fs-sm:13.5px;  /* hints, meta */
  --fs-base:15px;  /* body, inputs (16px on inputs at mobile to stop iOS zoom) */
  --fs-md:17px;    /* buttons, list titles */
  --fs-lg:20px;    /* h3 */
  --fs-xl:26px;    /* h2 */
  --fs-2xl:34px;   /* h1 */
  --fs-num:36px;   /* stat numbers (mono) */
  --lh-tight:1.15; --lh-base:1.5;

  /* --- Motion -------------------------------------------------------------- */
  --dur-fast:120ms;
  --dur-base:180ms;
  --ease:cubic-bezier(.2,.7,.2,1);
}

/* Reduced motion: no transitions, no animation, no press scale/shift. */
@media (prefers-reduced-motion: reduce){
  .clay{ --dur-fast:0ms; --dur-base:0ms }
  .clay *, .clay *::before, .clay *::after{
    transition:none !important;
    animation:none !important;
  }
}

/* Forced colors (Windows high contrast): shadows vanish, so every surface
   and control gets a real system-colour border; focus uses outline. */
@media (forced-colors: active){
  .clay{
    --highlight:0 0 0 transparent;
    --shadow-sm:0 0 0 transparent;
    --shadow-md:0 0 0 transparent;
    --shadow-pressed:0 0 0 transparent;
    --border:CanvasText;
    --field-border:CanvasText;
  }
}

/* --- On-site (sunlight) variant ---------------------------------------
   Group 2 pages (report_new / delivery_new and their sent pages) are used
   outdoors on cheap phones. Page opt-in: <body class="clay onsite">.
   Same palette, darker text shades so body text, labels, hints and alert
   text reach >= 7:1, and stronger field edges. Measured ratios: */
.clay.onsite{
  --text-muted:#524A42;      /* 8.56 on surface, 7.71 on bg (was 5.88 / 5.30) */
  --accent-text:#7A3410;     /* eyebrow/links: 8.89 on surface, 8.01 on bg */
  --on-error:#6A1010;        /* 7.86 on --error-bg */
  --on-success:#0B4029;      /* 9.03 on --success-bg, 11.62 on surface */
  --on-info:#1F3F73;         /* 8.27 on --info-bg (unchanged) */
  --error-text:#8A1C1C;      /* inline field error: 9.14 on surface, 8.23 on bg */
  --field-border:#766B61;    /* 5.11 on surface, 4.61 on bg, 4.26 on surface-sunken */
  --field-border-hover:#524A42;
  --placeholder:#6B6259;     /* example text stays lighter than real input (5.88, AA) so
                                "8" or "Sement" is never mistaken for a filled value */
}
@media (forced-colors: active){
  .clay.onsite{--field-border:CanvasText}
}
