/* =========================================================
   DARK MODE (html[data-theme="dark"])
   Same design, same colors for the pills and highlights;
   only the paper turns near-black and the ink turns light.
   ========================================================= */

/* ---------- the toggle button ---------- */

.theme-toggle {
  flex-shrink: 0;

  display: inline-grid;
  place-items: center;

  width: 38px;
  height: 38px;
  margin-left: 4px;
  padding: 0;

  border: 1px solid var(--ink, #151515);
  border-radius: 50%;

  background: #ffffff;
  color: #151515;

  cursor: pointer;

  transition: background 200ms ease, transform 200ms ease;
}

.theme-toggle:hover {
  background: #ffb48f;
  transform: rotate(-12deg);
}

.theme-toggle .lucide {
  width: 17px;
  height: 17px;
  margin: 0;
}

/* smooth switch */
html.theme-fading,
html.theme-fading *,
html.theme-fading *::before,
html.theme-fading *::after {
  transition: background-color 400ms ease, color 400ms ease, border-color 400ms ease !important;
}


/* ---------- the dark palette ---------- */

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

  --paper: #121212;
  --surface: #1b1b1b;
  --ink: #f2f0ec;
  --muted: #a8a49c;
  --line: rgba(242, 240, 236, 0.16);
  --hero-bg: #121212;
  --sec-bg: #121212;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: #121212;
  color: #f2f0ec;
}

html[data-theme="dark"] .nav,
html[data-theme="dark"] .nav.wrap {
  background: rgba(18, 18, 18, 0.9);
  border-bottom-color: rgba(242, 240, 236, 0.12);
}

/* sections that were painted white */
html[data-theme="dark"] .statement,
html[data-theme="dark"] .nyc-section,
html[data-theme="dark"] .map,
html[data-theme="dark"] .writing,
html[data-theme="dark"] .about,
html[data-theme="dark"] .morph-section,
html[data-theme="dark"] #statement,
html[data-theme="dark"] #nyc,
html[data-theme="dark"] #map,
html[data-theme="dark"] #writing,
html[data-theme="dark"] #about {
  background: transparent !important;
}

/* cards and white surfaces */
html[data-theme="dark"] .showcase,
html[data-theme="dark"] .card,
html[data-theme="dark"] .nudge-card,
html[data-theme="dark"] .nudge-engine,
html[data-theme="dark"] .nudge-lever,
html[data-theme="dark"] .nodes .subject,
html[data-theme="dark"] .nodes .subject.is-done,
html[data-theme="dark"] .notes-panel,
html[data-theme="dark"] .email-menu,
html[data-theme="dark"] .nyc-experience,
html[data-theme="dark"] .nyc-experience.home-city {
  background: #1b1b1b !important;
  color: #f2f0ec;
}

html[data-theme="dark"] .nodes .subject:not(.is-done) {
  background: #161616 !important;
}

/* outlined buttons and small tabs */
html[data-theme="dark"] .btn,
html[data-theme="dark"] .sc-tab,
html[data-theme="dark"] .s-next,
html[data-theme="dark"] .music-toggle,
html[data-theme="dark"] .theme-toggle {
  background: #1b1b1b;
  color: #f2f0ec;
  border-color: #f2f0ec;
}

html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .sc-tab[aria-selected="true"],
html[data-theme="dark"] .he-shuffle {
  background: #f2f0ec;
  color: #121212;
}

html[data-theme="dark"] .theme-toggle:hover,
html[data-theme="dark"] .music-toggle:hover,
html[data-theme="dark"] .btn:hover {
  background: #ff6b35;
  color: #121212;
}

/* colored pills keep their color with dark text */
html[data-theme="dark"] .nav nav a[href$=".html"],
html[data-theme="dark"] .nav nav .nav-cv,
html[data-theme="dark"] .tag,
html[data-theme="dark"] .index,
html[data-theme="dark"] .hero-intro .eyebrow,
html[data-theme="dark"] .page-card,
html[data-theme="dark"] .page-card *,
html[data-theme="dark"] .work-list .work-num {
  color: #151515;
  border-color: #151515;
}

html[data-theme="dark"] .work-list li .work-num {
  background: #f2f0ec;
}

html[data-theme="dark"] .nav nav .nav-contact {
  background: #262626;
  color: #f2f0ec;
}

/* highlighted words: the orange marker stays, text stays readable */
html[data-theme="dark"] mark,
html[data-theme="dark"] .sc-mark,
html[data-theme="dark"] .sc-role,
html[data-theme="dark"] .sc-value {
  color: #f2f0ec;
}

html[data-theme="dark"] h1 em,
html[data-theme="dark"] h2 em {
  color: #f2f0ec;
  background-image: linear-gradient(transparent 60%, rgba(255, 107, 53, 0.75) 60%, rgba(255, 107, 53, 0.75) 90%, transparent 90%) !important;
}

html[data-theme="dark"] mark,
html[data-theme="dark"] .sc-mark,
html[data-theme="dark"] .sc-role,
html[data-theme="dark"] .sc-value {
  background: linear-gradient(transparent 58%, rgba(255, 107, 53, 0.7) 58%, rgba(255, 107, 53, 0.7) 92%, transparent 92%) !important;
}

/* the logo */
html[data-theme="dark"] .mark-svg text {
  fill: #f2f0ec;
}

/* lines, labels and soft text */
html[data-theme="dark"] .lead,
html[data-theme="dark"] .lead-aside,
html[data-theme="dark"] .prose p,
html[data-theme="dark"] .work-text,
html[data-theme="dark"] .sc-text,
html[data-theme="dark"] .j-what {
  color: #e6e3dd;
}

html[data-theme="dark"] .journey {
  border-left-color: #f2f0ec;
}

html[data-theme="dark"] .journey li::before {
  background: #121212;
  border-color: #f2f0ec;
}

html[data-theme="dark"] .journey li:last-child::before {
  background: #ff6b35;
}

html[data-theme="dark"] .sc-progress {
  background: rgba(242, 240, 236, 0.14);
}

html[data-theme="dark"] .sc-progress span {
  background: #f2f0ec;
}

html[data-theme="dark"] .work-list,
html[data-theme="dark"] .work-list li,
html[data-theme="dark"] .block,
html[data-theme="dark"] .glance,
html[data-theme="dark"] .sc-outcomes li {
  border-color: rgba(242, 240, 236, 0.14) !important;
}

html[data-theme="dark"] a.work-row:hover,
html[data-theme="dark"] .work-list li a.work-row:hover {
  background: #1f1f1f !important;
}

/* agencies, nudge, notes */
html[data-theme="dark"] .agency-row,
html[data-theme="dark"] .agency-panel,
html[data-theme="dark"] .agency {
  border-color: rgba(242, 240, 236, 0.2);
  color: #f2f0ec;
}

html[data-theme="dark"] .growth-equation,
html[data-theme="dark"] .nodes,
html[data-theme="dark"] .nodes .subject {
  border-color: rgba(242, 240, 236, 0.22) !important;
}

html[data-theme="dark"] .nudge-lever.is-active,
html[data-theme="dark"] .nudge-lever[aria-selected="true"] {
  background: #1b1b1b !important;
}

/* footer */
html[data-theme="dark"] footer,
html[data-theme="dark"] footer * {
  color: #a8a49c;
}

/* Explore cards keep their soft orange, with dark text */
html[data-theme="dark"] .page-card,
html[data-theme="dark"] .page-card[style] {
  background: var(--card-tint, #ffd9c4) !important;
  color: #151515;
}

/* New York name tags */
html[data-theme="dark"] .nyc-label {
  background: #1b1b1b;
  color: #f2f0ec;
  border-color: #f2f0ec;
}

html[data-theme="dark"] .nyc-label:hover,
html[data-theme="dark"] .nyc-label.is-active {
  background: var(--brand);
  color: #ffffff;
}

html[data-theme="dark"] .nyc-top-ui,
html[data-theme="dark"] .nyc-controls,
html[data-theme="dark"] .nyc-coordinates {
  color: #a8a49c;
}


/* =========================================================
   NEURAL NETWORK BACKGROUND (network.js)
   Sits behind everything; the page background shows through
   the body so the dots are visible between sections. Cards
   keep their own surface, so text stays easy to read.
   ========================================================= */

.neural-bg {
  position: fixed;
  inset: 0;
  z-index: -1;

  pointer-events: none;
}

html {
  background: #ffffff;
}

html[data-theme="dark"] {
  background: #121212;
}

body,
html[data-theme="dark"] body {
  background: transparent !important;
}

/* sections that painted their own white would hide the network */
.statement,
.nyc-section,
.map,
.writing,
.about,
.morph-section,
#statement,
#nyc,
#map,
#writing,
#about {
  background: transparent !important;
}

/* "grow." and other heading highlights: deeper orange in dark mode */
html[data-theme="dark"] .first-screen .home-hero h1 em,
html[data-theme="dark"] .home-hero h1 em,
html[data-theme="dark"] .block h2 em,
html[data-theme="dark"] .rail-head h2 em,
html[data-theme="dark"] .work-page h1 em,
html[data-theme="dark"] .statement em,
html[data-theme="dark"] .map-head em,
html[data-theme="dark"] .nudge-head em,
html[data-theme="dark"] #nyc h2 em {
  color: #f2f0ec;
  background-image: linear-gradient(transparent 60%, rgba(255, 107, 53, 0.8) 60%, rgba(255, 107, 53, 0.8) 90%, transparent 90%) !important;
}


/* =========================================================
   TOGGLE AS A CLEAR PILL: black "Dark" in light mode,
   white "Light" in dark mode. Icon-only on small phones.
   ========================================================= */

.theme-toggle,
html[data-theme="dark"] .theme-toggle {
  width: auto;
  height: 36px;
  padding: 0 14px 0 11px;

  display: inline-flex;
  align-items: center;
  gap: 7px;

  border-radius: 999px;

  font: 700 13px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.theme-toggle {
  background: #151515;
  color: #ffffff;
  border-color: #151515;
}

html[data-theme="dark"] .theme-toggle {
  background: #ffffff;
  color: #151515;
  border-color: #ffffff;
}

.theme-toggle:hover,
html[data-theme="dark"] .theme-toggle:hover {
  background: #ff6b35;
  color: #151515;
  border-color: #ff6b35;
  transform: none;
}

.theme-toggle:hover .lucide {
  transform: rotate(-20deg);
}

.theme-toggle .lucide {
  transition: transform 300ms ease;
}

@media (max-width: 420px) {
  .theme-toggle,
  html[data-theme="dark"] .theme-toggle {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .theme-label {
    display: none;
  }
}


/* =========================================================
   DARK MODE: OPENED PANELS (company stories, MBA notes and
   models, Nudge cards and engine, agency details)
   Rule: white surfaces become dark surfaces with light text;
   colored fills keep their color with dark text.
   ========================================================= */

/* dark surfaces */
html[data-theme="dark"] .notes-panel .notes-item,
html[data-theme="dark"] .notes-panel article,
html[data-theme="dark"] .notes-panel .biz-stat,
html[data-theme="dark"] .notes-tab:not(.is-active),
html[data-theme="dark"] .notes-nav-button,
html[data-theme="dark"] .note-model,
html[data-theme="dark"] .model-slider,
html[data-theme="dark"] .model-verdict,
html[data-theme="dark"] .nudge-card-inner,
html[data-theme="dark"] .nudge-brand,
html[data-theme="dark"] .engine-chip,
html[data-theme="dark"] .engine-plan,
html[data-theme="dark"] .agency li,
html[data-theme="dark"] .agency-col,
html[data-theme="dark"] .agency-idea {
  background: #1f1f1f !important;
  color: #f2f0ec !important;
  border-color: rgba(242, 240, 236, 0.28) !important;
}

html[data-theme="dark"] .notes-panel .notes-item *,
html[data-theme="dark"] .notes-panel .biz-stat *,
html[data-theme="dark"] .notes-tab:not(.is-active) *,
html[data-theme="dark"] .note-model *:not(.model-result):not(.model-result *):not(.model-split *),
html[data-theme="dark"] .nudge-card-inner *:not(.nudge-card-icon):not(em),
html[data-theme="dark"] .engine-plan *:not(em),
html[data-theme="dark"] .agency li *,
html[data-theme="dark"] .agency-col *,
html[data-theme="dark"] .agency-idea * {
  color: #f2f0ec;
}

/* the big numbers in company stories */
html[data-theme="dark"] .notes-panel .biz-stat-value {
  color: #ffb48f !important;
}

html[data-theme="dark"] .notes-panel .biz-stat-label,
html[data-theme="dark"] .nudge-sub,
html[data-theme="dark"] .nudge-card-label,
html[data-theme="dark"] .agency-col h4 {
  color: #b9b5ad !important;
}

/* colored fills keep their color, text goes dark */
html[data-theme="dark"] .notes-tab.is-active,
html[data-theme="dark"] .notes-tab.is-active *,
html[data-theme="dark"] .model-result,
html[data-theme="dark"] .model-result *,
html[data-theme="dark"] .model-split *,
html[data-theme="dark"] .nudge-card-icon,
html[data-theme="dark"] .nudge-card-inner em,
html[data-theme="dark"] .nudge-engine em,
html[data-theme="dark"] .agency-num,
html[data-theme="dark"] .agency-toggle {
  color: #151515 !important;
}

/* the chosen engine chip: light pill, dark text */
html[data-theme="dark"] .engine-chip.is-chosen {
  background: #f2f0ec !important;
  color: #151515 !important;
}

html[data-theme="dark"] .engine-open {
  color: #f2f0ec !important;
}

/* notes panel itself */
html[data-theme="dark"] .notes-panel,
html[data-theme="dark"] .notes-panel .notes-inner {
  background: #161616 !important;
  color: #f2f0ec;
}

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

/* agency "+" buttons: light when closed, dark text on the colored open one */
html[data-theme="dark"] .agency-toggle {
  color: #f2f0ec !important;
  border-color: #f2f0ec;
}

html[data-theme="dark"] .agency.is-open .agency-toggle {
  color: #151515 !important;
}

html[data-theme="dark"] .growth-equation i {
  color: #a8a49c;
}
