/* UWC Nav — modern start page: gradient backdrop, favicon tiles, pinned OWU. */
:root {
  color-scheme: light;
  --bg: #eef2fc;
  --bg-deep: #e2e9fa;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --text: #1c2334;
  --muted: #5c677c;
  --faint: #8b95a9;
  --border: rgba(30, 45, 80, 0.1);
  --border-strong: rgba(30, 45, 80, 0.18);
  --accent: #4f6bff;
  --accent-two: #9b5cff;
  --accent-soft: rgba(79, 107, 255, 0.1);
  --focus: #4f6bff;
  --shadow: 0 2px 8px rgba(30, 45, 80, 0.06), 0 16px 40px rgba(30, 45, 80, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f1a;
  --bg-deep: #101627;
  --surface: rgba(23, 30, 48, 0.82);
  --surface-solid: #171e30;
  --text: #eef2fb;
  --muted: #a4aec4;
  --faint: #6d7891;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --accent: #8ba0ff;
  --accent-two: #bd8bff;
  --accent-soft: rgba(139, 160, 255, 0.14);
  --focus: #8ba0ff;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  transition: background-color 200ms ease, color 200ms ease;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.page {
  background:
    radial-gradient(900px 500px at 12% -8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 62%),
    radial-gradient(800px 480px at 108% 4%, color-mix(in srgb, var(--accent-two) 12%, transparent), transparent 60%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding: 22px clamp(18px, 4vw, 56px) 18px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.topbar-actions { align-items: center; display: flex; gap: 10px; }

.filter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(20, 28, 45, 0.04);
  color: var(--text);
  font-size: 13px;
  outline: none;
  padding: 9px 18px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  width: min(250px, 42vw);
}
.filter::placeholder { color: var(--faint); }
.filter:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.gh-link {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(20, 28, 45, 0.04);
  color: var(--muted);
  display: inline-flex;
  height: 38px;
  justify-content: center;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
  width: 38px;
}
.gh-link:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); }

.theme-toggle {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(20, 28, 45, 0.04);
  cursor: pointer;
  display: inline-flex;
  padding: 6px 10px 6px 7px;
  transition: border-color 160ms ease, transform 160ms ease;
}
.theme-toggle:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.theme-track { background: var(--border-strong); border-radius: 999px; display: block; height: 25px; padding: 3px; width: 42px; }
.theme-thumb {
  align-items: center;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(20, 28, 45, 0.15);
  display: flex;
  font-size: 10px;
  height: 19px;
  justify-content: center;
  transform: translateX(0);
  transition: transform 200ms cubic-bezier(.2,.8,.2,1);
  width: 19px;
}
:root[data-theme="dark"] .theme-thumb { transform: translateX(17px); }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: inline; }

/* Pinned feature card */
.pinned { margin: 0 auto 18px; max-width: 1200px; width: 100%; }
.pinned-card {
  align-items: center;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), color-mix(in srgb, var(--accent-two) 10%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 16px;
  padding: 16px 22px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.pinned-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 18%, transparent); transform: translateY(-2px); }
.pinned-icon {
  align-items: center;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(30, 45, 80, 0.12);
  display: flex;
  flex: none;
  height: 56px;
  justify-content: center;
  width: 56px;
}
.pinned-icon img { height: 30px; width: 30px; }
.pinned-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pinned-title { font-size: 19px; font-weight: 800; letter-spacing: 0.01em; }
.pinned-sub { color: var(--muted); font-size: 12px; font-weight: 600; }
.pinned-arrow { color: var(--accent); font-size: 20px; margin-left: auto; flex: none; }

/* Category cards + icon tiles */
.categories {
  display: grid;
  gap: 14px;
  grid-auto-rows: 1fr; /* strict equal-height rows: no uneven cards */
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  margin: 0 auto;
  max-width: 1200px;
  width: 100%;
}

.category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  padding: 16px 14px 14px;
  transition: border-color 160ms ease;
}
.category:hover { border-color: var(--border-strong); }
.category.hidden { display: none; }

.category-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 6px 12px;
  text-transform: uppercase;
}

.tile-list {
  align-content: start;
  display: grid;
  flex: 1;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}
.tile { position: relative; }
.tile.hidden { display: none; }
.tile-badge {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  padding: 2px 5px;
  position: absolute;
  right: 2px;
  top: 2px;
  z-index: 1;
}
.tile a {
  align-items: center;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 4px 9px;
  transition: background 150ms ease, transform 150ms ease;
}
.tile a:hover { background: var(--accent-soft); transform: translateY(-2px); }
.tile-icon {
  align-items: center;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 2px 8px rgba(30, 45, 80, 0.08);
  display: flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}
.tile-icon img { height: 22px; width: 22px; }
.tile-icon.fallback { background: var(--accent-soft); }
.tile-name {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile a:hover .tile-name { color: var(--accent); }

footer {
  color: var(--faint);
  display: flex;
  font-size: 10px;
  font-weight: 700;
  justify-content: space-between;
  letter-spacing: 0.08em;
  margin-top: 20px;
  padding: 0 2px;
  text-transform: uppercase;
}

button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

@media (max-width: 680px) {
  .page { padding: 16px 14px 14px; }
  .topbar { flex-wrap: wrap; margin-bottom: 16px; }
  .filter { order: 3; width: 100%; }
  .pinned-card { padding: 14px 16px; }
  .categories { gap: 12px; grid-template-columns: 1fr 1fr; }
  .category { padding: 12px 10px; }
  .tile-list { gap: 4px; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
}

@media (max-width: 420px) {
  .categories { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
