/* ===== Light theme =====
   <html data-theme="light"> is set by the header toggle (index.js) and kept in
   localStorage; dark stays the default. The dark design hard-codes many of its
   whites and blacks, so these rules restate just those for a light page. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg-color: #f3f1ee;
  --card-bg: rgba(255, 255, 255, 0.7);
  --text-primary: #1a1d26;
  --text-secondary: #5a5f6e;
  --border-color: rgba(20, 24, 40, 0.12);
  --glass-bg: rgba(20, 24, 40, 0.03);
  --fill-a: rgba(20, 24, 40, 0.03);
  --fill-b: rgba(20, 24, 40, 0.03);
  --edge-a: rgba(20, 24, 40, 0.14);
  --edge-b: rgba(20, 24, 40, 0.14);
  --glow: rgba(124, 58, 237, 0.1);
  --name-a: #1a1d26;
  --name-b: #1a1d26;
  --orb-a: 0.2;
}

:root[data-theme="light"] #aurora .b1 { opacity: 0.1; }
:root[data-theme="light"] #aurora .b2 { opacity: 0.09; }
:root[data-theme="light"] #aurora .b3 { opacity: 0.08; }
:root[data-theme="light"] #aurora .b4 { opacity: 0.08; }
:root[data-theme="light"] #aurora .b5 { opacity: 0.1; }

/* Header and stats */
:root[data-theme="light"] h1 { color: #11141c; }
:root[data-theme="light"] .description,
:root[data-theme="light"] .stats-bar { color: rgba(20, 24, 40, 0.8); }
:root[data-theme="light"] .stats-bar span[id] { color: #11141c; }
:root[data-theme="light"] .header-controls.is-pinned { background: rgba(243, 241, 238, 0.85); }

/* Display switches and the glow panel */
:root[data-theme="light"] .view-toggle {
  background: rgba(20, 24, 40, 0.05);
  border-color: rgba(20, 24, 40, 0.14);
}
:root[data-theme="light"] .view-btn { color: rgba(20, 24, 40, 0.55); }
:root[data-theme="light"] .view-btn:hover { color: #11141c; }
:root[data-theme="light"] .view-btn[aria-pressed="true"] {
  background: rgba(20, 24, 40, 0.12);
  color: #11141c;
}
:root[data-theme="light"] .glow-tune #glow-tune-btn[aria-expanded="true"] { background: rgba(20, 24, 40, 0.12); }
:root[data-theme="light"] .glow-panel {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(20, 24, 40, 0.14);
  box-shadow: 0 12px 32px rgba(20, 24, 40, 0.14);
}
:root[data-theme="light"] .glow-row { color: rgba(20, 24, 40, 0.8); }
:root[data-theme="light"] .glow-row output { color: rgba(20, 24, 40, 0.55); }
:root[data-theme="light"] .glow-reset {
  border-color: rgba(20, 24, 40, 0.14);
  background: rgba(20, 24, 40, 0.05);
  color: rgba(20, 24, 40, 0.8);
}
:root[data-theme="light"] .glow-reset:hover { background: rgba(20, 24, 40, 0.1); }

/* Search */
:root[data-theme="light"] .search-input {
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    var(--rainbow-edge) border-box;
  color: #11141c;
}
:root[data-theme="light"] .search-input::placeholder { color: rgba(20, 24, 40, 0.45); }
:root[data-theme="light"] .search-icon { color: rgba(20, 24, 40, 0.55); }
:root[data-theme="light"] .search-hint {
  border-color: rgba(20, 24, 40, 0.2);
  color: rgba(20, 24, 40, 0.55);
}
:root[data-theme="light"] .search-clear {
  background: rgba(20, 24, 40, 0.08);
  color: rgba(20, 24, 40, 0.8);
}
:root[data-theme="light"] .search-clear:hover { background: rgba(20, 24, 40, 0.16); color: #11141c; }

/* Filter chips */
:root[data-theme="light"] .filter-btn {
  background: rgba(20, 24, 40, 0.05);
  border-color: rgba(20, 24, 40, 0.14);
  color: rgba(20, 24, 40, 0.8);
}
:root[data-theme="light"] .filter-btn:hover { background: rgba(20, 24, 40, 0.09); }
:root[data-theme="light"] .filter-btn.active { color: #11141c; }

/* Cards: white glass with the platform orbs, instead of dark glass */
:root[data-theme="light"] .app-link {
  background:
    var(--orbs),
    rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 8px 22px rgba(30, 27, 60, 0.08),
    0 0 22px var(--glow);
}
:root[data-theme="light"] .app-link:hover {
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 0 40px rgba(255, 255, 255, 0.5),
    0 18px 40px rgba(30, 27, 60, 0.14),
    0 0 40px var(--glow);
}
:root[data-theme="light"] .app-link[class*="filter-"] {
  --fill-a: rgba(255, 255, 255, 0.9);
  --fill-b: rgb(var(--orb-1) / 0.16);
}
:root[data-theme="light"] .app-name {
  background-image: linear-gradient(90deg, color-mix(in srgb, var(--name-a) 80%, #0f1219), #1a1d26);
}
:root[data-theme="light"] .app-type { color: rgba(20, 24, 40, 0.85); }
:root[data-theme="light"] .changelog-text { color: rgba(20, 24, 40, 0.6); }
:root[data-theme="light"] .app-data-wrapper { border-top-color: rgba(20, 24, 40, 0.12); }
:root[data-theme="light"] .platform-row { border-bottom-color: rgba(20, 24, 40, 0.08); }
:root[data-theme="light"] .meta-label { color: rgba(20, 24, 40, 0.6); }
:root[data-theme="light"] .meta-value { color: #11141c; }
:root[data-theme="light"] .app-link::after { box-shadow: 0 0 22px var(--glow), 0 8px 20px rgba(30, 27, 60, 0.1); }

/* Modals */
:root[data-theme="light"] .modal { background-color: rgba(243, 241, 238, 0.8); }
:root[data-theme="light"] .modal-content {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.94) 60%, rgba(255, 255, 255, 0.88) 100%) padding-box,
    linear-gradient(150deg, var(--fill-a), var(--fill-b)) padding-box,
    linear-gradient(150deg, var(--edge-a), var(--edge-b)) border-box;
  box-shadow: inset 0 1px 0 #ffffff, 0 0 40px var(--glow), 0 40px 100px rgba(30, 27, 60, 0.18);
}
:root[data-theme="light"] .modal-content[class*="filter-"] {
  --fill-a: rgba(255, 255, 255, 0.9);
  --fill-b: rgb(var(--orb-1) / 0.16);
}
:root[data-theme="light"] #infoModal .modal-content {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(250, 249, 247, 0.98));
  border-color: rgba(124, 58, 237, 0.35);
}
:root[data-theme="light"] .form-group input,
:root[data-theme="light"] .form-group textarea { background: #ffffff; }
:root[data-theme="light"] .support-btn {
  background: rgba(20, 24, 40, 0.06);
  color: #11141c;
  border-color: rgba(20, 24, 40, 0.2);
}
:root[data-theme="light"] .support-btn:hover { box-shadow: 0 6px 20px rgba(20, 24, 40, 0.12); }
:root[data-theme="light"] .info-description-box { background: rgba(20, 24, 40, 0.03); }
:root[data-theme="light"] .close-info {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(20, 24, 40, 0.14);
  color: #11141c;
}
:root[data-theme="light"] .close-info:hover { background: rgba(20, 24, 40, 0.08); }

:root[data-theme="light"] .filter-btn.active[data-filter="all"] {
  color: #11141c;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    var(--rainbow-edge) border-box;
}
:root[data-theme="light"] .filter-btn[data-filter="android"] .ic { color: #15803d; }
:root[data-theme="light"] .filter-btn[data-filter="ios"] .ic { color: #1d4ed8; }
:root[data-theme="light"] .filter-btn[data-filter="mac"] .ic { color: #be185d; }
:root[data-theme="light"] .filter-btn[data-filter="web"] .ic { color: #b45309; }

/* Platform badges: the dark design's pale tints become readable on white. */
:root[data-theme="light"] .badge.android { background: rgba(22, 163, 74, 0.12); color: #15803d; border-color: rgba(22, 163, 74, 0.4); }
:root[data-theme="light"] .badge.ios { background: rgba(37, 99, 235, 0.1); color: #1d4ed8; border-color: rgba(37, 99, 235, 0.35); }
:root[data-theme="light"] .badge.web { background: rgba(234, 88, 12, 0.1); color: #c2410c; border-color: rgba(234, 88, 12, 0.35); }
:root[data-theme="light"] .badge.mac { background: rgba(147, 51, 234, 0.1); color: #7e22ce; border-color: rgba(147, 51, 234, 0.35); }
:root[data-theme="light"] .badge.firefox { background: rgba(255, 114, 57, 0.1); color: #c2410c; border-color: rgba(255, 114, 57, 0.35); }
:root[data-theme="light"] .badge:hover { box-shadow: 0 6px 16px rgba(20, 24, 40, 0.14); }

/* Theme toggle icon: the moon while dark, the sun while light (what you'd switch to). */
.theme-icon-light { display: none; }
:root[data-theme="light"] .theme-icon-light { display: block; }
:root[data-theme="light"] .theme-icon-dark { display: none; }
/* ===== Light theme: every page =====
   theme.js sets <html data-theme="light"> from the saved choice (dark is the
   default) and provides the switch. The page stylesheets hard-code many of their
   whites and blacks, so the rules below restate just those for a light page.
   The palette tokens and the dashboard's rules are in the section below. */

/* Floating switch, for pages without one in their header. */
.theme-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(20, 22, 28, 0.85);
  color: #f0f6fc;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform 0.2s ease;
}
.theme-fab:hover { transform: scale(1.06); }
.theme-fab:focus-visible { outline: 2px solid #a78bfa; outline-offset: 3px; }
.theme-fab svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
:root[data-theme="light"] .theme-fab {
  background: rgba(255, 255, 255, 0.92);
  color: #11141c;
  border-color: rgba(20, 24, 40, 0.16);
  box-shadow: 0 6px 18px rgba(20, 24, 40, 0.14);
}

/* Support pages */
:root[data-theme="light"] .app-link {
  background: var(--orbs), rgba(255, 255, 255, 0.82);
}
:root[data-theme="light"] .support-card-inline {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(20, 24, 40, 0.12);
  box-shadow: inset 0 1px 0 #ffffff, 0 16px 48px rgba(20, 24, 40, 0.1);
}
:root[data-theme="light"] .support-textarea { background: #ffffff; }
:root[data-theme="light"] .badge.mac {
  background: rgba(147, 51, 234, 0.1);
  color: #7e22ce;
  border-color: rgba(147, 51, 234, 0.35);
}

/* Project pages */
:root[data-theme="light"] .whats-new { border-top-color: rgba(20, 24, 40, 0.1); }
:root[data-theme="light"] .whats-new ul,
:root[data-theme="light"] .project-content li { color: #374151; }
:root[data-theme="light"] .feature-list li:hover { box-shadow: 0 10px 28px rgba(20, 24, 40, 0.12); }
:root[data-theme="light"] .gallery img {
  background: #ffffff;
  border-color: rgba(20, 24, 40, 0.12);
  box-shadow: 0 8px 24px rgba(20, 24, 40, 0.12);
}
:root[data-theme="light"] .gallery-nav { box-shadow: 0 4px 14px rgba(20, 24, 40, 0.18); }
:root[data-theme="light"] .note { background: rgba(255, 166, 87, 0.14); }
:root[data-theme="light"] .plan-btn { background: rgba(20, 24, 40, 0.05); }
:root[data-theme="light"] .project-banner {
  border-color: rgba(20, 24, 40, 0.12);
  box-shadow: 0 8px 24px rgba(20, 24, 40, 0.12);
}
:root[data-theme="light"] .page-toc a {
  border-bottom-color: rgba(20, 24, 40, 0.12);
  color: rgba(20, 24, 40, 0.85);
}
:root[data-theme="light"] .rail-node { background: #f3f1ee; }

/* Ratings, visitors and editions */
:root[data-theme="light"] .chart-tip {
  background: #ffffff;
  color: #11141c;
  box-shadow: 0 6px 18px rgba(20, 24, 40, 0.14);
}
:root[data-theme="light"] .downloads-card.is-focus .downloads-legend li.on { background: rgba(20, 24, 40, 0.06); }
:root[data-theme="light"] .v-tile { background: rgba(20, 24, 40, 0.03); }
:root[data-theme="light"] .country summary:hover { background: rgba(20, 24, 40, 0.04); }
:root[data-theme="light"] .c-bar { background: rgba(20, 24, 40, 0.08); }
:root[data-theme="light"] .glider-banner {
  border-color: rgba(20, 24, 40, 0.12);
  box-shadow: 0 8px 24px rgba(20, 24, 40, 0.12);
}
:root[data-theme="light"] .edition:hover { box-shadow: 0 10px 28px rgba(20, 24, 40, 0.12); }
:root[data-theme="light"] .status { background: rgba(20, 24, 40, 0.06); }
:root[data-theme="light"] .compare td { border-bottom-color: rgba(20, 24, 40, 0.08); }
:root[data-theme="light"] .compare thead th { background: rgba(20, 24, 40, 0.03); }


/* Pages with their own inline styles (404, privacy, EULA, get-the-app pages) */
:root[data-theme="light"] {
  --bg: #f3f1ee;
}
:root[data-theme="light"] .container,
:root[data-theme="light"] .card {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(20, 24, 40, 0.12);
  box-shadow: inset 0 1px 0 #ffffff, 0 8px 32px rgba(20, 24, 40, 0.1);
}
:root[data-theme="light"] h1 { color: #11141c; }
:root[data-theme="light"] .qr-wrap img { box-shadow: 0 10px 30px rgba(20, 24, 40, 0.12); }

/* Project pages: dark glass boxes, gradient titles and platform-tinted panels */
:root[data-theme="light"] .download-box,
:root[data-theme="light"] .table-wrap {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.9) 60%, rgba(255, 255, 255, 0.82) 100%);
  box-shadow: inset 0 1px 0 #ffffff, 0 0 18px var(--glow);
}
:root[data-theme="light"] .project-hero-text h1 {
  background-image: linear-gradient(90deg, color-mix(in srgb, var(--name-a) 80%, #0f1219), #1a1d26);
}
:root[data-theme="light"] [class*="filter-"] {
  --fill-a: rgba(255, 255, 255, 0.9);
  --fill-b: rgb(var(--orb-1, 124 58 237) / 0.14);
}

/* Feature cards on project pages share the dark-glass gradient with .table-wrap;
   the back link pins to a dark bar while scrolling. */
:root[data-theme="light"] .feature-list li {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.9) 60%, rgba(255, 255, 255, 0.82) 100%);
  box-shadow: inset 0 1px 0 #ffffff, 0 0 18px var(--glow);
}
:root[data-theme="light"] .feature-list li:hover {
  box-shadow: inset 0 1px 0 #ffffff, 0 10px 28px rgba(20, 24, 40, 0.12), 0 0 28px var(--glow);
}
:root[data-theme="light"] .back-link.is-pinned {
  background: rgba(243, 241, 238, 0.85);
}
:root[data-theme="light"] .feature-list strong {
  background-image: linear-gradient(90deg, color-mix(in srgb, var(--name-a) 80%, #0f1219), #1a1d26);
}

/* Editions cards share the same dark-glass gradient; intro copy is a light grey. */
:root[data-theme="light"] .edition {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.9) 60%, rgba(255, 255, 255, 0.82) 100%);
  box-shadow: inset 0 1px 0 #ffffff, 0 0 18px var(--glow);
}
:root[data-theme="light"] .glider-intro,
:root[data-theme="light"] .project-content p { color: #374151; }

/* Dashboard cards: the icon ring and the category pill were dark discs */
:root[data-theme="light"] .app-link::after {
  background:
    radial-gradient(circle at 50% 35%, #ffffff, #eceef3) padding-box,
    linear-gradient(150deg, var(--edge-a), var(--edge-b)) border-box;
  box-shadow: 0 0 22px var(--glow), 0 8px 20px rgba(30, 27, 60, 0.12);
}
:root[data-theme="light"] .app-category {
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(150deg, var(--edge-a), var(--edge-b)) border-box;
  color: color-mix(in srgb, var(--name-a) 80%, #0f1219);
}
