/*
 * SMM dark-mode test layer — plugin v1.0.0
 * Light mode remains the default. Dark mode is enabled only when
 * <html data-theme="dark"> is present.
 */

.smm-theme-toggle {
  order: 3;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  margin-left: 10px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}
.smm-theme-toggle:hover {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--blue-light);
}
.smm-theme-toggle:focus-visible {
  outline: 3px solid rgba(26,107,196,.35);
  outline-offset: 2px;
}
.smm-theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.smm-theme-icon-sun { display: none; }
html[data-theme="dark"] .smm-theme-icon-moon { display: none; }
html[data-theme="dark"] .smm-theme-icon-sun { display: block; }

/* Keep the menu before the theme control on desktop. */
.nav-menu { order: 2; }
.nav-toggle { order: 4; }

html[data-theme="dark"] {
  color-scheme: dark;
  --blue-light: #1b344c;
  --dark: #0d1c2b;
  --dark2: #14283b;
  --bg: #101923;
  --white: #17232f;
  --text: #edf3f8;
  --text2: #c1ced9;
  --text3: #9caebe;
  --border: #334555;
}

html[data-theme="dark"] body {
  background: var(--white);
  color: var(--text);
}
html[data-theme="dark"] nav {
  box-shadow: 0 2px 18px rgba(0,0,0,.28);
}
html[data-theme="dark"] .drop {
  box-shadow: 0 12px 36px rgba(0,0,0,.34);
}
html[data-theme="dark"] .drop a {
  border-bottom-color: #293b4b;
}
html[data-theme="dark"] .card-grid,
html[data-theme="dark"] .ref-grid {
  background: var(--border);
}
html[data-theme="dark"] .card:hover,
html[data-theme="dark"] a.info-card:hover,
html[data-theme="dark"] .smm-home-linked-card:hover,
html[data-theme="dark"] .smm-l1-linked-card:hover,
html[data-theme="dark"] .smm-l1-linked-card:focus-visible,
html[data-theme="dark"] .smm-l2-linked-card:hover,
html[data-theme="dark"] .smm-l2-linked-card:focus-visible {
  background: #1d384f !important;
}
html[data-theme="dark"] .card-num {
  color: #53697c;
}
html[data-theme="dark"] .ref-logo span {
  color: rgba(237,243,248,.38);
}

/* Image-backed Level-One cards: fade from the dark card surface into the image. */
html[data-theme="dark"] .card.has-image::after {
  background: linear-gradient(
    to right,
    var(--white) 0%,
    rgba(23,35,47,1) 15%,
    rgba(23,35,47,.90) 35%,
    rgba(23,35,47,.65) 50%,
    rgba(23,35,47,.25) 65%,
    rgba(23,35,47,0) 100%
  );
}
html[data-theme="dark"] .card.has-image:hover::after,
html[data-theme="dark"] .smm-l1-page .card.has-image.smm-l1-linked-card:hover::after,
html[data-theme="dark"] .smm-l1-page .card.has-image.smm-l1-linked-card:focus-visible::after {
  background: linear-gradient(
    to right,
    #1d384f 0%,
    rgba(29,56,79,1) 15%,
    rgba(29,56,79,.84) 35%,
    rgba(29,56,79,.32) 62%,
    rgba(29,56,79,0) 100%
  );
}

/* Level-Two plugin surfaces. Intentionally leave image canvases white where
   the source artwork itself is designed on white. */
html[data-theme="dark"] .smm-l2-overview-item,
html[data-theme="dark"] .smm-l2-type-card {
  background: var(--white) !important;
}
html[data-theme="dark"] .smm-l2-subsection + .smm-l2-subsection {
  border-top-color: var(--border);
}
html[data-theme="dark"] .smm-l2-card-map,
html[data-theme="dark"] .smm-l2-card-external,
html[data-theme="dark"] .smm-l2-card-linked-image,
html[data-theme="dark"] .smm-l2-gallery-trigger:not(.smm-l2-overview-media) {
  background: #243441;
}
html[data-theme="dark"] .smm-l2-overview-item:hover,
html[data-theme="dark"] .smm-l2-type-card:hover {
  box-shadow: 0 10px 32px rgba(0,0,0,.28);
}
html[data-theme="dark"] .smm-l2-linked-card:hover,
html[data-theme="dark"] .smm-l2-linked-card:focus-visible {
  box-shadow: 0 12px 30px rgba(0,0,0,.34);
}

/* Complex menu plugin. */
html[data-theme="dark"] .smm-complex-left {
  background: #14283a;
}
html[data-theme="dark"] .smm-complex-right,
html[data-theme="dark"] .smm-complex-group-links,
html[data-theme="dark"] .smm-complex-group-list > .smm-complex-group-links {
  background: var(--white) !important;
}
html[data-theme="dark"] .smm-complex-drop .smm-complex-left > a:hover,
html[data-theme="dark"] .smm-complex-drop .smm-complex-group-links > a:hover {
  background: rgba(43,78,106,.55);
}
html[data-theme="dark"] .smm-complex-empty {
  color: var(--text3);
}

/* Legal modal surfaces from the theme footer. */
html[data-theme="dark"] .legal-modal-dialog,
html[data-theme="dark"] .legal-modal-content {
  background: var(--white);
  color: var(--text);
}

@media (max-width: 980px) {
  .smm-theme-toggle {
    order: 3;
    margin-left: auto;
    margin-right: 2px;
    width: 40px;
    height: 40px;
  }
  .nav-toggle {
    order: 4;
    margin-left: 2px;
  }
  html[data-theme="dark"] .nav-menu {
    background: var(--white);
    border-top-color: var(--border);
    box-shadow: 0 14px 28px rgba(0,0,0,.34);
  }
  html[data-theme="dark"] .nav-menu > li {
    border-bottom-color: #293b4b;
  }
  html[data-theme="dark"] .nav-menu > li > .drop,
  html[data-theme="dark"] .nav-menu > li:hover > .drop {
    background: #111d28;
  }
}

@media (max-width: 640px) {
  .smm-theme-toggle {
    width: 38px;
    height: 38px;
  }
}

/* 1.0.1 — Level-Two hero dark-mode adaptation.
   Structural hero geometry remains owned by the Level-Two template. */
html[data-theme="dark"] .smm-l2-page .subpage-hero {
  background: #183c5c !important;
}

@media (min-width: 981px) {
  html[data-theme="dark"] .smm-l2-page .subpage-hero::before {
    background: #183c5c !important;
  }
}
