/* Night mode: applied when <html data-theme="dark">. Toggle lives in js/night-mode.js. */

:root {
    --nm-bg: #000000;
    --nm-surface: #000000;
    --nm-surface-solid: #000000;
    --nm-text: #e4e4e4;
    --nm-muted: #a9adb3;
    --nm-border: rgba(255, 255, 255, 0.18);
    --nm-accent: rgb(240, 128, 58);
}

/* Toggle button (both themes) */
.nm-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1100;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.85);
    color: #222;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: background 0.2s, color 0.2s;
}
.nm-toggle:hover { color: rgb(220, 98, 22); }
.nm-toggle:focus-visible { outline: 2px solid rgb(220, 98, 22); outline-offset: 2px; }

html[data-theme="dark"] .nm-toggle {
    background: var(--nm-surface-solid);
    box-shadow: none;
    border-color: transparent;
    color: #f3d27a;
}

/* Page backgrounds */
html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] .cd-hero,
html[data-theme="dark"] .cd-hero-slider,
html[data-theme="dark"] .cd-hero-slider li,
html[data-theme="dark"] .cd-full-width,
html[data-theme="dark"] .tm-page-3 {
    background: var(--nm-bg) !important;
    color: var(--nm-text);
}

/* Text */
html[data-theme="dark"] p,
html[data-theme="dark"] .tm-bg-white-translucent p,
html[data-theme="dark"] .cd-hero-slider .tm-text,
html[data-theme="dark"] .tm-pub-text,
html[data-theme="dark"] .tm-page-3 p {
    color: var(--nm-text) !important;
}
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] .cd-hero-slider h2.tm-text-title,
html[data-theme="dark"] .tm-site-name,
html[data-theme="dark"] .tm-icon {
    color: #f2f2f2;
}
/* Keep the orange greeting orange */
html[data-theme="dark"] h2[style*="220, 98, 22"] { color: var(--nm-accent) !important; }

/* Links / accents */
html[data-theme="dark"] a,
html[data-theme="dark"] .tm-pub-text a,
html[data-theme="dark"] span[style*="220, 98, 22"] {
    color: var(--nm-accent) !important;
}

/* Translucent content boxes */
html[data-theme="dark"] .tm-bg-white-translucent {
    background-color: var(--nm-surface);
}

/* Navigation */
html[data-theme="dark"] .cd-slider-nav a,
html[data-theme="dark"] .navbar-nav .nav-link {
    background-color: #000000 !important;
    color: var(--nm-text) !important;
}
html[data-theme="dark"] .cd-slider-nav .nav-item.selected .nav-link,
html[data-theme="dark"] .cd-slider-nav .nav-link:hover,
html[data-theme="dark"] .cd-slider-nav .nav-link:focus {
    background-color: #000000 !important;
    color: var(--nm-accent) !important;
}
html[data-theme="dark"] .navbar-toggler { color: #111; }

/* Research page */
html[data-theme="dark"] .tm-pub { border-top-color: var(--nm-border); }
html[data-theme="dark"] .cd-hero-slider p.tm-pub-note { color: var(--nm-muted) !important; }
html[data-theme="dark"] .tm-pub-img img {
    box-shadow: none;
    filter: brightness(0.92);
}
html[data-theme="dark"] .tm-pub-img-placeholder { background: rgba(255, 255, 255, 0.04); }

/* Social icons */
html[data-theme="dark"] .tm-social-icons-container a { color: var(--nm-accent) !important; }

/* Photo / artwork frames */
html[data-theme="dark"] .tm-img { border-color: #000000; }

/* No colour fades on the nav/toggle: the template's `transition: all` could leave
   the old light boxes stuck behind when switching themes. */
.cd-slider-nav a,
.navbar-nav .nav-link,
.nm-toggle {
    transition: none !important;
}
html[data-theme="dark"] .cd-slider-nav a,
html[data-theme="dark"] .navbar-nav .nav-link {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0;
}
