:root[data-theme="papier"] {
  color-scheme: light;
  --paper: #f6f2e9;
  --paper-raised: #fffdf7;
  --paper-deep: #e8e1d3;
  --ink: #1b231f;
  --ink-raised: #29312d;
  --muted: #59615c;
  --amber: #88500f;
  --amber-bright: #c1741f;
  --amber-wash: #ecd8b6;
  --line: rgba(27, 35, 31, 0.2);
  --line-faint: rgba(27, 35, 31, 0.09);
  --on-ink: #f7f2e7;
  --on-ink-muted: #ccc5b8;
  --focus: #a75c08;
  --contrast-surface: #1b231f;
  --contrast-ink: #f7f2e7;
  --contrast-muted: #ccc5b8;
  --contrast-accent: #e5aa59;
  --contrast-line: rgba(247, 242, 231, 0.24);
  --on-accent: #fffaf0;
  --theme-color: #f6f2e9;
  --shadow: 0 1.4rem 4rem rgba(27, 35, 31, 0.13);
}

:root,
:root[data-theme="salbei"] {
  color-scheme: light;
  --paper: #eef3ec;
  --paper-raised: #f9fcf7;
  --paper-deep: #dbe5d9;
  --ink: #183229;
  --ink-raised: #25463a;
  --muted: #52645c;
  --amber: #7b5129;
  --amber-bright: #ad7140;
  --amber-wash: #dfe7ce;
  --line: rgba(24, 50, 41, 0.2);
  --line-faint: rgba(24, 50, 41, 0.09);
  --on-ink: #eff6ef;
  --on-ink-muted: #c5d6cd;
  --focus: #8a4e20;
  --contrast-surface: #1d4537;
  --contrast-ink: #f1f7f0;
  --contrast-muted: #c6d9cf;
  --contrast-accent: #e4b172;
  --contrast-line: rgba(241, 247, 240, 0.24);
  --on-accent: #fffaf2;
  --theme-color: #eef3ec;
  --shadow: 0 1.4rem 4rem rgba(24, 50, 41, 0.14);
}

:root[data-theme="lichtpause"] {
  color-scheme: light;
  --paper: #edf4f6;
  --paper-raised: #f9fcfd;
  --paper-deep: #d9e7eb;
  --ink: #18313f;
  --ink-raised: #274859;
  --muted: #526773;
  --amber: #8a4d27;
  --amber-bright: #ba6e3d;
  --amber-wash: #dbe9e8;
  --line: rgba(24, 49, 63, 0.2);
  --line-faint: rgba(24, 49, 63, 0.09);
  --on-ink: #f0f7f8;
  --on-ink-muted: #c3d7df;
  --focus: #a35022;
  --contrast-surface: #1c465b;
  --contrast-ink: #f1f8fa;
  --contrast-muted: #c7dce4;
  --contrast-accent: #f0b278;
  --contrast-line: rgba(241, 248, 250, 0.25);
  --on-accent: #fffaf4;
  --theme-color: #edf4f6;
  --shadow: 0 1.4rem 4rem rgba(24, 49, 63, 0.14);
}

:root[data-theme="nachtlabor"] {
  color-scheme: dark;
  --paper: #171c1a;
  --paper-raised: #202724;
  --paper-deep: #2a332f;
  --ink: #edf2ec;
  --ink-raised: #dce5df;
  --muted: #b4c0b8;
  --amber: #e1aa5e;
  --amber-bright: #efb86d;
  --amber-wash: #393126;
  --line: rgba(237, 242, 236, 0.2);
  --line-faint: rgba(237, 242, 236, 0.08);
  --on-ink: #17201c;
  --on-ink-muted: #4f6259;
  --focus: #f0bd77;
  --contrast-surface: #e7eee8;
  --contrast-ink: #17201c;
  --contrast-muted: #53635b;
  --contrast-accent: #8b520f;
  --contrast-line: rgba(23, 32, 28, 0.24);
  --on-accent: #17201c;
  --theme-color: #171c1a;
  --shadow: 0 1.4rem 4rem rgba(0, 0, 0, 0.28);
}

.theme-picker {
  position: relative;
  z-index: 1200;
  flex: 0 0 auto;
  color: var(--ink);
  font-family: var(--sans, "Noto Sans", sans-serif);
  font-size: 0.75rem;
  line-height: 1.35;
}

.theme-picker summary {
  display: inline-flex;
  min-height: 2.35rem;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-raised) 88%, transparent);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.theme-picker summary::-webkit-details-marker {
  display: none;
}

.theme-picker summary::after {
  width: 0.42rem;
  height: 0.42rem;
  transform: translateY(-0.1rem) rotate(45deg);
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  content: "";
  transition: transform 160ms ease;
}

.theme-picker[open] summary::after {
  transform: translateY(0.12rem) rotate(225deg);
}

.theme-picker-title {
  color: var(--muted);
}

.theme-picker-current {
  font-weight: 700;
}

.theme-picker-mark {
  display: grid;
  grid-template-columns: repeat(2, 0.42rem);
  gap: 0.12rem;
}

.theme-picker-mark::before,
.theme-picker-mark::after {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--amber);
  content: "";
}

.theme-picker-mark::after {
  background: var(--contrast-surface);
}

.theme-picker-panel {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  width: min(21rem, calc(100vw - 2rem));
  padding: 0.55rem;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}

.theme-choice {
  display: grid;
  grid-template-columns: 2.75rem 1fr auto;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  padding: 0.72rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.theme-choice:hover,
.theme-choice[aria-pressed="true"] {
  background: var(--paper-deep);
}

.theme-choice[aria-pressed="true"]::after {
  color: var(--amber);
  content: "✓";
  font-size: 1rem;
  font-weight: 700;
}

.theme-choice-copy {
  display: grid;
  gap: 0.12rem;
}

.theme-choice-copy strong {
  font-size: 0.78rem;
}

.theme-choice-copy small {
  color: var(--muted);
  font-size: 0.68rem;
}

.theme-swatch {
  display: block;
  width: 2.75rem;
  height: 1.55rem;
  border: 1px solid rgba(24, 32, 28, 0.16);
  background: linear-gradient(115deg, var(--swatch-paper) 0 58%, var(--swatch-accent) 58% 74%, var(--swatch-ink) 74%);
}

.theme-choice[data-theme-value="papier"] .theme-swatch {
  --swatch-paper: #f6f2e9;
  --swatch-accent: #c1741f;
  --swatch-ink: #1b231f;
}

.theme-choice[data-theme-value="salbei"] .theme-swatch {
  --swatch-paper: #eef3ec;
  --swatch-accent: #ad7140;
  --swatch-ink: #1d4537;
}

.theme-choice[data-theme-value="lichtpause"] .theme-swatch {
  --swatch-paper: #edf4f6;
  --swatch-accent: #ba6e3d;
  --swatch-ink: #1c465b;
}

.theme-choice[data-theme-value="nachtlabor"] .theme-swatch {
  --swatch-paper: #171c1a;
  --swatch-accent: #e1aa5e;
  --swatch-ink: #e7eee8;
}

.learning-lab-strip .theme-picker {
  --sans: system-ui, sans-serif;
}

.learning-lab-strip .theme-picker summary {
  min-height: 1.9rem;
  border-color: var(--contrast-line);
  background: transparent;
  color: var(--contrast-ink);
}

@media (max-width: 900px) {
  .site-nav .theme-picker {
    margin-top: 1.2rem;
  }

  .site-nav .theme-picker summary {
    width: 100%;
    justify-content: space-between;
  }

  .site-nav .theme-picker-panel {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    margin-top: 0.45rem;
    box-shadow: none;
  }
}

@media (max-width: 32rem) {
  .learning-lab-strip .theme-picker {
    align-self: stretch;
  }

  .learning-lab-strip .theme-picker summary {
    width: 100%;
    justify-content: space-between;
  }
}

@media print {
  .theme-picker {
    display: none;
  }
}
