/* Menu bar, dropdown menus, status area and Control Centre (Tahoe / Liquid Glass). */

/* ---------- Menu bar: transparent over the wallpaper ---------- */

#desktop .menu-bar {
  background: linear-gradient(180deg, rgba(0, 8, 30, .34) 0%, rgba(0, 8, 30, .12) 62%, rgba(0, 8, 30, 0) 100%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  color: var(--lg-on-wallpaper);
  font: 500 13px/1 var(--lg-font);
  letter-spacing: -.01em;
  text-shadow: 0 1px 2px rgba(0, 10, 40, .45), 0 0 8px rgba(0, 10, 40, .22);
}
body.dark-desktop #desktop .menu-bar,
body.work-mode #desktop .menu-bar {
  background: linear-gradient(180deg, rgba(0, 0, 0, .46) 0%, rgba(0, 0, 0, .2) 62%, rgba(0, 0, 0, 0) 100%);
}
#desktop .menu-left, #desktop .menu-right { gap: 2px; }
#desktop .menu-left { padding-left: 0; }
#desktop #active-app {
  font-size: 13px; font-weight: 700; padding: 0 9px; white-space: nowrap;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}

#desktop .menu-trigger, #desktop .menu-icon, #desktop .menu-clock {
  position: relative; min-height: 28px; padding: 0 9px; border: 0; border-radius: 8px;
  background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-shadow: inherit;
  display: inline-flex; align-items: center; justify-content: center; cursor: default;
  transition: background var(--lg-fast) var(--lg-ease);
}
#desktop .menu-trigger:hover, #desktop .menu-icon:hover, #desktop .menu-clock:hover { background: rgba(255, 255, 255, .16); }
#desktop .menu-trigger.is-open, #desktop .menu-icon[aria-expanded="true"] { background: rgba(255, 255, 255, .26); }
#desktop .menu-trigger:focus-visible, #desktop .menu-icon:focus-visible, #desktop .menu-clock:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .85); outline-offset: -2px;
}
#desktop .menu-identity { padding: 0 10px; }
#desktop .brand-monogram { font-size: 20px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }

/* ---------- Status area ---------- */

#desktop .menu-icon { width: 32px; padding: 0; }
#desktop .menu-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 1.5px rgba(0, 10, 40, .4)); }
#desktop .menu-status { display: inline-flex; align-items: center; gap: 5px; padding: 0 6px; color: inherit; }
#desktop .menu-wifi svg { width: 16px; height: 12px; filter: drop-shadow(0 1px 1.5px rgba(0, 10, 40, .4)); }
#desktop .battery-glyph { width: 25px; height: 12px; filter: drop-shadow(0 1px 1.5px rgba(0, 10, 40, .4)); }
#desktop .battery-pct { font-size: 12px; font-variant-numeric: tabular-nums; display: none; }
#desktop #battery-status.has-level .battery-pct { display: inline; }
#desktop .battery-bolt { display: none; }
#desktop #battery-status.is-charging .battery-bolt { display: inline; }
#desktop #battery-status.is-low .battery-level { fill: #ff453a; }
#desktop .menu-clock { padding: 0 9px; }
#desktop #clock { min-width: 0; text-align: right; font-size: 13px; font-weight: 500; white-space: pre; font-variant-numeric: tabular-nums; }
#desktop #clock .clk-date { margin-right: .7em; }

/* ---------- Dropdown menus ---------- */

.menu-layer { position: absolute; inset: 0; z-index: 5200; pointer-events: none; }
.menu-panel {
  --lg-fill-regular: rgba(250, 251, 254, .8);
  position: absolute; min-width: 238px; max-width: calc(100vw - 16px); padding: 6px; border-radius: 14px;
  font: 400 13px/1.25 var(--lg-font); letter-spacing: -.005em; text-shadow: none; outline: 0;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: scale(.94) translateY(-4px); transform-origin: var(--menu-ox, 16px) 0;
  transition: opacity .1s linear, transform .12s var(--lg-ease), visibility 0s .12s;
}
body.dark-desktop .menu-panel { --lg-fill-regular: rgba(34, 36, 46, .86); }
.menu-panel.is-open {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity .12s linear, transform .3s var(--lg-spring), visibility 0s;
}
.menu-item {
  display: grid; grid-template-columns: 15px 1fr auto; align-items: center; column-gap: 5px;
  width: 100%; min-height: 26px; padding: 0 10px 0 6px; border: 0; border-radius: 8px;
  background: transparent; color: var(--lg-text); font: inherit; text-align: left; cursor: default;
}
.mi-check { font-size: 12px; font-weight: 700; text-align: center; }
.mi-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-hint { padding-left: 24px; color: var(--lg-text-2); font-size: 12px; letter-spacing: .02em; }
.menu-item:focus, .menu-item:focus-visible { outline: 0; background: var(--lg-accent); color: #fff; }
.menu-item:focus .mi-hint { color: rgba(255, 255, 255, .78); }
.menu-item[aria-disabled="true"] { color: var(--lg-text-3); }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--lg-separator); }

/* ---------- Control Centre ---------- */

#window-list { display: none !important; }

#appearance-panel.control-centre {
  --cc-module: rgba(255, 255, 255, .42);
  --cc-track: rgba(70, 80, 105, .17);
  --cc-fill: #fff;
  --cc-circle: rgba(88, 98, 124, .22);
  --cc-glyph: rgba(48, 56, 78, .6);
  --lg-fill-regular: rgba(246, 249, 254, .72);
  display: flex; flex-direction: column; gap: 8px;
  width: min(344px, calc(100vw - 24px)); max-height: calc(100svh - 62px); padding: 10px;
  overflow-x: hidden; overflow-y: auto; scrollbar-width: none;
  border-radius: var(--lg-r-panel); font: 400 12px/1.25 var(--lg-font);
  top: 46px; right: 10px;
  transform-origin: calc(100% - 22px) 0;
  transition: opacity .16s linear, transform .46s var(--lg-spring), visibility 0s;
}
#appearance-panel.control-centre::-webkit-scrollbar { display: none; }
body.dark-desktop #appearance-panel.control-centre {
  --cc-module: rgba(255, 255, 255, .08);
  --cc-track: rgba(255, 255, 255, .13);
  --cc-fill: rgba(255, 255, 255, .92);
  --cc-circle: rgba(255, 255, 255, .15);
  --cc-glyph: rgba(255, 255, 255, .75);
  --lg-fill-regular: rgba(30, 32, 42, .76);
}
/* Keep the hidden panel rendered so it can animate out (display:none cannot transition). */
#appearance-panel.control-centre[hidden] {
  display: flex; opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.82) translateY(-10px);
  transition: opacity .14s linear, transform .22s var(--lg-ease), visibility 0s .22s;
}

.cc-module {
  background: var(--cc-module); border-radius: 16px; padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 0 0 .5px rgba(255, 255, 255, .22);
}
body.dark-desktop .cc-module, body.dark-desktop .cc-tile { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), inset 0 0 0 .5px rgba(255, 255, 255, .06); }

.cc-circle {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cc-circle); transition: background var(--lg-fast) var(--lg-ease), transform .3s var(--lg-spring);
}
.cc-circle img { width: 19px; height: 19px; opacity: .62; }
body.dark-desktop .cc-circle img { filter: invert(1); opacity: .8; }

.cc-connect { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 4px; padding: 6px; }
.cc-toggle {
  display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 52px; padding: 6px;
  border: 0; border-radius: 12px; background: transparent; color: var(--lg-text); font: inherit; text-align: left;
  transition: background var(--lg-fast) var(--lg-ease);
}
.cc-toggle:hover { background: var(--lg-hover); }
.cc-toggle:active .cc-circle { transform: scale(.92); }
.cc-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cc-text b { font-size: 12px; font-weight: 600; line-height: 1.2; }
.cc-text small { font-size: 11px; color: var(--lg-text-2); line-height: 1.2; }
.cc-toggle[aria-pressed="true"] .cc-circle { background: var(--lg-accent); box-shadow: 0 2px 8px rgba(10, 132, 255, .38); }
.cc-toggle[aria-pressed="true"] .cc-circle img { filter: invert(1); opacity: 1; }

/* Capsule sliders */
.cc-slide label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 600; margin: 0; color: var(--lg-text); }
.cc-slide label span + span { font-weight: 400; color: var(--lg-text-2); font-variant-numeric: tabular-nums; }
.cc-slider { position: relative; height: 34px; margin-top: 8px; }
.cc-slider svg {
  position: absolute; left: 8px; top: 50%; width: 18px; height: 18px; translate: 0 -50%; pointer-events: none; z-index: 1;
  fill: none; stroke: #7b8394; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.cc-slider input[type="range"] {
  --pf: 1; appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 34px; margin: 0; padding: 0;
  background: transparent; border-radius: 17px; cursor: pointer; accent-color: var(--lg-accent);
}
.cc-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 34px; border-radius: 17px;
  background: linear-gradient(90deg, var(--cc-fill) calc(var(--pf) * (100% - 34px) + 17px), var(--cc-track) 0);
  box-shadow: inset 0 0 0 .5px rgba(0, 10, 30, .1), inset 0 1px 2px rgba(0, 10, 30, .1);
}
.cc-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 34px; height: 34px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 1px 5px rgba(0, 10, 30, .3), 0 0 0 .5px rgba(0, 10, 30, .08);
}
.cc-slider input[type="range"]::-moz-range-track { height: 34px; border-radius: 17px; background: var(--cc-track); }
.cc-slider input[type="range"]::-moz-range-progress { height: 34px; border-radius: 17px 0 0 17px; background: var(--cc-fill); }
.cc-slider input[type="range"]::-moz-range-thumb { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 1px 5px rgba(0, 10, 30, .3); }
.cc-slider input[type="range"]:focus-visible { outline: 2px solid var(--lg-accent); outline-offset: 2px; }

/* Wallpaper */
.cc-wallpaper { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 12px; }
.cc-title { font-size: 12px; font-weight: 600; color: var(--lg-text); }
.cc-swatches { display: flex; gap: 4px; }
.cc-swatches button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 3px 11px 3px 3px;
  border: 0; border-radius: 999px; background: transparent; color: var(--lg-text); font: 500 12px/1 var(--lg-font);
  transition: background var(--lg-fast) var(--lg-ease), box-shadow var(--lg-fast) var(--lg-ease);
}
.cc-swatches button:hover { background: var(--lg-hover); }
.cc-swatches button[aria-pressed="true"] { background: var(--lg-hover); box-shadow: inset 0 0 0 1.5px var(--lg-accent); }
.cc-swatch { width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 .5px rgba(0, 10, 30, .25), inset 0 1px 1px rgba(255, 255, 255, .5); }
.cc-swatch-blue { background: radial-gradient(circle at 30% 25%, #9fd8ff, #2f6bff 70%); }
.cc-swatch-dusk { background: radial-gradient(circle at 30% 25%, #ffc2a8, #8a5cff 72%); }

/* Bottom tiles */
.cc-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cc-tile {
  position: relative; display: flex; align-items: center; gap: 9px; min-height: 52px; padding: 8px 10px 8px 8px;
  border: 0; border-radius: 16px; background: var(--cc-module); color: var(--lg-text); font: 600 12px/1.2 var(--lg-font); text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 0 0 .5px rgba(255, 255, 255, .22);
  transition: background var(--lg-fast) var(--lg-ease), transform var(--lg-fast) var(--lg-ease);
}
.cc-tile:hover { background: var(--lg-hover); }
.cc-tile:active { transform: scale(.97); }
.cc-tile:disabled { opacity: .55; }
.cc-tile .cc-circle { transition: none; }
/* #motion-button's text is rewritten by app.js, so its icon is drawn by pseudo-elements. */
#motion-button { padding-left: 53px; }
#motion-button::before { content: ""; position: absolute; left: 8px; top: 50%; width: 36px; height: 36px; margin-top: -18px; border-radius: 50%; background: var(--cc-circle); }
#motion-button::after {
  content: ""; position: absolute; left: 8px; top: 50%; width: 36px; height: 36px; margin-top: -18px; background: var(--cc-glyph);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36'%3E%3Cpath d='M9 18h4.5l3-7.5 4 15 3-7.5H27' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/36px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36'%3E%3Cpath d='M9 18h4.5l3-7.5 4 15 3-7.5H27' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/36px no-repeat;
}
#motion-button[aria-pressed="true"]::before { background: var(--lg-accent); box-shadow: 0 2px 8px rgba(10, 132, 255, .38); }
#motion-button[aria-pressed="true"]::after { background: #fff; }

/* ---------- Mobile ---------- */

@media (max-width: 760px) {
  #desktop .menu-bar { padding: 0 6px; }
  #desktop .menu-trigger:not(#menu-brand), #desktop .menu-wifi { display: none; }
  #desktop #active-app { max-width: 40vw; padding: 0 4px; }
  #desktop .menu-icon { width: 38px; min-height: 38px; }
  #desktop .menu-trigger, #desktop .menu-clock { min-height: 38px; }
  #desktop #clock { font-size: 12px; min-width: 0; }
  #desktop #clock .clk-date { margin-right: .5em; }
  #desktop .battery-pct { display: none !important; }
  #appearance-panel.control-centre { top: 50px; right: 12px; }
  .cc-toggle { min-height: 56px; }
}
@media (max-width: 440px) {
  #desktop #clock .clk-date { display: none; }
}
