:root {
  color-scheme: light;
}

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 9px;
}

.header-actions .search-toggle,
.header-actions .back-home {
  justify-self: auto;
}

.theme-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: .78rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.theme-toggle:hover {
  color: var(--teal-700);
  border-color: var(--teal-500);
  transform: translateY(-1px);
}

.theme-toggle-icons {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.theme-icon {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-sun {
  display: none;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf7f5;
  --muted: #a5bbb7;
  --paper: #071211;
  --white: #0e1d1b;
  --teal-950: #032d2c;
  --teal-900: #8ae3de;
  --teal-700: #55d4ce;
  --teal-500: #30bdb7;
  --aqua: #6eddd8;
  --mint: #adf2ed;
  --line: #29413d;
  --shadow: 0 18px 50px rgb(0 0 0 / 32%);
}

html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .site-header {
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] .utility-bar {
  background: #021d1c;
  color: #bdd8d4;
}

html[data-theme="dark"] .brand-mark {
  box-shadow: 0 0 0 4px #0e1d1b, 0 0 0 6px rgb(85 212 206 / 25%);
}

html[data-theme="dark"] .main-nav,
html[data-theme="dark"] .trending,
html[data-theme="dark"] .ranking,
html[data-theme="dark"] .rail-card,
html[data-theme="dark"] .institutional-copy,
html[data-theme="dark"] .partner-directory article,
html[data-theme="dark"] .profile-card {
  background: var(--white);
}

html[data-theme="dark"] .search-toggle,
html[data-theme="dark"] .back-home,
html[data-theme="dark"] .copy-link,
html[data-theme="dark"] .trust-links a,
html[data-theme="dark"] .theme-toggle {
  background: #132522;
  color: var(--ink);
}

html[data-theme="dark"] .search-panel {
  background: #102724;
}

html[data-theme="dark"] .search-form input {
  border-color: #3b5752;
  background: #091714;
  color: var(--ink);
}

html[data-theme="dark"] .search-form input::placeholder {
  color: #7f9692;
}

html[data-theme="dark"] .search-form button,
html[data-theme="dark"] .partner-contact > a {
  background: #087d78;
  color: #fff;
}

html[data-theme="dark"] .breaking-bar {
  background: #08736f;
}

html[data-theme="dark"] .trending-inner a {
  background: #132522;
  color: #c9d9d6;
}

html[data-theme="dark"] .story-image,
html[data-theme="dark"] .latest-card-image,
html[data-theme="dark"] .profile-photo,
html[data-theme="dark"] .talent-portrait {
  background: #17302d;
}

html[data-theme="dark"] .ad-slot {
  border-color: #2b403c;
  background: repeating-linear-gradient(135deg, #0d1b19, #0d1b19 8px, #101f1d 8px, #101f1d 16px);
  color: #92aaa6;
}

html[data-theme="dark"] .relationship-inline,
html[data-theme="dark"] .article-callout,
html[data-theme="dark"] .contact-card,
html[data-theme="dark"] .partner-contact,
html[data-theme="dark"] .relationship-disclosure {
  border-color: #28645f;
  background: #102d2a;
  color: #d5e9e6;
}

html[data-theme="dark"] .partner-row {
  background: linear-gradient(90deg, rgb(48 189 183 / 13%), transparent);
}

html[data-theme="dark"] .talent-proof {
  background: #113532;
  color: var(--ink);
}

html[data-theme="dark"] .talent-proof span,
html[data-theme="dark"] .talent-proof a,
html[data-theme="dark"] .relationship-inline,
html[data-theme="dark"] .relationship-disclosure strong,
html[data-theme="dark"] .partner-contact span {
  color: var(--mint);
}

html[data-theme="dark"] .section-heading:not(.light) {
  border-bottom-color: #49615d;
}

html[data-theme="dark"] .news-row time,
html[data-theme="dark"] .story-meta,
html[data-theme="dark"] .story-meta span::before,
html[data-theme="dark"] .article-hero figcaption,
html[data-theme="dark"] .inline-media figcaption,
html[data-theme="dark"] .partner-directory small,
html[data-theme="dark"] .partner-contact p {
  color: #94aaa6;
}

html[data-theme="dark"] .article-body .lead-paragraph,
html[data-theme="dark"] .institutional-copy p,
html[data-theme="dark"] .institutional-copy li,
html[data-theme="dark"] .partner-directory p,
html[data-theme="dark"] .profile-card p,
html[data-theme="dark"] .profile-card ul {
  color: #c6d9d5;
}

html[data-theme="dark"] .inline-media-frame {
  background: linear-gradient(135deg, #102b28, #162421);
}

html[data-theme="dark"] .copy-link,
html[data-theme="dark"] .trust-links a {
  color: var(--aqua);
}

html[data-theme="dark"] ::selection {
  background: #1d7772;
  color: #fff;
}

@media (max-width: 640px) {
  .brand-row {
    gap: 12px;
  }

  .header-actions {
    gap: 6px;
  }

  .theme-toggle {
    width: 42px;
    min-height: 42px;
    padding: 0;
  }

  .theme-toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .header-actions .search-toggle,
  .header-actions .back-home {
    width: 42px;
    min-height: 42px;
    justify-content: center;
    padding: 0;
    font-size: 0;
  }

  .header-actions .search-toggle span {
    font-size: 1.3rem;
  }

  .header-actions .back-home::before {
    content: "←";
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle {
    transition: none;
  }
}
