/* PROTOTYPE: Andy's computer, laid over the iMac's screen (js/desktop.js). The look comes from the kit (css/mac.css);
   this file is the shell's own layout: the scaled screen, wallpaper, menu bar, widget, dock, windows and Ask panel.
   Inside .dt-screen, 1 CSS px = 1 point of the virtual desktop; the shell scales it to the screen's rectangle. */
#desktop.dt {
  position: fixed; left: var(--dx, 0px); top: var(--dy, 0px); width: var(--dw, 960px); height: var(--dh, 600px);
  z-index: 15; opacity: 0; transition: opacity 0.22s ease;
}
#desktop.dt.on { opacity: 1; }
#desktop.dt:focus { outline: none; }

.dt-screen { position: absolute; left: 0; top: 0; overflow: hidden; transform-origin: 0 0; background: #1a1a1a; isolation: isolate; }
.dt--expanded .dt-screen { position: fixed; left: 0; top: 0; }
.dt-screen :where(p, h1, h2, h3, h4, ul, ol, dl, dd, figure) { margin: 0; }
.dt-wall { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }

/* ---------- the menu bar: transparent over the wallpaper ---------- */
.dt-menubar { position: absolute; left: 0; right: 0; top: 0; z-index: 50; }
.dt-menubar .mac-menubar__title svg { width: 16px; height: 16px; }
.dt-menubar [data-menu="mark"] svg { width: 17px; height: 17px; }
.mac .dt-menubar .mac-menu:focus { outline: none; }   /* a menu whose items are all disabled holds the focus itself */
.dt-clock { white-space: pre; cursor: default; font-variant-numeric: tabular-nums; }
.dt-screen--narrow .dt-menubar { padding: 0 4px; }
.dt-screen--narrow .dt-menubar .mac-menubar__title { padding: 0 7px; }
.dt-screen--narrow .dt-menubar .mac-menubar__title--app { padding: 0 7px 0 8px; max-width: 132px; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 24px; }

/* ---------- desktop widget and file ---------- */
.dt-widgets {
  position: absolute; left: 20px; right: 20px; top: 42px; z-index: 1;
  display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none;
}
.dt-widgets > * { pointer-events: auto; }
.dt-screen .dt-widget { width: 300px; padding: 14px 16px 15px; border-radius: 22px; display: grid; gap: 3px; color: var(--glass-label-primary); }
.dt-widget__head { display: flex; align-items: center; gap: 6px; }
.dt-widget__mark { display: inline-flex; width: 16px; height: 16px; color: var(--glass-label-primary); }
.dt-widget__mark svg { width: 16px; height: 16px; }
.dt-widget__name { color: var(--glass-label-primary); }
.dt-widget__headline { color: var(--glass-label-secondary); }
.dt-widget__rule { margin: 8px 0 7px; background: var(--vibrant-separator); }
.dt-widget__label { color: var(--glass-label-secondary); letter-spacing: 0.6px; }
.dt-widget__now { color: var(--glass-label-primary); }
.dt-widget__where { display: flex; align-items: center; gap: 4px; margin-top: 5px; color: var(--glass-label-secondary); }
.dt-widget__pin { display: inline-flex; width: 13px; height: 13px; flex: none; }
.dt-widget__pin svg { width: 13px; height: 13px; }

.dt-file {
  display: grid; justify-items: center; gap: 4px; width: 156px; padding: 6px 4px 4px; margin: 0; border: 0; border-radius: 10px;
  background: none; cursor: pointer; color: var(--mac-label-primary);
}
.dt-file__icon { display: block; width: 60px; height: 60px; }
.dt-file__icon svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25)); }
.dt-file__name {
  max-width: 100%; padding: 1px 5px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 500 12px/15px var(--font-sans); letter-spacing: 0; text-align: center;
  text-shadow: 0 0 3px color-mix(in srgb, var(--mac-window-background) 70%, transparent);
}
.dt-file:hover .dt-file__icon svg { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25)) brightness(0.96); }
.dt-file:focus-visible { outline: none; }
.dt-file:focus-visible .dt-file__name { background: var(--accent); color: var(--on-accent); text-shadow: none; }
.dt-file:focus-visible .dt-file__icon { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 8px; }

/* phones: a compact widget, a smaller file */
.dt-screen--narrow .dt-widgets { left: 8px; right: 8px; top: 31px; }
.dt-screen--narrow .dt-widget { width: min(212px, 60%); padding: 9px 11px 10px; border-radius: 16px; gap: 2px; }
.dt-screen--narrow .dt-widget__headline, .dt-screen--narrow .dt-widget__rule { display: none; }
.dt-screen--narrow .dt-widget__label { margin-top: 3px; }
.dt-screen--narrow .dt-widget__now { font-size: 12px; line-height: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dt-screen--narrow .dt-widget__where { margin-top: 2px; }
.dt-screen--narrow .dt-file { width: 92px; padding: 2px; }
.dt-screen--narrow .dt-file__icon { width: 40px; height: 40px; }
.dt-screen--narrow .dt-file__name { font-size: 10px; line-height: 13px; }

/* ---------- the dock: an original glass launcher ---------- */
.dt-screen .dt-dock { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 40; padding: 6px; border-radius: 24px; }
.dt-dock__list { display: flex; gap: 6px; }
.dt-dock__item {
  position: relative; display: block; width: 56px; height: 56px; padding: 0; margin: 0; border: 0; border-radius: 14px;
  background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.dt-dock__icon { display: block; width: 100%; height: 100%; transition: transform 0.12s ease, filter 0.12s ease; }
.dt-dock__icon svg { display: block; width: 100%; height: 100%; }
.dt-dock__item:active .dt-dock__icon { filter: brightness(0.78); transform: scale(0.96); }
.dt-dock__item:focus-visible { outline-offset: 0; }
.dt-screen .dt-dock__tip {
  position: absolute; left: 50%; bottom: calc(100% + 16px); transform: translateX(-50%);
  display: flex; align-items: center; height: 26px; padding: 0 11px; white-space: nowrap; pointer-events: none;
  font: 500 13px/16px var(--font-sans); letter-spacing: -0.08px; opacity: 0; transition: opacity 0.12s ease;
}
.dt-dock__item:hover .dt-dock__tip, .dt-dock__item:focus-visible .dt-dock__tip { opacity: 1; }
.dt-dock__dot {
  position: absolute; left: 50%; bottom: -5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%;
  background: var(--glass-label-primary); opacity: 0; transition: opacity 0.2s ease;
}
.dt-dock__item.is-running .dt-dock__dot { opacity: 0.7; }
@keyframes dt-bounce { 0%, 100% { transform: none; } 22% { transform: translateY(-16px); } 45% { transform: none; } 65% { transform: translateY(-7px); } 82% { transform: none; } }
.dt-dock__item.is-bouncing .dt-dock__icon { animation: dt-bounce 0.68s cubic-bezier(0.3, 0.7, 0.4, 1); }
.dt-screen--narrow .dt-dock { bottom: 6px; padding: 5px; border-radius: 17px; }
.dt-screen--narrow .dt-dock__list { gap: 4px; }
.dt-screen--narrow .dt-dock__item { width: 38px; height: 38px; border-radius: 10px; }
.dt-screen--narrow .dt-dock__tip { display: none; }
.dt-screen--narrow .dt-dock__dot { bottom: -4px; width: 3px; height: 3px; margin-left: -1.5px; }

/* ---------- windows ---------- */
.dt-windows { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.dt-win { pointer-events: auto; transform-origin: 50% 50%; transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.dt-win:focus { outline: none; }
.dt-win.is-opening { opacity: 0; transform: scale(0.965); }
.dt-win.is-closing { opacity: 0; transform: scale(0.97); transition-duration: 0.15s; }
.dt-win.is-minimizing { opacity: 0; transform: var(--dt-genie, scale(0.1)); transition: opacity 0.28s ease-in, transform 0.28s cubic-bezier(0.5, 0, 0.75, 0.4); }
.dt-win.is-dragging { transition: none; user-select: none; -webkit-user-select: none; }
.dt-win .mac-window__titlebar { cursor: default; }
.dt-win--full { border-radius: 0 0 16px 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }
.dt-win--full::after { border-radius: 0 0 16px 16px; }
.dt--expanded .dt-screen--narrow .dt-dock { bottom: calc(6px + env(safe-area-inset-bottom)); }
.dt-win .mac-window__body:focus { outline: none; }

/* an app that isn't there yet */
.dt-soon { min-height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 32px; text-align: center; }
.dt-soon__icon { width: 64px; height: 64px; margin-bottom: 6px; }
.dt-soon__icon svg { display: block; width: 100%; height: 100%; }
.dt-soon p { max-width: 340px; }

/* "About This Computer" */
.dt-about { display: grid; justify-items: center; gap: 6px; padding: 8px 28px 28px; text-align: center; }
.dt-about__mark { width: 72px; height: 72px; margin-bottom: 6px; color: var(--mac-label-primary); }
.dt-about__mark svg { width: 100%; height: 100%; }
.dt-about__sub { color: var(--mac-label-secondary); margin-bottom: 12px; }
.mac .dt-about__rows { width: 100%; text-align: start; margin: 0 0 14px; }

/* ---------- the Ask panel: a centered glass field ---------- */
.dt-ask {
  position: absolute; left: 50%; top: 17%; z-index: 60; width: min(660px, calc(100% - 24px)); transform: translate(-50%, -6px);
  display: grid; gap: 10px; opacity: 0; transition: opacity 0.14s ease, transform 0.18s ease;
}
.dt-ask.on { opacity: 1; transform: translate(-50%, 0); }
.dt-screen .dt-ask__bar { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 18px 0 16px; border-radius: 9999px; }
.dt-ask__glyph { display: inline-flex; flex: none; color: var(--glass-label-secondary); }
.dt-ask__glyph svg { width: 20px; height: 20px; }
.dt-ask__input {
  flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; border: 0; background: none; outline: none;
  font: 400 20px/24px var(--font-sans); letter-spacing: -0.45px; color: var(--glass-label-primary); caret-color: var(--accent);
}
.mac .dt-ask__input:focus-visible { outline: none; }
.dt-ask__input::placeholder { color: var(--glass-label-secondary); opacity: 1; }
.dt-ask__spin {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--glass-label-tertiary); border-top-color: var(--glass-label-primary); animation: dt-spin 0.8s linear infinite;
}
@keyframes dt-spin { to { transform: rotate(360deg); } }
.dt-screen .dt-ask__out { max-height: min(430px, 56vh); overflow: auto; padding: 16px 18px 14px; border-radius: 26px; color: var(--glass-label-primary); }
.dt-ask__answer { white-space: pre-line; }
.dt-ask__error { font-weight: 500; }
.dt-ask__heading { margin: 14px 0 6px; font: 700 11px/14px var(--font-sans); letter-spacing: 0.06px; color: var(--glass-label-secondary); }
.dt-ask__records { list-style: none; margin: 0 -8px; padding: 0; display: grid; gap: 2px; }
.dt-ask__row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; margin: 0; border: 0; border-radius: 10px;
  background: none; text-align: start; cursor: pointer; color: var(--glass-label-primary);
}
.dt-ask__row:hover, .mac .dt-ask__row:focus-visible { background: var(--accent); color: var(--on-accent); outline: none; }
.dt-ask__row:hover .dt-ask__sub, .dt-ask__row:focus-visible .dt-ask__sub,
.dt-ask__row:hover .dt-ask__chev, .dt-ask__row:focus-visible .dt-ask__chev { color: inherit; }
.dt-ask__cover { flex: none; width: 36px; height: 36px; border-radius: 6px; overflow: hidden; background: var(--mac-fill-secondary); }
.dt-ask__cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dt-ask__text { display: grid; flex: 1 1 auto; min-width: 0; }
.dt-ask__title, .dt-ask__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-ask__sub { color: var(--glass-label-secondary); }
.dt-ask__chev { display: inline-flex; flex: none; color: var(--glass-label-secondary); }
.dt-ask__chev svg { width: 14px; height: 14px; }
.dt-ask__sources { margin: 0; padding-left: 16px; color: var(--glass-label-secondary); display: grid; gap: 2px; }
.dt-ask__mode { margin-top: 12px; color: var(--glass-label-secondary); }
.dt-screen--narrow .dt-ask { top: 30px; width: calc(100% - 16px); }
.dt-screen--narrow .dt-ask__bar { height: 40px; padding: 0 14px 0 12px; }
.dt-screen--narrow .dt-ask__input { font-size: 16px; line-height: 20px; }
.dt-screen--narrow .dt-ask__out { max-height: calc(100vh - 90px); padding: 12px 14px; border-radius: 18px; }

/* ---------- the way out: a glass pill just above the screen ---------- */
.dt-stepwrap { position: absolute; right: 0; bottom: calc(100% + 10px); background: none; }
.dt-step {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px 0 10px; margin: 0; border: 0; cursor: pointer;
  font: 500 13px/16px var(--font-sans); letter-spacing: -0.08px; color: var(--glass-label-primary);
}
.dt-step svg { width: 16px; height: 16px; flex: none; }
.dt-step:active { background-image: linear-gradient(var(--pressed-overlay), var(--pressed-overlay)); }
.dt--expanded .dt-stepwrap { display: none; }

@media (prefers-reduced-motion: reduce) {
  #desktop.dt, .dt-win, .dt-ask, .dt-dock__icon, .dt-dock__tip { transition: none !important; }
  .dt-dock__item.is-bouncing .dt-dock__icon { animation: none; }
  .dt-ask__spin { animation-duration: 2.4s; }
}
