/* Shared wallpaper, header, and brand color for login and dashboard. */
:root {
  --brand-red: #a70e17;
  --crest-finish: grayscale(1) sepia(1) saturate(1.4) brightness(.9) contrast(1.05);
  --brand-red-rgb: 167 14 23;
}
body {
  isolation: isolate;
  background: #100d0e !important;
}
.crest-wallpaper {
  position: fixed;
  inset: 0 0 auto;
  /* Keep the layer tall enough while mobile browser controls slide in/out. */
  height: 100%;
  height: 100lvh;
  min-height: 100%;
  z-index: -1;
  display: grid;
  pointer-events: none;
  overflow: hidden;
  opacity: .36;
}
.crest-wallpaper img {
  filter: var(--crest-finish);
  display: block;
  width: min(84px, calc(100% - 16px));
  height: min(84px, calc(100% - 16px));
  object-fit: contain;
  justify-self: center;
  align-self: center;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-block: 20px;
  background: rgb(var(--brand-red-rgb) / .78) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff !important;
  border: 0 !important;
  border-bottom: 2px solid rgb(255 255 255 / .55) !important;
  box-shadow: 0 5px 22px #0008;
}
.topbar a, .topbar strong, .topbar small, .topbar p, .topbar h1, .topbar .account, .topbar .badge { color: #fff !important; }
.login-panel button, .categories button[aria-pressed=true], .actions a {
  background: var(--brand-red) !important;
  color: #fff !important;
}
.login-panel button:hover, .categories button[aria-pressed=true]:hover, .actions a:hover { filter: brightness(1.12); }
.login-panel button:active, .categories button[aria-pressed=true]:active, .actions a:active { filter: brightness(.9); }

/* Give Kiryu and the header more room without stretching the square GIF. */
.topbar .brand img {
  width: 112px;
  height: 112px;
  padding: 0;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.topbar .brand-icon { flex-shrink: 0; }
@media (max-width: 650px) {
  .topbar { padding-block: 20px; }
  .topbar .brand img { width: 96px; height: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  .topbar .brand img { display: none; }
}

/* Both entry points share the same brand layout and control geometry. */
.topbar .brand { min-width: 0; }
.topbar .brand > span { min-width: 0; }
button, input, select { border-radius: 2px; }

/* Keep wallpaper text readable while panels follow the selected theme. */
:root {
  --menu-surface: linear-gradient(145deg, #211d1def, #131112f5);
  --menu-hover: linear-gradient(145deg, #302725, #191515);
}
:root[data-theme=light] {
  --menu-surface: linear-gradient(145deg, #f6f1e7fa, #e8ddcaf5);
  --menu-hover: linear-gradient(145deg, #fff9ee, #e8ddca);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme=dark]) {
    --menu-surface: linear-gradient(145deg, #f6f1e7fa, #e8ddcaf5);
    --menu-hover: linear-gradient(145deg, #fff9ee, #e8ddca);
  }
}
.toolbar, .card, .empty { background: var(--menu-surface) !important; color: var(--ink); }
.card:hover { background: var(--menu-hover) !important; }
.intro { color: #f5f0e7; --muted: #b9ada2; }
.group summary { --muted: #b9ada2; }
footer { color: #b9ada2; }

/* Service logos sit directly on the card, without a colored tile behind them. */
.card .icon { background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.card .icon img { display: block; width: 32px; height: 32px; object-fit: contain; padding: 0; }

/* Karakeep's white wordmark needs dark ink on the light card surface. */
:root[data-theme=light] .card .icon img[src*="/karakeep.svg"] { filter: brightness(.15); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme=dark]) .card .icon img[src*="/karakeep.svg"] { filter: brightness(.15); }
}

/* The header pin shares the background crests' gold treatment. */
.login-header .clan-pin { filter: var(--crest-finish) drop-shadow(0 3px 5px #0006); }
