/* Desktop layer. os/desktop.js builds the widget column, notifications, Notification Centre,
   context menu and marquee; the icon styles below restyle the static icons in index.html. */

/* ---------- Desktop icons: label under the icon, no card ---------- */
.desktop-icon {
  position: relative;
  isolation: isolate;
  background: none;
  text-shadow: 0 1px 3px rgba(0, 8, 30, .45);
}
.desktop-icon:hover { background: none; }
.desktop-icon:focus-visible { outline: none; }
/* Keep the description for screen readers, drop it visually (macOS shows only the name). */
.desktop-icon small {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.desktop-icon strong {
  display: inline-block;
  margin-top: 12px;
  padding: 1px 6px 2px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  color: #fff;
  letter-spacing: -.1px;
  transition: background var(--lg-fast) var(--lg-ease);
}
/* Translucent rounded highlight behind the icon. */
.desktop-icon::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 6px;
  left: 50%;
  width: 96px;
  height: 84px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
  opacity: 0;
  transform: translateX(-50%) scale(.9);
  transition: opacity var(--lg-fast) var(--lg-ease), transform var(--lg-medium) var(--lg-spring);
  pointer-events: none;
}
.desktop-icon.is-selected::before,
.desktop-icon:focus-visible::before { opacity: 1; transform: translateX(-50%) scale(1); }
/* Accent-blue label pill. Keyboard focus uses the same look as selection. */
.desktop-icon.is-selected strong,
.desktop-icon:focus-visible strong {
  background: var(--lg-accent);
  text-shadow: none;
  box-shadow: 0 2px 6px rgba(0, 20, 60, .3);
}

/* ---------- Marquee selection ---------- */
.marquee {
  position: fixed;
  z-index: 8200;
  border: 1px solid rgba(10, 132, 255, .9);
  border-radius: 3px;
  background: rgba(10, 132, 255, .18);
  pointer-events: none;
}

/* ---------- Desktop widgets (left column, below the menu bar) ---------- */
.desktop-widgets {
  position: absolute;
  z-index: 3;
  left: 28px;
  top: 20px;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dw {
  --dw-fill: rgba(10, 26, 60, .3);
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 16px 18px;
  border: 0;
  border-radius: 22px;
  color: #fff;
  font: inherit;
  text-align: left;
  text-shadow: 0 1px 4px rgba(0, 8, 30, .35);
  background: var(--lg-sheen), var(--dw-fill);
  box-shadow: var(--lg-rim-strong), var(--lg-shadow-sm);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
}
body.dark-desktop .dw { --dw-fill: rgba(4, 8, 20, .36); }
.dw :focus-visible { outline-color: #fff; }
.dw-title {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .8;
}

/* Calendar */
.dw-weekday { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .9; }
.dw-date { margin: 0 0 6px; font-size: 58px; font-weight: 300; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.dw-month { width: 100%; border-collapse: collapse; text-align: center; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.dw-month caption { caption-side: top; margin-bottom: 6px; text-align: left; font-size: 11px; font-weight: 600; opacity: .85; }
.dw-month th { padding: 2px 0 4px; font-weight: 600; opacity: .6; }
.dw-month td { height: 22px; padding: 0; }
.dw-month td span { display: inline-grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; }
.dw-month .is-today span { background: var(--lg-accent); color: #fff; font-weight: 700; box-shadow: 0 2px 6px rgba(10, 132, 255, .4); }

/* At a glance (whole card is one button that opens About) */
.dw-glance { cursor: pointer; transition: transform var(--lg-fast) var(--lg-ease); }
.dw-glance:active { transform: scale(.98); }
.dw-stat { display: block; font-size: 14px; line-height: 1.55; letter-spacing: -.2px; }
.dw-stat b { font-size: 20px; font-weight: 600; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }

/* Now building */
.dw-building ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.dw-project {
  display: block;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.dw-project:hover { background: rgba(255, 255, 255, .14); }
.dw-project strong { display: block; font-size: 13px; font-weight: 600; }
.dw-project small { display: block; margin-top: 1px; font-size: 10.5px; opacity: .78; }

/* Notification Centre copies: dark text on light glass */
.nc .dw { --dw-fill: rgba(255, 255, 255, .5); padding: 12px 14px; border-radius: 18px; color: var(--lg-text); text-shadow: none; box-shadow: var(--lg-rim), var(--lg-shadow-sm); }
body.dark-desktop .nc .dw { --dw-fill: rgba(255, 255, 255, .08); }
.nc .dw-project:hover { background: rgba(10, 20, 40, .07); }
.nc .dw-date { font-size: 44px; }
.nc .dw-title { opacity: .7; }

/* ---------- Notifications (top right, under the menu bar) ---------- */
.notif-stack {
  position: fixed;
  z-index: 9000;
  top: 55px;
  right: 12px;
  width: min(360px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.notif {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 34px 12px 12px;
  border-radius: 20px;
  color: var(--lg-text);
  background: var(--lg-sheen), var(--lg-fill-thick);
  box-shadow: var(--lg-rim-strong), var(--lg-shadow);
  opacity: 0;
  pointer-events: auto;
  transform: translateX(calc(100% + 32px));
  transition: transform .55s cubic-bezier(.22, 1.12, .36, 1), opacity .2s var(--lg-ease);
}
.notif.is-in { opacity: 1; transform: none; }
.notif.is-out { opacity: 0; transform: translateX(calc(100% + 32px)); transition: transform .3s var(--lg-ease), opacity .2s var(--lg-ease); }
.notif-main {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: default;
}
button.notif-main { cursor: pointer; }
.notif-main:focus-visible { outline: 2px solid var(--lg-accent); outline-offset: 3px; }
.notif-icon { flex: none; width: 36px; height: 36px; border-radius: 9px; object-fit: cover; }
.notif-text { display: flex; flex-direction: column; min-width: 0; }
.notif-text strong { font-size: 13px; font-weight: 600; line-height: 1.3; letter-spacing: -.1px; }
.notif-body { margin-top: 2px; font-size: 12px; line-height: 1.35; color: var(--lg-text-2); }
.notif-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--lg-fill-control);
  color: var(--lg-text);
  font: 500 15px/1 var(--lg-font);
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--lg-fast) var(--lg-ease), background var(--lg-fast) var(--lg-ease);
}
.notif-close:hover { background: var(--lg-hover); }
.notif:hover .notif-close,
.notif:focus-within .notif-close,
.notif-close:focus-visible { opacity: 1; }

/* ---------- Notification Centre (tall glass panel, slides in from the right) ---------- */
.nc {
  position: fixed;
  z-index: 9010;
  top: 53px;
  right: 12px;
  bottom: 16px;
  box-sizing: border-box;
  width: min(360px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  overflow: auto;
  scrollbar-width: none;
  border-radius: 24px;
  color: var(--lg-text);
  background: var(--lg-sheen), var(--lg-fill-thick);
  box-shadow: var(--lg-rim-strong), var(--lg-shadow-lg);
  visibility: hidden;
  transform: translateX(calc(100% + 40px));
  transition: transform .5s var(--lg-ease), visibility 0s linear .5s;
}
.nc.is-open { visibility: visible; transform: none; transition: transform .5s var(--lg-ease), visibility 0s; }
.nc:focus { outline: none; }
.nc-head { display: flex; align-items: center; justify-content: space-between; }
.nc-head h2 { margin: 0; font-size: 16px; letter-spacing: -.3px; }
.nc-clear { padding: 4px 8px; border: 0; border-radius: 8px; background: none; color: var(--lg-accent); font: inherit; font-size: 12px; cursor: pointer; }
.nc-clear:hover { background: var(--lg-hover); }
.nc-empty { margin: 14px 0; text-align: center; font-size: 13px; color: var(--lg-text-2); }
.nc-list { display: grid; gap: 6px; }
.nc-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: var(--lg-fill-control);
  color: inherit;
  font: inherit;
  text-align: left;
}
button.nc-row { cursor: pointer; }
button.nc-row:hover { background: var(--lg-hover); }
.nc-icon { flex: none; width: 26px; height: 26px; border-radius: 7px; object-fit: cover; }
.nc-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nc-row-text strong { font-size: 13px; font-weight: 600; }
.nc-row-text span { font-size: 12px; line-height: 1.35; color: var(--lg-text-2); }
.nc-row-text time { font-size: 10.5px; color: var(--lg-text-3); }
.nc-sub { margin: 4px 0 -4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--lg-text-2); }
.nc-widgets { display: grid; gap: 10px; }

/* ---------- Desktop context menu ---------- */
.ctx {
  position: fixed;
  z-index: 9020;
  top: 0;
  left: 0;
  min-width: 220px;
  padding: 5px;
  border-radius: 12px;
  color: var(--lg-text);
  background: var(--lg-sheen), var(--lg-fill-thick);
  box-shadow: var(--lg-rim-strong), var(--lg-shadow);
  visibility: hidden;
  opacity: 0;
  transform: scale(.96);
  transform-origin: top left;
  transition: opacity var(--lg-fast) var(--lg-ease), transform var(--lg-fast) var(--lg-spring), visibility 0s linear var(--lg-fast);
}
.ctx.is-open { visibility: visible; opacity: 1; transform: none; transition: opacity var(--lg-fast) var(--lg-ease), transform var(--lg-fast) var(--lg-spring), visibility 0s; }
.ctx:focus { outline: none; }
.ctx-item {
  display: flex;
  width: 100%;
  min-height: 24px;
  align-items: center;
  padding: 4px 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: default;
}
.ctx-item:hover,
.ctx-item:focus { outline: none; background: var(--lg-accent); color: #fff; }
.ctx-sep { height: 1px; margin: 5px 6px; background: var(--lg-separator); }

/* ---------- Visibility rules ---------- */
body.quiet-desktop .desktop-widgets,
body.work-mode .desktop-widgets,
body.profile-mode .desktop-widgets { display: none; }
body.work-mode .notif-stack,
body.profile-mode .notif-stack { display: none; }
/* Widgets need the room the icons leave on the right; below 1050px the icon grid spans the full width. */
@media (max-width: 1050px) {
  .desktop-widgets { display: none; }
}
@media (max-height: 700px) {
  .desktop-widgets .dw-calendar { display: none; }
}
@media (max-width: 760px) {
  .notif-stack,
  .nc { left: 10px; right: 10px; width: auto; }
}
@media (hover: none) {
  .notif-close { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .notif, .notif.is-out, .nc, .ctx, .desktop-icon::before, .dw-glance { transition: none !important; }
}

/* Menus and Control Centre sit above banners: hide banners while they are open. */
.notif-stack { transition: opacity .2s var(--lg-ease); }
body:has(.menu-layer .is-open, #appearance-panel:not([hidden]), #spotlight[open]) .notif-stack { opacity: 0; pointer-events: none; }
.notif-icon { box-shadow: 0 0 0 .5px rgba(255, 255, 255, .35), 0 2px 6px rgba(0, 10, 30, .25); border-radius: 50%; }
