/* ============================================================
   DARK-MODE.CSS — Global dark mode layer
   ============================================================ */

/* ── Neutral bridge variables — light mode defaults ── */
:root {
  --dm-bg-app: #f8fafc;
  --dm-bg-surface: #ffffff;
  --dm-bg-elevated: #ffffff;
  --dm-text-main: #0f172a;
  --dm-text-muted: #64748b;
  --dm-border: #e2e8f0;
  --dm-primary: #10b981;
  --dm-accent: #10b981;
}

/* ── Dark mode overrides — literal values only ── */
body.dark-mode {
  --dm-bg-app: #0f1115;
  --dm-bg-surface: #1a1d23;
  --dm-bg-elevated: #22262e;
  --dm-text-main: #e8eaed;
  --dm-text-muted: #9aa1ab;
  --dm-border: #2e333c;
  --dm-primary: #34d399;
  --dm-accent: #34d399;

  --surface:        var(--dm-bg-surface);
  --surface-subtle: var(--dm-bg-app);
  --text-main:      var(--dm-text-main);
  --text-muted:     var(--dm-text-muted);
  --border:         var(--dm-border);
  --primary:        var(--dm-primary);
  --accent:         var(--dm-accent);

  --bg-app:         var(--dm-bg-app);
  --card-bg:        var(--dm-bg-surface);
  --card-border:    var(--dm-border);
  --text-sub:       var(--dm-text-muted);
}

/* ── FOUC fix: apply dark vars BEFORE body class lands ── */
html.dark-mode-pending {
  --dm-bg-app: #0f1115;
  --dm-bg-surface: #1a1d23;
  --dm-bg-elevated: #22262e;
  --dm-text-main: #e8eaed;
  --dm-text-muted: #9aa1ab;
  --dm-border: #2e333c;
  --dm-primary: #34d399;
  --dm-accent: #34d399;

  --surface:        var(--dm-bg-surface);
  --surface-subtle: var(--dm-bg-app);
  --text-main:      var(--dm-text-main);
  --text-muted:     var(--dm-text-muted);
  --border:         var(--dm-border);
  --primary:        var(--dm-primary);
  --accent:         var(--dm-accent);

  --bg-app:         var(--dm-bg-app);
  --card-bg:        var(--dm-bg-surface);
  --card-border:    var(--dm-border);
  --text-sub:       var(--dm-text-muted);
}

html.dark-mode-pending,
html.dark-mode-pending body {
  background: var(--dm-bg-app);
  color: var(--dm-text-main);
}

body, body * {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

body.dark-mode img.requires-light-bg {
  background: #fff;
  border-radius: 4px;
  padding: 4px;
}

.dark-mode-toggle {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--dm-border);
  background: var(--dm-bg-surface);
  color: var(--dm-text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.dark-mode-toggle:hover {
  border-color: var(--dm-primary);
  color: var(--dm-primary);
}

/* === MOBILE HAMBURGER NAV === */
.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  font-size: 1.2rem;
  color: var(--text-main);
  padding: 10px 14px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

@media (max-width: 992px) {
  .nav-inner {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 12px;
    position: relative;
  }

  .brand {
    width: auto !important;
    flex: 1 1 auto;
    min-width: 0;
  }

  .brand span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hamburger-btn {
    display: flex;
  }

  .nav-actions {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    padding: var(--s-md);
    gap: var(--s-sm);
    z-index: 999;
    flex-wrap: nowrap !important;
  }

  .nav-actions.open {
    display: flex;
  }

  .nav-actions .btn-cta,
  .nav-actions .nav-link-main {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .cart-trigger-premium {
    order: 2;
  }

  .hamburger-btn {
    order: 3;
  }
}
