/* ============================================================
   The Codero — portfolio site stylesheet
   Plain CSS, no frameworks. Dark theme default + light theme.
   Motion kept minimal: subtle fades only, no looping animations.
   ============================================================ */

:root {
  --bg: #07070d;
  --bg-2: #0d0d18;
  --card: #12121f;
  --card-2: #171728;
  --text: #e9e9f2;
  --muted: #9c9cb4;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #7c5cff;
  --accent-2: #00d4ff;
  --grad: linear-gradient(100deg, var(--accent), var(--accent-2));
  --glow: rgba(124, 92, 255, 0.3);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

[data-theme="light"] {
  --bg: #f6f6fb;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-2: #f3f3fa;
  --text: #16161f;
  --muted: #5c5c74;
  --line: rgba(20, 20, 40, 0.10);
  --line-strong: rgba(20, 20, 40, 0.22);
  --glow: rgba(124, 92, 255, 0.18);
  --shadow: 0 10px 28px rgba(30, 20, 80, 0.10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(124, 92, 255, 0.13), transparent 60%),
    radial-gradient(700px 420px at -10% 20%, rgba(0, 212, 255, 0.09), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip; /* never scroll sideways on mobile */
}

img { max-width: 100%; height: auto; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--card-2); border: 1px solid var(--line); border-radius: 6px; padding: 0.1em 0.4em; }
pre { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1em; overflow-x: auto; }
pre code { background: none; border: none; padding: 0; }

.container { width: min(1120px, 92%); margin: 0 auto; }
.muted { color: var(--muted); }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 0.6em 1em; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------------- Header ---------------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-wrap { display: flex; align-items: center; gap: 0.9rem; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text); font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--grad); color: #fff; font-weight: 700;
}

.site-nav { display: flex; gap: 0.3rem; margin-left: auto; }
.site-nav a {
  color: var(--muted); padding: 0.45em 0.8em; border-radius: 999px;
  font-weight: 500; font-size: 0.93rem; white-space: nowrap;
  transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--text); text-decoration: none; background: var(--card-2); }
.site-nav a.active { color: var(--text); background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
.site-nav .nav-gh { color: var(--accent-2); }

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line);
}
.icon-btn:hover { border-color: var(--line-strong); }
.ic-sun { display: none; }
[data-theme="light"] .ic-sun { display: block; }
[data-theme="light"] .ic-moon { display: none; }

.nav-burger { display: none; }

/* ---------------- Buttons & chips ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0.72em 1.3em; border-radius: 12px;
  font-weight: 600; font-size: 0.95rem; cursor: pointer;
  border: 1px solid transparent; transition: border-color .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--grad); color: #fff; }
.btn-primary:hover { box-shadow: 0 6px 20px var(--glow); }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-block { width: 100%; }
.arrow { display: inline-block; }
.btn:hover .arrow { transform: translateX(2px); transition: transform .15s; }

.chip {
  display: inline-flex; align-items: center; gap: 0.35em;
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 0.3em 0.75em; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted);
  white-space: nowrap;
}
.chip:hover { text-decoration: none; color: var(--text); border-color: var(--accent); }
.chip-ai { border-color: rgba(124, 92, 255, 0.55); color: #b7a7ff; }
.chip-games { border-color: rgba(0, 212, 255, 0.55); color: #6fdcf5; }
.chip-security { border-color: rgba(255, 107, 107, 0.55); color: #ff9b9b; }
.chip-systems { border-color: rgba(80, 220, 140, 0.55); color: #7fe0aa; }
[data-theme="light"] .chip-ai { color: #5a3ce0; }
[data-theme="light"] .chip-games { color: #0088ad; }
[data-theme="light"] .chip-security { color: #c0392b; }
[data-theme="light"] .chip-systems { color: #1d8a4e; }

.tag {
  font-size: 0.72rem; color: var(--muted);
  background: var(--card-2); border: 1px solid var(--line);
  padding: 0.22em 0.7em; border-radius: 999px; white-space: nowrap;
}

/* ---------------- Source-availability badges ---------------- */

.src-badge {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em;
  border-radius: 999px; padding: 0.28em 0.75em; white-space: nowrap;
  border: 1px solid var(--line-strong); color: var(--muted);
}
.src-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.src-open { border-color: rgba(52, 211, 153, 0.55); color: #34d399; background: rgba(52, 211, 153, 0.08); }
.src-closed { border-color: rgba(248, 113, 113, 0.55); color: #f87171; background: rgba(248, 113, 113, 0.08); }
.src-personal { border-color: rgba(251, 191, 36, 0.55); color: #fbbf24; background: rgba(251, 191, 36, 0.08); }
.src-unspecified { color: var(--muted); }
[data-theme="light"] .src-open { color: #0e9f6e; }
[data-theme="light"] .src-closed { color: #d64545; }
[data-theme="light"] .src-personal { color: #b7791f; }

.src-legend {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem;
  font-size: 0.84rem; color: var(--muted); margin: 0.9rem 0 0;
}

.license-note {
  display: flex; align-items: center; gap: 1rem;
  background: color-mix(in srgb, var(--card) 85%, transparent);
  border: 1px solid var(--line-strong); border-left: 4px solid var(--accent);
  border-radius: 14px; padding: 1rem 1.3rem;
}
.license-note p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.license-note strong, .license-note em { color: var(--text); }
.ln-icon { font-size: 1.4rem; flex: none; }

.license-prompt {
  margin-top: 1rem; padding: 1rem 1.2rem;
  border-left: 4px solid #fbbf24; font-size: 0.9rem;
}
.license-prompt strong { display: block; margin-bottom: 0.35rem; }
.license-prompt p { margin: 0; color: var(--muted); }
.license-prompt a { font-weight: 600; }

/* ---------------- Live-data pill ---------------- */

.live-pill {
  display: inline-flex; align-items: center; gap: 0.45em;
  font-size: 0.74rem; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.32em 0.9em; white-space: nowrap;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.live-dot.ok { background: #34d399; }
.live-dot.warn { background: #fbbf24; }
.side-card .live-pill { margin: 0 0 0.9rem; }

/* ---------------- Hero ---------------- */

.hero { position: relative; overflow: hidden; padding: clamp(2.6rem, 6vw, 4.5rem) 0 3rem; }

.hero-grid {
  position: relative; display: grid; gap: 2.6rem;
  grid-template-columns: 1.25fr 0.75fr; align-items: center;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.55em;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.45em 1em; background: color-mix(in srgb, var(--card) 70%, transparent);
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); flex: none; }

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4rem);
  margin: 0.9rem 0 0.6rem; letter-spacing: -0.02em;
}
.hero-sub { font-size: 1.1rem; color: var(--muted); max-width: 34em; margin-bottom: 1.6rem; }
.hero-sub a { color: var(--text); font-weight: 600; border-bottom: 1px dashed var(--line-strong); }
.hero-sub a:hover { border-bottom-color: var(--accent-2); text-decoration: none; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 2rem; }

.hero-stats {
  display: grid; grid-template-columns: repeat(4, auto);
  justify-content: start; gap: 1.2rem 2.4rem; margin: 0;
}
.stat-num { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--text); margin: 0; }
.stat-label { font-size: 0.8rem; color: var(--muted); margin: 0; }

.hero-card {
  position: relative;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 2rem;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.9rem;
}
.hero-card-body strong { font-family: var(--font-display); font-size: 1.22rem; display: block; }
.hero-card-body code { display: inline-block; margin-top: 0.4rem; }
.hero-site { font-size: 0.86rem; font-weight: 600; }

.avatar-ring { position: relative; width: 128px; height: 128px; border-radius: 50%; padding: 4px; background: var(--grad); flex: none; }
.avatar-ring img { width: 100%; height: 100%; border-radius: 50%; display: block; object-fit: cover; }
.avatar-ring.big { width: 152px; height: 152px; }
.avatar-fallback {
  position: absolute; inset: 0; display: none; place-items: center;
  background: var(--card-2); border-radius: 50%;
  font-family: var(--font-display); font-size: 3rem; font-weight: 700; color: var(--muted);
}
.avatar-ring.no-img .avatar-fallback { display: grid; }

/* ---------------- Sections & cards ---------------- */

.section { padding: 2.4rem 0; }
.section-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem 1rem;
  margin-bottom: 1.4rem;
}
.section-head h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); margin: 0; margin-right: auto; }
.see-all { font-weight: 600; font-size: 0.92rem; white-space: nowrap; }

.grid { display: grid; gap: 1.1rem; }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.3rem;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }

.project-card { display: flex; flex-direction: column; gap: 0.65rem; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.card-top-right { display: inline-flex; align-items: center; gap: 0.45rem; min-width: 0; }
.badge-new {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em;
  background: var(--grad); color: #fff;
  border-radius: 999px; padding: 0.25em 0.7em;
}
.card-date { font-size: 0.76rem; color: var(--muted); white-space: nowrap; }
.card-title { margin: 0; font-size: 1.16rem; overflow-wrap: anywhere; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent-2); text-decoration: none; }
.card-blurb { color: var(--muted); font-size: 0.92rem; margin: 0; flex-grow: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.card-foot {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.5rem 0.8rem;
  border-top: 1px solid var(--line); padding-top: 0.8rem; margin-top: 0.3rem;
}
.meta-lang { display: inline-flex; align-items: center; gap: 0.45em; font-size: 0.84rem; color: var(--muted); min-width: 0; }
.foot-links { display: flex; gap: 0.9rem; margin-left: auto; }
.foot-links a { font-size: 0.84rem; font-weight: 600; white-space: nowrap; }

.lang-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.cat-card { display: flex; flex-direction: column; gap: 0.3rem; color: var(--text); }
.cat-card:hover { text-decoration: none; border-color: var(--accent); }
.cat-card p { color: var(--muted); font-size: 0.88rem; margin: 0; flex-grow: 1; }
.cat-icon { font-size: 1.8rem; line-height: 1; }
.cat-count { font-weight: 600; font-size: 0.85rem; color: var(--accent-2); }

/* ---------------- CTA band ---------------- */

.cta-band {
  display: flex; align-items: center; justify-content: space-between; gap: 1.4rem; flex-wrap: wrap;
  background: linear-gradient(120deg, rgba(124, 92, 255, 0.14), rgba(0, 212, 255, 0.09));
  border: 1px solid var(--line-strong); border-radius: 20px;
  padding: 1.8rem 2rem;
}
.cta-band h2 { margin-bottom: 0.3rem; }
.cta-band p { margin: 0; color: var(--muted); }

/* ---------------- Page head ---------------- */

.page-head { padding: 2.8rem 0 1.6rem; }
.page-head h1 { font-size: clamp(2rem, 5vw, 2.9rem); margin: 1rem 0 0.4rem; letter-spacing: -0.02em; }
.page-sub { color: var(--muted); font-size: 1.05rem; max-width: 40em; }

/* ---------------- Projects page ---------------- */

.toolbar-zone { margin-bottom: 1.6rem; }
.toolbar { display: flex; gap: 0.9rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }

.search-box {
  display: flex; align-items: center; gap: 0.6rem; flex: 1 1 240px; min-width: 0;
  background: var(--card); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 0.65em 1em; color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18); }
.search-box input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--text); font: inherit; font-size: 0.95rem;
}
.search-box input::placeholder { color: var(--muted); }

.sort-box { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; }
.sort-box select {
  background: var(--card); color: var(--text); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 0.6em 0.9em; font: inherit; font-size: 0.9rem; cursor: pointer;
}

.chips-row { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.chip-filter {
  display: inline-flex; align-items: center; gap: 0.4em;
  background: var(--card); color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 0.5em 1.05em; font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  white-space: nowrap;
}
.chip-filter:hover { color: var(--text); border-color: var(--accent); }
.chip-filter.active { background: var(--grad); color: #fff; border-color: transparent; }
.chip-count { opacity: 0.75; font-weight: 500; }

.result-count { font-size: 0.85rem; color: var(--muted); margin: 0.9rem 0 0; }

.empty-state { text-align: center; padding: 3.5rem 1rem; color: var(--muted); }
.empty-emoji { font-size: 2.2rem; display: block; margin-bottom: 0.6rem; }

.noscript-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.noscript-list ul { padding-left: 1.2rem; }

/* ---------------- Project detail ---------------- */

.crumbs { padding-top: 1.5rem; font-size: 0.87rem; color: var(--muted); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.crumb-sep { opacity: 0.5; }

.project-hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; padding: 1.7rem 0 0.5rem; align-items: start; }
.ph-main { min-width: 0; }
.ph-main h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); margin: 0.9rem 0 0.5rem; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.lead { font-size: 1.12rem; color: var(--text); max-width: 36em; }
.ph-desc { max-width: 44em; }
.meta-row { color: var(--muted); font-size: 0.92rem; display: flex; flex-wrap: wrap; gap: 0.4em 0.6em; align-items: center; margin-bottom: 0; }
.meta-row strong { color: var(--text); font-weight: 600; }
.dot-sep { opacity: 0.45; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 1rem 0 1.4rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.8rem; }

.ph-side { position: sticky; top: 88px; min-width: 0; }
.side-card h3 { font-size: 1rem; margin-bottom: 0.9rem; }
.facts { margin: 0 0 1rem; display: flex; flex-direction: column; gap: 0.55rem; }
.facts div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; border-bottom: 1px dashed var(--line); padding-bottom: 0.5rem; }
.facts dt { color: var(--muted); font-size: 0.88rem; flex: none; }
.facts dd { margin: 0; font-weight: 600; font-size: 0.9rem; text-align: right; overflow-wrap: anywhere; }

.readme-card { padding: 1.7rem; overflow-wrap: break-word; }
.readme-card h1, .readme-card h2, .readme-card h3 { margin-top: 1.4em; }
.readme-card > :first-child { margin-top: 0; }
.readme-card img { border-radius: 10px; }
.readme-card ul, .readme-card ol { padding-left: 1.4rem; }
.readme-card li { margin: 0.3em 0; }

.pager { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0 2rem; }
.pager-link {
  display: flex; flex-direction: column; gap: 0.15rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.8rem 1.2rem; color: var(--text); min-width: 0; flex: 1; max-width: 46%;
  transition: border-color .15s;
}
.pager-link:hover { text-decoration: none; border-color: var(--accent); }
.pager-link strong { font-family: var(--font-display); overflow-wrap: anywhere; }
.pager-link.right { text-align: right; align-items: flex-end; }

/* ---------------- Contact ---------------- */

.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; padding-bottom: 1rem; }
.contact-card { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; }
.contact-card .avatar-ring { width: 88px; height: 88px; }
.contact-card h2 { font-size: 1.22rem; margin: 0.4rem 0 0; }
.contact-card p { font-size: 0.93rem; }
.contact-card .btn, .contact-card select { margin-top: 0.4rem; }
.contact-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.contact-links a { color: var(--text); font-weight: 500; }
.contact-links a:hover { color: var(--accent-2); }
.issue-label { font-size: 0.85rem; font-weight: 600; margin-top: 0.6rem; }
.contact-card select {
  width: 100%; background: var(--card-2); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 0.6em 0.8em; font: inherit; font-size: 0.92rem;
}

/* ---------------- Redirect stub ---------------- */

.redirect-stub { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 2rem; }
.redirect-card {
  max-width: 420px; width: 100%; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 2.2rem 1.8rem;
}
.redirect-card .brand-mark { width: 44px; height: 44px; font-size: 1.25rem; border-radius: 12px; }
.redirect-card h1 { margin: 0.6rem 0 0.2rem; }
.redirect-card p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.redirect-card .btn { margin: 1.1rem 0 0.4rem; }
.redirect-note { font-size: 0.85rem; }

/* ---------------- 404 page ---------------- */

.error-hero { position: relative; overflow: hidden; padding: 4rem 0 2.6rem; text-align: center; }
.error-hero .eyebrow { margin-bottom: 1.1rem; }
.error-code {
  display: inline-block;
  font-size: clamp(5.4rem, 20vw, 10.5rem); line-height: 0.95; margin: 0;
  letter-spacing: -0.04em;
}
.error-title { font-size: clamp(1.35rem, 3.4vw, 1.9rem); margin: 0.8rem 0 0.4rem; }
.error-sub { color: var(--muted); max-width: 34em; margin: 0 auto 1.8rem; }
.error-form { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; max-width: 560px; margin: 0 auto 1.2rem; }
.error-box { flex: 1 1 220px; min-width: 0; background: var(--bg-2); }
.error-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; margin-bottom: 2.6rem; }
.error-suggest h3 { font-size: 1.05rem; margin-bottom: 1rem; }
.error-suggest .project-card { text-align: left; }

/* ---------------- Footer ---------------- */

.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; background: color-mix(in srgb, var(--bg-2) 60%, transparent); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1.4fr 1fr; gap: 2rem; padding: 2.4rem 0 1.6rem; }
.f-col h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.9rem; }
.f-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.f-col a { color: var(--text); font-size: 0.92rem; opacity: 0.85; overflow-wrap: anywhere; }
.f-col a:hover { opacity: 1; color: var(--accent-2); }
.f-brand p { color: var(--muted); font-size: 0.92rem; max-width: 30em; }
.f-credit { font-size: 0.92rem; }
.f-credit a, .footer-bottom a { color: var(--accent-2); font-weight: 600; }
.f-note { font-size: 0.8rem; opacity: 0.75; }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem 1.2rem;
  border-top: 1px solid var(--line); padding: 1.1rem 0 1.4rem;
  font-size: 0.82rem; color: var(--muted);
}

/* ---------------- Reveal (subtle fade only) ---------------- */

.reveal { opacity: 0; transition: opacity .4s ease; }
.reveal.in { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------------- Responsive: tablet ---------------- */

@media (max-width: 960px) {
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-side { width: 100%; max-width: 400px; margin: 0 auto; }
  .project-hero { grid-template-columns: 1fr; gap: 1.6rem; }
  .ph-side { position: static; width: 100%; max-width: 440px; }
  .contact-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .f-brand { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .site-nav a { padding: 0.4em 0.6em; font-size: 0.88rem; }
  .site-nav .nav-gh { display: none; } /* GitHub stays in footer + drawer */
  .hero-stats { gap: 1rem 1.8rem; }
}

/* ---------------- Responsive: mobile ---------------- */

@media (max-width: 640px) {
  .container { width: 90%; }

  /* header collapses into drawer */
  .nav-burger { display: inline-grid; }
  .site-nav {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0.15rem;
    background: var(--bg-2); border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.35);
    padding: 0.7rem 4% 1rem; margin: 0;
    display: none;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 0.75em 1em; font-size: 1rem; border-radius: 10px; }
  .site-nav .nav-gh { display: block; }

  /* grids single-column */
  .cards-3, .cards-4, .contact-grid { grid-template-columns: 1fr; }

  /* hero */
  .hero { padding: 2.2rem 0 2.4rem; }
  .hero-stats { grid-template-columns: repeat(2, auto); gap: 1.1rem 2rem; }
  .stat-num { font-size: 1.5rem; }
  .hero-card { padding: 1.6rem 1.2rem; }
  .avatar-ring { width: 108px; height: 108px; }
  .hero-cta .btn { flex: 1 1 auto; }

  /* toolbar: search full-width, chips swipeable */
  .toolbar { flex-direction: column; align-items: stretch; }
  .sort-box { justify-content: space-between; }
  .search-box input, .sort-box select, .contact-card select { font-size: 16px; } /* no iOS zoom */
  .chips-row {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 0.4rem; margin: 0 -4%; padding-left: 4%; padding-right: 4%;
    scrollbar-width: none;
  }
  .chips-row::-webkit-scrollbar { display: none; }
  .chip-filter { flex: none; }

  /* sections & bands */
  .section { padding: 1.9rem 0; }
  .page-head { padding: 2.2rem 0 1.3rem; }
  .license-note { align-items: flex-start; padding: 0.95rem 1rem; }
  .cta-band { flex-direction: column; align-items: flex-start; padding: 1.4rem; }
  .cta-band .btn { width: 100%; }

  /* detail page */
  .ph-side { max-width: none; }
  .facts div { gap: 0.8rem; }
  .readme-card { padding: 1.2rem; }
  .pager { flex-direction: column; }
  .pager-link { max-width: none; }
  .pager-link.right { align-items: flex-start; text-align: left; }

  /* 404 */
  .error-hero { padding: 3rem 0 2rem; }
  .error-form { flex-direction: column; }
  .error-form .btn { width: 100%; }

  /* footer */
  .footer-grid { grid-template-columns: 1fr; gap: 1.4rem; }
  .footer-bottom { flex-direction: column; }
}

/* ---------------- About page ---------------- */

.btn-col { display: flex; flex-direction: column; gap: 0.6rem; width: 100%; margin-top: 1rem; }
.lic-table { display: flex; flex-direction: column; gap: 0.7rem; padding: 1.1rem 1.3rem; margin-top: 1rem; }
.lic-row {
  display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  border-bottom: 1px dashed var(--line); padding-bottom: 0.6rem;
}
.lic-row:last-child { border-bottom: none; padding-bottom: 0; }
.lic-row .muted { font-size: 0.86rem; flex: 1 1 auto; }
.lic-row strong { font-family: var(--font-display); font-size: 1.1rem; margin-left: auto; }


/* ---------------- Support & ad pages ---------------- */

.support-grid .support-card { text-align: center; align-items: center; display: flex; flex-direction: column; gap: 0.5rem; }
.support-card p { flex-grow: 1; }
.support-emoji { font-size: 2.2rem; line-height: 1; }
.ad-note { font-size: 0.84rem; margin-top: 0.9rem; }
.h1-emoji { font-size: 0.7em; }

.ad-zone { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.ad-unit { display: flex; flex-direction: column; gap: 0.8rem; min-height: 240px; }
.ad-chrome { display: flex; align-items: center; gap: 0.5rem; }
.ad-tag {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--grad); color: #fff; border-radius: 999px; padding: 0.25em 0.75em;
}
.ad-slug { font-size: 0.72rem; color: var(--muted); margin-left: auto; }
.ad-refresh {
  border: 1px solid var(--line-strong); background: var(--card-2); color: var(--text);
  border-radius: 8px; width: 28px; height: 28px; cursor: pointer; font-size: 0.9rem; line-height: 1;
}
.ad-refresh:hover { border-color: var(--accent); }
.ad-creative { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.45rem; flex-grow: 1; justify-content: center; }
.ad-emoji { font-size: 2.6rem; line-height: 1; }
.ad-title { margin: 0.2rem 0 0; font-size: 1.3rem; }
.ad-blurb { color: var(--muted); font-size: 0.92rem; margin: 0; max-width: 30em; }
.ad-cta { margin-top: 0.7rem; }
