/**
 * XSET brand overlay for the XSET Valet instance (xset.valet.xors.xyz).
 *
 * The instance runs the same build as XORS Valet. install-brand.sh copies
 * the web build, links this file last in index.html and adds the files in
 * this folder under /brand/. It uses the same selectors as the build's XORS
 * theme (styles/xors.css) and loads after it, so it wins on source order.
 * Every block states the whole token set, as theme.css requires.
 *
 * Source: XSET's kit in xors-xyz lib/outreach/features.ts (xsetBrand):
 *   red #F00828, ground #0A0A0A, glyph and wordmark from xset.com.
 * Fills use #E5061F, a step darker than #F00828, so white type on a red
 * button passes 4.5:1 (4.8:1). Red text uses #C8021C on white (6.0:1) and
 * #FF4D5E on black (6.1:1).
 */

/* ── Light: white ground, black type, XSET red accent ─────────────────── */
:root,
:root[data-theme="light"],
.palette-swatch[data-palette="default"],
.palette-swatch[data-palette="default"][data-theme="light"] {
  color-scheme: light;

  --paper: #ffffff;
  --ink: #0a0a0a;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --moss: #e5061f;
  --amber: #b98a2f;

  --ink-wash: rgb(10 10 10 / 0.06);
  --ink-wash-strong: rgb(10 10 10 / 0.1);
  --moss-wash: rgb(229 6 31 / 0.08);
  --moss-wash-strong: rgb(229 6 31 / 0.15);
  --muted-wash: rgb(107 107 107 / 0.5);

  --on-moss: #ffffff;
  --moss-text: #c8021c;
  --control-border: #737373;
  --danger-text: oklch(53.0% 0.220 27);
  --neutral-h: 0;
  --neutral-c: 0;
  --accent-h: 27;
  --accent-c: 0.24;

  --success-wash: oklch(65.0% 0.150 145 / 0.15);
  --danger-wash: oklch(60.0% 0.220 27 / 0.15);
  --warning-wash: oklch(70.0% 0.140 75 / 0.18);
  --warning-fg: oklch(45.0% 0.110 75);
}

/* ── Dark: XSET black ground, white type, XSET red accent ─────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]),
  .palette-swatch[data-palette="default"]:not([data-theme="light"]) {
    color-scheme: dark;

    --paper: #0a0a0a;
    --ink: #f5f5f5;
    --muted: #a3a3a3;
    --line: #262626;
    --moss: #e5061f;
    --amber: oklch(75.0% 0.110 79);

    --ink-wash: rgb(245 245 245 / 0.08);
    --ink-wash-strong: rgb(245 245 245 / 0.14);
    --moss-wash: rgb(229 6 31 / 0.16);
    --moss-wash-strong: rgb(229 6 31 / 0.26);
    --muted-wash: rgb(163 163 163 / 0.5);

    --on-moss: #ffffff;
    --moss-text: #ff4d5e;
    --control-border: #a3a3a3;
    --danger-text: oklch(68.0% 0.200 27);
    --neutral-h: 0;
    --neutral-c: 0;
    --accent-h: 27;
    --accent-c: 0.24;

    --success-wash: oklch(72.0% 0.150 145 / 0.20);
    --danger-wash: oklch(68.0% 0.200 27 / 0.20);
    --warning-wash: oklch(80.0% 0.130 75 / 0.20);
    --warning-fg: oklch(85.0% 0.110 75);
  }
}

:root[data-theme="dark"],
.palette-swatch[data-palette="default"][data-theme="dark"] {
  color-scheme: dark;

  --paper: #0a0a0a;
  --ink: #f5f5f5;
  --muted: #a3a3a3;
  --line: #262626;
  --moss: #e5061f;
  --amber: oklch(75.0% 0.110 79);

  --ink-wash: rgb(245 245 245 / 0.08);
  --ink-wash-strong: rgb(245 245 245 / 0.14);
  --moss-wash: rgb(229 6 31 / 0.16);
  --moss-wash-strong: rgb(229 6 31 / 0.26);
  --muted-wash: rgb(163 163 163 / 0.5);

  --on-moss: #ffffff;
  --moss-text: #ff4d5e;
  --control-border: #a3a3a3;
  --danger-text: oklch(68.0% 0.200 27);
  --neutral-h: 0;
  --neutral-c: 0;
  --accent-h: 27;
  --accent-c: 0.24;

  --success-wash: oklch(72.0% 0.150 145 / 0.20);
  --danger-wash: oklch(68.0% 0.200 27 / 0.20);
  --warning-wash: oklch(80.0% 0.130 75 / 0.20);
  --warning-fg: oklch(85.0% 0.110 75);
}

/* ── Type ──────────────────────────────────────────────────────────────
   XSET publishes no UI typeface, so body and headings use the system sans.
   Headings drop the XORS serif and take a heavy weight instead. */
:root body,
:root .font-sans {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

:root .font-display {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── Glyph ─────────────────────────────────────────────────────────────
   The XSET glyph replaces the XORS iconmark in both top bars. The PNG is
   black artwork on transparency, so it is used as a mask and takes the
   ink color in either mode. */
:root a[aria-label="Valet — Home"] > span:first-child {
  display: inline-block;
  width: 16px;
  height: 16px;
  font-size: 0;
  color: var(--ink);
  background-color: currentColor;
  -webkit-mask: url("/brand/xset-glyph.png") center / contain no-repeat;
  mask: url("/brand/xset-glyph.png") center / contain no-repeat;
}

/* Sign-in and sign-up pages: the XSET wordmark replaces the ◈ above the
   heading. */
:root .text-center > span.text-moss[aria-hidden="true"]:first-child {
  display: block;
  width: 112px;
  height: 32px;
  margin: 0 auto 16px;
  font-size: 0;
  background-color: var(--ink);
  -webkit-mask: url("/brand/xset-wordmark.png") center / contain no-repeat;
  mask: url("/brand/xset-wordmark.png") center / contain no-repeat;
}

:root a[aria-label="Valet home"] > svg {
  display: none;
}

:root a[aria-label="Valet home"]::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background-color: var(--ink);
  -webkit-mask: url("/brand/xset-glyph.png") center / contain no-repeat;
  mask: url("/brand/xset-glyph.png") center / contain no-repeat;
}
