/* Site and cabinet share one theme preference and one keyboard-accessible control. */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
button[data-theme-toggle] { display: none; }
html[data-theme] button[data-theme-toggle] {
  display: inline-grid;
  place-items: center;
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #b7cbbd;
  border-radius: 50%;
  background: #fffef9;
  color: #245b43;
  cursor: pointer;
}
html[data-theme] button[data-theme-toggle]:focus-visible { outline: 3px solid #37825c; outline-offset: 3px; }
button[data-theme-toggle]::before {
  content: "";
  width: 16px;
  height: 16px;
  margin: -3px -3px 0 0;
  border-radius: 50%;
  box-shadow: -4px 3px 0 0 currentColor;
}
html[data-theme="dark"] button[data-theme-toggle] {
  color: #bce6c6;
  background: #1c2d25;
  border-color: #486554;
}
html[data-theme="dark"] button[data-theme-toggle]::before {
  margin: 0;
  width: 10px;
  height: 10px;
  border: 1.6px solid currentColor;
  box-sizing: border-box;
  box-shadow: 0 -9px 0 -4px currentColor, 0 9px 0 -4px currentColor,
    9px 0 0 -4px currentColor, -9px 0 0 -4px currentColor,
    6px 6px 0 -4px currentColor, -6px -6px 0 -4px currentColor,
    6px -6px 0 -4px currentColor, -6px 6px 0 -4px currentColor;
}
html[data-theme] button[data-theme-toggle]:hover { border-color: currentColor; }
:root:has(.site-shell) { background-color: #f7f5ed; }
:root[data-theme="dark"]:has(.site-shell) { background-color: #111c18; }
:root[data-theme="dark"] .site-shell {
  --surface: #192a22;
  --surface-raised: #223b2d;
  --card: #192a22;
  --card-strong: #20352a;
  --line: #3a5144;
  --muted: #b1c5b9;
  --text: #eef5ed;
  --accent: #9bddae;
  --accent-ink: #10271b;
  --button-hover: #b9ebc1;
  --shadow: 0 18px 48px rgb(0 0 0 / 19%);
  color: var(--text);
}
:root[data-theme="dark"] body:has(.site-shell) {
  background: radial-gradient(circle at 90% 0%, #213d2c, transparent 30rem), #111c18;
}
:root[data-theme="dark"] body:has(.site-shell)::before {
  background-image: linear-gradient(rgb(211 237 218 / 7%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(211 237 218 / 7%) 1px, transparent 1px);
}
:root[data-theme="dark"] .site-shell .brand img { filter: brightness(0) invert(1); opacity: .9; }
:root[data-theme="dark"] .site-shell :is(.button-secondary, .topnav-cabinet) {
  color: var(--accent); border-color: #629c74;
}
:root[data-theme="dark"] .site-shell .button-primary {
  background: #071b10; border-color: #b7ecc4; color: #f7fff9;
}
:root[data-theme="dark"] .site-shell .button-primary:hover { background: #163d27; }
.site-shell .topbar { column-gap: clamp(8px, 2vw, 24px); }
.site-shell .topbar > .topnav { margin-inline-start: auto; }
@media (min-width: 521px) and (max-width: 760px) {
  .site-shell .topbar { display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .site-shell .topbar > .topnav { grid-column: 1/-1; grid-row: 2; }
  .site-shell .topbar > [data-theme-toggle] { grid-column: 2; grid-row: 1; }
}
@media (max-width: 520px) {
  .site-shell .topbar { flex-wrap: wrap; }
  .site-shell .topbar > .topnav { display: flex; gap: 4px; }
  html[data-theme] .site-shell button[data-theme-toggle] { width: 40px; height: 40px; }
}
