/* Kosmos colour system. Change theme seeds here; components consume roles below.
   data-palette selects a brand; data-mode="light" selects the shared light roles (the default, set by appearance.js).
   Surfaces step page < panel < card/sidebar < raised, each its own seed. Fills are flat: gradients are kept only for
   progress, the sorting glow and the page lighting. */
:root {
  --theme-primary:#b5432f;
  --theme-secondary:#5b8fc9;
  --theme-accent:#d9663f;
  --theme-accent-secondary:#ece4d4;
  --theme-dust:#7d8085;
  --theme-muted:#a19e99;
  --theme-dark:#0e0f11;
  /* The page has its own seed; --theme-dark stays the depth colour (photo overlay) */
  --theme-page:#0e0f11;
  /* Independent surface/control bases. Equal defaults do not link the roles. */
  --theme-panel:#16181b;
  --theme-card:#1d2024;
  --theme-sidebar:#1d2024;
  --theme-stats:#1d2024;
  --theme-action-base:#1d2024;
  --theme-ink:#16181b;
  --theme-raised:#262a2f;
  --theme-light:#fff7ef;
  --theme-paper:#ece4d4;
  --theme-white:#fff;
  --theme-on-primary:var(--theme-light);
  /* Blue is selection; unsure has its own sand so the two never look alike */
  --status-review:#d6a85a;
  --status-success:#7fd19b;
  --status-danger:#ff8a7a;
  /* Dotted globe (pluto.js): on graphite the dots are lighter than the page, ember with ice highlights */
  --art-a:#e07a52;--art-b:var(--theme-accent-secondary);--art-dots:1.5;--art-size:1.5;--art-halo:.06;
  /* Dark menu option in light mode */
  --menu-dark:#1a1c1f;--menu-dark-ink:#f3efe8;
  /* Dark mode's menu bar: the ice band under a dark veil, so the ice shows through faintly. The veil is darker than the
     sidebar because the light ice lifts it; #040910 is the owner's match to the sidebar's grey (13 Nov) */
  --menu-grey:#040910;
  --menu-grey-veil-start:color-mix(in srgb,var(--menu-grey) 84%,transparent);
  --menu-grey-veil-end:color-mix(in srgb,var(--menu-grey) 90%,transparent);
  /* Fixed utility pigment: masks and physical shadows do not carry branding. */
  --utility-black:#000;
  color-scheme:dark;
}
:root[data-palette="glacier"] {
  --theme-primary:#355e8b;--theme-secondary:#d9663f;
  --theme-accent:#ece4d4;--theme-accent-secondary:#8a7a86;
}
:root[data-palette="rose"] {
  --theme-primary:#a84965;--theme-secondary:#4e8b88;
  --theme-accent:#b59768;--theme-accent-secondary:#bd7654;
}

/* Semantic roles: primary = the main action; secondary = navigation/selection.
   Review, success and errors retain their meaning when the brand changes. */
:root {
  --surface-page:var(--theme-page);
  --surface-panel:var(--theme-panel);
  --surface-card:var(--theme-card);
  --surface-raised:var(--theme-raised);
  --surface-sidebar:var(--theme-sidebar);
  --surface-toolbar:var(--theme-sidebar);
  --surface-stats:var(--theme-stats);
  --text:var(--theme-paper);
  --muted:var(--theme-muted);
  --text-subtle:var(--theme-dust);
  --panel:color-mix(in srgb,var(--surface-panel) 84%,transparent);
  --glass:color-mix(in srgb,var(--surface-panel) 60%,transparent);
  --field:color-mix(in srgb,var(--text) 6%,transparent);
  --border:color-mix(in srgb,var(--text) 12%,transparent);
  --hairline:color-mix(in srgb,var(--text) 7%,transparent);
  --art:color-mix(in srgb,var(--text) 18%,transparent);
  --action-primary:var(--theme-primary);
  --action-hover:color-mix(in srgb,var(--theme-primary) 86%,var(--theme-accent));
  --on-primary:var(--theme-on-primary);
  --accent-soft:color-mix(in srgb,var(--theme-accent) 16%,transparent);
  --text-primary:color-mix(in srgb,var(--theme-accent) 46%,var(--theme-light));
  --action-neutral:color-mix(in srgb,var(--text) 8%,var(--theme-action-base));
  --action-neutral-hover:color-mix(in srgb,var(--text) 13%,var(--theme-action-base));
  --on-secondary:color-mix(in srgb,var(--theme-secondary) 60%,var(--theme-light));
  --selection:color-mix(in srgb,var(--theme-secondary) 25%,var(--theme-action-base));
  --selection-border:var(--theme-secondary);
  --on-selection:var(--text);
  --focus:var(--theme-secondary);
  --link:var(--on-secondary);
  --info-soft:color-mix(in srgb,var(--status-review) 20%,transparent);
  --info-ink:color-mix(in srgb,var(--status-review) 54%,var(--theme-light));
  --ok:var(--status-success);--ok-soft:color-mix(in srgb,var(--ok) 14%,transparent);
  --warn:var(--info-ink);--warn-soft:var(--info-soft);
  --danger:var(--status-danger);--danger-soft:color-mix(in srgb,var(--danger) 13%,transparent);
  --menu-text:var(--theme-ink);
  --menu-muted:color-mix(in srgb,var(--theme-ink) 90%,var(--theme-light));
  --menu-active:var(--theme-ink);
  --menu-state:var(--theme-primary);  /* the run's state in the top bar (SORTED) */
  --logo-ring:var(--menu-text);
  --menu-border:color-mix(in srgb,var(--menu-text) 32%,transparent);
  /* The ice band: a white veil so it reads as bright ice, not beige */
  --menu-veil-start:color-mix(in srgb,var(--theme-white) 64%,transparent);
  --menu-veil-end:color-mix(in srgb,var(--theme-light) 58%,transparent);
  --photo-frame:color-mix(in srgb,var(--theme-paper) 75%,var(--theme-white));
  --photo-frame-back:var(--theme-raised);
  --photo-overlay:var(--theme-dark);
  --photo-on-overlay:var(--theme-white);
  --photo-placeholder:var(--surface-raised);
  --media-neutral-top:color-mix(in srgb,var(--theme-raised) 78%,var(--theme-muted));
  --media-neutral-bottom:var(--theme-raised);
  --media-neutral-mean:color-mix(in srgb,var(--theme-raised) 88%,var(--theme-muted));
  --mask-opaque:var(--utility-black);
  --shadow-color:var(--utility-black);
  --highlight:var(--theme-white);
  --effect-primary:var(--theme-primary);
  --effect-secondary:var(--theme-secondary);
  --effect-accent:var(--theme-accent);
  --effect-warm:color-mix(in srgb,var(--theme-accent) 35%,var(--theme-light));
  --effect-cool:color-mix(in srgb,var(--theme-secondary) 30%,var(--theme-white));
  --effect-spark:var(--theme-light);
  /* Flat fills */
  --fill-primary:var(--action-primary);
  --fill-primary-hover:var(--action-hover);
  --fill-card:var(--surface-card);
  --fill-card-hover:color-mix(in srgb,var(--surface-card) 94%,var(--text));
  --fill-stats:var(--surface-stats);
  --gradient-progress:linear-gradient(90deg,var(--theme-dust),var(--theme-primary) 40%,var(--theme-accent) 80%,var(--theme-accent-secondary));
  /* The four brand colours blended round (All folders thumbnail) */
  --gradient-art:conic-gradient(from 45deg,var(--theme-primary),var(--theme-accent),var(--theme-accent-secondary),var(--theme-secondary),var(--theme-primary));
  --shadow:0 1px 2px color-mix(in srgb,var(--shadow-color) 30%,transparent),0 14px 40px color-mix(in srgb,var(--shadow-color) 40%,transparent);
  --shadow-card:0 1px 2px color-mix(in srgb,var(--shadow-color) 18%,transparent);
  /* Page lighting when the photo texture is off: light falls from the top centre, the edges shade off, a faint dot grid */
  --depth-lift:color-mix(in srgb,var(--surface-page) 90%,var(--highlight));
  --depth-shade:color-mix(in srgb,var(--surface-page) 55%,var(--shadow-color));
  --depth-dot:color-mix(in srgb,var(--text) 7%,transparent);
  --texture-image:url(/assets/surface.jpg);--texture-strength:.18;
}

/* Mode changes semantic surfaces/ink once, without per-component light CSS. */
:root[data-mode="light"] {
  color-scheme:light;
  --theme-panel:var(--theme-white);
  --theme-card:var(--theme-white);
  --theme-sidebar:var(--theme-white);
  --theme-stats:var(--theme-white);
  --theme-action-base:var(--theme-white);
  --theme-ink:#1a1c1f;
  --theme-page:#f2efea;
  --surface-raised:#e9e5df;
  --text:var(--theme-ink);
  --muted:color-mix(in srgb,var(--theme-ink) 72%,var(--theme-light));
  --text-subtle:var(--muted);
  --text-primary:color-mix(in srgb,var(--theme-primary) 85%,var(--theme-ink));
  --on-secondary:color-mix(in srgb,var(--theme-secondary) 55%,var(--theme-ink));
  /* Deeper glacier for selection borders and focus rings: about 5.5:1 on white (the plain secondary is 3.4:1) */
  --selection-border:color-mix(in srgb,var(--theme-secondary) 70%,var(--theme-ink));
  --focus:var(--selection-border);
  --status-review:#94651a;
  --info-ink:color-mix(in srgb,var(--status-review) 62%,var(--theme-ink));
  --status-success:#32704c;--status-danger:#ae3c32;
  /* Photo sphere: back tiles fade into the paper, distant placeholders are light */
  --photo-overlay:var(--surface-page);--photo-frame-back:var(--surface-raised);
  --media-neutral-top:color-mix(in srgb,var(--surface-raised) 80%,var(--theme-muted));--media-neutral-bottom:var(--surface-raised);
  --media-neutral-mean:color-mix(in srgb,var(--surface-raised) 90%,var(--theme-muted));
  /* Dots need more weight on paper: deeper rust, larger and more opaque */
  --art-a:#a33a27;--art-b:var(--theme-accent);--art-dots:1.6;--art-size:1.7;--art-halo:.05;
  --depth-lift:color-mix(in srgb,var(--surface-page) 35%,var(--highlight));
  --depth-shade:color-mix(in srgb,var(--surface-page) 91%,var(--shadow-color));
  --depth-dot:color-mix(in srgb,var(--text) 11%,transparent);
  --texture-image:url(/assets/ice.jpg);--texture-strength:.22;
}
/* Dark mode's menu is a dark bar matched to the sidebar's grey, with light ink. Light mode: Ice (default), White, or Dark */
:root:not([data-mode="light"]),
:root[data-mode="light"][data-menu="dark"] {
  --menu-text:var(--menu-dark-ink);--menu-muted:color-mix(in srgb,var(--menu-dark-ink) 75%,transparent);--menu-active:var(--theme-white);
  --menu-state:color-mix(in srgb,var(--theme-accent) 70%,var(--theme-light));
}
