:root {
  --menubar-h: 26px;
  --dock-h: 68px;
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.35);
  --text-dark: #1d1d1f;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --cursor-default: url("assets/cursors/default.svg") 10 7, default;
  --cursor-pointer: url("assets/cursors/pointer.svg") 20 12, pointer;
}

/* Cursores más grandes en pantallas amplias */
@media (min-width: 1800px), (min-resolution: 2.5dppx) {
  :root {
    --cursor-default: url("assets/cursors/lg/default.svg") 14 11, default;
    --cursor-pointer: url("assets/cursors/lg/pointer.svg") 30 19, pointer;
  }
}

html, body, .desktop, .win { cursor: var(--cursor-default); }
button { font: inherit; }
a, button, [role="button"], .folder, .dock-item, .photos-widget { cursor: var(--cursor-pointer); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Helvetica, Arial, sans-serif;
  background: #e9e9ec;
}

/* ---------- Menu bar ---------- */
.menubar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--menubar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  font-size: 13px;
  color: var(--text-dark);
  z-index: 50;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.menubar-left, .menubar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.apple-logo {
  width: 14px;
  height: 14px;
  display: inline-block;
  background: var(--text-dark);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 384 512'><path d='M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zM256.4 88.9c26.9-32 24.5-61.2 23.7-71.9-23.8 1.4-51.4 16.4-67.1 34.9-17.3 19.8-27.5 44.3-25.3 71.9 26.2 2 50.1-11.3 68.7-34.9z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 384 512'><path d='M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zM256.4 88.9c26.9-32 24.5-61.2 23.7-71.9-23.8 1.4-51.4 16.4-67.1 34.9-17.3 19.8-27.5 44.3-25.3 71.9 26.2 2 50.1-11.3 68.7-34.9z'/></svg>");
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
}

.menu-item { white-space: nowrap; }
.menu-item.bold { font-weight: 600; }

/* ---------- Desktop ---------- */
.desktop {
  position: fixed;
  inset: 0;
  padding-top: var(--menubar-h);
  padding-bottom: var(--dock-h);
  background: #0c1647 url("assets/wallpaper/wallpaper-solar-gradients.jpg") center / cover no-repeat;
  background-image: image-set(url("assets/wallpaper/wallpaper-solar-gradients.webp") type("image/webp"), url("assets/wallpaper/wallpaper-solar-gradients.jpg") type("image/jpeg"));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.icons-grid {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 28px 30px;
  max-width: min(94vw, 660px);
  padding: 4px;
}

.folder {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 130px;
  cursor: var(--cursor-pointer);
  user-select: none;
  -webkit-user-select: none;
  padding: 6px 4px;
  border-radius: 8px;
  transition: background 0.12s ease;
}

.folder:hover { background: rgba(255,255,255,0.12); }

.folder:active .folder-icon,
.folder.selected .folder-icon { filter: brightness(0.92); }

.folder.selected .folder-label {
  background: #0a66ff;
  color: #fff;
}

.folder-icon {
  width: 88px;
  height: 73px;
  margin-bottom: 6px;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,0.3));
}

.folder-label, .app-icon-label {
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  /* texto blanco con sombra (estilo macOS sobre fondo oscuro) */
  color: #fff;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,0.75);
  padding: 1px 6px;
  border-radius: 4px;
  max-width: 100%;
  overflow-wrap: break-word;
}

/* ---------- Dock ---------- */
.dock-wrapper {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 8px;
  display: flex;
  justify-content: center;
  z-index: 40;
  pointer-events: none;
}

.dock {
  --dock-icon: 48px;
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: calc(var(--dock-icon) + 16px);
  padding: 8px 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.dock-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: var(--cursor-pointer);
}

.dock-icon {
  width: calc(var(--dock-icon) * var(--s, 1));
  height: calc(var(--dock-icon) * var(--s, 1));
  border-radius: 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  transition: width 0.14s ease-out, height 0.14s ease-out;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.dock-icon svg { width: 58%; height: 58%; }

.dock-item::after {
  content: attr(data-name);
  position: absolute;
  bottom: 100%;
  margin-bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,32,0.85);
  color: #fff;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.dock-item:hover::after { opacity: 1; }

.dock-separator {
  width: 1px;
  align-self: stretch;
  background: rgba(0,0,0,0.15);
  margin: 4px 2px;
}

.linkedin { background: linear-gradient(135deg, #2f8fd8, #0a66c2); }
.mail { background: linear-gradient(135deg, #6dc3ff, #1f6fff); }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .dock { --dock-icon: 40px; }
}

/* ---------- Widgets ---------- */
.widget {
  position: fixed;
  z-index: 30;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 10px 30px rgba(0,0,0,0.22);
  color: var(--text-dark);
}

/* Música */
.music-widget {
  top: calc(var(--menubar-h) + 16px);
  left: 16px;
  width: 280px;
  padding: 14px;
}

.music-top { display: flex; align-items: center; gap: 12px; }

.music-cover {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff7eb3, #8a6bff);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.9);
  font-size: 26px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}
.music-cover.has-image span { display: none; }

.music-info { min-width: 0; }
.music-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-artist {
  font-size: 12px;
  color: rgba(29,29,31,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-progress { margin-top: 14px; }
.music-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(0,0,0,0.15);
  cursor: var(--cursor-pointer);
  position: relative;
}
.music-bar::before { content: ""; position: absolute; inset: -6px 0; }
.music-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: rgba(29,29,31,0.75);
}
.music-times {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 10px;
  color: rgba(29,29,31,0.55);
  font-variant-numeric: tabular-nums;
}

.music-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  margin-top: 6px;
}
.ctrl {
  background: none;
  border: none;
  padding: 4px;
  color: var(--text-dark);
  cursor: var(--cursor-pointer);
  display: flex;
  border-radius: 50%;
  transition: transform 0.1s ease, opacity 0.1s ease;
}
.ctrl:hover { opacity: 0.7; }
.ctrl:active { transform: scale(0.9); }
.ctrl.play .icon-pause { display: none; }
.ctrl.play.playing .icon-play { display: none; }
.ctrl.play.playing .icon-pause { display: block; }

/* Fotos */
.photos-widget {
  right: 16px;
  bottom: 16px;
  width: 200px;
  height: 200px;
  overflow: hidden;
  padding: 0;
}

.photos-stage { position: absolute; inset: 0; }
.photo-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.photo-slide.active { opacity: 1; }

.photos-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 26px 12px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.45));
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.photos-badge {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: conic-gradient(#ff5f57, #febc2e, #f5e94a, #28c840, #3d9dfa, #a074f5, #ff5f57);
}

@media (max-width: 900px) {
  .photos-widget { display: none; }
  .music-widget { width: 230px; padding: 10px; }
}
