/* assets/switcher.css
   Athenian Site Themes — Compact popup/dropdown theme switcher (NATIVE)
   - Token-aware (reads your theme tokens):
     --surface-1/2, --border, --text-high/mid/low, --radius, --radius-lg, --gap,
     --focus-ring, --focus-ring-strong, --drop-sm, --drop-md, --ctl-c1.. (for accents)
   - No legacy/STTM references
   - Supports multiple instances
   - Optional caret toggle via: data-ast-caret="0|1"
   - Respects prefers-reduced-motion
*/

/* -------------------------------------------------------------------------- */
/* Root / component tokens                                                    */
/* -------------------------------------------------------------------------- */

:root{
  --astt-radius: var(--radius, 10px);
  --astt-pad: 8px;
  --astt-gap: var(--gap, 6px);
  --astt-border: var(--border, #ffffff22);
  --astt-fg: var(--text-high, #e6edf7);
  --astt-fg-mid: var(--text-mid, #b8c3d4);
  --astt-bg: var(--surface-1, #10101a);
  --astt-bg-2: var(--surface-2, #131422);
  --astt-shadow: var(--drop-sm, 0 10px 24px rgba(0,0,0,.35));
  --astt-ring: var(--focus-ring, rgba(0, 200, 255, .35));
  --astt-ring-strong: var(--focus-ring-strong, rgba(0, 200, 255, .55));
  --astt-scale-in: .97;
}

/* -------------------------------------------------------------------------- */
/* Shell                                                                      */
/* -------------------------------------------------------------------------- */

[data-ast-switcher].astt-compact{
  position: relative;
  display: inline-block;
  font: inherit;
}

/* trigger (button) */
[data-ast-switcher].astt-compact .astt-trigger{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in oklch, var(--astt-bg) 85%, transparent),
    color-mix(in oklch, var(--astt-bg-2) 85%, transparent)
  );
  color: var(--astt-fg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease, opacity .2s ease;
  will-change: transform;
}

[data-ast-switcher].astt-compact .astt-trigger:hover{
  transform: translateY(-1px);
  border-color: color-mix(in oklch, var(--astt-border) 60%, var(--ctl-c2, #5cf) 40%);
  box-shadow: 0 10px 24px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.08);
}

[data-ast-switcher].astt-compact .astt-trigger:focus-visible{
  outline: 0;
  box-shadow: 0 0 0 3px var(--astt-ring), 0 10px 24px rgba(0,0,0,.28);
}

/* trigger content */
.astt-trigger-swatch{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
  background:
    radial-gradient(circle at 30% 30%, var(--sw1, var(--ctl-c1, #888)), transparent 60%),
    radial-gradient(circle at 70% 70%, var(--sw2, var(--ctl-c2, #aaa)), transparent 60%),
    linear-gradient(135deg, var(--sw1, var(--ctl-c1, #888)), var(--sw2, var(--ctl-c2, #aaa)));
  border: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
}

.astt-trigger-label{
  font-size: .92rem;
  letter-spacing: .01em;
  color: var(--astt-fg);
  white-space: nowrap;
}

.astt-trigger-caret{
  opacity: .85;
}

/* Default: no caret (matches your previous default behavior) */
[data-ast-switcher][data-ast-caret="0"] .astt-trigger-caret{
  display:none !important;
}

/* -------------------------------------------------------------------------- */
/* Popup                                                                      */
/* -------------------------------------------------------------------------- */

.astt-pop{
  position: absolute;
  z-index: 9999;
  inset: auto auto auto 0; /* align left under trigger; JS can flip */
  margin-top: 8px;
  min-width: 220px;
  max-width: 320px;
  color: var(--astt-fg);
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.35));
}

.astt-pop .astt-pop-inner{
  background: linear-gradient(
    180deg,
    color-mix(in oklch, var(--astt-bg) 94%, transparent),
    color-mix(in oklch, var(--astt-bg-2) 94%, transparent)
  );
  border: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
  border-radius: var(--astt-radius);
  padding: 6px;
  backdrop-filter: blur(10px) saturate(110%);
}

/* menu */
.astt-menu{
  list-style: none;
  margin: 0;
  padding: 4px;
  display: grid;
  gap: 2px;
  max-height: 60vh;
  overflow: auto;
}

/* items */
.astt-item{
  width: 100%;
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  font: inherit;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--astt-fg-mid);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .12s ease;
}

.astt-item:hover{
  background: color-mix(in oklch, var(--ctl-c2, #4aa3ff) 10%, transparent);
  color: var(--astt-fg);
  border-color: color-mix(in oklch, var(--astt-border) 60%, transparent);
}

.astt-item:focus-visible{
  outline: 0;
  border-color: var(--astt-ring-strong);
  box-shadow: 0 0 0 2px var(--astt-ring);
  color: var(--astt-fg);
}

.astt-item[aria-checked="true"]{
  background: color-mix(in oklch, var(--ctl-c2, #4aa3ff) 16%, transparent);
  color: var(--astt-fg);
  border-color: color-mix(in oklch, var(--astt-border) 60%, transparent);
}

/* swatch and check */
.astt-item-swatch{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, var(--sw1, #777), transparent 60%),
    radial-gradient(circle at 70% 70%, var(--sw2, #999), transparent 60%),
    linear-gradient(135deg, var(--sw1, #777), var(--sw2, #999));
  border: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
}

.astt-item-check{
  opacity: 0;
  transform: scale(.9);
  transition: transform .18s ease, opacity .18s ease;
}

.astt-item[aria-checked="true"] .astt-item-check{
  opacity: 1;
  transform: scale(1);
}

/* open/close animation */
.astt-pop.astt-anim{
  opacity: 0;
  transform-origin: 12px top;
  transform: translateY(-6px) scale(var(--astt-scale-in));
  transition: opacity .18s ease, transform .18s ease;
}

.astt-pop.astt-anim[data-open="true"]{
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* arrow tip */
.astt-pop[data-open="true"]::before{
  content: "";
  position: absolute;
  top: -6px;
  left: 16px;
  width: 10px;
  height: 10px;
  background: linear-gradient(
    180deg,
    color-mix(in oklch, var(--astt-bg) 94%, transparent),
    color-mix(in oklch, var(--astt-bg-2) 94%, transparent)
  );
  border-left: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
  border-top: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
  transform: rotate(45deg);
  z-index: -1;
}

/* reduced motion */
@media (prefers-reduced-motion: reduce){
  .astt-pop.astt-anim,
  .astt-item,
  .astt-trigger{
    transition: none !important;
  }
}


/* --------------------------------------------------------------------------
   Legacy STTM selector aliases
   -------------------------------------------------------------------------- */

/* assets/switcher.css
   Athenian Site Themes — Compact popup/dropdown theme switcher (NATIVE)
   - Token-aware (reads your theme tokens):
     --surface-1/2, --border, --text-high/mid/low, --radius, --radius-lg, --gap,
     --focus-ring, --focus-ring-strong, --drop-sm, --drop-md, --ctl-c1.. (for accents)
   - No legacy/STTM references
   - Supports multiple instances
   - Optional caret toggle via: data-sttm-caret="0|1"
   - Respects prefers-reduced-motion
*/

/* -------------------------------------------------------------------------- */
/* Root / component tokens                                                    */
/* -------------------------------------------------------------------------- */

:root{
  --astt-radius: var(--radius, 10px);
  --astt-pad: 8px;
  --astt-gap: var(--gap, 6px);
  --astt-border: var(--border, #ffffff22);
  --astt-fg: var(--text-high, #e6edf7);
  --astt-fg-mid: var(--text-mid, #b8c3d4);
  --astt-bg: var(--surface-1, #10101a);
  --astt-bg-2: var(--surface-2, #131422);
  --astt-shadow: var(--drop-sm, 0 10px 24px rgba(0,0,0,.35));
  --astt-ring: var(--focus-ring, rgba(0, 200, 255, .35));
  --astt-ring-strong: var(--focus-ring-strong, rgba(0, 200, 255, .55));
  --astt-scale-in: .97;
}

/* -------------------------------------------------------------------------- */
/* Shell                                                                      */
/* -------------------------------------------------------------------------- */

[data-sttm].sttm-compact{
  position: relative;
  display: inline-block;
  font: inherit;
}

/* trigger (button) */
[data-sttm].sttm-compact .sttm-trigger{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in oklch, var(--astt-bg) 85%, transparent),
    color-mix(in oklch, var(--astt-bg-2) 85%, transparent)
  );
  color: var(--astt-fg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease, opacity .2s ease;
  will-change: transform;
}

[data-sttm].sttm-compact .sttm-trigger:hover{
  transform: translateY(-1px);
  border-color: color-mix(in oklch, var(--astt-border) 60%, var(--ctl-c2, #5cf) 40%);
  box-shadow: 0 10px 24px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.08);
}

[data-sttm].sttm-compact .sttm-trigger:focus-visible{
  outline: 0;
  box-shadow: 0 0 0 3px var(--astt-ring), 0 10px 24px rgba(0,0,0,.28);
}

/* trigger content */
.sttm-trigger-swatch{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
  background:
    radial-gradient(circle at 30% 30%, var(--sw1, var(--ctl-c1, #888)), transparent 60%),
    radial-gradient(circle at 70% 70%, var(--sw2, var(--ctl-c2, #aaa)), transparent 60%),
    linear-gradient(135deg, var(--sw1, var(--ctl-c1, #888)), var(--sw2, var(--ctl-c2, #aaa)));
  border: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
}

.sttm-trigger-label{
  font-size: .92rem;
  letter-spacing: .01em;
  color: var(--astt-fg);
  white-space: nowrap;
}

.sttm-trigger-caret{
  opacity: .85;
}

/* Default: no caret (matches your previous default behavior) */
[data-sttm][data-sttm-caret="0"] .sttm-trigger-caret{
  display:none !important;
}

/* -------------------------------------------------------------------------- */
/* Popup                                                                      */
/* -------------------------------------------------------------------------- */

.sttm-pop{
  position: absolute;
  z-index: 9999;
  inset: auto auto auto 0; /* align left under trigger; JS can flip */
  margin-top: 8px;
  min-width: 220px;
  max-width: 320px;
  color: var(--astt-fg);
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.35));
}

.sttm-pop .sttm-pop-inner{
  background: linear-gradient(
    180deg,
    color-mix(in oklch, var(--astt-bg) 94%, transparent),
    color-mix(in oklch, var(--astt-bg-2) 94%, transparent)
  );
  border: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
  border-radius: var(--astt-radius);
  padding: 6px;
  backdrop-filter: blur(10px) saturate(110%);
}

/* menu */
.sttm-menu{
  list-style: none;
  margin: 0;
  padding: 4px;
  display: grid;
  gap: 2px;
  max-height: 60vh;
  overflow: auto;
}

/* items */
.sttm-item{
  width: 100%;
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  font: inherit;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--astt-fg-mid);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .12s ease;
}

.sttm-item:hover{
  background: color-mix(in oklch, var(--ctl-c2, #4aa3ff) 10%, transparent);
  color: var(--astt-fg);
  border-color: color-mix(in oklch, var(--astt-border) 60%, transparent);
}

.sttm-item:focus-visible{
  outline: 0;
  border-color: var(--astt-ring-strong);
  box-shadow: 0 0 0 2px var(--astt-ring);
  color: var(--astt-fg);
}

.sttm-item[aria-checked="true"]{
  background: color-mix(in oklch, var(--ctl-c2, #4aa3ff) 16%, transparent);
  color: var(--astt-fg);
  border-color: color-mix(in oklch, var(--astt-border) 60%, transparent);
}

/* swatch and check */
.sttm-item-swatch{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, var(--sw1, #777), transparent 60%),
    radial-gradient(circle at 70% 70%, var(--sw2, #999), transparent 60%),
    linear-gradient(135deg, var(--sw1, #777), var(--sw2, #999));
  border: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
}

.sttm-item-check{
  opacity: 0;
  transform: scale(.9);
  transition: transform .18s ease, opacity .18s ease;
}

.sttm-item[aria-checked="true"] .sttm-item-check{
  opacity: 1;
  transform: scale(1);
}

/* open/close animation */
.sttm-pop.sttm-anim{
  opacity: 0;
  transform-origin: 12px top;
  transform: translateY(-6px) scale(var(--astt-scale-in));
  transition: opacity .18s ease, transform .18s ease;
}

.sttm-pop.sttm-anim[data-open="true"]{
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* arrow tip */
.sttm-pop[data-open="true"]::before{
  content: "";
  position: absolute;
  top: -6px;
  left: 16px;
  width: 10px;
  height: 10px;
  background: linear-gradient(
    180deg,
    color-mix(in oklch, var(--astt-bg) 94%, transparent),
    color-mix(in oklch, var(--astt-bg-2) 94%, transparent)
  );
  border-left: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
  border-top: 1px solid color-mix(in oklch, var(--astt-border) 100%, transparent);
  transform: rotate(45deg);
  z-index: -1;
}

/* reduced motion */
@media (prefers-reduced-motion: reduce){
  .sttm-pop.sttm-anim,
  .sttm-item,
  .sttm-trigger{
    transition: none !important;
  }
}
.screen-reader-text{
  position:absolute !important;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0);
  white-space:nowrap; border:0;
}
