/* ==========================================================================
   OSS Tracker — warm editorial palette (pairs with asifad.github.io)
   Theme: data-theme="dark" | "light" on <html>
   ========================================================================== */

/* ── Dark (default) ── */
:root,
[data-theme="dark"] {
  --bg: #15130f;
  --bg-subtle: #1c1a15;
  --bg-panel: rgba(255, 248, 232, 0.04);
  --border: rgba(235, 230, 220, 0.10);
  --border-strong: rgba(235, 230, 220, 0.18);
  --text: #ebe6dc;
  --text-muted: #8a8579;
  --text-dim: #5c594f;
  --accent: #f97316;
  --accent-hover: #fb923c;
  --accent-soft: rgba(249, 115, 22, 0.14);
  --accent-text: #15130f;
  --success: #6b9e78;
  --success-soft: rgba(107, 158, 120, 0.14);
  --warn: #d4a054;
  --warn-soft: rgba(212, 160, 84, 0.14);
  --neutral-soft: rgba(138, 133, 121, 0.12);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 40px -16px rgba(0, 0, 0, 0.55);
  --hero-texture: radial-gradient(ellipse 70% 50% at 80% 20%, rgba(249, 115, 22, 0.06) 0%, transparent 60%),
                  radial-gradient(ellipse 50% 40% at 10% 80%, rgba(107, 158, 120, 0.04) 0%, transparent 50%);
  --meta-theme: #15130f;
}

/* ── Light ── */
[data-theme="light"] {
  --bg: #faf7f2;
  --bg-subtle: #f0ebe2;
  --bg-panel: rgba(26, 24, 22, 0.025);
  --border: rgba(26, 24, 22, 0.10);
  --border-strong: rgba(26, 24, 22, 0.16);
  --text: #1a1816;
  --text-muted: #6b6661;
  --text-dim: #a09a90;
  --accent: #c2410c;
  --accent-hover: #ea580c;
  --accent-soft: rgba(194, 65, 12, 0.10);
  --accent-text: #faf7f2;
  --success: #3d7a52;
  --success-soft: rgba(61, 122, 82, 0.10);
  --warn: #b8860b;
  --warn-soft: rgba(184, 134, 11, 0.10);
  --neutral-soft: rgba(107, 102, 97, 0.08);
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.02) inset, 0 12px 40px -20px rgba(0, 0, 0, 0.12);
  --hero-texture: radial-gradient(ellipse 70% 50% at 80% 20%, rgba(194, 65, 12, 0.05) 0%, transparent 60%),
                  radial-gradient(ellipse 50% 40% at 10% 80%, rgba(61, 122, 82, 0.04) 0%, transparent 50%);
  --meta-theme: #faf7f2;
}

/* ── Shared tokens ── */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 12px;
  --radius-lg: 16px;
  --nav-height: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-theme: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
}

html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: var(--transition-theme);
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }

.container {
  width: min(1080px, 92vw);
  margin: 0 auto;
}

/* ── Loader ── */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-ring {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loader-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Navigation ── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0.75rem 1rem 0;
}

.nav-shell {
  max-width: 1080px;
  margin: 0 auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  transition: var(--transition-theme);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 0.5rem 0.4rem 1rem;
  min-height: var(--nav-height);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.logo-muted {
  color: var(--text-muted);
  font-weight: 500;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  justify-content: center;
}

.nav-links a {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-panel);
}

.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.nav-chip {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
  white-space: nowrap;
}

.nav-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.nav-chip-muted {
  color: var(--text-muted);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  transition: transform 0.25s, opacity 0.25s;
}

/* ── Hero ── */
.hero {
  padding: calc(var(--nav-height) + 3rem) 0 3rem;
  background: var(--hero-texture);
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 3rem;
  align-items: start;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.hero-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--text-muted);
}

.hero-lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 520px;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.hero-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.hero-meta a {
  color: var(--accent);
  font-weight: 500;
}

.hero-meta a:hover { text-decoration: underline; }

.hero-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: var(--transition-theme);
}

.panel-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.85rem;
}

.quick-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.quick-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
}

.quick-nav a span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  min-width: 1.25rem;
}

.quick-nav a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--bg-panel);
}

/* ── Stats ── */
.stats-section {
  padding: 2.5rem 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem;
  text-align: center;
  transition: var(--transition-theme);
}

.stat-card:hover {
  border-color: var(--border-strong);
}

.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Sections ── */
.section {
  padding: 4.5rem 0;
}

.section-alt {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: var(--transition-theme);
}

.section-header {
  margin-bottom: 2.5rem;
  max-width: 560px;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.975rem;
  line-height: 1.65;
}

/* ── Contributions ── */
.contributions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.contrib-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: border-color 0.25s, transform 0.25s var(--ease), var(--transition-theme);
}

.contrib-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.contrib-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.contrib-tech {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.contrib-status {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contrib-status.open {
  background: var(--success-soft);
  color: var(--success);
}

.contrib-status.investigating,
.contrib-status.in-progress {
  background: var(--warn-soft);
  color: var(--warn);
}

.contrib-status.merged {
  background: var(--success-soft);
  color: var(--success);
  opacity: 0.85;
}

.contrib-status.closed {
  background: var(--neutral-soft);
  color: var(--text-dim);
}

.contrib-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.contrib-module {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.contrib-summary {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.contrib-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.15rem;
}

.contrib-tag {
  padding: 0.25rem 0.55rem;
  background: var(--neutral-soft);
  border-radius: 6px;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.contrib-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.contrib-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
}

.contrib-link:hover { text-decoration: underline; }

/* ── Roadmap ── */
.filter-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.45rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.roadmap-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color 0.25s, transform 0.25s var(--ease), var(--transition-theme);
}

.roadmap-card.hidden-filter { display: none; }

.roadmap-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.roadmap-card-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.roadmap-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.roadmap-label {
  font-size: 1rem;
  font-weight: 600;
}

.roadmap-status {
  margin-left: auto;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.roadmap-status.active {
  background: var(--success-soft);
  color: var(--success);
}

.roadmap-status.planned {
  background: var(--warn-soft);
  color: var(--warn);
}

.roadmap-status.placeholder {
  background: var(--neutral-soft);
  color: var(--text-dim);
}

.roadmap-next {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.roadmap-next strong {
  color: var(--text-dim);
  font-weight: 500;
}

.roadmap-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.roadmap-prs { font-family: var(--font-mono); }

.roadmap-docs-link {
  color: var(--accent);
  font-weight: 500;
}

.roadmap-docs-link:hover { text-decoration: underline; }

/* ── Timeline ── */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  max-width: 640px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--border-strong);
}

.timeline-item {
  position: relative;
  padding: 0 0 2rem 1.5rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.45rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  transform: translateX(-4px);
}

.timeline-item.type-pr::before { border-color: var(--success); }
.timeline-item.type-planned::before {
  border-color: var(--warn);
  border-style: dashed;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.timeline-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.timeline-desc {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.timeline-link {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
}

.timeline-link:hover { text-decoration: underline; }

/* ── CTA ── */
.cta-section { padding-bottom: 3.5rem; }

.cta-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition-theme);
}

.cta-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.cta-card p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 1.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.cta-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  transition: var(--transition-theme);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.footer-brand {
  font-weight: 500;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--accent); }

.footer-copy {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ── Reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero-aside { order: -1; }

  .hero-panel { max-width: 100%; }

  .quick-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .quick-nav a {
    flex: 1;
    min-width: fit-content;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: calc(var(--nav-height) + 1.25rem);
    left: 1rem;
    right: 1rem;
    flex-direction: column;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    box-shadow: var(--shadow);
    transform: translateY(-130%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s var(--ease), opacity 0.3s;
    z-index: 999;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-links a {
    width: 100%;
    text-align: center;
    padding: 0.65rem;
  }

  .nav-chip-muted { display: none; }

  .nav-toggle { display: flex; }

  .nav-toggle.open span:first-child {
    transform: rotate(45deg) translate(2px, 2px);
  }

  .nav-toggle.open span:last-child {
    transform: rotate(-45deg) translate(2px, -2px);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .nav-actions .nav-chip:first-of-type { display: none; }

  .hero-actions {
    flex-direction: column;
  }

  .btn { width: 100%; }
}

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

  .reveal, .timeline-item {
    opacity: 1;
    transform: none;
  }

  html { scroll-behavior: auto; }
}
