/* ============================================================
   Demon of Fire – Portfolio Website
   styles.css (Enhanced & Polished)
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
  --color-bg:           #0a0a0d;
  --color-surface:      #131318;
  --color-surface-2:    #1b1b22;
  --color-surface-hover:#22222c;
  --color-border:       #262633;
  --color-border-hover: #e05c2a;
  --color-accent:       #e05c2a;
  --color-accent-hover: #f07040;
  --color-accent-glow:  rgba(224, 92, 42, 0.25);
  --color-text:         #ececf2;
  --color-text-muted:   #9ca3af;
  --color-text-subtle:  #6b7280;
  --color-link:         #e05c2a;
  --color-link-hover:   #f07040;
  --color-focus:        #f07040;
  --color-focus-outer:  #ffffff;

  --font-sans:   'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:   'Cascadia Code', 'Fira Code', 'Consolas', monospace;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-nav:  0 2px 12px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px var(--color-accent-glow);

  --transition:  220ms cubic-bezier(0.4, 0, 0.2, 1);

  --nav-height:  68px;
  --content-max: 1120px;
  --gap:         2rem;
}

/* ── High Contrast Theme (WCAG AAA) ── */
[data-theme="high-contrast"] {
  --color-bg:           #000000;
  --color-surface:      #050505;
  --color-surface-2:    #121212;
  --color-surface-hover:#222222;
  --color-border:       #ffffff;
  --color-border-hover: #ffff00;
  --color-accent:       #ffff00;
  --color-accent-hover: #ffff55;
  --color-accent-glow:  rgba(255, 255, 0, 0.4);
  --color-text:         #ffffff;
  --color-text-muted:   #ffffcc;
  --color-text-subtle:  #ffffff;
  --color-link:         #ffff00;
  --color-link-hover:   #ffffff;
  --color-focus:        #ffff00;
  --color-focus-outer:  #ffffff;
  --shadow-card:        0 0 0 2px #ffffff;
  --shadow-nav:         0 0 0 2px #ffffff;
}

[data-theme="high-contrast"] .btn-primary {
  background: #ffff00;
  color: #000000;
  font-weight: 800;
  border-color: #ffff00;
}
[data-theme="high-contrast"] .btn-primary:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}
[data-theme="high-contrast"] .btn-ghost {
  background: #000000;
  color: #ffffff;
  border-color: #ffffff;
}
[data-theme="high-contrast"] .card-badge.available::before {
  background: #00ff66;
  box-shadow: 0 0 0 2px #000;
}

/* ── Dyslexia Friendly Font ── */
[data-font="dyslexic"] {
  --font-sans: 'OpenDyslexic', 'Comic Sans MS', -apple-system, sans-serif;
  letter-spacing: 0.04em;
  word-spacing: 0.08em;
  line-height: 1.85;
}

/* ── Reduced Motion Mode ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

[data-motion="reduced"] *, 
[data-motion="reduced"] *::before, 
[data-motion="reduced"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* ── Light Theme ── */
[data-theme="light"] {
  --color-bg:           #f7f5f2;
  --color-surface:      #ffffff;
  --color-surface-2:    #efebe4;
  --color-border:       #d9d3c9;
  --color-text:         #1c1c22;
  --color-text-muted:   #4a4a55;
  --color-text-subtle:  #71717b;
  --color-link:         #a1350f;
  --color-link-hover:   #b8441a;
  --color-focus:        #b8441a;
  --shadow-card: 0 2px 12px rgba(60, 50, 40, 0.12);
  --shadow-nav:  0 1px 8px rgba(60, 50, 40, 0.1);
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: #0f1015;
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Reduced Motion (accessibility) ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Skip Link (accessibility) ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  z-index: 9999;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid var(--color-focus);
}

/* Visually hidden but available to screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ── Focus Visible ── */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}

/* ── Links ── */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover {
  color: var(--color-link-hover);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
  color: #ffffff;
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.75rem); }
h3 { font-size: clamp(1.05rem, 1.8vw, 1.25rem); }

p {
  color: var(--color-text-muted);
  max-width: 72ch;
}

/* ── Layout Utilities ── */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

main {
  flex: 1;
  padding-block: 2rem 4rem;
}

/* ── Navigation Bar ── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-nav .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Brand */
.nav-brand {
  text-decoration: none;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.nav-brand:hover {
  color: var(--color-accent);
}

/* Hamburger Button */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Theme Toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-text-subtle);
  background: var(--color-surface-2);
}
.theme-toggle svg {
  width: 16px;
  height: 16px;
  display: none;
}
.theme-toggle .icon-moon {
  display: block;
}
[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}
[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

/* Nav Links */
.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0.25rem;
}

.nav-links a {
  display: block;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.92rem;
}
.nav-links a:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}
.nav-links a[aria-current="page"] {
  color: #fff;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}

/* Mobile Navigation */
@media (max-width: 640px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem 1rem;
    gap: 0.25rem;
    clip-path: inset(0 0 100% 0);
    opacity: 0;
    pointer-events: none;
  }

  .nav-links.is-open {
    clip-path: inset(0 0 0% 0);
    opacity: 1;
    pointer-events: auto;
  }
}

/* ── Hero ── */
.hero {
  padding: 4.5rem 0 3.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
}

.hero .label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-link);
  margin-bottom: 0.75rem;
}

.hero h1 {
  margin-bottom: 1rem;
  color: var(--color-text);
  max-width: 14ch;
}

.hero p {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.hero-proof {
  margin: 1.3rem 0 0 !important;
  font-size: 0.83rem !important;
  font-weight: 650;
  color: var(--color-text-muted) !important;
}
.hero-proof span { color: var(--color-accent); font-weight: 900; }
.hero-art { position: relative; min-height: 280px; display: grid; place-items: center; }
.hero-orb { position: absolute; width: 230px; height: 230px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(240,112,64,.42), rgba(224,92,42,.12) 42%, transparent 70%); filter: blur(2px); }
.hero-window { width: min(100%, 350px); position: relative; overflow: hidden; padding: 1rem 1.15rem 1.2rem; border: 1px solid rgba(224,92,42,.55); border-radius: var(--radius-lg); background: linear-gradient(145deg, rgba(31,30,37,.94), rgba(14,14,18,.94)); box-shadow: 0 18px 50px rgba(0,0,0,.42), var(--shadow-glow); transform: rotate(3deg); }
.hero-window-bar { display: flex; gap: .35rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--color-border); }
.hero-window-bar span { width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-subtle); }
.hero-window-bar span:first-child { background: var(--color-accent); }
.hero-wave { height: 98px; display: flex; align-items: center; justify-content: center; gap: 7px; }
.hero-wave i { width: 5px; border-radius: 999px; background: var(--color-accent); box-shadow: 0 0 14px var(--color-accent-glow); }
.hero-wave i:nth-child(1), .hero-wave i:nth-child(9) { height: 20px; }.hero-wave i:nth-child(2), .hero-wave i:nth-child(8) { height: 40px; }.hero-wave i:nth-child(3), .hero-wave i:nth-child(7) { height: 63px; }.hero-wave i:nth-child(4), .hero-wave i:nth-child(6) { height: 42px; }.hero-wave i:nth-child(5) { height: 82px; }
.hero-window p { font: 700 .68rem/1 var(--font-mono); letter-spacing: .1em; color: var(--color-text-muted); text-align: center; margin: 0 0 1rem; }
.hero-lines { display: grid; gap: .4rem; }.hero-lines span { display: block; height: 7px; border-radius: 99px; background: var(--color-surface-2); }.hero-lines span:nth-child(2) { width: 78%; }.hero-lines span:nth-child(3) { width: 55%; }

/* ── Stats Bar ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 4rem;
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #fff;
}

.btn-ghost {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-ghost:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-text-subtle);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
}

/* ── Section Dividers ── */
.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  margin-bottom: 1.5rem;
  margin-top: 2.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

/* ── Cards & Grid ── */
.card-grid, .featured-grid, .nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--gap);
}

.project-preview { height: 112px; margin: -1.5rem -1.5rem 1.25rem; border-bottom: 1px solid var(--color-border); overflow: hidden; position: relative; background: #111116; }
.preview-overlay { padding: 1.1rem; display: grid; grid-template-columns: 42px 1fr; grid-template-rows: repeat(3, 1fr); gap: .5rem; background: linear-gradient(135deg, #15151d, #26202b); }
.preview-overlay span { grid-row: span 3; display: grid; place-items: center; background: var(--color-accent); color: #fff; font: 800 1rem var(--font-mono); }.preview-overlay div { border-radius: 3px; background: linear-gradient(90deg, rgba(255,255,255,.22), rgba(255,255,255,.06)); }.preview-overlay div:last-child { width: 65%; }
.preview-recorder { display: grid; place-items: center; background: radial-gradient(circle at 50% 120%, rgba(224,92,42,.45), transparent 50%), #111217; }.preview-recorder > span { position: absolute; top: .8rem; left: 1rem; font: 800 .7rem var(--font-mono); letter-spacing: .08em; color: #ff7b4b; }.preview-bars { display: flex; align-items: center; gap: 5px; height: 56px; }.preview-bars i { width: 6px; border-radius: 9px; background: var(--color-accent); }.preview-bars i:nth-child(1),.preview-bars i:nth-child(7){height:22px}.preview-bars i:nth-child(2),.preview-bars i:nth-child(6){height:38px}.preview-bars i:nth-child(3),.preview-bars i:nth-child(5){height:52px}.preview-bars i:nth-child(4){height:30px}
.preview-nova { display: grid; place-items: center; background: radial-gradient(circle, rgba(108,99,255,.55), transparent 28%), linear-gradient(130deg,#15152a,#0e0e16); }.preview-nova span,.preview-nova i { position: absolute; border-radius: 50%; border: 1px solid rgba(180,176,255,.55); }.preview-nova span{width:72px;height:72px}.preview-nova i{width:44px;height:44px}.preview-nova b { position: absolute; bottom: .9rem; font: 700 .65rem var(--font-mono); letter-spacing:.2em; color:#d5d3ff; }
.download-note { margin: .9rem 0 0; color: var(--color-text-subtle); font-size: .75rem; }.download-note span { color: var(--color-accent); font-weight: 800; }
.section-action { margin: 1.5rem 0 0; font-weight: 700; }.section-action a { text-decoration: none; }.section-action a:hover { text-decoration: underline; }
.trust-section { border-block: 1px solid var(--color-border); padding-block: 2.5rem; }.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }.trust-grid > div { padding-left: 1rem; border-left: 2px solid var(--color-accent); }.trust-grid strong { font-size: 1rem; }.trust-grid p { margin: .35rem 0 0; font-size: .9rem; color: var(--color-text-muted); }

.card, .nav-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.card[data-href] {
  cursor: pointer;
}

.card:hover, .nav-card:hover {
  border-color: var(--color-border-hover);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
}

.card-title-group {
  flex: 1;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.card-title a {
  color: var(--color-text);
  text-decoration: none;
}
.card-title a:hover {
  color: var(--color-accent);
}

.card-platform {
  font-size: 0.76rem;
  color: var(--color-text-subtle);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card-description {
  font-size: 0.92rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  flex: 1;
  max-width: none;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: auto;
  padding-top: 0.6rem;
}

/* ── Badges ── */
.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted);
}
.card-badge.available::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ec46d;
  box-shadow: 0 0 8px rgba(62, 196, 109, 0.6);
}

/* ── Nav Cards (Home) ── */
.nav-card {
  text-decoration: none;
  color: inherit;
}
.nav-card-icon {
  font-size: 2rem;
  line-height: 1;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}
.nav-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
}
.nav-card-desc {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ── About & Skills Sections ── */
.about-section, .credits-section {
  margin-top: 2rem;
}

.about-content, .credits-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.about-content p, .credits-content > p {
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
  max-width: none;
}

/* ── Credits Grid ── */
.credits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.credit-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.credit-card h3 {
  font-size: 1.1rem;
  color: var(--color-text);
}

.credit-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.credit-link {
  margin-top: auto;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
}
.credit-link:hover {
  text-decoration: underline;
}

/* ── Project Detail Pages ── */
.project-hero {
  padding-block: 2.5rem 2rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2.5rem;
}

.project-hero .card-platform {
  font-size: 0.85rem;
}

.project-hero p {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 65ch;
  margin-top: 0.75rem;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-decoration: none;
  margin-bottom: 1.5rem;
}
.back-link:hover {
  color: var(--color-text);
}
.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.5rem;
}
.meta-badge {
  padding: 0.35rem 0.85rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.project-body {
  display: grid;
  grid-template-columns: 1fr min(300px, 35%);
  gap: 3rem;
  align-items: start;
}
@media (max-width: 768px) {
  .project-body { grid-template-columns: 1fr; }
}

.project-content h2 {
  font-size: 1.35rem;
  margin-top: 2.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}
.project-content h2:first-child { margin-top: 0; }
.project-content p { margin-bottom: 1rem; max-width: none; }
.project-content ul { padding-left: 1.5rem; margin-bottom: 1.25rem; }
.project-content li { color: var(--color-text-muted); margin-bottom: 0.4rem; line-height: 1.6; }
.project-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-surface-2);
  padding: 0.15em 0.45em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  color: var(--color-accent-hover);
}

.project-content pre {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.project-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.88rem;
  color: var(--color-text);
}

/* ── Keyboard Shortcut Tables ── */
.table-wrap {
  overflow-x: auto;
}

.kbd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.kbd-table th {
  text-align: left;
  padding: 0.5rem 1rem 0.5rem 0;
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text);
  font-weight: 600;
}

.kbd-table td {
  padding: 0.4rem 1rem 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  vertical-align: top;
}

.kbd-table tbody tr:last-child td {
  border-bottom: none;
}

.kbd-table kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-surface-2);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

/* ── Sidebar ── */
.project-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
}
.sidebar-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}
.sidebar-card h3 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}
.sidebar-list, .sidebar-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.sidebar-list li {
  font-size: 0.88rem;
  color: var(--color-text-muted);
}
.sidebar-links a {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  text-decoration: none;
}
.sidebar-links a:hover {
  color: var(--color-accent);
}

/* ── Notice / Callout ── */
.notice {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  margin-bottom: 1.5rem;
}

.notice-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1.65;
}

.notice p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  max-width: none;
}

.notice-info {
  border-color: rgba(60, 130, 220, 0.3);
  background: rgba(60, 130, 220, 0.06);
}

/* ── Legal / Prose Pages ── */
.prose h2 {
  font-size: 1.2rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}
.prose h2:first-child {
  margin-top: 0;
}

.prose p {
  margin-bottom: 1rem;
  max-width: none;
}

.prose ul, .prose ol {
  padding-left: 1.4rem;
  margin-bottom: 1rem;
}

.prose li {
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}

.prose a {
  color: var(--color-link);
}

/* ── Home Nav Cards (index.html) ── */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
  margin-top: 2rem;
}

.nav-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-card);
  position: relative;
}

.nav-card:hover,
.nav-card:focus-visible {
  border-color: var(--color-accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.nav-card-icon {
  font-size: 1.75rem;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin-bottom: 0.25rem;
}

.nav-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}
 .nav-card-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  max-width: none;
  margin: 0;
  line-height: 1.6;
}

.nav-card-arrow {
  position: absolute;
  bottom: 1.25rem;
  right: 1.25rem;
  font-size: 1rem;
  color: var(--color-text-subtle);
  transition: color var(--transition), transform var(--transition);
}

.nav-card:hover .nav-card-arrow,
.nav-card:focus-visible .nav-card-arrow {
  color: var(--color-link);
  transform: translateX(3px);
}

/* ── Footer ── */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding-block: 2.5rem;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
.footer-brand {
  font-weight: 800;
  color: var(--color-text);
  text-decoration: none;
}
.footer-brand:hover {
  color: var(--color-link-hover);
}
.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}
.footer-links a {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--color-text);
}
.footer-copy {
  font-size: 0.82rem;
  color: var(--color-text-subtle);
}
.footer-discord {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  background: #5865F2;
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}
.footer-discord:hover {
  background: #4752c4;
}
.footer-github {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  background: #24292f;
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}
.footer-github:hover {
  background: #1b1f24;
}
.footer-contact {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  background: var(--color-surface, #1a1a1f);
  color: var(--color-text, #eee);
  border: 1px solid var(--color-border, #333);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}
.footer-contact:hover {
  background: var(--color-surface-2, #232329);
}

/* Notice */
.notice {
  display: flex;
  gap: 0.85rem;
  padding: 1.1rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  margin-top: 2.5rem;
}
.notice-info {
  border-color: rgba(224, 92, 42, 0.3);
  background: rgba(224, 92, 42, 0.05);
}

/* ── Accessibility Trigger (nav, next to theme toggle) ── */
.a11y-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  padding: 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.a11y-trigger:hover, .a11y-trigger:focus-visible {
  color: var(--color-text);
  background: var(--color-surface-2);
}
.a11y-trigger svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ── Accessibility Modal / Panel ── */
.a11y-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  /* visibility:hidden removes all controls inside from the tab order
     and the accessibility tree while the panel is closed */
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition), visibility var(--transition);
}
.a11y-panel-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.a11y-panel {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 1.75rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), var(--shadow-glow);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transform: scale(0.95);
  transition: transform var(--transition);
}
.a11y-panel-backdrop.is-open .a11y-panel {
  transform: scale(1);
}

.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.75rem;
}
.a11y-panel-header h2 {
  font-size: 1.25rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.a11y-close-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}
.a11y-close-btn:hover, .a11y-close-btn:focus-visible {
  color: var(--color-text);
  background: var(--color-surface-2);
}

.a11y-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.a11y-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}
.a11y-row:last-child {
  border-bottom: none;
}
.a11y-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
}
.a11y-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.a11y-btn-group {
  display: flex;
  gap: 0.35rem;
}
.a11y-toggle-btn {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.a11y-toggle-btn:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}
.a11y-toggle-btn[aria-pressed="true"] {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* ── Text Size Slider ── */
.a11y-range-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  min-width: 170px;
}
.a11y-range {
  width: 170px;
  accent-color: var(--color-accent);
  cursor: pointer;
}
.a11y-range-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
}
[data-theme="high-contrast"] .a11y-range {
  accent-color: #ffff00;
}

[data-theme="high-contrast"] .a11y-toggle-btn[aria-pressed="true"] {
  background: #ffff00;
  color: #000;
  font-weight: 800;
}

/* ── Live Announcer (Screen Readers) ── */
.sr-announcer {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Card badge: source-only projects ── */
.card-badge.source-only {
  color: var(--color-link);
  border-color: rgba(224, 92, 42, 0.35);
}

/* ── Home page: featured project row ── */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
  margin-top: 2rem;
}

/* ── Sidebar badges (detail pages) ── */
.sidebar-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sidebar-badges img {
  height: 20px;
  width: auto;
}

/* ── Timeline / changelog list ── */
.timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.timeline li {
  position: relative;
  padding-left: 1.4rem;
  border-left: 2px solid var(--color-border);
}

.timeline li::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 0.35rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-link);
}

.timeline time {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  margin-bottom: 0.25rem;
}

/* ── Section subtitles ── */
.section-subtitle {
  color: var(--color-text-muted);
  margin: -0.5rem 0 1.5rem;
}

/* ── Latest releases (homepage) ── */
.release-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.release-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color var(--transition);
}
.release-card:hover {
  border-color: var(--color-border-hover);
}
.release-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.release-card h3 {
  font-size: 0.95rem;
  margin: 0;
}
.release-card h3 a {
  color: var(--color-text);
  text-decoration: none;
}
.release-card h3 a:hover {
  color: var(--color-link);
}
.release-version {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-link);
  background: rgba(224, 92, 42, 0.12);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.release-date {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
}
.release-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

/* ── Testimonials ── */
.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.testimonial-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.testimonial-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text);
  font-style: italic;
}
.testimonial-card footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.testimonial-card cite {
  font-style: normal;
  font-weight: 700;
  color: var(--color-link);
  font-size: 0.9rem;
}
.testimonial-role {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* ── Roadmap (currently building) ── */
.roadmap-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0;
  margin: 0 0 1rem;
}
.roadmap-list li {
  position: relative;
  padding-left: 1.5rem;
  color: var(--color-text-muted);
}
.roadmap-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
}
.roadmap-note {
  color: var(--color-text-muted);
}

/* ── Project card filter (list pages) ── */
.card-filter-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: -0.5rem 0 1.5rem;
  max-width: 380px;
}
.card-filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}
.card-filter {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  font-family: var(--font-sans);
}
.card-filter:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-color: var(--color-focus);
}
.card-filter-empty {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ── Screenshots (detail pages) ── */
.screenshots-section {
  margin-top: 2.5rem;
}
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.screenshot-card {
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
}
.screenshot-card img {
  width: 100%;
  height: auto;
  display: block;
}
.screenshot-card figcaption {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  padding: 0.5rem 0.85rem;
}
.screenshot-card.missing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  border-style: dashed;
}
.screenshot-placeholder {
  font-size: 0.9rem;
  color: var(--color-text-subtle);
}

/* ── Changelog page ── */
.changelog-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.changelog-project h3 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}
.changelog-project h3 a {
  color: var(--color-text);
  text-decoration: none;
}
.changelog-project h3 a:hover {
  color: var(--color-link);
}
.changelog-releases {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.changelog-releases li {
  border-left: 2px solid var(--color-border);
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.changelog-version {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-link);
  font-size: 0.9rem;
}
.changelog-date {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
}
.changelog-body {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}
.changelog-loading {
  color: var(--color-text-muted);
}

/* ── FAQ page ── */
.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 0.25rem 1.1rem;
  margin-bottom: 0.75rem;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text);
  padding: 0.7rem 0;
  border-radius: var(--radius-sm);
}
.faq-item summary:hover,
.faq-item summary:focus-visible {
  color: var(--color-link);
}
.faq-item[open] summary {
  color: var(--color-link);
}
.faq-item p {
  color: var(--color-text-muted);
  line-height: 1.65;
  padding-bottom: 0.9rem;
}

/* FAQ search + category index */
.faq-tools {
  margin: 0 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.faq-search {
  width: 100%;
  max-width: 32rem;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.faq-search:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
.faq-result-count {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.faq-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.faq-index-link {
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-link);
  text-decoration: none;
  background: var(--color-surface);
}
.faq-index-link:hover,
.faq-index-link:focus-visible {
  border-color: var(--color-link);
  color: var(--color-link);
}
.faq-no-results {
  margin: 0;
  font-weight: 600;
  color: var(--color-text);
}

/* ── Respect the OS "reduce motion" setting automatically ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Homepage layout changes must come after the desktop hero rules above. */
@media (max-width: 768px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-block: 3rem 2.5rem; gap: 2rem; }
  .hero h1 { max-width: 18ch; }
  .hero-art { min-height: 190px; }
  .hero-window { width: min(100%, 310px); transform: none; }
  .hero-orb { width: 180px; height: 180px; }
  .trust-grid { grid-template-columns: 1fr; gap: 1rem; }
}
