/* Shared macOS Sonoma dark-mode material for portfolio windows. */
:root {
  --sonoma-window-surface: rgba(55, 54, 58, 0.64);
  --sonoma-titlebar-surface: rgba(73, 71, 76, 0.78);
  --sonoma-content-surface: rgba(41, 40, 44, 0.74);
  --sonoma-window-border: rgba(255, 255, 255, 0.20);
  --sonoma-window-blur: blur(42px) saturate(155%);
}

/* Background windows dim only their titlebar; the lower content material keeps
   exactly the same brightness and translucency as the focused window. */
.window:not(.focused):not(.facetime-window) {
  --sonoma-titlebar-surface: rgba(51, 50, 54, 0.78);
  --sonoma-window-border: rgba(255, 255, 255, 0.12);
}

/* Measured from the native Sonoma panel across dark (#292929) and light
   (#f3f3f3) backgrounds: a #313131 tint at 60% plus a broad material blur. */
#about-window.about-window {
  --sonoma-window-surface: rgba(49, 49, 49, 0.60);
  --sonoma-content-surface: transparent;
  --sonoma-window-border: rgba(255, 255, 255, 0.19);
  --sonoma-window-blur: blur(38px) saturate(120%);
}

#about-window.about-window:not(.focused) {
  --sonoma-window-surface: rgba(49, 49, 49, 0.60);
  --sonoma-content-surface: transparent;
}

.finder-window,
#settings-window.system-window,
#music-window.music-window,
#about-window.about-window,
#maps-window.maps-window,
#mail-window.mail-window,
.legal-window {
  background: var(--sonoma-window-surface) !important;
  border-color: var(--sonoma-window-border) !important;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.20) inset,
    0 -1px 0 rgba(0, 0, 0, 0.14) inset !important;
  -webkit-backdrop-filter: var(--sonoma-window-blur) !important;
  backdrop-filter: var(--sonoma-window-blur) !important;
}

.window.focused:not(.facetime-window) {
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.20),
    0 1px 0 rgba(255, 255, 255, 0.20) inset,
    0 -1px 0 rgba(0, 0, 0, 0.14) inset !important;
}

.window:not(.focused):not(.facetime-window) {
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.16),
    0 1px 0 rgba(255, 255, 255, 0.10) inset,
    0 -1px 0 rgba(0, 0, 0, 0.20) inset !important;
}

.window:not(.focused):not(.facetime-window) > .titlebar > :not(.traffic-lights),
.window:not(.focused):not(.facetime-window) > .about-drag-zone > :not(.traffic-lights) {
  opacity: 0.58;
}

.finder-window > .titlebar,
#settings-window.system-window > .titlebar,
#maps-window.maps-window > .titlebar,
#mail-window > .titlebar,
.legal-window > .titlebar {
  background: var(--sonoma-titlebar-surface) !important;
  border-bottom-color: rgba(0, 0, 0, 0.28) !important;
  -webkit-backdrop-filter: blur(30px) saturate(150%) !important;
  backdrop-filter: blur(30px) saturate(150%) !important;
}

#maps-window.maps-window.maximized > .titlebar {
  background: transparent !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.finder-window .finder-body > .window-content,
#settings-window.system-window > .window-content {
  background: var(--sonoma-content-surface) !important;
  -webkit-backdrop-filter: blur(28px) saturate(145%) !important;
  backdrop-filter: blur(28px) saturate(145%) !important;
}

/* Match Music's revealed fullscreen strip exactly. */
#settings-window.system-window.maximized > .titlebar {
  background: var(--sonoma-toolbar-material, rgba(54, 54, 54, .96)) !important;
  border-bottom-color: rgba(0, 0, 0, 0.22) !important;
}

/* Borderless utility-window bodies use the same material as Finder content. */
#music-window .window-content.music-content,
#about-window .about-body,
#mail-window .mail-content,
.legal-window .legal-content {
  background: var(--sonoma-content-surface) !important;
  -webkit-backdrop-filter: blur(42px) saturate(155%) !important;
  backdrop-filter: blur(42px) saturate(155%) !important;
}

#about-window .about-body {
  background: transparent !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

#music-window.music-window:not(.focused):not(.maximized) .music-content > :not(.music-traffic-lights),
#about-window.about-window:not(.focused) .about-body {
  filter: brightness(0.88) saturate(0.92);
}

#settings-window .system-sidebar {
  background: rgba(82, 80, 84, 0.70) !important;
  border-right-color: rgba(255, 255, 255, 0.10) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Keep this final so the focused and background-window materials cannot add
   their inset highlight back onto an edge-to-edge fullscreen window. */
.window.maximized,
.window.maximized.focused,
.window.maximized:not(.focused) {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}
