/* The chrome every Sprekka site shares (static/js/products.js, the switcher;
   static/js/accountchip.js, the account chip). Nothing here loads from
   anywhere else. Each site colours it with its own --sp-* variables, set in
   its own stylesheet from its own palette; these are the defaults. */

:where(:root) {
  --sp-bg: #ffffff;
  --sp-btn-bg: transparent;
  --sp-text: #1d1a15;
  --sp-muted: #6a6356;
  --sp-line: #d9d2c5;
  --sp-hover: rgba(0, 0, 0, .05);
  --sp-accent: #1a5c9e;
  --sp-on-accent: #ffffff;
  --sp-shadow: 0 10px 34px rgba(0, 0, 0, .16);
  --sp-scrim: rgba(0, 0, 0, .35);
  --sp-font: inherit;
  --sp-radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :where(:root) {
    --sp-bg: #26231f;
    --sp-text: #f2eee6;
    --sp-muted: #a39b89;
    --sp-line: #4a443b;
    --sp-hover: rgba(255, 255, 255, .06);
    --sp-accent: #7db4e8;
    --sp-on-accent: #10151b;
    --sp-shadow: 0 10px 34px rgba(0, 0, 0, .55);
    --sp-scrim: rgba(0, 0, 0, .55);
  }
}

/* ---------- the switcher ---------- */
.sp-switch { position: relative; display: inline-flex; flex: none; font-family: var(--sp-font); }
.sp-switch-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px 0 8px;
  border: 1px solid var(--sp-line); border-radius: calc(var(--sp-radius) - 3px);
  background: var(--sp-btn-bg); color: var(--sp-text); font: 600 13px/1 var(--sp-font);
  cursor: pointer; white-space: nowrap;
}
.sp-switch-btn:hover, .sp-switch.open .sp-switch-btn { background: var(--sp-hover); }
.sp-switch-btn:focus-visible, .sp-switch-row:focus-visible, .sp-chip-btn:focus-visible, .sp-chip-menu a:focus-visible,
.sp-chip-menu button:focus-visible, .sp-chip-in:focus-visible {
  outline: 2px solid var(--sp-accent); outline-offset: 2px;
}
.sp-switch-grid { width: 15px; height: 15px; fill: currentColor; }
.sp-switch-caret { width: 13px; height: 13px; color: var(--sp-muted); transition: transform .15s; }
.sp-switch.open .sp-switch-caret { transform: rotate(180deg); }

.sp-switch-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 1000; width: 300px;
  background: var(--sp-bg); color: var(--sp-text); border: 1px solid var(--sp-line);
  border-radius: var(--sp-radius); box-shadow: var(--sp-shadow); padding: 6px; text-align: left;
}
.sp-switch-menu[hidden] { display: none; }
.sp-switch-list { list-style: none; margin: 0; padding: 0; }
.sp-switch-row {
  display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: calc(var(--sp-radius) - 4px);
  color: var(--sp-text); text-decoration: none;
}
.sp-switch-row:hover, .sp-switch-row:focus-visible { background: var(--sp-hover); }
.sp-mark { width: 28px; height: 28px; flex: none; border-radius: 8px; box-shadow: 0 0 0 1px var(--sp-line); }
.sp-switch-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sp-switch-text b { font-size: 14px; font-weight: 700; }
.sp-switch-text small { font-size: 12.5px; color: var(--sp-muted); }
.sp-switch-tick { width: 16px; height: 16px; margin-left: auto; flex: none; color: var(--sp-accent); visibility: hidden; }
.sp-switch-row[aria-current="page"] .sp-switch-tick { visibility: visible; }
.sp-switch-row[aria-current="page"] b { color: var(--sp-accent); }
.sp-switch-foot { margin: 4px 8px 4px; padding-top: 8px; border-top: 1px solid var(--sp-line); font-size: 12px; color: var(--sp-muted); }
.sp-switch-scrim { display: none; }

@media (max-width: 600px) {
  .sp-switch-label, .sp-switch-caret { display: none; }
  .sp-switch-btn { width: 34px; height: 34px; padding: 0; justify-content: center; }
  /* a full-width sheet dropping from the top of the screen */
  .sp-switch-menu {
    position: fixed; top: 0; left: 0; right: 0; width: auto; border-radius: 0 0 var(--sp-radius) var(--sp-radius);
    border-width: 0 0 1px; padding: max(10px, env(safe-area-inset-top)) 10px 10px;
    animation: sp-drop .18s ease-out;
  }
  .sp-switch.open .sp-switch-scrim { display: block; position: fixed; inset: 0; z-index: 999; background: var(--sp-scrim); }
  .sp-switch-row { padding: 11px 8px; }
}
@keyframes sp-drop { from { transform: translateY(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sp-switch-menu { animation: none; } .sp-switch-caret { transition: none; } }

/* ---------- the account chip ---------- */
.sp-chip { position: relative; display: inline-flex; flex: none; font-family: var(--sp-font); }
.sp-chip-in {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: calc(var(--sp-radius) - 3px);
  background: var(--sp-accent); color: var(--sp-on-accent); font: 700 13px/1 var(--sp-font); text-decoration: none; white-space: nowrap;
}
.sp-chip-in:hover { filter: brightness(1.07); }
.sp-chip-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; max-width: 220px; padding: 0 10px 0 4px;
  border: 1px solid var(--sp-line); border-radius: 999px; background: var(--sp-btn-bg); color: var(--sp-text);
  font: 600 13px/1 var(--sp-font); cursor: pointer;
}
.sp-chip-btn:hover, .sp-chip.open .sp-chip-btn { background: var(--sp-hover); }
.sp-chip-dot {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none;
  border-radius: 50%; background: var(--sp-accent); color: var(--sp-on-accent); font-size: 12px; font-weight: 800; text-transform: uppercase;
}
.sp-chip-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sp-chip-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 1000; min-width: 220px;
  background: var(--sp-bg); color: var(--sp-text); border: 1px solid var(--sp-line);
  border-radius: var(--sp-radius); box-shadow: var(--sp-shadow); padding: 6px; text-align: left;
}
.sp-chip-menu[hidden] { display: none; }
.sp-chip-who { margin: 4px 8px 6px; font-size: 12px; color: var(--sp-muted); overflow-wrap: anywhere; }
.sp-chip-menu a, .sp-chip-menu button {
  display: block; width: 100%; padding: 9px 8px; border: 0; border-radius: calc(var(--sp-radius) - 4px); background: none;
  color: var(--sp-text); font: 600 14px/1.2 var(--sp-font); text-align: left; text-decoration: none; cursor: pointer;
}
.sp-chip-menu a:hover, .sp-chip-menu button:hover { background: var(--sp-hover); }
@media (max-width: 600px) {
  .sp-chip-mail { display: none; }
  .sp-chip-btn { padding: 0 4px; }
}
