/* ------------------------------------------------------------------ */
/* Dark ("night") theme.
/* Active when <html> has class "theme-dark": set automatically from the
/* visitor's device setting, or by the moon/sun button in the menu.
/* ------------------------------------------------------------------ */

html.theme-dark {
   --bg: #161B20;
   --surface: #1F262D;
   --surface-2: #242C34;
   --border: #2E3841;
   --text: #C5CED4;
   --heading: #EEF2F4;
   --muted: #8D99A1;
   --accent: #2CC4C9;
   --accent-soft: rgba(44, 196, 201, .14);
   color-scheme: dark;
}

/* page and sections */
html.theme-dark body,
html.theme-dark body #about,
html.theme-dark body #resume,
html.theme-dark body #contact,
html.theme-dark body footer,
html.theme-dark body.journal-page { background: var(--bg) !important; color: var(--text); }
html.theme-dark #resume,
html.theme-dark #contact,
html.theme-dark footer { border-color: var(--border) !important; }

/* photo fades into the dark page instead of the light one */
html.theme-dark header:after {
   background: linear-gradient(to bottom, rgba(22, 27, 32, 0) 0%, rgba(22, 27, 32, .45) 40%, rgba(22, 27, 32, .85) 75%, #161B20 100%) !important;
}

/* headings and text */
html.theme-dark #about p,
html.theme-dark #about .address,
html.theme-dark #resume .desc,
html.theme-dark #resume .cv-list li,
html.theme-dark #resume .pub-authors,
html.theme-dark #contact p.lead,
html.theme-dark #contact label { color: var(--text) !important; }
html.theme-dark #about .bio-text.bio-columns > p:first-child,
html.theme-dark #resume h1,
html.theme-dark #resume h3,
html.theme-dark #resume h3 a,
html.theme-dark #resume .pub-title,
html.theme-dark #resume .award-name,
html.theme-dark h1.section-title,
html.theme-dark #contact h1,
html.theme-dark #portfolio h1 { color: var(--heading) !important; }
html.theme-dark #resume .info,
html.theme-dark #resume .pub-venue,
html.theme-dark #resume .cv-subhead,
html.theme-dark #about h2.cv-subhead,
html.theme-dark #resume .cv-list li span,
html.theme-dark footer,
html.theme-dark footer a { color: var(--muted) !important; }

/* links and accents */
html.theme-dark #about a, html.theme-dark #about a:visited,
html.theme-dark #resume a, html.theme-dark #resume a:visited,
html.theme-dark #contact a, html.theme-dark #contact a:visited { color: var(--accent); border-bottom-color: rgba(44, 196, 201, .35); }
html.theme-dark #about h2.bio-kicker { color: var(--accent); }
html.theme-dark #about .bio-text.bio-columns { column-rule-color: var(--border); }
html.theme-dark #resume .cv-date,
html.theme-dark .w-tag, html.theme-dark a.w-tag { background: var(--accent-soft) !important; color: var(--accent) !important; }

/* resume details */
html.theme-dark #resume .cv-entry { border-left-color: var(--border); }
html.theme-dark #resume .cv-entry:before { background: var(--bg); }
html.theme-dark #resume .cv-entry:first-child:before { background: var(--accent); }
html.theme-dark .education, html.theme-dark .work { border-bottom-color: var(--border) !important; }
html.theme-dark #resume .award-list li { border-bottom-color: var(--border) !important; }
html.theme-dark #resume .pub-list li { background: var(--surface) !important; }
html.theme-dark #resume .pub-toggle { background: var(--accent-soft); color: var(--accent); }
html.theme-dark #resume .pub-toggle:hover { background: var(--accent); color: #0D1114; }
html.theme-dark .portfolio-item .item-wrap img { box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
html.theme-dark #resume .links-row .portfolio-item .portfolio-item-meta h5 { color: var(--text) !important; }

/* contact form */
html.theme-dark body #contact input,
html.theme-dark body #contact textarea,
html.theme-dark body #contact select { background: var(--surface) !important; color: var(--heading) !important; border-color: var(--border) !important; }
html.theme-dark body #contact input:focus,
html.theme-dark body #contact textarea:focus { border-color: var(--accent) !important; }

/* popups (link details) */
html.theme-dark .popup-modal { background: var(--surface); }
html.theme-dark .popup-modal .description-box h4 { color: var(--heading); }
html.theme-dark .popup-modal .description-box p { color: var(--text); }

/* journal pages */
html.theme-dark .w-list-head h1,
html.theme-dark .w-card h2,
html.theme-dark .w-post-head h1,
html.theme-dark .w-body strong, html.theme-dark .w-body b,
html.theme-dark .w-body h2, html.theme-dark .w-body h3,
html.theme-dark .w-book-title,
html.theme-dark .w-linkcard-title,
html.theme-dark .w-nav-title { color: var(--heading) !important; }
html.theme-dark .w-intro,
html.theme-dark .w-excerpt,
html.theme-dark .w-body,
html.theme-dark .w-dek,
html.theme-dark .w-body blockquote { color: var(--text) !important; }
html.theme-dark .w-meta,
html.theme-dark .w-crumb,
html.theme-dark .w-book-author,
html.theme-dark .w-book-label,
html.theme-dark .w-linkcard-source,
html.theme-dark .w-linkcard-host,
html.theme-dark .w-nav-label,
html.theme-dark .w-project-paper { color: var(--muted) !important; }
html.theme-dark .w-card a,
html.theme-dark .w-book,
html.theme-dark .w-linkcard,
html.theme-dark .w-nav-card { background: var(--surface) !important; border-color: var(--border) !important; }
html.theme-dark .w-post-head,
html.theme-dark .w-post-nav { border-color: var(--border) !important; }
html.theme-dark .w-filter { background: var(--surface-2); color: var(--text); }
html.theme-dark .w-filter.is-active { background: var(--accent); color: #0D1114; }
html.theme-dark .w-body a, html.theme-dark .w-body a:visited,
html.theme-dark .w-post-nav a, html.theme-dark .w-crumb:hover { color: var(--accent); }
html.theme-dark .w-body code, html.theme-dark .w-body pre { background: var(--surface-2); }
html.theme-dark .w-linkcard-icon { background: var(--accent-soft); color: var(--accent); }
html.theme-dark .w-topbar { background: #0F1317; }

/* the moon / sun button */
.theme-toggle {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   width: 30px;
   height: 30px;
   padding: 0;
   margin: 0 0 0 10px;
   border: 1px solid rgba(255, 255, 255, .45);
   border-radius: 50%;
   background: transparent;
   color: #fff;
   cursor: pointer;
   vertical-align: middle;
   transition: color .2s ease, border-color .2s ease;
}
.theme-toggle:hover { color: #11ABB0; border-color: #11ABB0; }
.theme-toggle svg { width: 15px; height: 15px; }
.theme-toggle .icon-sun { display: none; }
html.theme-dark .theme-toggle .icon-sun { display: block; }
html.theme-dark .theme-toggle .icon-moon { display: none; }

/* place the button in the menus */
ul#nav li.nav-theme { display: inline-flex; align-items: center; height: auto; }
.w-nav li.nav-theme { display: flex; align-items: center; }
@media only screen and (max-width: 767px) {
   ul#nav li.nav-theme { display: block; padding: 10px 4%; }
   ul#nav li.nav-theme .theme-toggle { margin: 0; }
}




/* welcome photo tint: a separate layer that fades in for dark mode */
header#home .hero-tint {
   position: absolute;
   inset: 0;
   z-index: 0;
   pointer-events: none;
   background: linear-gradient(to bottom, rgba(22, 27, 32, .30) 0%, rgba(22, 27, 32, .42) 55%, rgba(22, 27, 32, .78) 100%);
   opacity: 0;
   transition: opacity .6s ease;
}
html.theme-dark header#home .hero-tint { opacity: 1; }
header#home .banner { position: relative; z-index: 1; }
header#home .hero-latest-wrap { position: relative; z-index: 2; }

/* smooth switch between day and night: colours fade (the welcome area is left alone) */
html.theme-switching body *:not(header):not(header *),
html.theme-switching body *:not(header):not(header *):before,
html.theme-switching body *:not(header):not(header *):after {
   transition: background-color .6s ease, color .6s ease, border-color .6s ease !important;
}
html.theme-switching body,
html.theme-switching header:after { transition: background-color .6s ease !important; }
@media (prefers-reduced-motion: reduce) { header#home .hero-tint { transition: none; } }


/* day mode: misty lake with pines, cross-fading with the night photo */
header#home .hero-day {
   position: absolute;
   inset: 0;
   z-index: 0;
   pointer-events: none;
   background:
      linear-gradient(to bottom, rgba(16, 26, 30, .38) 0%, rgba(16, 26, 30, .28) 45%, rgba(16, 26, 30, .30) 100%),
      url(../images/header-day.jpg) center top / 100% auto no-repeat,
      #475352;
   opacity: 1;
   transition: opacity .6s ease;
}
html.theme-dark header#home .hero-day { opacity: 0; }
@media (prefers-reduced-motion: reduce) { header#home .hero-day { transition: none; } }

/* show the whole day photo on wide screens (no zoom); phones still need to fill */
@media only screen and (max-width: 900px) {
   header#home .hero-day {
      background-size: auto, cover;
      background-position: 0 0, 58% top;
   }
}
