/* =====================================================================
   Vatar skin for the Lagos Life chat prototype.
   On with ?ds=vatar (index.html's head script sets <html data-ds="vatar"> and loads vds/fonts.css + vds/tokens.css).
   Every rule here is scoped to :root[data-ds="vatar"], so with the switch off this file does nothing.
   Structure stays ours: only colours, type, radii, shapes and selected states change.

   1. Token map: DS A semantic variables -> Vatar semantic tokens (design-system.md §2.2, §3, §4.3, §4.5)
   2. Components: Vatar buttons (§8.1, §8.8), pills and count tags (§18), underline tabs (§8.2), inputs (§8.6)
   3. Art that keeps its own colours (gift box, Ticket, flags, platform marks)
   Themes: Night = Vatar dark (its :root default), Light = data-theme="light" (set by the head script).
   ===================================================================== */

/* ---------- 1. Token map (both themes: Vatar's aliases are theme-aware) ---------- */
:root[data-ds="vatar"] {
  color-scheme: dark;

  /* Surfaces. Dark: canvas #000 page, surface n-900 for fields and chips (§2.2). */
  --paper: var(--color-bg-canvas);
  --surface: var(--paper);
  --background: var(--paper);
  --mist: var(--color-bg-surface);
  --card: var(--paper);
  --popover: var(--paper);
  --surface-glass-control: var(--color-bg-surface);
  --surface-glass-panel: var(--color-bg-surface);
  --surface-toast: var(--color-bg-surface-raised);
  --surface-dark-solid: var(--color-neutral-1000);
  --gradient-avatar: linear-gradient(var(--color-bg-surface-raised), var(--color-bg-surface-raised));

  /* Text */
  --ink: var(--color-text-primary);
  --ink-soft: var(--color-text-secondary);
  --ink-placeholder: var(--color-text-tertiary);
  --ink-inactive: var(--color-text-disabled);
  --ink-positive: var(--color-status-success-fg);

  /* Selected = lilac (§2.3: lilac carries every selected and accent state); label on it is brand black */
  --ink-fill: var(--color-brand-lilac);
  --ink-on: var(--color-lilac-950); /* Mikky 4 Dec: the live game's shade, lilac-200 fill with deep-lilac label */
  --ink-on-fill: var(--color-status-danger-on-solid);

  /* Lines and focus (§4.4: 2px lilac ring, 3px offset) */
  --line: var(--color-border-subtle);
  --input: var(--color-border-default);
  --border-control: var(--color-border-control);
  --ring: var(--color-border-focus);
  --focus-width: var(--focus-ring-width);
  --focus-offset: var(--focus-ring-offset);
  --focus-halo: transparent;
  --sheet-handle-color: var(--color-border-strong);

  /* Actions (§2.2 color.action.*; §8.8 quiet = the secondary) */
  --primary: var(--color-action-primary-bg);
  --primary-foreground: var(--color-action-primary-text);
  --primary-hover: var(--color-action-primary-bg-hover);
  --primary-pressed: var(--color-action-primary-bg-pressed);
  --primary-lip: var(--button-primary-slab);
  --secondary: var(--button-quiet-bg);
  --secondary-foreground: var(--button-quiet-text);
  --accent: var(--color-bg-brand);
  --button-danger-label: var(--color-status-danger-on-solid);
  --button-danger-fill: var(--color-status-danger-solid);
  --button-special-label: var(--color-brand-black);

  /* DS A hues -> Vatar roles. Lagoon (links, info, ring) becomes lilac; leaf/rose/sunset become status colours. */
  --lagoon: var(--color-text-accent);
  --lagoon-deep: var(--color-text-link);
  --lagoon-soft: var(--color-bg-brand);
  --fill-lagoon: var(--color-bg-brand-strong);
  --leaf: var(--color-status-success-solid);
  --leaf-deep: var(--color-status-success-fg);
  --leaf-soft: var(--color-status-success-bg);
  --fill-leaf-deep: var(--color-status-success-solid);
  --rose: var(--color-status-danger-fg);
  --rose-deep: var(--color-status-danger-fg);
  --rose-soft: var(--color-status-danger-bg);
  --fill-rose: var(--color-status-danger-solid);
  --sunset: var(--color-status-warning-solid);
  --sunset-deep: var(--color-status-warning-fg);
  --sunset-soft: var(--color-status-warning-bg);
  /* Gold -> Vatar signal amber (§2.4: the only gold-family hue; amber-400 for fills, text.hud for text) */
  --gold: var(--color-amber-400);
  --gold-deep: var(--color-text-hud);
  --gold-soft: color-mix(in srgb, var(--color-amber-400) 14%, transparent);
  --glow-gold: 0 0 var(--space-3-5) 0 color-mix(in srgb, var(--color-amber-400) 60%, transparent);

  /* Scrims and elevation (§2.2 overlay/scrim, §4.5: dark is flat, shadows only for things that float) */
  --scrim-modal: var(--color-overlay-backdrop);
  --scrim-sheet: var(--color-scrim-soft);
  --shadow-flat: var(--elevation-raised);
  --shadow-raised: var(--elevation-overlay);
  --shadow-glass: var(--elevation-overlay);
  --shadow-overlay: var(--elevation-dialog);
  --shadow-lip-rest: none;
  --shadow-lip-hover: none;
  --shadow-lip-pressed: none;

  /* Type (§3: Inter for UI, Inter Display bold for headings). DS A sizes are kept: the structure is ours. */
  --font-body: var(--font-family-body);
  --font-display: var(--font-family-display);
  --type-display: var(--font-weight-bold) var(--type-display-size)/var(--type-display-leading) var(--font-family-display);
  --type-wordmark: var(--font-weight-extrabold) var(--type-wordmark-size)/var(--type-wordmark-leading) var(--font-family-display);
  --type-title-lg: var(--font-weight-bold) var(--type-title-lg-size)/var(--type-title-lg-leading) var(--font-family-display);
  --type-title: var(--font-weight-bold) var(--type-title-size)/var(--type-title-leading) var(--font-family-display);
  --type-title-sm: var(--font-weight-bold) var(--type-title-sm-size)/var(--type-title-sm-leading) var(--font-family-display);

  /* Radii (§4.3): md 14 for cards, rows, inputs; lg 24 for sheets; pill for pills; bubble 18 */
  --radius: var(--radius-md);
  --radius-sm: var(--radius-md);
  --radius-tile: var(--radius-md);
  --radius-card: var(--radius-md);
  --radius-panel: var(--radius-lg);
  --radius-sheet: var(--radius-lg);
  --radius-full: var(--radius-pill);

  /* Motion (§5): Vatar standard ease and the 0.97 press */
  --ease-standard: var(--motion-easing-standard);
  --ease-sheet: var(--motion-easing-out-ios);
  --ease-scrim: var(--motion-easing-out-ios);
}
/* Light: Vatar light theme. Following the live game (_refs/05): the panel is surface grey, fields and pills are white canvas. */
:root[data-ds="vatar"][data-theme="light"] {
  color-scheme: light;
  --paper: var(--color-bg-surface);
  --mist: var(--color-bg-canvas);
}

/* ---------- 2. Components ---------- */

/* Headings: Inter Display, tight tracking (§3.2 h4 role) */
:root[data-ds="vatar"] :is(.bar__title, .ll-sheet__title, .ll-empty-state__title, .rc__t, .pinned__title) { letter-spacing: var(--type-h4-letter-spacing); }
:root[data-ds="vatar"] :is(.bar__title--big, .rc__big) { letter-spacing: var(--type-h2-letter-spacing); }

/* Buttons (§8.1 Direction B, Angular; §8.8 quiet and text). Our markup stays; the face is chamfered
   (top-left and bottom-right cut at 45°) with a gradient instead of clip-path, so the 44px hit area
   (state.css ::after) is never clipped. The slab is a drop-shadow of the chamfered face. */
:root[data-ds="vatar"] .ll-button {
  --_ch: var(--button-chamfer-sm);
  --_cut: calc(var(--_ch) * 0.7071);
  border-radius: 0;
  background: linear-gradient(135deg, transparent var(--_cut), var(--_fill) var(--_cut) calc(100% - var(--_cut)), transparent calc(100% - var(--_cut)));
  font-family: var(--font-family-body);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--type-button-letter-spacing);
}
:root[data-ds="vatar"] .ll-button.ll-interactive::before {
  border-radius: 0;
  clip-path: polygon(var(--_ch) 0, 100% 0, 100% calc(100% - var(--_ch)), calc(100% - var(--_ch)) 100%, 0 100%, 0 var(--_ch));
}
:root[data-ds="vatar"] .ll-button--lg { --_ch: var(--button-chamfer-md); }
/* Primary: lilac plate on its slab; press slides the plate onto the slab */
:root[data-ds="vatar"] .ll-button--primary {
  --_off: var(--button-offset-sm);
  filter: drop-shadow(var(--_off) var(--_off) 0 var(--button-primary-slab));
  transition: transform var(--button-duration-release) var(--motion-easing-spring), filter var(--button-duration-release) var(--motion-easing-standard), color var(--motion-duration-fast) var(--motion-easing-standard);
}
@media (hover: hover) {
  :root[data-ds="vatar"] .ll-button--primary:not([aria-disabled="true"], :disabled, [aria-busy="true"]):hover { transform: none; }
}
:root[data-ds="vatar"] .ll-button--primary:not([aria-disabled="true"], :disabled, [aria-busy="true"]):active {
  transform: translate(var(--_off), var(--_off));
  filter: drop-shadow(0 0 0 var(--button-primary-slab));
  transition-duration: var(--button-duration-press);
}
:root[data-ds="vatar"] .ll-button--primary:is([aria-disabled="true"], :disabled) { filter: none; }
:root[data-ds="vatar"] .ll-button--secondary { --_fill: var(--button-quiet-bg); --_label: var(--button-quiet-text); }
:root[data-ds="vatar"] .ll-button--ghost { --_label: var(--button-text-text); background: transparent; }
:root[data-ds="vatar"] .ll-button--danger { --_label: var(--color-status-danger-fg); --_shadow: none; --_fill: var(--button-quiet-bg); }
/* The floating "New message" button: a chamfered lilac plate (buttons are never round, §8.1) */
:root[data-ds="vatar"] .fab { --_ch: var(--button-chamfer-lg); }

/* Icon buttons: secondary = Vatar round (44px circle on the quiet fill, lilac icon, §8.8); ghost stays ink for navigation */
:root[data-ds="vatar"] .ll-icon-button--secondary { --_fill: var(--button-quiet-bg); --_label: var(--button-quiet-text); }
:root[data-ds="vatar"][data-theme="light"] .ll-icon-button--secondary { --_fill: var(--color-bg-canvas); --_shadow: inset 0 0 0 1px var(--color-border-subtle); }

/* Pills (§18 pill + tag): chips are pills with a hairline; selected = lilac fill, black label */
:root[data-ds="vatar"] .ll-chip { --_shadow: inset 0 0 0 1px var(--color-border-default); font-family: var(--font-family-body); }
:root[data-ds="vatar"] .ll-chip:is([aria-pressed="true"], [aria-selected="true"]) { --_shadow: inset 0 0 0 1px var(--color-brand-lilac); }
/* Count pills = Vatar tag: lilac, black text, 11px semibold; inside a lilac selected pill it flips to the ink tag */
:root[data-ds="vatar"] .ll-chip__count,
:root[data-ds="vatar"] #v-list .seg-c .ll-segmented__item .ll-chip__count,
:root[data-ds="vatar"] #v-list .seg-c .ll-segmented__item[data-req] .ll-chip__count,
:root[data-ds="vatar"] #v-list .seg-c .ll-segmented__item[aria-selected="true"] .ll-chip__count {
  background: var(--color-brand-lilac); color: var(--color-lilac-950); font-weight: var(--font-weight-semibold);
}
:root[data-ds="vatar"] .ll-chip:is([aria-pressed="true"], [aria-selected="true"]) .ll-chip__count { background: var(--color-brand-ink); color: var(--color-brand-paper); }
/* Unread badges and the bell count: lilac tags (the live game's lilac count pills) */
:root[data-ds="vatar"] .ll-badge:not(.ll-badge--status):not(.badge--muted) { background: var(--color-brand-lilac); color: var(--color-lilac-950); }
:root[data-ds="vatar"] .chat .ll-badge:empty,
:root[data-ds="vatar"] .pinned .dot,
:root[data-ds="vatar"] .dot { background: var(--color-text-accent); }
/* Unread time in lilac accent, not danger red (red is status only, §2.5) */
:root[data-ds="vatar"] .ll-list-row__time[data-unread] { color: var(--color-text-accent); }
/* The Updates "LIVE" dot is Vatar's live signal: amber (§2.4) */
:root[data-ds="vatar"] .uf-live-dot { background: var(--color-live-dot); }

/* Segmented control -> underline tabs. The spec's tab look is the nav's active state: label in text.primary
   with a 2px lilac indicator (§8.2, §4.4 border.width.thick); the live game uses the same (_refs/05). */
:root[data-ds="vatar"] .ll-segmented {
  padding: 0; gap: 0; border-radius: 0; background: transparent;
  box-shadow: inset 0 -1px 0 0 var(--color-border-subtle);
}
:root[data-ds="vatar"] .ll-segmented__item {
  height: var(--control-md); border-radius: 0; color: var(--color-text-secondary);
  font-family: var(--font-family-body); font-weight: var(--font-weight-semibold);
}
:root[data-ds="vatar"] .ll-segmented__item.ll-selectable:is([aria-selected="true"], [aria-pressed="true"]) {
  background: transparent; color: var(--color-text-primary);
  box-shadow: inset 0 calc(var(--border-width-thick) * -1) 0 0 var(--color-text-accent);
}
:root[data-ds="vatar"] .ll-segmented__item:focus-visible { outline-offset: calc(var(--focus-ring-width) * -1); }

/* Fields (§8.6): white/surface field with a control-strength hairline; the lilac 2px ring on focus */
:root[data-ds="vatar"] .search { box-shadow: inset 0 0 0 1px var(--color-border-default); }
:root[data-ds="vatar"] .search:focus-within { outline-width: var(--focus-ring-width); outline-offset: 0; }

/* Radios, checkboxes and switches: DS A marks "on" in leaf green; Vatar marks every selection in lilac accent (§2.3) */
:root[data-ds="vatar"] :is(.ll-radio, .ll-radio__box, .ll-checkbox, .ll-checkbox__box, .ll-switch) { --leaf-deep: var(--color-text-accent); }

/* City pill (selected city): lilac like every selected state */
:root[data-ds="vatar"] .citypill { font-family: var(--font-family-body); }

/* Chat bubbles (§4.3 radius.bubble 18) */
:root[data-ds="vatar"] .ll-speech-bubble { border-radius: var(--radius-bubble); }

/* Sheets: the panel radius is lg 24; the handle in border.strong */
:root[data-ds="vatar"] dialog.ll-sheet { box-shadow: var(--elevation-dialog); }
:root[data-ds="vatar"][data-theme="light"] dialog.ll-sheet { background: var(--color-bg-surface); }

/* Light: rows and fields sit on surface grey; give the white pills/fields a hairline so they hold their edge */
:root[data-ds="vatar"][data-theme="light"] :is(.caught, .tm-plink) { box-shadow: inset 0 0 0 1px var(--color-border-subtle); }

/* ---------- 3. Art that keeps its own colours ---------- */
/* The gift box is Lagos Life art (gift.css: Mikky 4 Dec, "the box is not following Lagos Life color"):
   body green, ribbon gold, inside deep green. Pinned here, because --primary/--gold now point at Vatar. */
:root[data-ds="vatar"] svg#giftbox {
  --gb-paper: #15864f;
  --gb-ribbon: #ffc20e;
  --gb-ribbon-shade: color-mix(in srgb, #ffc20e 72%, #0c5a35);
  --gb-inside: #0c5a35;
  --gb-floor: color-mix(in srgb, #0c5a35 70%, #000);
}
/* The reveal's postage stamp stays paper-white in both themes */
:root[data-ds="vatar"] #team-ov .stamp { background: var(--color-neutral-0); box-shadow: inset 0 0 0 4px var(--color-neutral-0), inset 0 0 0 5.5px var(--color-alpha-black-32), var(--elevation-overlay); }
:root[data-ds="vatar"] #team-ov .bless .b-spark { fill: var(--color-neutral-0); }

/* Ticket cards (and the Pay slip art) keep their Lagos Life art colours: inside them the DS A hues are
   restored from DS A's own primitives, so the album art (sky, lagoon, sunset, gold tier) looks the same in both skins.
   The card surface and text (--paper, --ink) still follow the theme, as they do in Lagos Life. */
:root[data-ds="vatar"] :is(.tk, .rv-tk, .slipw, .lla-slipw, .psx) {
  --lagoon: var(--ll-lagoon-500);
  --lagoon-deep: var(--ll-lagoon-600);
  --fill-lagoon: var(--ll-lagoon-600);
  --leaf: var(--ll-leaf-500);
  --leaf-deep: var(--ll-leaf-700);
  --leaf-soft: #22b5731f;
  --fill-leaf-deep: var(--ll-leaf-700);
  --sunset: var(--ll-sunset-500);
  --rose: var(--ll-rose-500);
  --gold: var(--ll-gold-400);
  --gold-deep: var(--ll-gold-800);
  --primary: #15864f;
  --ink-on-fill: var(--ll-base-white);
  --surface-dark-solid: var(--ll-night-950);
}
:root.dark[data-ds="vatar"] :is(.tk, .rv-tk, .slipw, .lla-slipw, .psx) {
  --lagoon-deep: var(--ll-lagoon-400);
  --rose: var(--ll-rose-400);
  --gold-deep: var(--ll-gold-400);
  --leaf-deep: var(--ll-leaf-300);
  --leaf-soft: #1fa2681f;
}

/* The live game's selected pill (Mikky 4 Dec "see the shade she uses"): lilac-200 fill, deep-lilac label, no hard ring.
   Applies to selected chips, the selected city pill and the selected city in the sheet. */
:root[data-ds="vatar"] .ll-chip:is([aria-pressed="true"], [aria-selected="true"]),
:root[data-ds="vatar"] .citypill { background: var(--color-lilac-200); color: var(--color-lilac-950); --_shadow: none; box-shadow: none; }
:root[data-ds="vatar"] .citypill .x { background: color-mix(in srgb, var(--color-lilac-950) 12%, transparent); }
:root[data-ds="vatar"] .ll-chip:is([aria-pressed="true"], [aria-selected="true"]) .ll-chip__count { background: var(--color-lilac-950); color: var(--color-lilac-200); }
