/**
 * Shared theme control: the Light | Dark switch (below) plus the older
 * single-button pill styles it builds on.
 * Markup: views/partials/theme-toggle-pill.php
 * Wiring: [data-theme-toggle] + theme-toggle.js (or site-local cycle JS).
 *
 * Uses currentColor / generic tokens so it works on portal, marketing,
 * fleet, product shells, and CMS chrome without brand-specific vars.
 */
.ls-theme-pill {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin: 0;
    padding: 7px 12px 7px 9px;
    border: 1px solid var(--line-strong, rgba(128, 140, 160, 0.28));
    border-radius: 999px;
    background: var(--ls-theme-pill-bg, rgba(128, 140, 160, 0.08));
    color: var(--muted, var(--paper-2, #8a93a3));
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.ls-theme-pill:hover {
    /* Portal: --paper = text, --ink = page bg. Product shells invert that
     * (--ink = text). CMS uses --text. Prefer text tokens first. */
    color: var(--text, var(--paper, var(--ink, #f2f4f8)));
    border-color: var(--accent, rgba(93, 211, 255, 0.45));
    background: var(--ls-theme-pill-bg-hover, rgba(128, 140, 160, 0.12));
}
.ls-theme-pill:focus-visible {
    outline: 2px solid var(--accent, #5dd3ff);
    outline-offset: 2px;
}
.ls-theme-pill-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1px solid currentColor;
    position: relative;
    flex-shrink: 0;
    box-sizing: border-box;
}
/* Auto / System: gold core (like Aetia) */
.ls-theme-pill-dot::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--ls-theme-pill-accent, #e8b84a);
    transform: scale(1);
    transition: transform 0.25s ease;
}
/* Light lock: empty disc + moon inset */
.ls-theme-pill[data-theme-state="light"] .ls-theme-pill-dot::after,
html[data-theme="light"] .ls-theme-pill[data-theme-state="auto"] .ls-theme-pill-dot::after {
    transform: scale(0);
}
.ls-theme-pill[data-theme-state="light"] .ls-theme-pill-dot {
    box-shadow: inset -4px -2px 0 0 var(--ls-theme-pill-accent, #e8b84a);
}
/* When auto resolves to light, show moon-ish empty disc */
html[data-theme="light"] .ls-theme-pill[data-theme-state="auto"] .ls-theme-pill-dot {
    box-shadow: inset -4px -2px 0 0 var(--ls-theme-pill-accent, #e8b84a);
}
/* Dark lock: filled core stays (or stronger) */
.ls-theme-pill[data-theme-state="dark"] .ls-theme-pill-dot::after {
    transform: scale(1);
    background: var(--accent, #5dd3ff);
}
.ls-theme-pill[data-theme-state="light"],
.ls-theme-pill[data-theme-state="dark"] {
    color: var(--text, var(--paper, var(--ink, #f2f4f8)));
}

/* Light page chrome */
html[data-theme="light"] .ls-theme-pill {
    --ls-theme-pill-bg: rgba(18, 21, 28, 0.04);
    --ls-theme-pill-bg-hover: rgba(18, 21, 28, 0.07);
    color: var(--muted, #5a6474);
    border-color: var(--line-strong, rgba(18, 21, 28, 0.14));
}
html[data-theme="light"] .ls-theme-pill:hover,
html[data-theme="light"] .ls-theme-pill[data-theme-state="light"],
html[data-theme="light"] .ls-theme-pill[data-theme-state="dark"] {
    /* Same token order as dark chrome — never use --ink first (portal bg). */
    color: var(--text, var(--paper, var(--ink, #12151c)));
}

/* ------------------------------------------------------------------
 * Two-button switch (Light | Dark). Replaces the 3-step cycle.
 * Markup: <div class="ls-theme-pill ls-theme-switch" role="group">
 *           <button class="ls-theme-switch-btn" data-theme-set="light">…
 *           <button class="ls-theme-switch-btn" data-theme-set="dark">…
 * (Sites with their own theme script use data-theme-pick instead.)
 * No stored choice = follow the device; clicking a button stores it.
 * aria-pressed marks whichever theme is showing right now.
 * ------------------------------------------------------------------ */
.ls-theme-pill.ls-theme-switch {
    gap: 2px;
    padding: 2px;
    cursor: default;
}
.ls-theme-switch-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 5px 11px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.ls-theme-switch-btn:hover {
    color: var(--text, var(--paper, var(--ink, #f2f4f8)));
}
.ls-theme-switch-btn:focus-visible {
    outline: 2px solid var(--accent, #5dd3ff);
    outline-offset: 1px;
}
.ls-theme-switch-btn[aria-pressed="true"] {
    background: var(--ls-theme-switch-on-bg, rgba(128, 140, 160, 0.22));
    color: var(--text, var(--paper, var(--ink, #f2f4f8)));
}
.ls-theme-switch-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-sizing: border-box;
}
.ls-theme-switch-btn[data-theme-set="light"] .ls-theme-switch-icon,
.ls-theme-switch-btn[data-theme-pick="light"] .ls-theme-switch-icon {
    background: var(--ls-theme-pill-accent, #e8b84a);
}
.ls-theme-switch-btn[data-theme-set="dark"] .ls-theme-switch-icon,
.ls-theme-switch-btn[data-theme-pick="dark"] .ls-theme-switch-icon {
    border: 1px solid currentColor;
    box-shadow: inset -3px -1px 0 0 currentColor;
}
html[data-theme="light"] .ls-theme-switch-btn:hover,
html[data-theme="light"] .ls-theme-switch-btn[aria-pressed="true"] {
    color: var(--text, var(--paper, var(--ink, #12151c)));
}
html[data-theme="light"] .ls-theme-switch-btn[aria-pressed="true"] {
    background: var(--ls-theme-switch-on-bg, rgba(18, 21, 28, 0.09));
}
