/* macOS reference pass
   Shared geometry and app-specific material corrections based on the root
   reference captures. Kept last in the cascade on purpose. */

:root {
  --window-radius: 18px;
  --mac-chrome: rgba(246, 246, 248, 0.82);
  --mac-sidebar: rgba(241, 241, 243, 0.86);
  --mac-canvas: #fff;
  --mac-line: rgba(60, 60, 67, 0.12);
  --mac-label: rgba(60, 60, 67, 0.62);
  --mac-fill: rgba(118, 118, 128, 0.12);
  --mac-fill-hover: rgba(118, 118, 128, 0.18);
  --mac-blue: #007aff;
}

/* Stable browser translation of winliqglass: one modest backdrop sample for
   the active window only. Nested sampling is prohibitively expensive on an
   animated desktop and can collapse frame rate on integrated graphics. */
html.gg-liq-css:not(.gg-liq-live) .window:not([data-opaque-body]) {
  background:
    linear-gradient(145deg, rgba(255,255,255,.18), rgba(255,255,255,.035) 45%, rgba(255,255,255,.1)),
    rgba(var(--gg-body-rgb), .58) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html.gg-liq-css:not(.gg-liq-live) .window.active:not([data-opaque-body]) {
  backdrop-filter: blur(8px) saturate(125%) !important;
  -webkit-backdrop-filter: blur(8px) saturate(125%) !important;
}
html.gg-liq-css:not(.gg-liq-live) .window:not([data-opaque-body]) :is(.window-toolbar,.window-body,.window-content,.window-sidebar) {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html.gg-liq-css:not(.gg-liq-live) .liquid-glass {
  /* The material itself is painted by the layered fill/rim/specular rules.
     Avoid allocating a compositor blur layer for every button and popover. */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* A moving backdrop invalidates every translucent surface each frame. Freeze
   decorative wallpaper motion while the browser fallback is active; the GPU
   shader path still owns and animates its own composed scene. */
html.gg-liq-css:not(.gg-liq-live) .wallpaper-sky,
html.gg-liq-css:not(.gg-liq-live) .wallpaper-fog,
html.gg-liq-css:not(.gg-liq-live) .wallpaper-water {
  animation-play-state: paused !important;
}

/* Window silhouette and title bar */
.window {
  border-radius: var(--window-radius);
  border: 0.5px solid rgba(0, 0, 0, 0.22);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.48) inset,
    0 1px 2px rgba(0, 0, 0, 0.1),
    0 10px 28px rgba(0, 0, 0, 0.22),
    0 28px 70px rgba(0, 0, 0, 0.26);
}
.window.active {
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.56) inset,
    0 2px 4px rgba(0, 0, 0, 0.12),
    0 16px 38px rgba(0, 0, 0, 0.28),
    0 38px 90px rgba(0, 0, 0, 0.3);
}
.window-toolbar {
  min-height: 48px;
  height: 48px;
  padding: 0 13px;
  gap: 11px;
  border-bottom: 0.5px solid var(--mac-line);
}
.traffic-lights { gap: 8px; padding-right: 8px; }
.traffic { width: 12px; height: 12px; }
.window-title {
  color: #1d1d1f;
  font: 600 12px/1 var(--font-ui);
  letter-spacing: -0.006em;
}
.toolbar-slot { min-width: 0; }

/* Clear-rim controls following winliqglass/htmlify's browser translation. */
.gg-btn,
.gg-icon-btn,
.gg-tool-btn,
.gg-finder-tool-btn,
.gg-cal-ico,
.gg-cal-search-btn,
.gg-maps-side-toggle,
button[class*="-ico-btn"],
button[class*="-tool-btn"] {
  position: relative;
  border: 0.5px solid rgba(255, 255, 255, 0.7) !important;
  background:
    linear-gradient(145deg, rgba(255,255,255,.2), rgba(255,255,255,.03) 52%, rgba(255,255,255,.12)),
    rgba(246, 246, 248, 0.18) !important;
  /* Do not create a compositor surface for every button. The layered fill,
     rim and specular reproduce htmlify's fallback without per-control blur. */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow:
    inset 0 0.5px 0 rgba(255,255,255,.9),
    inset 0 -0.5px 0 rgba(0,0,0,.1),
    0 0.5px 1.5px rgba(0,0,0,.12) !important;
}
.gg-btn:hover,
.gg-icon-btn:hover,
.gg-tool-btn:hover,
.gg-finder-tool-btn:hover,
.gg-cal-ico:hover,
.gg-cal-search-btn:hover {
  background-color: rgba(255, 255, 255, 0.34) !important;
}
.gg-btn:active,
.gg-icon-btn:active,
.gg-tool-btn:active,
.gg-finder-tool-btn:active {
  filter: brightness(.94);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.16) !important;
}
.gg-btn.primary,
.gg-btn.active,
.gg-icon-btn.active {
  color: #fff !important;
  background: var(--mac-blue) !important;
  border-color: rgba(255,255,255,.3) !important;
}

/* Segments are a single shallow trough with a raised selected plate. */
.gg-seg,
.gg-segment,
.gg-finder-view-seg {
  padding: 2px !important;
  gap: 1px !important;
  border-radius: 9px !important;
  background: rgba(118, 118, 128, 0.12) !important;
  box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.05);
}
.gg-seg button,
.gg-segment button,
.gg-finder-view-seg button {
  min-height: 24px !important;
  border-radius: 7px !important;
  color: rgba(60, 60, 67, .78) !important;
  background: transparent !important;
  box-shadow: none !important;
}
.gg-seg button.active,
.gg-segment button.active,
.gg-finder-view-seg button.active {
  color: #1d1d1f !important;
  background: rgba(255,255,255,.92) !important;
  box-shadow: 0 .5px 1px rgba(0,0,0,.16), 0 1px 4px rgba(0,0,0,.09) !important;
}

/* Inputs: compact, softly recessed, never chunky. */
.gg-input,
.gg-select,
.gg-search,
input[type="search"] {
  min-height: 28px !important;
  border-radius: 8px !important;
  border: 0.5px solid rgba(0,0,0,.06) !important;
  background: rgba(118,118,128,.12) !important;
  color: #1d1d1f !important;
  box-shadow: inset 0 .5px 1px rgba(0,0,0,.06) !important;
}
input[type="range"] {
  height: 22px;
  accent-color: var(--mac-blue);
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mac-blue), rgba(118,118,128,.28));
  box-shadow: inset 0 .5px 1px rgba(0,0,0,.18);
}
input[type="range"]::-webkit-slider-thumb {
  width: 14px;
  height: 22px;
  margin-top: -9px;
  border-radius: 8px;
  border: .5px solid rgba(0,0,0,.16);
  background:
    linear-gradient(145deg, rgba(255,255,255,.98), rgba(235,235,238,.74));
  box-shadow: inset 0 .5px 0 #fff, 0 1px 4px rgba(0,0,0,.24);
  -webkit-appearance: none;
}
/* Switches are owned entirely by css/switch.css. */

/* Shared split-view language */
.gg-sidebar,
.window-sidebar,
.gg-finder-sidebar,
.gg-ml-side,
.gg-msg-side,
.gg-cal-side,
.gg-rem-side,
.gg-nt-side,
.gg-ct-groups,
.gg-mu-side,
.gg-pd-side,
.gg-as-side,
.gg-ss-side,
.gg-ph-side {
  background: var(--mac-sidebar) !important;
  border-right: 0.5px solid var(--mac-line) !important;
  color: #1d1d1f;
}
.gg-list-item,
.sidebar-item,
[class$="-sitem"] {
  min-height: 28px;
  border-radius: 7px !important;
}
.gg-list-item.active,
.sidebar-item.active,
[class$="-sitem"].active {
  background: rgba(0,122,255,.14) !important;
  color: #0066d6 !important;
  box-shadow: none !important;
}

/* Finder: translucent navigation column, white file plane. */
.window[data-app-id="finder"] .gg-finder { color: #1d1d1f; }
.window[data-app-id="finder"] .gg-finder-chrome,
.window[data-app-id="finder"] .gg-finder-tabs { background: rgba(246,246,248,.8) !important; }
.window[data-app-id="finder"] .gg-finder-content,
.window[data-app-id="finder"] .gg-finder-stage,
.window[data-app-id="finder"] .gg-finder-preview { background: #fff !important; }
.gg-finder-icon.selected { background: rgba(0,122,255,.14) !important; }
.gg-finder-icon.selected .name,
.gg-finder-list tr.selected td { background: #0a84ff !important; color: #fff !important; }

/* Three-column productivity apps. */
.window:is([data-app-id="mail"],[data-app-id="messages"],[data-app-id="notes"],[data-app-id="contacts"]) {
  --gg-body-rgb: 248, 248, 250;
}
.window[data-app-id="mail"] :is(.gg-ml-mid,.gg-ml-read),
.window[data-app-id="messages"] :is(.gg-msg-list,.gg-msg-thread),
.window[data-app-id="notes"] :is(.gg-nt-list,.gg-nt-paper,.gg-nt-ed),
.window[data-app-id="contacts"] :is(.gg-ct-list,.gg-ct-detail,.gg-ct-body) {
  background: #fff !important;
  color: #1d1d1f;
}
.gg-msg-bubble.mine,
.gg-bubble.mine { background: #0a84ff !important; color: #fff !important; }

/* Calendar and Reminders */
.window[data-app-id="calendar"] .gg-cal-main,
.window[data-app-id="reminders"] .gg-rem-main {
  background: #fff !important;
  color: #1d1d1f;
}
.gg-cal-block { border-left-width: 3px !important; border-radius: 4px !important; }
.gg-rem-card,
.gg-rem-section { border-radius: 11px !important; }

/* Content-first scenic apps */
.window[data-app-id="maps"] .gg-maps-canvas { background-color: #bde9f2 !important; }
.window[data-app-id="maps"] :is(.gg-maps-side,.gg-maps-route-card,.gg-maps-ctrl,.gg-maps-zoom,.gg-maps-weather,.gg-maps-compass) {
  border: .5px solid rgba(255,255,255,.66) !important;
  background: rgba(240,252,255,.62) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 8px 26px rgba(42,96,120,.18), inset 0 .5px 0 rgba(255,255,255,.9) !important;
}
.window[data-app-id="weather"] .gg-app,
.window[data-app-id="weather"] .gg-weather {
  color: #fff !important;
  background: linear-gradient(180deg,#1765ae 0%,#4d98db 48%,#77b7e9 100%) !important;
}
.window[data-app-id="weather"] :is(.gg-weather-card,.gg-panel-card,.gg-hour-card,.gg-detail-card) {
  background: rgba(19,92,171,.38) !important;
  border: .5px solid rgba(255,255,255,.2) !important;
  border-radius: 16px !important;
  box-shadow: inset 0 .5px 0 rgba(255,255,255,.16) !important;
}

/* Photos is a strict white library canvas with edge-to-edge imagery. */
.window[data-app-id="photos"] :is(.gg-ph-main,.gg-ph-body) { background: #fff !important; color: #1d1d1f; }
.gg-ph-grid { gap: 2px !important; padding: 2px !important; }
.gg-ph-tile { border-radius: 0 !important; overflow: hidden; }

/* Media libraries: quiet white surface and a floating glass transport. */
.window:is([data-app-id="music"],[data-app-id="podcasts"],[data-app-id="appstore"]) :is(.gg-mu-main,.gg-pd-main,.gg-as-main,.gg-as-content) {
  background: #fff !important;
  color: #1d1d1f;
}
.window[data-app-id="music"] .gg-mu-player,
.window[data-app-id="podcasts"] .gg-pd-player {
  border: .5px solid rgba(255,255,255,.8) !important;
  border-radius: 18px !important;
  background: rgba(248,248,250,.66) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 8px 28px rgba(0,0,0,.16), inset 0 .5px 0 #fff !important;
}
.window[data-app-id="tv"] :is(.gg-tv-main,.gg-tv-content,.gg-tv-hero) { background-color: #050507 !important; color: #fff; }
.window[data-app-id="tv"] .gg-tv-side { background: rgba(16,18,36,.9) !important; color: #fff; }

/* Utilities keep their deliberate dark materials. */
.window[data-app-id="calculator"] { border-radius: 24px; }
.window[data-app-id="calculator"] :is(.window-toolbar,.window-body,.gg-calc) { background: #222528 !important; color: #fff; }
.gg-calc-key { border-radius: 999px !important; box-shadow: inset 0 .5px 0 rgba(255,255,255,.16) !important; }
.gg-calc-key.op { background: #ff9f0a !important; color: #fff !important; }
.window[data-app-id="clock"] :is(.window-toolbar,.window-body,.gg-clk,.gg-suite) { background: #1c1c1e !important; color: #fff; }
.window[data-app-id="terminal"] :is(.window-toolbar,.window-body,.gg-term,.gg-terminal) { background: rgba(24,25,28,.97) !important; color: #f2f2f7; }
.window[data-app-id="activity"] :is(.window-toolbar,.window-body,.gg-act,.gg-suite) { background: #fff !important; color: #1d1d1f; }

/* iWork and creation apps */
.window:is([data-app-id="keynote"],[data-app-id="numbers"],[data-app-id="pages"]) :is(.gg-kn-main,.gg-num-main,.gg-pg-main) {
  background: #eceef1 !important;
  color: #1d1d1f;
}
.window:is([data-app-id="keynote"],[data-app-id="numbers"],[data-app-id="pages"]) :is(.gg-kn-page,.gg-num-page,.gg-pg-page) {
  background: #fff !important;
  box-shadow: 0 2px 10px rgba(0,0,0,.16) !important;
}
.window[data-app-id="freeform"] :is(.gg-ff-canvas,.gg-ff-board,.gg-ff-stage,.gg-ff-world) { background: #fbfaf7 !important; color: #1d1d1f; }
.window[data-app-id="freeform"] :is(.gg-ff-menu,.gg-ff-popover,.gg-ff-sheet) {
  background: rgba(248,248,250,.78) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Settings: grouped inset cards and compact navigation. */
.window[data-app-id="settings"] .gg-ss-main { background: #f5f5f7 !important; color: #1d1d1f; }
.window[data-app-id="settings"] :is(.gg-ss-card,.gg-ss-group,.gg-ss-panel) {
  background: #fff !important;
  border: .5px solid rgba(0,0,0,.06) !important;
  border-radius: 12px !important;
  box-shadow: 0 .5px 1px rgba(0,0,0,.05) !important;
}

/* Sheets and popovers */
.gg-modal,
.gg-sheet,
.gg-popover,
[class$="-modal"],
[class$="-sheet"],
[class$="-popover"] {
  border: .5px solid rgba(255,255,255,.75) !important;
  border-radius: 16px !important;
  background: rgba(248,248,250,.82) !important;
  backdrop-filter: blur(12px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(12px) saturate(140%) !important;
  box-shadow: 0 18px 56px rgba(0,0,0,.26), inset 0 .5px 0 #fff !important;
  color: #1d1d1f;
}

/* The shell follows the same thin, clear-rim material. */
.menubar { height: 25px; font-size: 12px; }
.dock {
  border-radius: 22px !important;
  border: .5px solid rgba(255,255,255,.58) !important;
  box-shadow: 0 10px 32px rgba(0,0,0,.25), inset 0 .5px 0 rgba(255,255,255,.76) !important;
}
.dock-running-dot { width: 4px !important; height: 4px !important; background: rgba(0,0,0,.82) !important; }
.spotlight-panel { border-radius: 22px !important; }

/* Compositing budget: app panes are isolated once, and permanent windows do
   not reserve animated GPU layers after their opening transition.
   `contain: paint` is deliberately absent — it forms a backdrop root, which
   would leave the adaptive matte with nothing behind it to frost. */
.window { will-change: auto !important; contain: layout; }
.window-body > .gg-app,
.window-body > [class^="gg-"] { contain: layout paint; }

/* Control Centre is owned entirely by css/control-center.css. */

.gg-mu-apple-embed { width:100%; min-height:175px; margin:10px 0 16px; border:0; border-radius:14px; background:#1b1b1f; box-shadow:0 8px 22px rgba(0,0,0,.16); }
.gg-ph-tile img,
.gg-as-shot img,
.gg-mu-main img,
.gg-pd-main img { content-visibility: auto; }

@media (max-width: 760px) {
  .window { min-width: 320px; border-radius: 15px; }
  .window-toolbar { height: 44px; min-height: 44px; }
  .gg-sidebar,
  .window-sidebar,
  .gg-finder-sidebar { width: 174px !important; flex-basis: 174px !important; }
}
