/* Shared light/dark theme. Colours follow the Nexius Academy refresh:
   paper #ffffff, canvas #f6f6f4, ink #111111, line #e5e5e1,
   teal #00CABA (dark) / #006b63 (light text), navy #071327. */

:root {
  color-scheme: dark;
  --ink: #f6f6f4;
  --muted: #b4b4b0;
  --quiet: #a8aaa6;
  --bg: #071327;
  --bg2: #0d1f3d;
  --bg-deep: #06141e;
  --panel: #0d1f3d;
  --panel2: #1d2a4d;
  --panel-soft: #1d2a4d;
  --line: rgba(229, 229, 225, 0.16);
  --line2: rgba(229, 229, 225, 0.1);
  --line-soft: rgba(229, 229, 225, 0.1);
  --teal: #00caba;
  --teal2: #7dfff0;
  --teal-bright: #00caba;
  --orange: #00caba;
  --orange2: #7dfff0;
  --orange-soft: #7dfff0;
  --on-accent: #062825;
}

.button.primary,
.btn.primary,
.skip-link,
.skip:focus {
  color: var(--on-accent);
}

/* Shared light/dark theme overrides + toggle control for melverick.com */

.nav-actions,
.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line2, var(--line-soft, rgba(142, 186, 215, 0.18)));
  border-radius: 0;
  background: transparent;
  color: var(--ink, #f6f6f4);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
  border-color: var(--teal, #00caba);
  color: var(--teal2, var(--teal-bright, #7dfff0));
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--teal2, var(--teal-bright, #7dfff0));
  outline-offset: 3px;
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  display: block;
  background: currentColor;
  /* sun (default for dark theme — click to go light) */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E") center / contain no-repeat;
}

html[data-theme="light"] .theme-toggle-icon {
  /* moon when in light mode — click to go dark */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 14.5A8.5 8.5 0 0 1 9.5 3 7 7 0 1 0 21 14.5z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 14.5A8.5 8.5 0 0 1 9.5 3 7 7 0 1 0 21 14.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---- Light theme: CSS variables (home + blog naming) ---- */
html[data-theme="light"] {
  color-scheme: light;
  --ink: #111111;
  --muted: #525252;
  --quiet: #525252;
  --bg: #ffffff;
  --bg2: #f6f6f4;
  --bg-deep: #f6f6f4;
  --panel: #ffffff;
  --panel2: #f6f6f4;
  --panel-soft: #f6f6f4;
  --line: #e5e5e1;
  --line2: #d6d6d1;
  --line-soft: #d6d6d1;
  --teal: #006b63;
  --teal2: #006b63;
  --teal-bright: #006b63;
  --orange: #111111;
  --orange2: #333333;
  --orange-soft: #333333;
  --on-accent: #ffffff;
}

/* Home page body/nav hardcodes */
html[data-theme="light"] body {
  background: #ffffff !important;
  color: var(--ink);
}

html[data-theme="light"] .nav {
  background: rgba(255, 255, 255, 0.94) !important;
}

html[data-theme="light"] .mark,
html[data-theme="light"] .brand-mark {
  background: #ffffff !important;
  border-color: rgba(0, 107, 99, 0.45) !important;
  color: var(--teal) !important;
}

html[data-theme="light"] .nav-links,
html[data-theme="light"] .nav-links a {
  color: #111111 !important;
}

html[data-theme="light"] .nav-links a:hover {
  color: var(--teal) !important;
}

/* Blog / shared SiteFooter hardcodes */
html[data-theme="light"] .prose > :first-child,
html[data-theme="light"] .prose h2,
html[data-theme="light"] .prose h3,
html[data-theme="light"] .prose strong,
html[data-theme="light"] .prose blockquote {
  color: var(--ink) !important;
}

html[data-theme="light"] .editorial-note,
html[data-theme="light"] .post-card.featured,
html[data-theme="light"] .article-next,
html[data-theme="light"] .workforce-principle {
  background: linear-gradient(145deg, rgba(0, 107, 99, 0.06), rgba(17, 17, 17, 0.04)), #ffffff !important;
}

html[data-theme="light"] .category-card,
html[data-theme="light"] .workforce-directory li {
  background: rgba(255, 255, 255, 0.92) !important;
}

html[data-theme="light"] .category-card:hover {
  background: rgba(0, 107, 99, 0.08) !important;
}

html[data-theme="light"] .workforce-chart {
  background: #ffffff !important;
  box-shadow: 0 20px 50px rgba(15, 40, 60, 0.08) !important;
}

html[data-theme="light"] .prose a,
html[data-theme="light"] .article-meta a,
html[data-theme="light"] .article-rail a {
  color: var(--teal-bright) !important;
}

/* Home page panels / cards that use translucent dark fills */
html[data-theme="light"] .card,
html[data-theme="light"] .post,
html[data-theme="light"] .person,
html[data-theme="light"] .panel,
html[data-theme="light"] .gist-feature,
html[data-theme="light"] .cta {
  background-color: rgba(255, 255, 255, 0.85);
}

/* Light-theme contrast corrections for dark-theme hardcodes. */
html[data-theme="light"] .context p:last-child,
html[data-theme="light"] .gist-principles li,
html[data-theme="light"] .gist-files code {
  color: var(--ink) !important;
}

html[data-theme="light"] .profile-card,
html[data-theme="light"] .gist-files {
  background: #ffffff !important;
}

html[data-theme="light"] .footer-inner a {
  color: #111111 !important;
}

html[data-theme="light"] .btn.primary,
html[data-theme="light"] .button.primary,
html[data-theme="light"] .skip-link {
  color: #ffffff !important;
}

html[data-theme="light"] .skip {
  color: var(--ink) !important;
}

html[data-theme="light"] .skip:focus {
  color: #ffffff !important;
}

/* This caption stays on a deliberately dark image overlay in both themes. */
html[data-theme="light"] .caption {
  color: #f6f6f4 !important;
}

@media (max-width: 620px) {
  .theme-toggle {
    width: 44px;
    height: 44px;
  }
  .nav-actions,
  .header-actions {
    gap: 6px;
  }
}

/* Shared header: secondary links stay reachable on small screens. */
.nav-menu {
  display: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line2, rgba(142, 186, 215, 0.18));
  background: transparent;
  color: var(--ink, #f6f6f4);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.nav-menu:focus-visible {
  outline: 3px solid var(--teal2, #7dfff0);
  outline-offset: 3px;
}

.nav-menu-icon {
  width: 16px;
  height: 12px;
  display: block;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 12'%3E%3Cpath fill='black' d='M0 0h16v2H0zm0 5h16v2H0zm0 5h16v2H0z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 12'%3E%3Cpath fill='black' d='M0 0h16v2H0zm0 5h16v2H0zm0 5h16v2H0z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.site-header.is-open .nav-menu-icon {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M2.3 0L8 5.7 13.7 0 16 2.3 10.3 8 16 13.7 13.7 16 8 10.3 2.3 16 0 13.7 5.7 8 0 2.3z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M2.3 0L8 5.7 13.7 0 16 2.3 10.3 8 16 13.7 13.7 16 8 10.3 2.3 16 0 13.7 5.7 8 0 2.3z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.site-header nav {
  flex-wrap: nowrap;
  gap: 22px;
}

.site-header nav a {
  white-space: nowrap;
  letter-spacing: 0.06em;
}

.nav-menu {
  display: none;
}

@media (max-width: 860px) {
  .site-header .header-inner {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    height: auto;
    min-height: 64px;
    gap: 0 8px;
    padding-bottom: 6px;
  }
  .site-header nav {
    grid-column: 1 / -1;
    justify-content: space-between;
    gap: 10px;
  }
  .site-header nav a {
    min-width: 0;
    padding: 10px 0;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
  }
  .header-actions,
  .nav-actions {
    gap: 4px;
  }
}

/* Homepage headshot: a portrait, not a full-bleed panel. */
body.home .hero {
  align-items: center;
}
body.home .portrait {
  width: min(100%, 280px);
  max-width: 280px;
  min-height: 0;
  aspect-ratio: 1;
  justify-self: end;
}
body.home .portrait:before {
  display: none;
}
body.home .portrait img {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  opacity: 1;
  filter: none;
  object-fit: cover;
  object-position: center 18%;
}
.about-bridge img {
  width: min(100%, 280px);
  height: auto;
}
body.home .portrait picture,
.page-body picture {
  display: block;
  width: 100%;
  height: 100%;
}
.about-bridge picture {
  display: block;
  width: min(100%, 280px);
  height: auto;
}
@media (max-width: 980px) {
  body.home .portrait {
    justify-self: start;
  }
}

/* Simple pages that share the blog header and footer. */
.page-hero {
  border-bottom: 1px solid var(--line, rgba(142, 186, 215, 0.18));
  padding: 72px 0 40px;
}
.page-hero h1,
.page-body h2 {
  font-family: Manrope, sans-serif;
  letter-spacing: -0.03em;
  line-height: 1.12;
  overflow-wrap: break-word;
  text-wrap: balance;
  font-weight: 800;
}
.page-hero h1 {
  margin: 12px 0 16px;
  font-size: clamp(2.4rem, 3.2vw, 3.15rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 18ch;
  hyphens: auto;
}
.page-hero p,
.page-body p,
.page-body li {
  color: var(--muted, #b4b4b0);
  max-width: 68ch;
}
.page-body {
  padding: 40px 0 88px;
}
.page-body h2 {
  margin: 1.8rem 0 0.6rem;
  font-size: 1.45rem;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.page-portrait {
  width: min(100%, 280px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center 18%;
  border: 1px solid var(--line, rgba(142, 186, 215, 0.18));
  margin: 8px 0 24px;
}
@media (max-width: 620px) {
  .page-hero {
    padding: 48px 0 28px;
  }
  .page-actions .button {
    width: 100%;
  }
}
