/* css/main.css — shell layers (wallpaper, mount points) + menu bar. Owner: Dev A. */

:root {
  --tb-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --tb-menubar-h: 28px;
  --tb-glass: rgba(255, 255, 255, .16);
  --tb-radius: 12px;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: var(--tb-font);
  /* Neutral backdrop until the first city video starts playing. */
  background: #121b27;
}

/* ---- mount-point layers ---- */

#desktop {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* Video-only wallpaper crossfade layers (built by js/menubar.js). */
#desktop .tb-wall-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.4s cubic-bezier(.22,1,.36,1); /* duration overridden inline by wallpaperFade */
  overflow: hidden;
  pointer-events: none;
}

#desktop .tb-wall-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

#desktop .tb-wall-video[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  #desktop .tb-wall-layer { transition: none; }
}

/* top-left Apple logo image in the menu bar (SVG fallback in js if missing) */
#menubar-root .tb-apple-logo {
  height: 15px;
  width: auto;
  display: block;
}

/* Wallpaper video attribution (bottom-left; links to its source page). */
.tb-wall-credit {
  position: fixed;
  left: 12px;
  bottom: 10px;
  z-index: 1;
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.tb-wall-credit--on {
  opacity: 0.85;
  pointer-events: auto;
}

.tb-wall-credit:hover {
  opacity: 1;
  text-decoration: underline;
}

@media (max-width: 768px) {
  .tb-wall-credit { bottom: 104px; }
}

/* Desktop furniture layers: folders top-right, widget column on the left.
   z-index 2 → above the wallpaper (0), below windows (10). Roots are
   click-through; children re-enable pointer events. */
/* Icons layer spans the whole desktop so icons can be dragged anywhere;
   icons position themselves absolutely inside it (desktop-icons.js). */
#icons-root {
  position: fixed;
  top: calc(var(--tb-menubar-h) + 10px);
  right: 14px;
  bottom: 96px;
  left: 14px;
  z-index: 2;
  pointer-events: none;
}

#widgets-root {
  --tb-widget-column: 336px;
  --tb-widget-gap: 16px;
  position: fixed;
  top: calc(var(--tb-menubar-h) + 16px);
  left: 16px;
  bottom: 96px;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Promo column: download card + banners down the RIGHT edge (balances the
   left-side widget column). Same z-2 furniture layer, click-through root. */
#promo-root {
  position: fixed;
  top: calc(var(--tb-menubar-h) + 10px);
  right: 14px;
  bottom: 96px;
  width: 300px;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#menubar-root {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--tb-menubar-h);
  z-index: 20;
}

#notch-root {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
}

#windows-root {
  position: fixed;
  inset: var(--tb-menubar-h) 0 0 0;
  z-index: 10;
  pointer-events: none;
}

#windows-root > * {
  pointer-events: auto;
}

#dock-root {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
}

/* ---- menu bar ---- */

.tb-menubar {
  height: var(--tb-menubar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: #fff;
  font-size: 13px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
  -webkit-user-select: none;
  user-select: none;
}

.tb-menubar-left,
.tb-menubar-right {
  display: flex;
  align-items: center;
  height: 100%;
}

.tb-menubar-right {
  gap: 14px;
}

.tb-menu {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

.tb-menu-label {
  display: flex;
  align-items: center;
  height: calc(100% - 6px);
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  text-shadow: inherit;
  cursor: default;
}

.tb-menu-label.tb-bold {
  font-weight: 700;
}

.tb-menu.tb-open .tb-menu-label {
  background: rgba(255, 255, 255, .22);
}

.tb-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 230px;
  padding: 5px;
  border-radius: 8px;
  background: rgba(246, 246, 250, .84);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .15);
  color: #1c1c1e;
  text-shadow: none;
}

.tb-menu.tb-open .tb-dropdown {
  display: block;
}

.tb-dropdown-item {
  padding: 4px 10px;
  border-radius: 5px;
  white-space: nowrap;
}

.tb-dropdown-item:not(.tb-disabled):hover {
  background: rgba(0, 0, 0, .08);
}

.tb-dropdown-item.tb-disabled {
  color: rgba(60, 60, 67, .38);
}

.tb-dropdown-sep {
  height: 1px;
  margin: 5px 10px;
  background: rgba(60, 60, 67, .16);
}

/* Apple Support's Control Center silhouette, tinted to the menu bar text.
   Source: ipcdn-web.apple.com/assets/v2/web/83f4d7c5-4244-48ce-ae13-cce2bdd9456e */
.tb-cc-icon {
  display: block;
  flex: 0 0 auto;
  width: 14px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url('../assets/icons/control-center-apple.png') center / contain no-repeat;
  mask: url('../assets/icons/control-center-apple.png') center / contain no-repeat;
  pointer-events: none;
}

.tb-cc-btn {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: var(--tb-menubar-h);
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tb-cc-btn:hover,
.tb-cc-btn:active,
.tb-cc-btn:focus,
.tb-cc-btn.tb-open,
.tb-cc-btn[aria-expanded="true"] {
  background: transparent;
  box-shadow: none;
}
.tb-cc-btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -3px;
}

/* Control Center panel: dark frosted (matches the reference clone) */
.tb-cc-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 8px;
  width: 300px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(30, 30, 32, .72);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 12px 38px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .15);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;
  text-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tb-cc-panel[hidden] {
  display: none;
}

.tb-cc-slider {
  width: 100%;
  margin: 0;
  accent-color: #0a84ff;
}

.tb-cc-slider:disabled {
  opacity: .4;
}

/* two-part clock: date + time spans with a 6px gap */
.tb-clock {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ---- responsive: phones ----
   Everything below only applies inside these media queries; desktop rules
   above are untouched. nth-of-type indexes count the .tb-menu divs in the
   left cluster in DOM order: 1=apple, 2=File, 3=Edit, 4=View, 5=Window,
   6=Help (the bold site name is a span, not counted). */

@media (max-width: 768px) {
  :root {
    --tb-menubar-h: 24px;
  }

  .tb-menubar {
    padding: 0 8px;
    font-size: 12px;
  }

  .tb-menu-label {
    padding: 0 6px;
  }

  .tb-menubar-right {
    gap: 8px;
  }

  /* File/Edit/View contain only disabled items (pure parody filler) —
     they drop out first so the working menus never wrap or overflow. */
  .tb-menubar-left .tb-menu:nth-of-type(2),
  .tb-menubar-left .tb-menu:nth-of-type(3),
  .tb-menubar-left .tb-menu:nth-of-type(4) {
    display: none;
  }

  .tb-dropdown {
    min-width: 200px;
    max-width: calc(100vw - 24px);
  }

  .tb-cc-panel {
    width: min(300px, calc(100vw - 16px));
    right: 4px;
  }

  /* clock keeps only the time — the full date wraps and crams the bar */
  .tb-clock-date {
    display: none;
  }

  /* PHONE LAYOUT: the desktop becomes a scrolling feed — promo cards and
     widgets stack vertically (DOM order) in a centered column over the fixed
     wallpaper; menubar/notch/dock stay pinned. No overlaps, ever. */
  html, body {
    overflow-y: auto;
  }

  body {
    padding-top: calc(var(--tb-menubar-h) + 8px);
    padding-bottom: 110px; /* clear the fixed dock */
  }

  #promo-root,
  #widgets-root {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    width: auto;
    max-width: 560px;
    margin: 0 auto 14px;
    padding: 0 10px;
    pointer-events: auto;
    flex-direction: column;
    display: flex;
    gap: 14px;
  }

  /* desktop folder icons: dragging is a mouse game — they collide with the
     feed on touch, so they're hidden on phones (folders remain reachable
     via Spotlight and the Finder windows) */
  #icons-root {
    display: none;
  }
}

@media (max-width: 480px) {
  /* small phones: left keeps just the apple menu + bold site name
     (Window/Help links remain reachable from the dock). */
  .tb-menubar-left .tb-menu:nth-of-type(5),
  .tb-menubar-left .tb-menu:nth-of-type(6) {
    display: none;
  }

}

/* ---- Shared battery artwork and Control Center controls ---- */

/* battery icon with the ⚡ charging overlay */
.tb-battery-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.tb-battery-bolt {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
  text-shadow: 0 0 2px rgba(0, 0, 0, .6);
}

/* full-screen dim driven by the CC brightness slider (z 15: above windows,
   below the menu bar so the bar stays readable) */
.tb-dim {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 15;
}

/* CC 2×2 toggle grid */
.tb-cc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tb-cc-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 0 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
}

.tb-cc-tbtn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: default;
}

.tb-cc-tbtn.tb-on {
  background: #0a84ff;
}

.tb-cc-tlabel {
  font-size: 10px;
  color: rgba(255, 255, 255, .85);
  text-align: center;
}

/* CC slider/battery rows */
.tb-cc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
}

.tb-cc-ricon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  flex: none;
}

.tb-cc-row .tb-cc-slider {
  flex: 1;
}

.tb-cc-battpct {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* CC music mini-player row */
.tb-cc-music {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  box-sizing: border-box;
}

.tb-cc-music.tb-cc-disabled {
  opacity: .5;
}

.tb-cc-art {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex: none;
}

.tb-cc-mtexts {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.tb-cc-mtitle {
  font-size: 12px;
  font-weight: 600;
}

.tb-cc-mname {
  font-size: 11px;
  color: rgba(255, 255, 255, .6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-cc-mbtns {
  display: flex;
  gap: 4px;
  flex: none;
}

.tb-cc-mbtn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: default;
}

.tb-cc-mbtn:disabled {
  opacity: .4;
}

.flex{
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}
