/* M3-CRETE dark theme.
   Applies when <html data-sdt-theme="dark">. Loaded after /styles.css, so every selector carries the
   html[data-sdt-theme] prefix; !important is used only where a page sets an inline color. */

html[data-sdt-theme="dark"] {
  color-scheme: dark;
  background-color: #061321;
  --d-bg: #061321;
  --d-panel: rgba(11, 28, 48, 0.88);
  --d-panel-solid: #0b1c30;
  --d-band: rgba(3, 10, 19, 0.62);
  --d-line: #1d3552;
  --d-line-2: #2a4566;
  --d-ink: #f0f4f7;
  --d-text: #c9d6e0;
  --d-muted: #9fb2c2;
  --d-link: #a8e81a;
  --d-link-hover: #c9f56a;
  --d-green: #97d700;
}

/* Base: navy glow over near-black navy, behind everything (replaces the light paper-noise layer). */
html[data-sdt-theme="dark"] body {
  background: transparent;
  color: var(--d-text);
}
html[data-sdt-theme="dark"] body::before {
  z-index: -2;
  opacity: 1;
  background:
    radial-gradient(1100px 560px at 80% -8%, rgba(1, 58, 115, 0.55), rgba(1, 58, 115, 0) 70%),
    radial-gradient(900px 620px at -10% 45%, rgba(1, 58, 115, 0.26), rgba(1, 58, 115, 0) 70%),
    linear-gradient(180deg, #061321, #040d18);
}
html[data-sdt-theme="dark"] ::selection { background: var(--d-green); color: #061321; }

/* Text */
html[data-sdt-theme="dark"] :is(h1, h2, h3) { color: var(--d-ink); }
/* Page titles set an inline navy color for the light bands. */
html[data-sdt-theme="dark"] main h1[style] { color: var(--d-ink) !important; }
html[data-sdt-theme="dark"] .eyebrow { color: var(--d-green); }
html[data-sdt-theme="dark"] .section-head p { color: var(--d-text); }
html[data-sdt-theme="dark"] :is(.fine-print, .loop-note, .cad-reference-view figcaption) { color: var(--d-muted); }
/* Page titles: on narrow phones the longest word ("conversation.") must fit the column. */
@media (max-width: 440px) {
  html[data-sdt-theme="dark"] .section-head h1 { font-size: clamp(2.4rem, 12.5vw, 3.4rem); }
}

/* Links */
html[data-sdt-theme="dark"] a {
  color: var(--d-link);
  text-decoration-color: rgba(168, 232, 26, 0.35);
}
html[data-sdt-theme="dark"] a:hover { color: var(--d-link-hover); }

/* Sticky header: dark glass, white wordmark, light links. */
html[data-sdt-theme="dark"] .site-header {
  background: rgba(6, 19, 33, 0.86);
  border-bottom-color: rgba(151, 215, 0, 0.45);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
html[data-sdt-theme="dark"] .brand-main { color: var(--d-ink); }
html[data-sdt-theme="dark"] .brand-sub { color: var(--d-muted); border-left-color: var(--d-line-2); }
html[data-sdt-theme="dark"] .nav a { color: #dce6ee; }
html[data-sdt-theme="dark"] .nav a:is(:hover, :focus-visible, [aria-current="page"]) { color: var(--d-green); }

/* Hero: same render, tinted to the page navy and faded into it at the bottom. */
html[data-sdt-theme="dark"] .hero {
  background:
    linear-gradient(0deg, #061321 0%, rgba(6, 19, 33, 0) 26%),
    linear-gradient(90deg, rgba(6, 19, 33, 0.94) 0%, rgba(6, 19, 33, 0.78) 44%, rgba(6, 19, 33, 0.24) 100%),
    url("/images/M3-CRETE_render.jpg") center right / cover no-repeat,
    #061321;
}
@media (max-width: 920px) {
  html[data-sdt-theme="dark"] .hero {
    background:
      linear-gradient(180deg, rgba(6, 19, 33, 0.96) 0%, rgba(6, 19, 33, 0.8) 60%, rgba(6, 19, 33, 0.92) 100%),
      url("/images/M3-CRETE_render.jpg") center / cover no-repeat,
      #061321;
  }
}

/* Bands: plain bands let the background through; "dark" bands become a deeper strip. */
html[data-sdt-theme="dark"] .band { background: transparent; }
html[data-sdt-theme="dark"] :is(.band.dark, .full-loop-section) {
  background: var(--d-band);
  border-block: 1px solid var(--d-line);
}
html[data-sdt-theme="dark"] .band.dark :is(p, li) { color: var(--d-text); }

/* Cards and notices */
html[data-sdt-theme="dark"] .card,
html[data-sdt-theme="dark"] .dark .card {
  background: var(--d-panel);
  border-color: var(--d-line);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
html[data-sdt-theme="dark"] .card h3 { color: var(--d-green); }
html[data-sdt-theme="dark"] .card :is(p, li) { color: var(--d-text); }
html[data-sdt-theme="dark"] .notice {
  background: rgba(151, 215, 0, 0.07);
  border-left-color: var(--d-green);
  color: var(--d-text);
}

/* Plain (outline) buttons read as light outlines on navy; primary and secondary keep their colors. */
html[data-sdt-theme="dark"] .button:not(.primary):not(.secondary) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.34);
  color: var(--d-ink);
}
html[data-sdt-theme="dark"] .button:not(.primary):not(.secondary):hover { border-color: var(--d-green); }
html[data-sdt-theme="dark"] .button.primary { color: #061321; }
html[data-sdt-theme="dark"] .button.primary:hover { background: #a8e81a; border-color: #a8e81a; }

/* CAD renders are drawn on white: shown as framed drawing sheets on the dark page. */
html[data-sdt-theme="dark"] .cad-reference-view img {
  border-color: var(--d-line-2);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

/* Portfolio map */
html[data-sdt-theme="dark"] .full-loop-card { border-color: var(--d-line); }
html[data-sdt-theme="dark"] .full-loop-summaries a {
  background: var(--d-panel);
  border-color: var(--d-line);
  color: var(--d-text);
}
html[data-sdt-theme="dark"] .full-loop-summaries a:hover { border-color: var(--d-green); }
html[data-sdt-theme="dark"] .full-loop-summaries span { color: var(--d-ink); }

/* Footers */
html[data-sdt-theme="dark"] .footer {
  border-top-color: var(--d-line);
  background: rgba(4, 13, 24, 0.75);
  color: var(--d-muted);
}
html[data-sdt-theme="dark"] .footer a { color: var(--d-text); text-decoration-color: rgba(201, 214, 224, 0.3); }
html[data-sdt-theme="dark"] .footer a:is(:hover, [aria-current="page"]) { color: var(--d-green); }
html[data-sdt-theme="dark"] .footer .sdt-netfooter { border-top-color: var(--d-line); }
html[data-sdt-theme="dark"] .footer .sdt-netfooter :is(a, .sdt-netfooter__label) { opacity: 1; }
html[data-sdt-theme="dark"] .footer .sdt-netfooter__label { color: var(--d-muted); }

/* ---- Background layers (created by sdt-bg.js) ---- */
html[data-sdt-theme="dark"] .sdt-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
html[data-sdt-theme="dark"] .sdt-bg canvas { display: block; width: 100%; height: 100%; }
