/**
FileName: tokens.css
Version: 8.7.1
Written based on the version: 8.7.0
Purpose: Single token source for A-SUN Studio.
Decision Log:
  8.7.1 FIX: weather accent/tint were dead channels. Custom properties
        substitute var() at their DECLARED scope only; declared on :root,
        accent/tint resolved once with :root channels and inherited as
        fixed values. Persona hue (8.6.0), project-status saturation
        (8.6.0) and user accent (8.7.0) never reached them. Redeclared
        both on .a-sun-studio so all overrides finally propagate.
  8.7.0 NEW: [data-theme="modern"] theme block.
  8.7.0 NEW: User accent override (personalization), hue-only.
  8.6.0 NEW: Project Weather two-channel model (hue/saturation).
  8.5.1 FIX: Project Weather recolors the UI via --color-primary.
  8.5.0 NEW: Project Weather layer.
  7.4.0 NEW: thinking-sun palette + scoped application rules.
Rules:
  No hard-coded colors are allowed in other CSS files.
  Light/dark themes are token-driven.
Owner: A-SUN Studio
*/

:root {
    --color-primary: #a46497;
    --color-accent: #2d5c4d;
    --bg-light: #e7e7e7;
    --bg-dark: #323232;

    --font-fa: 'Anjoman', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    --font-en: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --astudio-radius-ts: 0;
    --astudio-radius-te: 7px;
    --astudio-radius-be: 0;
    --astudio-radius-bs: 7px;

    --astudio-panel: rgba(17, 18, 23, 0.82);
    --astudio-text: #f2f3f6;
    --astudio-muted: color-mix(in srgb, var(--astudio-text) 68%, transparent);
    --astudio-surface: color-mix(in srgb, var(--astudio-text) 7%, transparent);
    --astudio-surface-strong: color-mix(in srgb, var(--astudio-text) 13%, transparent);
    --astudio-field: color-mix(in srgb, var(--astudio-text) 9%, transparent);
    --astudio-border: color-mix(in srgb, var(--astudio-text) 16%, transparent);
    --astudio-glass: color-mix(in srgb, var(--astudio-text) 4%, transparent);
    --astudio-inset: color-mix(in srgb, var(--astudio-text) 5%, transparent);
    --astudio-popover: rgba(22, 23, 29, 0.97);

    --astudio-success: #35b184;
    --astudio-error: #e0685c;
    --astudio-icon-dot: var(--color-primary);

    /* ── 8.6.0: Project Weather — two channel model ─────────────────
       HUE         ← persona identity / user accent (set on the shell)
       SATURATION  ← project intensity (set on the shell)
       Default hue 315 ≈ brand purple; default sat keeps resting look. */
    --astudio-weather-hue: 315;
    --astudio-weather-sat: 34%;
    --astudio-weather-light: 52%;
    --astudio-weather-accent: hsl(var(--astudio-weather-hue) var(--astudio-weather-sat) var(--astudio-weather-light));
    --astudio-weather-tint: hsl(var(--astudio-weather-hue) var(--astudio-weather-sat) var(--astudio-weather-light) / 0.14);

    /* 7.4.0 — thinking sun: white core, warm ring, color-wheel rays. */
    --astudio-sun-core: #ffffff;
    --astudio-sun-ring: #eac96e;
    --astudio-sun-ray-1: hsl(4, 62%, 62%);
    --astudio-sun-ray-2: hsl(32, 68%, 58%);
    --astudio-sun-ray-3: hsl(50, 74%, 50%);
    --astudio-sun-ray-4: hsl(105, 42%, 54%);
    --astudio-sun-ray-5: hsl(172, 52%, 46%);
    --astudio-sun-ray-6: hsl(212, 56%, 62%);
    --astudio-sun-ray-7: hsl(268, 48%, 66%);
    --astudio-sun-ray-8: hsl(322, 54%, 62%);
}

/* ── 8.7.1 FIX: derived weather vars must be REDECLARED on the shell ──
   Custom properties substitute var() at their declared scope only.
   On :root they resolved once with :root channels and inherited as a
   FIXED value, so hue/sat overrides on .a-sun-studio never propagated.
   Redeclaring here makes accent/tint compute against the shell's own
   (overridable) channels — persona hue, project-status saturation and
   the user accent all come alive with this block. */
.a-sun-studio {
    --astudio-weather-accent: hsl(var(--astudio-weather-hue) var(--astudio-weather-sat) var(--astudio-weather-light));
    --astudio-weather-tint: hsl(var(--astudio-weather-hue) var(--astudio-weather-sat) var(--astudio-weather-light) / 0.14);
}

[data-theme="light"] {
    --astudio-panel: rgba(245, 245, 247, 0.82);
    --astudio-text: #1a1b21;
    --astudio-muted: color-mix(in srgb, var(--astudio-text) 62%, transparent);
    --astudio-surface: color-mix(in srgb, var(--astudio-text) 5%, transparent);
    --astudio-surface-strong: color-mix(in srgb, var(--astudio-text) 10%, transparent);
    --astudio-field: color-mix(in srgb, var(--astudio-text) 6%, transparent);
    --astudio-border: color-mix(in srgb, var(--astudio-text) 14%, transparent);
    --astudio-glass: color-mix(in srgb, var(--astudio-text) 3%, transparent);
    --astudio-inset: color-mix(in srgb, var(--astudio-text) 4%, transparent);
    --astudio-popover: rgba(252, 252, 253, 0.97);

    --astudio-sun-ray-3: hsl(50, 82%, 42%);
    --astudio-sun-ray-5: hsl(172, 56%, 38%);
}

/* 8.7.0: "مدرن" — cooler graphite-blue glass between dark and light. */
[data-theme="modern"] {
    --astudio-panel: rgba(24, 28, 38, 0.82);
    --astudio-text: #eef1f7;
    --astudio-muted: color-mix(in srgb, var(--astudio-text) 66%, transparent);
    --astudio-surface: color-mix(in srgb, var(--astudio-text) 6%, transparent);
    --astudio-surface-strong: color-mix(in srgb, var(--astudio-text) 12%, transparent);
    --astudio-field: color-mix(in srgb, var(--astudio-text) 8%, transparent);
    --astudio-border: color-mix(in srgb, var(--astudio-text) 15%, transparent);
    --astudio-glass: color-mix(in srgb, var(--astudio-text) 4%, transparent);
    --astudio-inset: color-mix(in srgb, var(--astudio-text) 5%, transparent);
    --astudio-popover: rgba(28, 32, 44, 0.97);
}

/* ── Persona weather HUE mapping ─────────────────────────────────────
   Hue values mirror prompts.php :: a_sun_studio_persona_weather().
   NOTE: these only became visually effective with the 8.7.1 fix above. */
.a-sun-studio[data-persona="design_coach"] {
    --astudio-weather-hue: 315;
}

.a-sun-studio[data-persona="elham"] {
    --astudio-weather-hue: 36;
}

.a-sun-studio[data-persona="hoshiar"] {
    --astudio-weather-hue: 165;
}

.a-sun-studio[data-persona="negar"] {
    --astudio-weather-hue: 215;
}

.a-sun-studio[data-persona="product_designer"] {
    --astudio-weather-hue: 288;
}

.a-sun-studio[data-persona="mechanic_engineer"] {
    --astudio-weather-hue: 205;
}

.a-sun-studio[data-persona="roundtable"] {
    --astudio-weather-hue: 315;
}

/* ── 8.6.0: Project status SATURATION mapping ───────────────────────
   The stage of the active project modulates the weather intensity.
   draft = muted/uncertain, ideation = vivid spark, in_progress =
   focused solid, finished = settled calm. status.js stamps the attr. */
.a-sun-studio[data-project-status="draft"] {
    --astudio-weather-sat: 22%;
}

.a-sun-studio[data-project-status="ideation"] {
    --astudio-weather-sat: 48%;
}

.a-sun-studio[data-project-status="in_progress"] {
    --astudio-weather-sat: 40%;
}

.a-sun-studio[data-project-status="finished"] {
    --astudio-weather-sat: 30%;
}

/* ── The weather lever ──────────────────────────────────────────────
   When a persona is active, the master accent follows its weather color.
   Every element styled with var(--color-primary) shifts together. Because
   --color-primary = --astudio-weather-accent, project-status saturation
   also flows through to all accents, including the status bar. */
.a-sun-studio[data-persona] {
    --color-primary: var(--astudio-weather-accent);
}

/* ── 8.7.0: User accent override (personalization) ──────────────────
   Explicit user choice beats persona hue. HUE ONLY — the saturation
   channel stays owned by project status, so the weather model keeps
   breathing. `default` removes the attribute (persona-driven). */
.a-sun-studio[data-accent="brand"] {
    --astudio-weather-hue: 315;
}

.a-sun-studio[data-accent="rose"] {
    --astudio-weather-hue: 350;
}

.a-sun-studio[data-accent="amber"] {
    --astudio-weather-hue: 36;
}

.a-sun-studio[data-accent="teal"] {
    --astudio-weather-hue: 168;
}

.a-sun-studio[data-accent="blue"] {
    --astudio-weather-hue: 215;
}

/* ── 7.3.0: icon dot accent application ───────────────────────────── */
.astudio-icon-dot {
    fill: var(--astudio-icon-dot);
}

/* ── 7.4.0: thinking-sun application (COLOR ONLY) ─────────────────── */
.a-sun-studio .astudio-think-sun {
    fill: var(--astudio-sun-core);
    stroke: var(--astudio-sun-ring);
}

.a-sun-studio .astudio-think-rays line:nth-child(1) {
    stroke: var(--astudio-sun-ray-1);
}

.a-sun-studio .astudio-think-rays line:nth-child(2) {
    stroke: var(--astudio-sun-ray-2);
}

.a-sun-studio .astudio-think-rays line:nth-child(3) {
    stroke: var(--astudio-sun-ray-3);
}

.a-sun-studio .astudio-think-rays line:nth-child(4) {
    stroke: var(--astudio-sun-ray-4);
}

.a-sun-studio .astudio-think-rays line:nth-child(5) {
    stroke: var(--astudio-sun-ray-5);
}

.a-sun-studio .astudio-think-rays line:nth-child(6) {
    stroke: var(--astudio-sun-ray-6);
}

.a-sun-studio .astudio-think-rays line:nth-child(7) {
    stroke: var(--astudio-sun-ray-7);
}

.a-sun-studio .astudio-think-rays line:nth-child(8) {
    stroke: var(--astudio-sun-ray-8);
}