/* Shared appearance layer. Dark defaults remain in the existing page styles. */
:root { --theme-control-bg: #091a27; --theme-control-text: #e7f2f8; --theme-control-line: #315064; }
html[data-theme='light'] {
  color-scheme: light;
  --bg: #f3f8fc;
  --surface: #ffffff;
  --surface-hover: #e7f3f8;
  --text: #123047;
  --body: #3d5a6d;
  --muted: #567182;
  --line: #bfd4df;
  --accent: #006b84;
  --available: #08785e;
  --theme-control-bg: #ffffff;
  --theme-control-text: #123047;
  --theme-control-line: #a3bfce;
}
html[data-theme='dark'] { color-scheme: dark; }
.theme-picker { position: relative; flex: 0 0 auto; margin-left: -12px; color: var(--theme-control-text); }
.theme-picker summary { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0; border: 1px solid var(--theme-control-line); border-radius: 50%; background: var(--theme-control-bg); cursor: pointer; list-style: none; }
.theme-picker summary::-webkit-details-marker { display: none; }
.theme-picker summary::marker { content: ''; }
.theme-picker summary:hover, .theme-picker[open] summary { border-color: var(--accent); }
.theme-picker summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.theme-icon { width: 19px; height: 19px; flex: 0 0 auto; }
.theme-icon-sun { display: none; }
html[data-theme='light'] .theme-icon-sun { display: block; }
html[data-theme='light'] .theme-icon-moon { display: none; }
.theme-mobile-label { display: none; }
.theme-options { position: absolute; z-index: 60; top: calc(100% + 10px); right: 0; width: 174px; min-width: 0; margin: 0; padding: 7px; border: 1px solid var(--theme-control-line); border-radius: 12px; background: var(--theme-control-bg); color: var(--theme-control-text); box-shadow: 0 10px 35px #00192826; }
.theme-options label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 9px 12px; border-radius: 7px; cursor: pointer; font: 14px/1.4 -apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif; }
.theme-options label:hover { background: var(--surface-hover); }
.theme-options label:has(:checked) { background: var(--surface-hover); font-weight: 600; }
.theme-options input { appearance: auto; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.theme-options label:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Two non-overlapping uses of the original logo avoid double-alpha fringes.
   SVG changes lettering ink only; cyan artwork remains the source pixels. */
.brand-logo-light { display: none; width: 100%; height: auto; }
html[data-theme='light'] :is(.brand,.footer-brand) .brand-logo-dark { display: none; }
html[data-theme='light'] :is(.brand,.footer-brand) .brand-logo-light { display: block; }
html[data-theme='light'] :is(.navigation a,.copyright,.footer-links,.back-link) { color: var(--body); }
html[data-theme='light'] .navigation :is(a:hover,a[aria-current]) { color: var(--accent); }
html[data-theme='light'] :is(.language-toggle,.site-menu-toggle) { color: var(--text); }
html[data-theme='light'] .language-toggle { background: #ffffffa6; border-color: var(--line); }
html[data-theme='light'] .language-toggle:hover { background: var(--surface-hover); color: var(--accent); border-color: var(--accent); }
html[data-theme='light'] .site-footer { border-color: var(--line); }
html[data-theme='light'] .primary { background: linear-gradient(135deg,#006eb9,#00579b); color: #fff; border-color: #087db5; box-shadow: 0 5px 20px #087fa524,inset 0 1px 0 #ffffff30; }
html[data-theme='light'] .primary:hover { background: linear-gradient(135deg,#0061a5,#004c88); border-color: #005781; }
html[data-theme='light'] .arrow { color: var(--accent); }
html[data-theme='light'] .primary .arrow { color: #fff; }
/* The daylight scene belongs to the page, not to a rectangular hero picture.
   It continues behind header, devices and projects, then fades into the footer. */
html[data-theme='light'] body[data-page='home'] {
  background: linear-gradient(180deg, #f3f8fcd9 0, #f3f8fc00 140px, #f3f8fc00 38%, var(--bg) 93%),
    url('assets/light-space-earth.webp') center top / 100% auto no-repeat,
    var(--bg);
}
html[data-theme='light'] .home-top {
  --hero-ground-height: clamp(110px, 13vw, 200px);
  background: transparent;
  overflow: visible;
}
html[data-theme='light'] .home-top::before,
html[data-theme='light'] .home-top .hero-art::before { display: none; }
.hero-device-guard-mobile { display: none; }
.hero-contact-shadows { display: none; }
html[data-theme='light'] .hero-contact-shadows { display: block; }
/* A full-width surface runs behind the original devices, whose individual
   contact shadows share the exact source-image coordinates in both crops. */
html[data-theme='light'] .home-top::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  bottom: calc(var(--hero-ground-height) * -.4);
  height: var(--hero-ground-height);
  pointer-events: none;
  background: url('assets/light-space-ground.webp') center 48% / cover no-repeat;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 68%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 68%, transparent);
}
html[data-theme='light'] .home-top .hero-art picture { opacity: 0; }
html[data-theme='light'] .home-top :is(.hero-device-guard,.hero-device-guard-mobile) {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  pointer-events: none;
}
html[data-theme='light'] .home-top .hero-device-guard-mobile { display: none; }
html[data-theme='light'] body[data-page='home'] .project-strip { background: transparent; }
html[data-theme='light'] .hero-intro { color: var(--body); }
html[data-theme='light'] .hero::before { opacity: .1; }
html[data-theme='light'] .quick-card { border-color: var(--line); background: linear-gradient(125deg,#fff,#edf6fc); box-shadow: 0 5px 22px #1c65830b; }
html[data-theme='light'] :is(a.quick-card:hover,.quick-card:focus-within) { border-color: #41a3bd; background: var(--surface); }
html[data-theme='light'] .legal-note { background: #e3f0f8; }
html[data-theme='light'] .legal-main .placeholder { color: #835c18; }
@media(min-width:901px) {
  html[data-theme='light'] .hero-copy { text-shadow: none; }
}
@media(min-width:721px) and (max-width:1100px) {
  .site-header .navigation { gap: 18px; font-size: 14px; }
  .site-header .brand { width: 176px; }
  .theme-picker { margin-left: -6px; }
}
@media(max-width:900px) {
  html[data-theme='light'] body[data-page='home'] {
    background: linear-gradient(180deg, #f3f8fc 2%, #f3f8fc70 24%, #f3f8fc00 43%, var(--bg) 83%),
      url('assets/light-space-earth.webp') 66% top / auto 100% no-repeat,
      var(--bg);
  }
  html[data-theme='light'] .home-top .hero-art { border-radius: 0; overflow: visible; }
  html[data-theme='light'] .home-top .hero-device-guard { display: none; }
  html[data-theme='light'] .home-top .hero-device-guard-mobile { display: block; }
}
@media(max-width:720px) {
  .site-header > .navigation .theme-picker { margin: 0; }
  .site-header > .navigation .theme-picker summary { width: 100%; min-height: 46px; border: 0; border-radius: 6px; justify-content: flex-start; padding: 0 12px; background: transparent; font-size: 14px; }
  .theme-mobile-label { display: inline; }
  .theme-options { position: static; width: 100%; margin-block: 5px; box-shadow: none; }
  html[data-theme='light'] .site-header > .navigation { background: #f9fcfffa; border-color: var(--line); box-shadow: 0 15px 40px #214f7026; }
  html[data-theme='light'] .site-header > .navigation :is(a:hover,.language-toggle:hover) { background: var(--surface-hover); }
}
@media(prefers-reduced-motion:reduce) { .theme-picker *, .theme-picker *::before, .theme-picker *::after { transition: none; animation: none; } }
