/* Dark theme — high-contrast charcoal with distinct blue, teal, gold and coral accents. */
html[data-theme="dark"] {
  --cream: #101316;
  --dark: #f5f2e9;
  --accent: #8b86ff;
  --highlight: #ffd84d;
  --toronto-blue: #4169d8;
  --teal: #14969b;
  --indigo: #7770e8;
  --line: #d8d3c8;
  --sun: #ffd166;
  background: #101316;
  color-scheme: dark;
}

html[data-theme="dark"] body,
html[data-theme="dark"] nav {
  background-color: #101316;
  color: #f5f2e9;
}

html[data-theme="dark"] nav {
  border-color: #d8d3c8;
}

html[data-theme="dark"] .logo,
html[data-theme="dark"] .back-btn,
html[data-theme="dark"] .nav-links a:not(.nav-resume),
html[data-theme="dark"] footer a {
  color: #f5f2e9;
}

/* Neutral content surfaces */
html[data-theme="dark"] .box:not(.project-box),
html[data-theme="dark"] .form-section,
html[data-theme="dark"] .resonance-card,
html[data-theme="dark"] .game-card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .modal-box,
html[data-theme="dark"] .post-card {
  background: #191e22;
  color: #f5f2e9;
  border-color: #d8d3c8;
}

html[data-theme="dark"] .box:not(.project-box) h3,
html[data-theme="dark"] .box:not(.project-box) p,
html[data-theme="dark"] .box:not(.project-box) .mini-stat b,
html[data-theme="dark"] .box:not(.project-box) .mini-stat span,
html[data-theme="dark"] .post-card h1,
html[data-theme="dark"] .post-card .content p,
html[data-theme="dark"] .modal-content h2,
html[data-theme="dark"] .modal-content .essay-body,
html[data-theme="dark"] .modal-content .emphasis,
html[data-theme="dark"] .resonance-card .msg-text,
html[data-theme="dark"] .resonance-card .msg-name {
  color: #f5f2e9;
}

/* About page keeps visual variety without sacrificing readability. */
html[data-theme="dark"] .story-block {
  background: #191e22;
  color: #f5f2e9;
  border-color: #d8d3c8;
}

html[data-theme="dark"] .story-block:nth-child(even) {
  background: #343270;
  color: #ffffff;
}

html[data-theme="dark"] .story-block h2,
html[data-theme="dark"] .story-block h3,
html[data-theme="dark"] .story-block p {
  color: inherit;
}

/* Gold labels always use dark ink. This fixes “Non-Profit • Co-Founder”. */
html[data-theme="dark"] .tag,
html[data-theme="dark"] .tag-pill,
html[data-theme="dark"] .category,
html[data-theme="dark"] .highlight-box,
html[data-theme="dark"] .game-tag {
  background-color: #ffd84d;
  color: #171717 !important;
}

html[data-theme="dark"] .game-tag[style*="--toronto-blue"],
html[data-theme="dark"] .game-tag[style*="--teal"],
html[data-theme="dark"] .game-tag[style*="--indigo"] {
  color: #ffffff !important;
}

html[data-theme="dark"] .game-tag[style*="--toronto-blue"] { background: #3159c5 !important; }
html[data-theme="dark"] .game-tag[style*="--teal"] { background: #087078 !important; }
html[data-theme="dark"] .game-tag[style*="--indigo"] { background: #514aad !important; }

/* Project cards retain their own accent surfaces and readable text. */
html[data-theme="dark"] .project-box {
  color: #ffffff;
}

html[data-theme="dark"] .project-box[style*="--toronto-blue"] {
  background: #3159c5 !important;
}

html[data-theme="dark"] .project-box[style*="--teal"] {
  background: #087c82 !important;
}

html[data-theme="dark"] .project-box:not([style*="--toronto-blue"]):not([style*="--teal"]) {
  background: #ffd84d;
  color: #171717;
}

html[data-theme="dark"] .project-box:not([style*="--toronto-blue"]):not([style*="--teal"]) .tag {
  background: #171717;
  color: #ffffff !important;
}

/* Strong dark callouts */
html[data-theme="dark"] .nav-resume,
html[data-theme="dark"] .contact-box,
html[data-theme="dark"] .closing-statement,
html[data-theme="dark"] .close-btn,
html[data-theme="dark"] .submit-btn,
html[data-theme="dark"] .start-btn {
  background: #252b30;
  color: #ffffff !important;
  border-color: #d8d3c8;
}

html[data-theme="dark"] .contact-box,
html[data-theme="dark"] .closing-statement {
  border: 2px solid #555d61;
}

html[data-theme="dark"] .contact-box a,
html[data-theme="dark"] .closing-statement p {
  color: #f5f2e9;
}

html[data-theme="dark"] .back-btn:hover,
html[data-theme="dark"] .close-btn:hover,
html[data-theme="dark"] .submit-btn:hover,
html[data-theme="dark"] .start-btn:hover,
html[data-theme="dark"] .choice-btn:hover {
  background: #ffd84d;
  color: #171717 !important;
}

/* Essays */
html[data-theme="dark"] .card-blue { background-color: #3159c5; color: #ffffff; }
html[data-theme="dark"] .card-teal { background-color: #087c82; color: #ffffff; }
html[data-theme="dark"] .card-indigo { background-color: #343270; color: #ffffff; }
html[data-theme="dark"] .essay-title,
html[data-theme="dark"] .essay-preview { color: #ffffff; }
html[data-theme="dark"] .read-prompt { color: #ffe16e; }

/* Forms and Wall */
html[data-theme="dark"] .form-input,
html[data-theme="dark"] .form-input:focus,
html[data-theme="dark"] .choice-btn,
html[data-theme="dark"] .sim-stats,
html[data-theme="dark"] #joystick-base {
  background: #252b30;
  color: #f5f2e9;
  border-color: #a8a49b;
}

html[data-theme="dark"] .form-input::placeholder { color: #aaa69d; opacity: 1; }
html[data-theme="dark"] .form-group label { color: #ddd8ce; }
html[data-theme="dark"] .msg-meta { border-color: #62686b; }
html[data-theme="dark"] .msg-date { color: #c3beb3; }

/* Arcade */
html[data-theme="dark"] #canvas-frame {
  background: #0a0c0e;
  border-color: #555d61;
}

html[data-theme="dark"] .sim-progress,
html[data-theme="dark"] .joystick-hint {
  color: #d4cfc5;
  opacity: 1;
}

html[data-theme="dark"] .stat-value,
html[data-theme="dark"] .stat-box span,
html[data-theme="dark"] #hud-time,
html[data-theme="dark"] #hud-health,
html[data-theme="dark"] #hud-score,
html[data-theme="dark"] #wordle-message {
  color: #54ddd2;
}

html[data-theme="dark"] .wordle-tile {
  background: #f1ede3;
  color: #171717;
  border-color: #77736b;
}

html[data-theme="dark"] .key {
  background-color: #d3d6da;
  color: #171717;
}

html[data-theme="dark"] .key:hover { background-color: #ffffff; }
html[data-theme="dark"] .key.correct,
html[data-theme="dark"] .key.present,
html[data-theme="dark"] .key.absent { color: #ffffff; }

/* Gallery frames and caption overlays */
html[data-theme="dark"] .shot { background: #252b30; }
html[data-theme="dark"] .shot figcaption,
html[data-theme="dark"] .lb-caption { color: #ffffff; }
html[data-theme="dark"] .lb-sub { color: #d0cbc0; }

/* Catch hardcoded muted inline copy used throughout the original pages. */
html[data-theme="dark"] [style*="color: #444"],
html[data-theme="dark"] [style*="color: #555"],
html[data-theme="dark"] [style*="color: #666"],
html[data-theme="dark"] [style*="color:#444"],
html[data-theme="dark"] [style*="color:#555"],
html[data-theme="dark"] [style*="color:#666"],
html[data-theme="dark"] .page-header p {
  color: #d4cfc5 !important;
}

/* Theme control */
#theme-toggle { color: inherit; }
html[data-theme="dark"] #theme-toggle {
  background: #252b30 !important;
  color: #ffffff !important;
  border-color: #8f9699 !important;
}