/* Landing page: a Windows 98 style desktop over a pipes screensaver.
   Builds on theme-win98.css (bevels, buttons, taskbar, Start menu). */

html, body { height: 100%; }
html { background: #000; }
body.desktop-page { margin: 0; padding: 0; overflow: hidden; color: #000; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: #fff; padding: 6px 10px; border: 1px solid #000; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.px { image-rendering: pixelated; display: block; }

/* Wallpaper from the desktop folder (replaces the pipes) */
body.has-wallpaper { background-color: var(--wallpaper-color, #008080); background-image: var(--wallpaper); }
body.wallpaper-cover { background-size: cover; background-position: center; background-repeat: no-repeat; }
body.wallpaper-tile { background-repeat: repeat; }
body.wallpaper-center { background-repeat: no-repeat; background-position: center calc(50% - 16px); }
html:has(body.has-wallpaper) { background: var(--wallpaper-color, #008080); }

.dt-custom-icon { width: 48px; height: 48px; object-fit: contain; }
.dt-title-icon img, .dt-title-icon svg { width: 16px; height: 16px; }

#pipes { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
.dt { position: fixed; inset: 0 0 32px 0; z-index: 1; }

/* ---------- Desktop icons ---------- */
.dt-icons {
  position: absolute; top: 0; left: 0; bottom: 0;
  list-style: none; margin: 0; padding: 10px 6px;
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 88px);
  grid-auto-columns: 88px; gap: 6px 4px; width: max-content;
}
.dt-icon {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 88px; padding: 4px 2px; text-decoration: none; color: #fff; outline: none; text-align: center;
}
.dt-icon span {
  font: 12px/1.25 var(--ui); padding: 1px 3px; text-shadow: 1px 1px 0 #000;
  overflow-wrap: anywhere;
}
.dt-icon:hover span, .dt-icon:focus-visible span { background: var(--select); text-shadow: none; }
.dt-icon:focus-visible span { outline: 1px dotted #ffff00; outline-offset: 0; }
.dt-icon:hover svg, .dt-icon:focus-visible svg { filter: brightness(0.75) sepia(1) hue-rotate(185deg) saturate(4); }
.dt-recycle { position: absolute; right: 10px; bottom: 10px; }

/* ---------- Windows ---------- */
.dt-window {
  position: absolute; display: none; flex-direction: column;
  background: var(--face); padding: 3px; box-shadow: var(--raised), 2px 2px 0 rgba(0,0,0,.35);
  max-height: calc(100% - 24px);
}
.dt-window.is-open, .dt-window:target { display: flex; }
.dt-window.is-front { z-index: 5; }
#win-welcome { left: 140px; top: 40px; width: min(600px, calc(100vw - 180px)); }
#win-stories { right: 36px; top: 70px; width: 340px; }
#win-soon { left: 50%; top: 32%; width: 360px; transform: translateX(-50%); z-index: 10; }

.dt-titlebar {
  display: flex; align-items: center; gap: 4px; height: 22px; padding: 2px 3px;
  background: linear-gradient(90deg, var(--title-a), var(--title-b)); cursor: default; user-select: none; touch-action: none;
}
.dt-window:not(.is-front) .dt-titlebar { background: linear-gradient(90deg, #808080, #b5b5b5); }
.dt-title-icon svg { width: 16px; height: 16px; }
.dt-title { flex: 1; margin: 0; color: #fff; font: 700 13px/1 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Title-bar buttons with Windows 98 style pixel glyphs */
.dt-tbtn { flex: none; width: 16px; height: 14px; padding: 0; border: 0; cursor: pointer;
  background: var(--face) no-repeat center / auto; box-shadow: var(--raised); }
.dt-tbtn:active { box-shadow: var(--pressed); background-position: calc(50% + 1px) calc(50% + 1px); }
.dt-tbtn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.dt-min { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='7' shape-rendering='crispEdges'%3E%3Crect x='1' y='5' width='6' height='2'/%3E%3C/svg%3E"); }
.dt-max { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h9v9H0z M1 2v6h7V2z' fill-rule='evenodd'/%3E%3C/svg%3E"); }
.is-max .dt-max { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='9' shape-rendering='crispEdges'%3E%3Cpath d='M2 0h6v6H6V2H3V0z M0 3h6v6H0z M1 5v3h4V5z' fill-rule='evenodd'/%3E%3C/svg%3E"); }
.dt-close { margin-left: 2px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='7' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v1h1v1h2V1h1V0h2v1H7v1H6v1H5v1h1v1h1v1h1v1H6V6H5V5H3v1H2v1H0V6h1V5h1V4h1V3H2V2H1V1H0z'/%3E%3C/svg%3E"); }

/* Maximized: fill the desktop above the taskbar */
.dt-window.is-max { left: 0 !important; top: 0 !important; right: 0 !important; bottom: 0; width: auto !important;
  max-height: none; transform: none !important; }
.dt-window.is-max .dt-body { flex: 1; }

.dt-body { background: #fff; box-shadow: var(--field); margin-top: 3px; padding: 16px 18px 18px; overflow: auto; }
.dt-heading { margin: 0 0 10px; font: 700 15px/1.3 var(--ui); }
.dt-text { font: 15px/1.65 var(--read); }
.dt-text p { margin: 0 0 0.9em; }
.dt-text a, .dt-stories a, .dt-more a { color: var(--link); }
.dt-fine { margin: 14px 0 0; font-size: 12px; }
.dt-fine a { color: var(--link); }
.dt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }

.dt-stories { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font: 14px/1.4 var(--read); }
.dt-stories span { display: block; font: 12px/1.4 var(--ui); color: #444; }
.dt-more { margin: 14px 0 0; font-size: 13px; }

.dt-dialog .dt-body { background: var(--face); box-shadow: none; display: grid; grid-template-columns: 40px 1fr; gap: 6px 12px; align-items: start; }
.dt-msg-icon { grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 2px solid #000080;
  color: #000080; font: italic 700 20px/28px Georgia, serif; text-align: center; }
.dt-msg p { margin: 0; font-size: 13px; line-height: 1.5; }
.dt-msg .dt-actions { justify-content: center; }

/* ---------- Taskbar ---------- */
.taskbar { gap: 4px; }
.start-button { display: inline-flex; align-items: center; gap: 5px; }
.start-mark { width: 16px; height: 14px; background: #000; box-shadow: inset 2px 2px 0 #008080, inset -2px -2px 0 #c0c0c0; }
.start-menu li { list-style: none; }
.start-menu form { margin: 0; }
.start-menu button { display: block; width: 100%; text-align: left; padding: 7px 12px; border: 0; background: none; font: 13px var(--ui); color: #000; cursor: pointer; }
.start-menu button:hover, .start-menu button:focus-visible { background: var(--select); color: #fff; outline: none; }
.task-buttons { display: flex; gap: 3px; flex: 1; min-width: 0; }
.task-btn { flex: 0 1 170px; min-width: 0; height: 24px; padding: 0 8px; text-align: left; border: 0; background: var(--face); box-shadow: var(--raised);
  font: 13px var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.task-btn[hidden] { display: none; }
.task-btn.is-active { font-weight: 700; box-shadow: var(--pressed);
  background: repeating-conic-gradient(var(--face) 0 25%, #fff 0 50%) 0 0 / 2px 2px; }
.tray { display: flex; align-items: center; gap: 8px; height: 24px; padding: 0 8px 0 4px;
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 #fff; }
.tray-search input { width: 15rem; height: 20px; min-height: 0; padding: 2px 6px; font-size: 12px; }
.clock { font: 12px var(--ui); min-width: 58px; text-align: right; white-space: nowrap; }

/* ---------- Small screens: stack instead of floating windows ---------- */
@media (max-width: 760px) {
  body.desktop-page { overflow: auto; }
  .dt { position: relative; inset: auto; padding-bottom: 44px; }
  .dt-icons { position: static; grid-auto-flow: row; grid-template-columns: repeat(auto-fill, 84px); grid-template-rows: none; grid-auto-columns: auto; width: auto; height: auto; justify-content: center; }
  .dt-icon { width: 84px; }
  .dt-recycle { position: static; margin: 0 auto; }
  .dt-window { position: static; width: auto !important; margin: 10px; transform: none !important; max-height: none; }
  #win-soon { position: fixed; left: 10px; right: 10px; top: 25%; }
  .task-buttons { display: none; }
  .tray { flex: 1; }
  .tray-search { flex: 1; }
  .tray-search input { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .px-cursor { animation: none; }
}
.px-cursor { animation: blink 1.06s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
