/*
 * For more Support see: https://t.me/Deivid21Hub
 *
 * Copyright (C) 2017 - 2026 Deivid Ignacio Parra (Deivid21)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* ── Tokens ─────────────────────────────────────────── */
:root {
  /* Material You tonal palette, seed #00acc1 (dark scheme) */
  --md-primary: #69d5e8; --md-on-primary: #01363e;
  --md-primary-container: #014e59; --md-on-primary-container: #9eefff;
  --md-secondary-container: #1f4d55; --md-on-secondary-container: #bceaf4;
  --md-tertiary-container: #30476c; --md-on-tertiary-container: #d7e3ff;
  --md-surface: #0b1517; --md-surface-low: #151d1f; --md-surface-c: #192123;
  --md-surface-high: #232b2d; --md-surface-highest: #2d3638;
  --md-on-surface: #d9e4e7; --md-on-variant: #b4cacf;
  --md-outline: #7f9499; --md-outline-variant: #374a4e;
  --bg: var(--md-surface);
  --bg-soft: var(--md-surface-high);
  --card: var(--md-surface-c);
  --card-hover: var(--md-surface-high);
  --border: var(--md-outline-variant);
  --text: var(--md-on-surface);
  --muted: var(--md-on-variant);
  --accent: var(--md-primary);
  --accent-soft: var(--md-primary-container);
  --ok: #3fb950;
  --warn: #d29922;
  --off: #f0616d;
  --radius: 24px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
/* Light scheme: follows the system unless the theme toggle picked one (html[data-theme]) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --md-primary: #006876; --md-on-primary: #ffffff;
    --md-primary-container: #9eefff; --md-on-primary-container: #001f24;
    --md-secondary-container: #bceaf4; --md-on-secondary-container: #001f24;
    --md-tertiary-container: #d7e3ff; --md-on-tertiary-container: #011c38;
    --md-surface: #f0fbfe; --md-surface-low: #eaf6f8; --md-surface-c: #e5f0f2;
    --md-surface-high: #dfeaec; --md-surface-highest: #d9e4e7;
    --md-on-surface: #151d1f; --md-on-variant: #374a4e;
    --md-outline: #667b7f; --md-outline-variant: #b4cacf;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --md-primary: #006876; --md-on-primary: #ffffff;
  --md-primary-container: #9eefff; --md-on-primary-container: #001f24;
  --md-secondary-container: #bceaf4; --md-on-secondary-container: #001f24;
  --md-tertiary-container: #d7e3ff; --md-on-tertiary-container: #011c38;
  --md-surface: #f0fbfe; --md-surface-low: #eaf6f8; --md-surface-c: #e5f0f2;
  --md-surface-high: #dfeaec; --md-surface-highest: #d9e4e7;
  --md-on-surface: #151d1f; --md-on-variant: #374a4e;
  --md-outline: #667b7f; --md-outline-variant: #b4cacf;
  color-scheme: light;
}

/* ── Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Bilingual content blocks: <div data-lang="en|es" markdown="1"> */
html[lang="en"] [data-lang="es"], html[lang="es"] [data-lang="en"] { display: none; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Google Sans Flex", "Google Sans", Roboto, system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
code { font-family: var(--mono); font-size: .9em; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }

.container { width: min(1180px, 100% - 32px); margin-inline: auto; }
.container.narrow { width: min(780px, 100% - 32px); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
main { min-height: 70vh; padding-bottom: 64px; }

/* ── Header ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--md-surface-c) 92%, transparent);
  border-bottom: 0;
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.lang-toggle {
  display: inline-flex; margin-left: 6px; padding: 2px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: .78rem; font-weight: 600;
}
.lang-toggle span { padding: 3px 8px; color: var(--muted); border-radius: 999px; }
html[lang="en"] .lang-toggle [data-lang-opt="en"],
html[lang="es"] .lang-toggle [data-lang-opt="es"] { background: var(--md-primary); color: var(--md-on-primary); }
.theme-toggle {
  display: inline-grid; place-items: center; width: 30px; height: 30px; margin-left: 6px; padding: 0; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; color: var(--muted);
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { width: 16px; height: 16px; display: none; }
html:not([data-theme]) .theme-toggle .ic-auto,
html[data-theme="light"] .theme-toggle .ic-light,
html[data-theme="dark"] .theme-toggle .ic-dark { display: block; }
.nav-links a { color: var(--muted); padding: 6px 12px; font-weight: 500; font-size: .95rem; border-radius: 999px; }
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg-soft); text-decoration: none; }

/* ── Hero ───────────────────────────────────────────── */
.hero {
  padding: 72px 0 48px;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--accent-soft), transparent 70%);
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.eyebrow { font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; margin: 0 0 8px; color: var(--md-primary); }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); letter-spacing: -.02em; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 640px; }
.stats { display: flex; gap: 32px; margin: 28px 0; flex-wrap: wrap; }
.stats div { display: flex; flex-direction: column; }
.stats strong { font-size: 1.8rem; }
.stats span { color: var(--muted); font-size: .9rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
/* Page heroes with an illustration next to the title (above it on phones) */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); align-items: center; gap: 32px; }
.hero-text { grid-column: 1; grid-row: 1; }
.hero-art { grid-column: 2; grid-row: 1; width: 100%; height: auto; }
@media (max-width: 720px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .hero-art { grid-column: 1; max-width: 300px; margin: 0 auto; }
  .hero-text { grid-row: 2; }
}

/* Home: big logo next to the title (above it on phones) */
.home-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 40px; }
.home-logo { grid-column: 2; grid-row: 1; width: clamp(160px, 22vw, 240px); height: auto; filter: drop-shadow(0 12px 32px rgba(0, 151, 167, .35)); }
.home-hero-text { grid-column: 1; grid-row: 1; }
@media (max-width: 720px) {
  .home-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .home-logo { grid-column: 1; width: 120px; }
  .home-hero-text { grid-row: 2; }
}

/* ── Buttons / tags ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .95rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 10px 24px;
  background: var(--md-primary);
  border-color: var(--md-primary);
  color: var(--md-on-primary);
  font-weight: 500;
  letter-spacing: .01em;
}
.btn:hover { text-decoration: none; filter: none; box-shadow: 0 1px 3px rgba(0,0,0,.3), 0 1px 1px rgba(0,0,0,.15); }
.btn-ghost { background: transparent; color: var(--md-primary); border-color: var(--md-outline); }
.btn-ghost:hover { background: color-mix(in srgb, var(--md-primary) 10%, transparent); box-shadow: none; }

.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag {
  display: inline-block;
  font-size: .75rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 8px;
  padding: 3px 10px;
  font-weight: 500;
}
.tag-ok { background: rgba(63,185,80,.15); color: var(--ok); }
.tag-dev { background: rgba(210,153,34,.15); color: var(--warn); }
.tag-off { background: rgba(240,97,109,.14); color: var(--off); }
.tag-soon { background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.tag-plain { color: var(--muted); background: var(--md-surface-highest); }

/* ── Devices finder: search + filters ─────────────── */
.finder { margin-bottom: 32px; }
.finder-bar { display: flex; gap: 10px; align-items: stretch; }
.search-box { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 20px; border-radius: 999px; background: var(--md-surface-high); cursor: text; }
.search-box:focus-within { outline: 2px solid var(--md-primary); outline-offset: 1px; }
.search-box svg { flex: none; width: 22px; height: 22px; fill: var(--muted); }
.search-box input { flex: 1; min-width: 0; font: inherit; color: var(--text); border: 0; background: transparent; padding: 14px 0; outline: none; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-clear { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: .95rem; }
.search-clear:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); color: var(--text); }
.filters-btn { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 0 20px; border: 0; border-radius: 999px; font: inherit; font-weight: 500; cursor: pointer; background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.filters-btn svg { width: 20px; height: 20px; fill: currentColor; }
.filters-btn:hover { filter: brightness(1.05); }
.filters-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: .75rem; line-height: 20px; text-align: center; background: var(--md-primary); color: var(--md-on-primary); }
.finder-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 12px; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.active-filters:empty { display: none; }
.chip.chip-removable { background: var(--md-secondary-container); border-color: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.link-btn { border: 0; background: none; padding: 4px; font: inherit; font-size: .88rem; font-weight: 500; color: var(--md-primary); cursor: pointer; }
.results-count { margin: 0 0 0 auto; color: var(--muted); font-size: .88rem; }
.flat-grid { margin-bottom: 44px; }
.empty .btn { margin-top: 12px; }

/* Filters panel: centered dialog, bottom sheet on phones */
.filters-panel { width: min(520px, calc(100% - 32px)); max-height: calc(100% - 48px); padding: 0; border: 0; border-radius: 28px; background: var(--md-surface-low); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
.filters-panel::backdrop { background: rgba(0, 0, 0, .45); }
.filters-inner { display: flex; flex-direction: column; gap: 20px; padding: 24px; }
.filters-head { display: flex; align-items: center; justify-content: space-between; }
.filters-head h2 { margin: 0; font-size: 1.35rem; }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.05rem; cursor: pointer; }
.icon-btn:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); color: var(--text); }
.filter-field { display: flex; flex-direction: column; gap: 10px; }
.filter-field > label, .filter-label { font-size: .85rem; font-weight: 500; color: var(--muted); }
.filter-field select { font: inherit; color: var(--text); padding: 12px 16px; border: 1px solid var(--md-outline); border-radius: 12px; background: var(--md-surface-high); }
.filters-foot { display: flex; justify-content: space-between; gap: 12px; padding-top: 4px; }
@media (max-width: 720px) {
  .filters-btn { padding: 0 16px; }
  .filters-btn > span[data-i18n] { display: none; }
  .filters-panel[open] { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 28px 28px 0 0; max-height: 88vh; }
  .filters-inner { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  border-color: var(--md-outline-variant);
  color: var(--md-on-variant);
  padding: 6px 16px;
}
.chip:hover { color: var(--text); background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.chip.active { background: var(--md-secondary-container); border-color: var(--md-secondary-container); color: var(--md-on-secondary-container); }

/* ── Device groups and cards ────────────────────────── */
.family { margin-bottom: 44px; scroll-margin-top: 80px; }
.family-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.family-head h2 { margin: 0; font-size: 1.4rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }

.device-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
  border-radius: 24px;
}
.device-card:hover { text-decoration: none; transform: none; border-color: transparent; background: var(--md-surface-high); }
.device-img { height: 190px; padding: 16px; background: var(--bg-soft); }
.device-img img { width: 100%; height: 100%; object-fit: contain; }
.device-info { padding: 12px 14px 14px; }
.device-info h3 { font-size: 1rem; margin: 0 0 2px; }
.codename { color: var(--muted); font-size: .85rem; }
.codename.big { font-size: 1rem; margin-right: 8px; }
.device-links { margin: 12px 0 0; font-weight: 500; }
.device-vendor { margin: 0 0 2px; color: var(--muted); font-size: 1.15rem; font-weight: 500; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* ── Device page ────────────────────────────────────── */
.breadcrumb { color: var(--muted); font-size: .9rem; margin: 24px 0; }
.breadcrumb a { color: var(--muted); }
.device-hero { display: grid; grid-template-columns: 280px 1fr; gap: 40px; align-items: center; margin-bottom: 40px; }
.device-hero-img { height: 320px; padding: 24px; border: 0; background: var(--md-surface-c); border-radius: 28px; }
.device-hero-img img { width: 100%; height: 100%; object-fit: contain; }
.device-hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
.specs { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 20px 0; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-weight: 500; }
.source-links { display: flex; gap: 10px; flex-wrap: wrap; }

.block { margin-bottom: 40px; }
.block h2 { font-size: 1.3rem; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.rom-list { display: flex; flex-direction: column; gap: 14px; }
.rom-list + .rom-list { margin-top: 14px; }
.rom { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.rom-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.rom h3 { margin: 0; font-size: 1.1rem; }
.rom-actions { display: flex; gap: 8px; }
.hash { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 8px 12px; background: var(--bg-soft); border-radius: 8px; overflow: hidden; }
.hash code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .8rem; }
.copy { font: inherit; font-size: .8rem; cursor: pointer; background: none; border: 1px solid var(--border); color: var(--text); padding: 3px 10px; border-radius: 999px; border-color: var(--md-outline); }
.copy:hover { border-color: var(--accent); }
.rom-notes { margin: 12px 0 0; color: var(--muted); font-size: .93rem; }
.extras { padding-left: 20px; }
.extras li { margin: 6px 0; }

/* ── Guides / prose ─────────────────────────────────── */
.guide-cards { list-style: none; padding: 0; margin: 0 0 48px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.guide-card { position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden; border-radius: 24px; background: var(--md-surface-c); color: var(--text); transition: background .2s ease, transform .2s ease; }
.guide-card:hover { background: var(--md-surface-high); text-decoration: none; transform: translateY(-2px); }
.guide-card img { display: block; width: 100%; height: auto; aspect-ratio: 760 / 300; object-fit: cover; }
.guide-thumb-empty { aspect-ratio: 760 / 300; background: linear-gradient(135deg, var(--md-primary-container), var(--md-surface-high)); }
.guide-step { position: absolute; top: 12px; left: 12px; min-width: 32px; height: 32px; padding: 0 10px; border-radius: 16px; display: grid; place-items: center; font-weight: 700; font-size: .9rem; background: var(--md-primary); color: var(--md-on-primary); }
.guide-body { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px 20px; flex: 1; }
.guide-body h2 { margin: 0; font-size: 1.15rem; }
.guide-body p { margin: 0; color: var(--muted); font-size: .92rem; }
.guide-meta { margin-top: auto !important; padding-top: 10px; font-size: .82rem !important; }
.prose h2 { margin-top: 1.8em; }
.prose pre { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; overflow-x: auto; }
.prose :not(pre) > code { background: var(--bg-soft); padding: 2px 6px; border-radius: 5px; }
.prose blockquote { margin: 1.2em 0; padding: 10px 16px; border-left: 3px solid var(--warn); background: rgba(210,153,34,.08); border-radius: 0 8px 8px 0; }
.prose blockquote p { margin: 0; }
.install-pick select { width: 100%; max-width: 420px; padding: 12px 16px; border: 1px solid var(--md-outline); border-radius: 12px; background: var(--md-surface-high); color: var(--text); font: inherit; }
.guide-hero { display: block; width: 100%; height: auto; margin: 8px 0 20px; border-radius: 24px; }

/* ── Footer ─────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0; color: var(--muted); font-size: .9rem; }
.footer-inner p { margin: 4px 0; }
.footer-links { display: flex; gap: 16px; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 720px) {
  .device-hero { grid-template-columns: 1fr; gap: 24px; }
  .device-hero-img { height: 260px; }
  .device-img { height: 150px; padding: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .nav-links a { padding: 6px 8px; font-size: .9rem; }
  .brand span { display: none; }
  .hero { padding: 48px 0 32px; }
}

/* ── Alt names / counters ───────────────────────────── */
.aka { margin: 0 0 4px; color: var(--muted); font-size: .8rem; line-height: 1.3; }
.aka.big { font-size: 1rem; margin-bottom: 10px; }
.chip .count { opacity: .6; font-size: .8em; margin-left: 2px; }
.rom-soon { opacity: .7; border-style: dashed; }
.warning { display: flex; gap: 10px; align-items: baseline; margin: -12px 0 32px; padding: 12px 16px; background: rgba(210,153,34,.1); border: 0; border-radius: 16px; }
.warning strong { color: var(--warn); }

/* ── Icons ──────────────────────────────────────────── */
.icon { width: 1em; height: 1em; flex: none; }

/* ── Donate button (header) ─────────────────────────── */
.nav-links a.nav-donate {
  display: inline-flex; align-items: center; gap: 6px;
  color: #fff; background: var(--accent); border: 1px solid var(--accent);
}
.nav-links a.nav-donate:hover, .nav-links a.nav-donate.active { color: #fff; background: var(--accent); border-color: var(--accent); filter: brightness(1.12); }

/* ── Donate page ────────────────────────────────────── */
.donate-hero {
  text-align: center; padding: 64px 0 40px;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, var(--accent-soft), transparent 70%);
}
.donate-hero .lead { margin-inline: auto; }
.donate-heart { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 16px; border-radius: 50%; font-size: 30px; animation: beat 2.4s ease-in-out infinite; background: var(--md-primary-container); color: var(--md-on-primary-container); }
@keyframes beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.12); } 24% { transform: scale(1); } 36% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .donate-heart { animation: none; } }

.donate-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 8px; }
.donate-card {
  --brand: var(--accent);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 28px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.donate-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--brand);
}
.donate-card:hover { transform: translateY(-4px); border-color: var(--brand); box-shadow: 0 12px 32px -12px var(--brand); text-decoration: none; }
.donate-card h2 { font-size: 1.35rem; margin: 10px 0 0; }
.donate-card p { color: var(--muted); margin: 0 0 18px; flex: 1; }
.donate-logo { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: var(--brand-logo); color: #fff; font-size: 30px; }
.donate-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px;
  background: var(--brand); color: var(--brand-ink, #fff); font-weight: 600;
}
/* GitHub: black/white like github.com, inverted per theme */
.donate-github { --brand: #f0f6fc; --brand-ink: #0d1117; --brand-logo: #24292f; }
.donate-github .donate-logo { border: 1px solid #3d444d; }
.donate-paypal { --brand: #0070e0; --brand-ink: #fff; --brand-logo: #003087; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .donate-github { --brand: #24292f; --brand-ink: #fff; }
  :root:not([data-theme="dark"]) .donate-github .donate-logo { border-color: transparent; }
}
:root[data-theme="light"] .donate-github { --brand: #24292f; --brand-ink: #fff; }
:root[data-theme="light"] .donate-github .donate-logo { border-color: transparent; }
.donate-thanks { text-align: center; margin-top: 36px; }

@media (max-width: 720px) {
  .donate-grid { grid-template-columns: 1fr; }
  .nav-donate span { display: none; }
}
.brand img { flex: none; }

/* ── Collapsible ROM cards ──────────────────────────── */
details.rom { padding: 0; }
details.rom > summary { flex-wrap: nowrap; list-style: none; cursor: pointer; padding: 18px 20px; border-radius: 24px; }
details.rom > summary::-webkit-details-marker { display: none; }
details.rom > summary:hover { background: var(--card-hover); }
details.rom[open] > summary { border-bottom: 1px solid var(--border); border-bottom-color: var(--md-outline-variant); border-radius: 24px 24px 0 0; }
.rom-title { flex: 1; min-width: 0; }
.rom-chevron { width: 10px; height: 10px; flex: none; margin-left: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s ease; }
details.rom[open] .rom-chevron { transform: rotate(-135deg); }
.rom-info { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; padding: 16px 20px; }
/* Card body: info on the left, ROM banner on the right (on top on phones) */
.rom-body { display: grid; grid-template-columns: minmax(0, 1fr); }
.rom-banner { margin: 16px 20px 0; position: relative; border-radius: 16px; overflow: hidden; background: var(--md-surface-highest); aspect-ratio: 16 / 9; }
.rom-banner img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 721px) {
  .rom-body { grid-template-columns: minmax(0, 1fr) minmax(0, 40%); align-items: start; }
  .rom-banner { grid-column: 2; grid-row: 1; margin: 16px 20px 16px 0; }
  .rom-body .rom-info { grid-column: 1; grid-row: 1; }
}
.rom-info dt { color: var(--muted); }
.rom-info dd { margin: 0; font-weight: 500; display: flex; align-items: center; gap: 8px; }
details.rom .hash { margin: 0 20px 16px; }
details.rom .rom-notes { margin: 0 20px 16px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot-active { background: var(--ok); }
.dot-discontinued { background: var(--off); }
@media (max-width: 720px) {
  details.rom > summary { flex-wrap: wrap; }
  .rom-chevron { position: absolute; right: 18px; top: 24px; }
  details.rom { position: relative; }
  .rom-title { flex-basis: 100%; padding-right: 28px; }
}
details.rom.rom-loading .rom-info dd { opacity: .5; }

.hero-compact { padding: 48px 0 32px; }

/* ── Code blocks ────────────────────────────────────── */
pre.code { position: relative; margin: 10px 0 0; padding: 14px 16px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; font-size: .85rem; line-height: 1.55; }
pre.code .copy { position: absolute; top: 8px; right: 8px; background: var(--card); }
.note { margin-top: 14px; padding: 12px 16px; font-size: .93rem; border-left: 0; border-radius: 16px; background: var(--md-primary-container); color: var(--md-on-primary-container); }
.note strong { display: block; margin-bottom: 2px; color: var(--accent); }
.note code, .block p code { background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; }

/* ── Moto Camera page ───────────────────────────────── */
.mc-hero-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.mc-hero-img { width: 100%; max-width: 416px; height: auto; justify-self: end; border-radius: 18px; border: 1px solid var(--border); box-shadow: 0 18px 40px -18px rgba(0,0,0,.45); }
@media (max-width: 820px) { .mc-hero-grid { grid-template-columns: 1fr; gap: 24px; } .mc-hero-img { justify-self: start; } }
.mc-packages { display: flex; flex-wrap: wrap; gap: 8px; }
.mc-package { padding: 8px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); font-weight: 500; font-size: .92rem; }
.mc-search { width: 100%; margin: 6px 0 14px; padding: 12px 16px; font: inherit; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 12px; }
.mc-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.mc-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.mc-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.mc-table th { text-align: left; font-weight: 600; color: var(--muted); background: var(--bg-soft); padding: 10px 14px; white-space: nowrap; }
.mc-table td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.mc-table td .aka { display: block; color: var(--muted); font-size: .8rem; }
.mc-table code { white-space: nowrap; }
#mc-devices tbody tr { cursor: pointer; }
#mc-devices tbody tr:hover { background: var(--card-hover); }
#mc-devices tbody tr.selected { background: var(--accent-soft); }
.mc-scroll { max-height: 540px; overflow: auto; }
.mc-scroll thead th { position: sticky; top: 0; z-index: 1; }
.mc-selected { padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); font-weight: 500; }
.mc-steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 22px; }
.mc-steps > li { counter-increment: step; position: relative; padding-left: 46px; }
.mc-steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .9rem; background: var(--md-primary); color: var(--md-on-primary); }
.mc-steps h3 { margin: 4px 0 2px; font-size: 1.05rem; }
.mc-steps p { margin: 0; }
.mc-repo-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mc-support { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.mc-support h2 { border: 0; padding: 0; }
.mc-support p { margin: 0; }
.mc-license { padding: 16px 20px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.mc-license summary { cursor: pointer; font-weight: 600; }
.mc-license p { color: var(--muted); font-size: .92rem; }
@media (max-width: 720px) {
  .mc-support { flex-direction: column; align-items: flex-start; }
  .mc-steps > li { padding-left: 40px; }
}
@media (max-width: 720px) {
  .nav-links { gap: 2px; }
  .nav-links a { padding: 6px 6px; font-size: .84rem; white-space: nowrap; }
  .nav-links a.nav-telegram { display: none; }
  .lang-toggle, .theme-toggle { margin-left: 2px; }
}
.stats strong code { font-size: .8em; }
@media (max-width: 420px) {
  .nav-short-hide { display: none; }
  .site-header .container { width: calc(100% - 24px); }
  .nav { gap: 8px; }
  .nav-links a { padding: 6px 4px; font-size: .8rem; }
  .theme-toggle { width: 26px; height: 26px; }
  .lang-toggle span { padding: 3px 6px; }
}

/* ── Home page ──────────────────────────────────────── */
.home-hero { padding: 88px 0 64px; }
.home-hero h1 { font-size: clamp(2.6rem, 8vw, 4.2rem); margin-bottom: .25em; }
.section-title { font-size: 1.3rem; margin: 8px 0 18px; }
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.project {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  border-radius: 28px;
}
.project:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 14px 34px -18px var(--accent); text-decoration: none; }
.project h3 { font-size: 1.3rem; margin: 2px 0 0; }
.project p { color: var(--muted); margin: 0 0 8px; }
.project-kicker { color: var(--accent); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.project-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 8px; border-radius: 13px; background: var(--accent-soft); color: var(--accent); font-size: 24px; }
.project-icon-muted { background: var(--bg-soft); color: var(--text); }
.project-stats { display: flex; gap: 26px; margin: 6px 0 14px; }
.project-stats div { display: flex; flex-direction: column; }
.project-stats strong { font-size: 1.6rem; line-height: 1.1; }
.project-stats span { color: var(--muted); font-size: .85rem; }
.project-cta { margin-top: auto; color: var(--accent); font-weight: 600; }
.project-devices { grid-column: span 2; flex-direction: row; align-items: stretch; gap: 20px; padding: 0; background: linear-gradient(120deg, var(--card) 45%, var(--accent-soft)); }
.project-devices .project-body { flex: 1 1 52%; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 28px; }
.project-phones { flex: 1 1 48%; display: flex; align-items: flex-end; justify-content: center; gap: 0; padding: 28px 20px 0; }
.project-phones img { flex: 1 1 0; min-width: 0; height: 270px; object-fit: contain; object-position: bottom; filter: drop-shadow(0 12px 18px rgba(0,0,0,.35)); transition: transform .25s ease; }
.project-phones img:nth-child(2) { height: 310px; z-index: 1; }
.project-devices:hover .project-phones img { transform: translateY(-4px); }
.project-camera { background: linear-gradient(160deg, var(--card) 55%, var(--accent-soft)); }
.project-banner { width: calc(100% + 48px); max-width: none; height: auto; aspect-ratio: 416 / 235; object-fit: cover; margin: -24px -24px 12px; border-bottom: 1px solid var(--border); }
@media (max-width: 900px) {
  .projects { grid-template-columns: 1fr 1fr; }
  .project-devices { grid-column: span 2; }
}
@media (max-width: 640px) {
  .home-hero { padding: 56px 0 40px; }
  .projects { grid-template-columns: 1fr; }
  .project-devices { grid-column: auto; flex-direction: column; }
  .project-devices .project-body { padding: 24px 24px 0; }
  .project-phones { padding-top: 8px; }
  .project-phones img { height: 150px; }
  .project-phones img:nth-child(2) { height: 170px; }
}

/* ── Moto Camera link on device pages ───────────────── */
.device-mc { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); color: var(--text); transition: border-color .15s ease; }
.device-mc:hover { border-color: var(--accent); text-decoration: none; }
.device-mc .project-icon { margin: 0; flex: none; }
.device-mc-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.device-mc-body code { font-size: .85em; }
.device-mc .project-cta { margin: 0; white-space: nowrap; }
@media (max-width: 640px) { .device-mc { flex-wrap: wrap; } .device-mc .project-cta { width: 100%; } }

/* ── 404 page ───────────────────────────────────────── */
.notfound { padding: 96px 0 72px; text-align: center; background: radial-gradient(ellipse 70% 60% at 50% 0%, var(--accent-soft), transparent 70%); }
.notfound .lead { margin-inline: auto; }
.notfound .hero-actions { justify-content: center; }
.notfound-code { margin: 0; font-size: clamp(5rem, 22vw, 9rem); font-weight: 700; line-height: 1; letter-spacing: -.04em; color: var(--accent); opacity: .9; }
.mc-version-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.mc-version-pick .count { font-family: var(--mono); }

/* ── ROM card extras: files, share link, linked card ── */
.rom-files { flex-wrap: wrap; gap: 6px 14px !important; }
.rom-files a { font-family: var(--mono); font-size: .85rem; }
.rom-share { display: flex; justify-content: flex-end; padding: 0 20px 14px; }
.copy-link { font: inherit; font-size: .82rem; cursor: pointer; background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; padding: 4px 10px; }
.copy-link:hover { color: var(--text); border-color: var(--accent); }
details.rom { scroll-margin-top: 80px; }
details.rom.rom-target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); transition: box-shadow .3s ease, border-color .3s ease; }

/* ── Legal page ─────────────────────────────────────── */
.legal { padding: 32px 0 16px; }

/* ── Material You overrides (selector groups) ─────────── */
@media (min-width: 721px) { .nav-links a { padding: 8px 16px; } }
.nav-links a:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); text-decoration: none; }
.nav-links a.active, .nav-links a[aria-current] { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.lang-toggle, .theme-toggle { border: 0; background: var(--md-surface-high); border-radius: 999px; }
.nav-links a.nav-donate, .nav-links a.nav-donate:hover, .nav-links a.nav-donate.active { background: var(--md-primary); border-color: var(--md-primary); color: var(--md-on-primary); filter: none; }
.chip.active::before { content: "✓ "; }
.device-card, .rom, .project, .donate-card, .mc-support, .mc-license, .mc-package { border-color: transparent; background: var(--md-surface-c); }
.device-card .device-img { border-radius: 16px; }
.hash, pre.code, .prose pre { border: 0; background: var(--md-surface-highest); border-radius: 16px; }
