/* The "Aa" appearance button and its menu (appearance.js). Tokens only. */
.aa-btn {
  display: inline-grid; place-items: center; width: max(40px, var(--tap)); height: max(40px, var(--tap)); flex: none;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; padding: 0;
}
.aa-btn:hover { border-color: var(--line-strong); }
.aa-btn[aria-expanded="true"] { border-color: var(--ink-2); background: var(--surface-2); }
.aa-aa { font: 650 var(--fs-md)/1 var(--font-display); letter-spacing: -.02em; }

.aa-pop {
  position: fixed; z-index: var(--z-popover); width: 360px; max-height: calc(100dvh - var(--bar-h) - 16px); overflow: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow);
  font-size: var(--fs-sm); overscroll-behavior: contain;
}
.aa-pop.aa-anim:not([hidden]) { animation: aa-in .14s var(--ease); }
@keyframes aa-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.aa-pop.aa-sheet {
  left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 88dvh; border-radius: 16px 16px 0 0;
  border-left: 0; border-right: 0; border-bottom: 0;
}
.aa-pop.aa-sheet.aa-anim:not([hidden]) { animation-name: aa-up; animation-duration: .18s; }
@keyframes aa-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.aa-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 4px 18px; }
.aa-title { font-weight: 650; font-size: var(--fs-md); }
.aa-x { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; padding: 0; }
.aa-x:hover { background: var(--surface-2); color: var(--ink); }
.aa-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.aa-body { padding: 0 18px 4px; }
.aa-row { border: 0; margin: 0; padding: 12px 0; min-width: 0; }
.aa-row + .aa-row { border-top: 1px solid var(--line); }
.aa-leg { float: left; width: 100%; padding: 0; margin: 0 0 8px; font-size: var(--fs-xs); font-weight: 650; color: var(--ink-2); }
.aa-opts { clear: both; display: grid; gap: 6px; }
.aa-theme .aa-opts, .aa-size .aa-opts { grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); }
.aa-size .aa-opts { --n: 4; }
.aa-skin .aa-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.aa-font .aa-opts { grid-template-columns: repeat(3, minmax(96px, 1fr)); }   /* 3 per row, two rows: names never touch the tile edge */

.aa-opt {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: max(36px, var(--tap));
  padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink);
  font-size: var(--fs-xs); font-weight: 550; cursor: pointer; text-align: center; line-height: 1.2;
}
.aa-opt:hover { border-color: var(--ink-2); }
.aa-opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); color: var(--ink); }
.aa-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.aa-ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.aa-skin .aa-opt { justify-content: flex-start; }
.aa-font .aa-opt { flex-direction: column; gap: 3px; padding: 8px 6px; min-height: 56px; }
.aa-f { font-size: var(--fs-lg); font-weight: 600; line-height: 1.1; }
.aa-f-system { font-family: var(--font-system); }
.aa-f-readable { font-family: var(--font-readable); }
.aa-f-rounded { font-family: var(--font-rounded); }
.aa-f-serif { font-family: var(--font-serif); }
.aa-f-mono { font-family: var(--mono); }
.aa-sz { font-weight: 650; }
.aa-sz-s { font-size: var(--fs-xs); }
.aa-sz-m { font-size: var(--fs-sm); }
.aa-sz-l { font-size: var(--fs-md); }
.aa-sz-xl { font-size: var(--fs-lg); }

.aa-sw { display: inline-flex; width: 22px; height: 22px; flex: none; border-radius: 50%; overflow: hidden; border: 1px solid var(--line-strong); }
.aa-sw > span { flex: 1; }
.aa-sw-classic .aa-sw-a { background: var(--sw-classic-l); } .aa-sw-classic .aa-sw-b { background: var(--sw-classic-d); }
.aa-sw-graphite .aa-sw-a { background: var(--sw-graphite-l); } .aa-sw-graphite .aa-sw-b { background: var(--sw-graphite-d); }
.aa-sw-ocean .aa-sw-a { background: var(--sw-ocean-l); } .aa-sw-ocean .aa-sw-b { background: var(--sw-ocean-d); }
.aa-sw-contrast .aa-sw-a { background: var(--sw-contrast-l); } .aa-sw-contrast .aa-sw-b { background: var(--sw-contrast-d); }
.aa-sw-renaissance .aa-sw-a { background: var(--sw-renaissance-l); } .aa-sw-renaissance .aa-sw-b { background: var(--sw-renaissance-d); }

.aa-switch { display: flex; align-items: center; gap: 14px; cursor: pointer; min-height: var(--tap); }
.aa-sw-text { flex: 1; display: grid; }
.aa-switch .aa-leg { float: none; margin: 0; font-size: var(--fs-sm); color: var(--ink); }
.aa-help { font-size: var(--fs-xs); color: var(--muted); }
.aa-cb { position: absolute; opacity: 0; width: 1px; height: 1px; }
.aa-track { position: relative; width: 40px; height: 24px; flex: none; border-radius: 12px; background: var(--line-strong); transition: background .15s; }
.aa-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); transition: transform .15s var(--ease); }
.aa-cb:checked + .aa-track { background: var(--accent); }
.aa-cb:checked + .aa-track::after { transform: translateX(16px); }
.aa-cb:focus-visible + .aa-track { outline: 2px solid var(--focus); outline-offset: 2px; }

.aa-extra { border-top: 1px solid var(--line); padding: 6px 0; display: grid; }
.aa-item { text-align: left; min-height: var(--tap); padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }

.aa-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px 14px; border-top: 1px solid var(--line); }
.aa-saved { font-size: var(--fs-xs); color: var(--muted); }
.aa-reset { flex: none; min-height: var(--tap); }

@media (max-width: 359px) {
  .aa-font .aa-opts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* bottom sheet on phones: clear the home bar and a landscape notch */
.aa-pop.aa-sheet { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.aa-pop.aa-sheet .aa-foot { padding-bottom: max(14px, calc(env(safe-area-inset-bottom, 0px) + 8px)); }
