*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --mac-window-bg: rgba(255, 255, 255, 0.86);
  --mac-window-bg-solid: #f5f5f7;
  --mac-window-border: rgba(0, 0, 0, 0.1);
  --mac-title-bar-bg: rgba(232, 232, 237, 0.92);
  --mac-title-text: #1d1d1f;
  --mac-shadow: 0 22px 70px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  --mac-radius: 10px;
  --mac-accent: #007aff;
  --mac-close: #ff5f57;
  --mac-minimize: #febc2e;
  --mac-zoom: #28c840;
  --mac-control-ring: rgba(0, 0, 0, 0.15);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui,
    "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 13px;
  color: #1d1d1f;
}

.desktop {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.wallpaper {
  position: absolute;
  inset: 10%;
  background-image: url("assets/ui/Background.jpg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  border-radius: 0%;
}

.wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.60;
  background-image: url("assets/ui/PaperTexture.png");
  background-size: 220px 220px;
  mix-blend-mode: soft-light;
}

.desktop-icons {
  position: absolute;
  inset: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 4px;
  pointer-events: none;
}

.icon {
  pointer-events: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 72px;
  padding: 4px 2px;
  border: none;
  background: transparent;
  color: #090909;
  cursor: default;
}

.icon:focus-visible {
  outline: 2px solid var(--mac-accent);
  outline-offset: 2px;
}

.icon-glyph {
  display: inline-block;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Desktop + dock glyphs (see index.html, app.js DOCK_ITEMS); swap url() for your PNGs */
.icon-glyph-finder {
  background-image: url("assets/ui/finder.png");
}

.icon-glyph-gmail {
  background-image: url("assets/ui/gmail.png");
}

.icon-glyph-photos {
  background-image: url("assets/ui/photos.png");
}

.icon-glyph-music {
  background-image: url("assets/ui/music.png");
}

.icon-glyph-notes {
  background-image: url("assets/ui/notes.png");
}

.icon-glyph-camera {
  background-image: url("assets/ui/camera.png");
}

.icon-glyph-lightroom {
  background-image: url("assets/ui/lightroom.png");
}

.icon-glyph-photoshop {
  background-image: url("assets/ui/photoshop.png");
}

.icon-glyph-claude {
  background-image: url("assets/ui/claude.png");
}

.icon-glyph-brave {
  background-image: url("assets/ui/brave.png");
}

.icon-glyph-settings {
  background-image: url("assets/ui/settings.png");
}

.icon-glyph-bin {
  background-image: url("assets/ui/trash.png");
}

.icon-glyph-radio {
  background-image: url("assets/ui/icon-all.png");
}

.icon-glyph-gallery {
  background-image: url("assets/ui/icon-all.png");
}

.icon-glyph-stickies-window {
  background-image: url("assets/ui/icon-all.png");
}

.icon-glyph-about {
  background-image: url("assets/ui/icon-all.png");
}

.icon-label {
  max-width: 100%;
  padding: 1px 2px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.window {
  position: absolute;
  left: 96px;
  top: 72px;
  width: min(460px, calc(100vw - 40px));
  background: var(--mac-window-bg);
  border: 1px solid var(--mac-window-border);
  border-radius: var(--mac-radius);
  box-shadow: var(--mac-shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  overflow: hidden;
  display: none;
}

.window.is-open {
  display: block;
}

.window[data-window-id="gallery"].is-open {
  display: flex;
  flex-direction: column;
  max-height: min(85vh, 720px);
}

.window[data-window-id="gallery"] .title-bar {
  flex-shrink: 0;
}

.window[data-window-id="gallery"] .window-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 12px;
}

.title-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 12px;
  background: var(--mac-title-bar-bg);
  color: var(--mac-title-text);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.title-bar:active {
  cursor: grabbing;
}

.title-bar-leading,
.title-bar-trailing {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.title-bar-leading {
  justify-content: flex-start;
}

.title-bar-trailing {
  justify-content: flex-end;
  pointer-events: none;
}

.window-title {
  flex: 0 1 auto;
  max-width: 42%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.window-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.traffic {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 0.5px var(--mac-control-ring);
}

.traffic-minimize,
.traffic-zoom {
  display: block;
  background: var(--mac-minimize);
  pointer-events: none;
}

.traffic-zoom {
  background: var(--mac-zoom);
}

.traffic-close {
  margin: 0;
  padding: 0;
  border: none;
  background: var(--mac-close);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  line-height: 0;
}

.traffic-close::after {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.45);
  line-height: 1;
}

.title-bar:hover .traffic-close::after {
  content: "×";
}

.traffic-close:hover {
  filter: brightness(0.95);
}

.traffic-close:active {
  filter: brightness(0.88);
}

.window-body {
  padding: 12px;
  border: none;
  margin: 0;
  background: var(--mac-window-bg-solid);
}

.sticky-window {
  width: 220px;
}

.note-body {
  min-height: 120px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #fffef0 0%, #fff8dc 100%);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-family: "SF Pro Text", -apple-system, ui-monospace, "Courier New", monospace;
  white-space: pre-wrap;
  color: #1d1d1f;
}

.about-window {
  max-width: 420px;
}

.about-body {
  font-size: 12px;
}

.about-columns {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
}

.about-labels p {
  margin: 0 0 4px;
  font-weight: 600;
  color: #6e6e73;
}

.about-values p {
  margin: 0 0 4px;
  color: var(--mac-title-text);
}

.about-footnote {
  margin-top: 10px;
  font-size: 11px;
  color: #6e6e73;
}

.viz-canvas {
  display: block;
  width: 100%;
  height: 96px;
  background: #0a0a0a;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.ctrl-btn {
  min-width: 36px;
  height: 28px;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  color: var(--mac-title-text);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.ctrl-btn:hover {
  background: #f5f5f7;
}

.ctrl-btn:active {
  background: #ebebed;
  transform: scale(0.98);
}

.volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.volume-label {
  display: none;
}

.volume-wrap input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--mac-accent);
}

.track-meta {
  margin-top: 4px;
  text-align: center;
  max-width: 100%;
}

.track-name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--mac-title-text);
}

.track-duration {
  margin: 4px 0 0;
  font-size: 12px;
  color: #6e6e73;
}

.track-caption {
  margin: 4px 0 0;
  font-size: 12px;
  color: #6e6e73;
}

.radio-layout {
  display: grid;
  grid-template-rows: auto auto;   /* top then bottom */
  grid-template-columns: 1fr;
  gap: 10px;
}

.radio-albums {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* 3 columns */
  grid-template-rows: repeat(2, auto);              /* 2 rows = 2x3 */
  gap: 8px;
}

.album-item {
  cursor: pointer;
  padding: 6px;
  border: 2px solid transparent;
  background: none;
  border-radius: 8px;
  box-shadow: none;
  font: inherit;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.album-item:hover {
  box-shadow: none;
}

.album-item.is-active {
  border-color: var(--mac-accent);
  box-shadow: 0 0 0 1px var(--mac-accent), 0 2px 8px rgba(0, 122, 255, 0.2);
}

.album-cover {
  width: 100px;
  height: 100px;
  position: relative;
  background-size: cover;
  background-position: center center;
  overflow: hidden;
  border-radius: 0%; /* keep the original aspect ratio */
}

.album-title {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--mac-title-text);
}

.radio-player {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "meta vinyl"
    "controls controls";
  column-gap: 16px;
  row-gap: 10px;
  align-items: center;

  margin: 0;                 /* aligns with window-body edges */
  padding: 16px;             /* inner breathing room */
  border: 1px solid rgba(231, 231, 231, 0.12);
  border-radius: 12px;
  background: rgba(221, 221, 221, 0.6);
}

.track-meta {
  grid-area: meta;
  margin-top: 0;
  text-align: left;
  justify-self: start;
}

.vinyl-wrapper {
  grid-area: vinyl;
  display: flex;
  justify-content: flex-end;
}

.radio-controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  justify-content: space-between; /* button left, volume right */
  width: 100%;
  gap: 12px;
}

.volume-wrap {
  max-width: 170px;
  margin-left: auto;
}

.vinyl-wrapper {
  display: flex;
  justify-content: center;
}

.vinyl {
  width: 170px;
  height: 170px;
  border-radius: 80%;
  background-color: #0c0c0c;
  border: none;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.vinyl-center {
  position: absolute;
  inset: 0;
  border-radius: none;
  background-image: url("assets/ui/vinylCenter.jpg"); /* your default art */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #fbfee7; /* fallback while image loads */
}

.vinyl.is-rotating {
  animation: spin 4s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.gallery-scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gallery-item {
  margin: 0;
  padding: 0;
}

.gallery-scroll img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.gallery-item figcaption {
  margin: 0;
  padding: 6px 12px 0;
  font-size: 11px;
  text-align: center;
  color: #6e6e73;
}

/* —— Dock —— */
.dock {
  position: fixed;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  padding: 8px 12px 10px;
  margin: 0;
  list-style: none;
  background: rgba(255, 255, 255, 0.098);
  border: 1px solid rgba(255, 255, 255, 0.097);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  pointer-events: auto;
}

.dock-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: none;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.dock-item-label {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate3d(-50%, 6px, 0);
  margin: 0;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  color: #f5f5f7;
  background: rgba(29, 29, 31, 0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
  z-index: 1;
}

.dock-item:hover .dock-item-label,
.dock-item:focus-visible .dock-item-label {
  opacity: 1;
  visibility: visible;
  transform: translate3d(-50%, 0, 0);
}

.dock-item:hover {
  z-index: 2;
  transform: scale(1.12) translateY(-4px);
  background: rgba(255, 255, 255, 0.5);
}

.dock-item:focus-visible {
  z-index: 2;
  outline: 2px solid var(--mac-accent);
  outline-offset: 2px;
}

.dock-item:active {
  transform: scale(1.05) translateY(-2px);
}

.dock-item-icon.icon-glyph {
  display: inline-block;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* —— macOS-style alert —— */
.alert-root {
  position: fixed;
  inset: 0;
  z-index: 10000;
  padding: 24px;
  pointer-events: none;
}

.alert-root:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.alert-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.alert-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 24px 24px 16px;
  background: var(--mac-window-bg-solid);
  border: 1px solid var(--mac-window-border);
  border-radius: 12px;
  box-shadow: var(--mac-shadow);
  color: var(--mac-title-text);
}

.alert-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

.alert-title-rule {
  height: 2px;
  margin: 0 0 12px;
  border: none;
  border-radius: 1px;
  background: rgba(0, 0, 0, 0.12);
}

.alert-body {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
}

.alert-dialog-icon.icon-glyph {
  display: block;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.alert-message {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 12px;
  line-height: 1.25;
  color: #3a3a3c;
}

.alert-actions {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: flex-end;
}

.alert-btn {
  min-width: 100px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}

.alert-btn-primary {
  background: var(--mac-accent);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 1px 3px rgba(0, 122, 255, 0.35);
}

.alert-btn-primary:hover {
  filter: brightness(1.05);
}

.alert-btn-primary:active {
  transform: scale(0.98);
}

.alert-btn:focus-visible {
  outline: 2px solid var(--mac-accent);
  outline-offset: 2px;
}
