/* =========================================
   DARK MODE — Homepage (index.html)
   Scoped via html[data-theme="dark"]
   ========================================= */

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

/* ── CSS Variables ──
   Override :root vars by targeting html directly (higher specificity)
   ── */
html[data-theme="dark"] {
  --bg-color: #0a0a0a;
  --card-bg: #141414;
  --text-main: #f2f2f2;
  --text-secondary: #888888;
  --border-color: #2a2a2a;
}

/* ── Base ── */
html[data-theme="dark"] body {
  background-color: var(--bg-color) !important;
  color: var(--text-main);
}

/* ── Navigation ── */
html[data-theme="dark"] .nav-container.scrolled {
  background: rgba(20, 20, 20, 0.95) !important;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .nav-logo-on-light img {
  filter: invert(0) !important;
}

html[data-theme="dark"] .hamburger-btn span {
  background-color: var(--text-main);
}

html[data-theme="dark"] .mobile-menu-overlay {
  background: var(--bg-color);
}

html[data-theme="dark"] .close-menu-btn {
  color: var(--text-main);
}

/* ── Cards ── */
html[data-theme="dark"] .card {
  background: var(--card-bg) !important;
}

html[data-theme="dark"] .card:hover {
  background: #1a1a1a !important;
}

html[data-theme="dark"] .card-dark {
  background: #111111 !important;
}

/* ── Typography ── */
html[data-theme="dark"] .text-secondary {
  color: var(--text-secondary) !important;
}

html[data-theme="dark"] .text-mono-small {
  color: var(--text-secondary);
}

html[data-theme="dark"] .dotted-number {
  color: var(--text-main);
}

/* ── Section Labels ── */
html[data-theme="dark"] .section-label-pill {
  background: #1a1a1a !important;
  border: 1px solid var(--border-color);
}

html[data-theme="dark"] .section-label-line {
  background-image: linear-gradient(to right, #f2f2f2 50%, transparent 50%);
}

/* ── Marquee ── */
html[data-theme="dark"] .marquee-section {
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* ── Hero Message Feed ── */
html[data-theme="dark"] .message-card {
  background: #1a1a1a !important;
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

html[data-theme="dark"] .message-card:hover {
  background: #222222;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

html[data-theme="dark"] .message-user {
  color: #f2f2f2;
}

html[data-theme="dark"] .message-content {
  color: #aaaaaa;
}

html[data-theme="dark"] .message-header {
  color: #888888;
}

/* ── Images ── */
html[data-theme="dark"] .img-cover-container-sm {
  background: #222222;
}

/* ── Tech Tags ── */
html[data-theme="dark"] .tech-tag {
  border-color: #333333;
  color: #999999;
}

/* ── Footer ── */
html[data-theme="dark"] .footer-card {
  background: var(--card-bg) !important;
}

html[data-theme="dark"] .footer-pill {
  background: #1a1a1a !important;
  border-color: var(--border-color) !important;
}

html[data-theme="dark"] .footer-input-group {
  background: #1a1a1a !important;
  border-color: #333333 !important;
}

html[data-theme="dark"] .footer-input {
  background: transparent;
  color: var(--text-main);
}

html[data-theme="dark"] .footer-links-container {
  border-top-color: var(--border-color);
}

html[data-theme="dark"] .footer-card img[alt="Fair Developers"] {
  filter: invert(1);
}

/* ── Modal ── */
html[data-theme="dark"] .modal-content {
  background-color: #141414 !important;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

html[data-theme="dark"] .close-btn {
  color: #888888;
}

html[data-theme="dark"] .close-btn:hover {
  color: var(--accent-color);
}

html[data-theme="dark"] .modal-header h3 {
  color: var(--text-main);
}

html[data-theme="dark"] .modal-header p {
  color: var(--text-secondary);
}

/* ── Forms ── */
html[data-theme="dark"] .form-input,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .form-textarea {
  background-color: #1a1a1a;
  border-color: #333333;
  color: var(--text-main);
}

html[data-theme="dark"] .form-input:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] .form-textarea:focus {
  border-color: #555555;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .form-label {
  color: #cccccc;
}

html[data-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ── Buttons ── */
html[data-theme="dark"] .btn-primary {
  background: #f2f2f2 !important;
  color: #0a0a0a !important;
}

html[data-theme="dark"] .btn-primary:hover {
  background: #ffffff !important;
}

html[data-theme="dark"] .btn-secondary {
  border-color: var(--text-main);
  color: var(--text-main);
}

html[data-theme="dark"] .btn-secondary:hover {
  background: #f2f2f2 !important;
  color: #0a0a0a !important;
}

/* ── Nav CTA Button ── */
html[data-theme="dark"] .nav-container .btn-primary {
  background: #0a0a0a !important;
  color: #ffffff !important;
  border: 1px solid #ffffff !important;
}

html[data-theme="dark"] .nav-container .btn-primary:hover {
  background: #ffffff !important;
  color: #0a0a0a !important;
}

/* ── CTA Split ── */
html[data-theme="dark"] .cta-split-layout {
  background: #141414 !important;
}

/* ── Waveform Visual Fallback ── */
html[data-theme="dark"] #waveform-visual {
  background:
    radial-gradient(circle at 30% 40%, rgba(234,50,26,0.06) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.02) 0%, transparent 50%),
    linear-gradient(135deg, #141414 0%, #0a0a0a 100%);
}

html[data-theme="dark"] #waveform-visual::before {
  color: #555555;
}

/* ── Comparison Section ── */
html[data-theme="dark"] .grid-cols-2 > .card:first-child {
  background: #141414 !important;
  border-color: #2a2a2a !important;
}

html[data-theme="dark"] .grid-cols-2 > .card:first-child h3 {
  color: #666666 !important;
}

html[data-theme="dark"] .grid-cols-2 > .card:first-child li {
  color: #666666 !important;
}

/* ── Process / Topology Grids ── */
html[data-theme="dark"] .process-loop-container {
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
}

html[data-theme="dark"] .topology-container {
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
}

/* ── Subscribe Status ── */
html[data-theme="dark"] .subscribe-status-success {
  color: #4ade80;
}

html[data-theme="dark"] .subscribe-status-error {
  color: #f87171;
}

/* ── Modal Status Messages ── */
html[data-theme="dark"] .success-message {
  color: #4ade80;
  background-color: rgba(74, 222, 128, 0.1);
}

html[data-theme="dark"] .error-message {
  color: #f87171;
  background-color: rgba(248, 113, 113, 0.1);
}

/* ── Scrollbar ── */
html[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #0a0a0a;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #333333;
  border-radius: 4px;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #444444;
}

/* ── Extra overrides for hardcoded light values in rebrand-styles.css ── */

/* Form elements */
html[data-theme="dark"] .minimal-input {
  background: #1a1a1a !important;
  border-color: #333333 !important;
  color: var(--text-main);
}

/* Blog / Search components */
html[data-theme="dark"] .search-input {
  background: #1a1a1a !important;
  color: var(--text-main);
}

html[data-theme="dark"] .filter-pill {
  background: #1a1a1a;
  color: var(--text-main);
}

html[data-theme="dark"] .filter-pill:hover:not(.active) {
  background: #333333;
}

html[data-theme="dark"] .filter-pill.active {
  background: #f2f2f2;
  color: #0a0a0a;
}

html[data-theme="dark"] .blog-card {
  background: var(--card-bg) !important;
}

html[data-theme="dark"] .blog-image-container {
  background: #222222;
}

html[data-theme="dark"] .blog-tag {
  background: #1a1a1a;
  color: #888888;
}

/* Message avatar fallback */
html[data-theme="dark"] .message-avatar {
  background: #2a2a2a;
  color: #f2f2f2;
}

/* Teams nav fallback */
html[data-theme="dark"] body.teams-page .nav-container {
  background: #141414 !important;
  border-bottom-color: #2a2a2a !important;
}
