/* nonefound.online desktop. Sits on top of XP.css. */

:root {
  --taskbar-h: 30px;
  --sky-top: #2c6fd6;
  --sky-bottom: #8fc1f2;
  --hill: #4c9a2a;
  --hill-light: #7cc246;
  --select: #316ac5;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body.desktop {
  overflow: hidden;
  font-family: "Pixelated MS Sans Serif", Tahoma, Arial, sans-serif;
  font-size: 11px;
  /* Original backdrop: gradient sky + one rolling hill. */
  background:
    radial-gradient(140% 60% at 30% 108%, var(--hill-light) 0 40%, var(--hill) 55%, transparent 56%),
    radial-gradient(120% 50% at 90% 115%, var(--hill) 0 45%, transparent 46%),
    linear-gradient(var(--sky-top), var(--sky-bottom) 70%);
  background-attachment: fixed;
  color: #000;
}

img { image-rendering: pixelated; }

/* ---- desktop icons ------------------------------------------------------ */

.icons {
  position: absolute;
  inset: 8px auto calc(var(--taskbar-h) + 8px) 8px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 14px 8px;
}

.icon {
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 2px;
  color: #fff;
  text-decoration: none;
  text-align: center;
  user-select: none;
  -webkit-user-drag: none;
}

.icon span {
  padding: 1px 3px;
  text-shadow: 1px 1px 1px #000;
  line-height: 1.2;
}

.icon img { -webkit-user-drag: none; }

.icon.selected span,
.icon:focus-visible span {
  background: var(--select);
  text-shadow: none;
  outline: 1px dotted #fff;
}

.icon.selected img { filter: brightness(0.7) sepia(1) hue-rotate(180deg) saturate(3); }
.icon:focus { outline: none; }

/* ---- windows ------------------------------------------------------------ */

#windows { position: absolute; inset: 0 0 var(--taskbar-h) 0; pointer-events: none; }

.window.app {
  position: absolute;
  pointer-events: auto;
  max-width: calc(100vw - 16px);
  display: flex;
  flex-direction: column;
}

.window.app .title-bar { cursor: default; touch-action: none; user-select: none; }

.window.app .window-body {
  overflow: auto;
  max-height: calc(100vh - var(--taskbar-h) - 120px);
}

.window.app.maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  max-width: none;
  height: 100%;
  border-radius: 0;
}

.window.app.maximized .window-body { flex: 1; max-height: none; }

.window.app.dragging { opacity: 0.92; }

/* Inactive title bars, washed out like the real thing. */
.window.app:not(.active) .title-bar {
  background: linear-gradient(180deg, #7a9ef0, #6a8eea 10%, #7d9ff0 85%, #6788e0);
}
.window.app:not(.active) .title-bar-text { color: #d8e4f8; }

.title-bar-text {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.window-body h1 { font-size: 15px; margin: 0 0 8px; }
.window-body p, .window-body ul { line-height: 1.5; }
.window-body a { color: #0b4fc7; }

.file-list { list-style: none; padding: 0; }
.file-list a { display: inline-flex; gap: 6px; align-items: center; padding: 2px 4px; }
.file-list a:hover { background: var(--select); color: #fff; }

.hint { color: #555; }

.window-body h2 { font-size: 12px; margin: 14px 0 6px; }
.window-body h2:first-child { margin-top: 0; }
.window-body h3 { font-size: 11px; margin: 10px 0 4px; }
.gallery-page h2 { margin-top: 14px; padding-bottom: 3px; border-bottom: 1px solid #b8c6dc; color: #1a3d7a; }

/* ---- rules -------------------------------------------------------------- */

.rules section { margin-bottom: 4px; }
.rule-list { padding-left: 24px; margin: 0; }
.rule-list li { padding: 2px 0; }
.rule-list li::marker { font-weight: 700; color: #c1121f; }

/* ---- prim of the week --------------------------------------------------- */

/* index */
.potw-now {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(180deg, #fff, #e8f0fc);
  border: 1px solid #7f9db9;
}
.potw-now p { margin: 0; line-height: 1.4; }
.potw-now-label { color: #1a3d7a; font-weight: 700; }
.potw-now-theme { font-size: 18px; font-weight: 700; }
.potw-filter { margin: 6px 0; }
.potw-filter input { flex: 1; }
.potw-archive {
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid #7f9db9;
}
.potw-cols, .potw-weeks a {
  display: grid;
  grid-template-columns: 3.2em 4.2em 1fr 9em;
  gap: 6px;
  align-items: center;
}
.potw-cols {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 3px 6px;
  background: linear-gradient(180deg, #fff, #ebeadb);
  border-bottom: 1px solid #c7c5b2;
  font-weight: 700;
}
.potw-archive summary {
  padding: 3px 6px;
  font-weight: 700;
  cursor: pointer;
  background: #eef3fc;
  border-bottom: 1px solid #dbe3f0;
}
.potw-archive details[hidden] { display: none; }
.potw-weeks { list-style: none; margin: 0; padding: 0; }
.potw-weeks li[hidden] { display: none; }
.potw-weeks a { padding: 2px 6px; color: #000; text-decoration: none; }
.potw-weeks li:nth-child(even) a { background: #f6f8fc; }
.potw-weeks a:hover, .potw-weeks a:focus-visible { background: var(--select); color: #fff; outline: none; }
.potw-weeks .n { color: #1a3d7a; font-weight: 700; }
.potw-weeks a:hover .n, .potw-weeks a:hover .d, .potw-weeks a:hover .w { color: #fff; }
.potw-weeks .d, .potw-weeks .w { color: #555; }
.potw-weeks .t, .potw-weeks .w { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.potw-empty { padding: 6px; margin: 0; }
@media (max-width: 700px) {
  .potw-cols, .potw-weeks a { grid-template-columns: 3.2em 4.2em 1fr; }
  .potw-cols .w, .potw-weeks .w { display: none; }
}
.potw fieldset { margin-top: 12px; }
.potw fieldset p:last-child { margin-bottom: 0; }

/* weekly post (generated from prim/NNN.md) */
.potw-post h1 { margin: 0 0 4px; }
.potw-post h1 + p { margin-top: 0; font-size: 13px; }
.potw-post h2 { margin-top: 16px; padding-bottom: 3px; border-bottom: 1px solid #b8c6dc; color: #1a3d7a; }
.potw-post p { margin: 6px 0; }
.potw-post .gallery { margin: 4px 0 12px; }
.entrants { margin: 0; padding: 4px 4px 4px 28px; background: #fff; border: 1px solid #7f9db9; }
.entrants li { padding: 3px 4px; line-height: 1.5; }
.entrants li.place-1 { background: #fff4cc; }
.entrants li.place-2 { background: #eef1f4; }
.entrants li.place-3 { background: #f8ebe0; }
.potw-post figure.video { margin: 4px 0 12px; }
.potw-post figure.video video,
.potw-post figure.video iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid #7f9db9;
  background: #000;
}
.potw-post figure.video figcaption { margin-top: 3px; color: #555; }
.potw-post blockquote { margin: 6px 0; padding: 4px 10px; border-left: 3px solid #b8c6dc; }
.potw-nav { margin-top: 14px; }

/* ---- gallery ------------------------------------------------------------ */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  padding: 8px;
  background: #fff;
  border: 1px solid #7f9db9;
}
.gallery figure { margin: 0; text-align: center; }
.gallery a { display: block; padding: 3px; border: 1px solid transparent; line-height: 0; }
.gallery a:hover, .gallery a:focus-visible { border-color: var(--select); background: #dbe7fb; outline: none; }
.gallery img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.gallery figcaption { margin-top: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---- picture viewer ----------------------------------------------------- */

.window-body.viewer { margin: 0; display: flex; flex-direction: column; }
.viewer-stage {
  flex: 1;
  min-height: 200px;
  display: grid;
  place-items: center;
  background: #000;
  overflow: hidden;
}
.viewer-stage img { max-width: 100%; max-height: calc(100vh - var(--taskbar-h) - 160px); display: block; }
.window.app.maximized .viewer-stage img { max-height: calc(100vh - var(--taskbar-h) - 90px); }
.viewer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-top: 1px solid #fff;
}
.viewer-bar button { min-width: 28px; padding: 0 6px; }
.viewer-caption { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.viewer-count { color: #555; }

/* ---- calendar ----------------------------------------------------------- */

.cal { margin-bottom: 8px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head button { min-width: 28px; padding: 0 6px; }
.cal-title { font-size: 12px; }
.cal-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
  border: 1px solid #7f9db9;
}
.cal-grid th { padding: 3px 0; background: #dbe7fb; font-weight: 700; color: #1a3d7a; }
.cal-grid td { padding: 1px; text-align: center; height: 30px; }
.cal-grid td button {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font: inherit;
}
.cal-grid td button:hover { border-color: var(--select); background: #eef3fc; }
.cal-grid td button.has-event { background: #ffe9a8; font-weight: 700; }
.cal-grid td button.today { border-color: #c1121f; }
.cal-grid td button.selected { background: var(--select); color: #fff; }

.events { list-style: none; margin: 0; padding: 0; }
.events li {
  display: grid;
  grid-template-columns: 9em 1fr;
  column-gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px dotted #b8c6dc;
}
.events li[hidden] { display: none; }
.events time { grid-row: span 2; font-weight: 700; color: #1a3d7a; }
.events span { color: #333; }

/* Dialogs (404 etc.) */
.dialog { display: flex; gap: 12px; align-items: flex-start; }
.dialog p { margin: 0; }
.dialog-buttons { justify-content: center; margin-top: 14px; }

a.button {
  display: inline-block;
  min-width: 75px;
  padding: 4px 12px;
  text-align: center;
  color: #000;
  text-decoration: none;
  border: 1px solid #003c74;
  border-radius: 3px;
  background: linear-gradient(180deg, #fff, #ecebe6 86%, #d6d0c5);
}
a.button:hover { box-shadow: inset 0 0 0 2px #f8b636; }

/* ---- standalone pages (no JS / direct visit) ---------------------------- */

body.standalone { display: grid; place-items: center; padding: 16px; overflow: auto; }
body.standalone .window.page { width: min(560px, 100%); }
body.standalone .title-bar-controls .to-desktop {
  color: #fff;
  font-size: 11px;
  padding: 0 6px;
  text-decoration: underline;
}

/* ---- taskbar ------------------------------------------------------------ */

.taskbar {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--taskbar-h);
  display: flex;
  align-items: stretch;
  z-index: 100000;
  background: linear-gradient(180deg, #3168d5, #4993e6 4%, #2157d7 12%, #245edc 88%, #1941a5);
  color: #fff;
}

.start-button {
  min-width: 0;
  min-height: 0;
  padding: 0 22px 0 16px;
  border: 0;
  border-radius: 0 10px 10px 0;
  box-shadow: none;
  font: italic bold 16px/1 "Trebuchet MS", sans-serif;
  color: #fff;
  text-shadow: 1px 1px 2px #1a3d10;
  background: linear-gradient(180deg, #3c8f3c, #4fae4f 10%, #3a9a3a 60%, #2f7d2f);
  cursor: pointer;
}
.start-button:hover { filter: brightness(1.1); }
.start-button.pressed, .start-button:active { filter: brightness(0.85); }
.start-button:focus-visible { outline: 1px dotted #fff; outline-offset: -4px; }

.tasks {
  flex: 1;
  display: flex;
  gap: 3px;
  align-items: center;
  padding: 0 6px;
  overflow: hidden;
}

.task {
  flex: 0 1 160px;
  min-width: 40px;
  height: 22px;
  padding: 0 8px 0 26px;
  border: 1px solid #1a50b8;
  border-radius: 3px;
  box-shadow: none;
  color: #fff;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--icon, none) 6px 50% / 16px no-repeat, linear-gradient(180deg, #3c81f3, #3474e8);
  cursor: pointer;
}
.task:hover { filter: brightness(1.12); }
.taskbar button:focus { outline: none; box-shadow: none; }
.taskbar .task:focus-visible { outline: 1px dotted #fff; outline-offset: -3px; }
.task.current {
  background: var(--icon, none) 6px 50% / 16px no-repeat, linear-gradient(180deg, #1e52b7, #1948a8);
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.45);
}

.tray {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-left: 1px solid #1042af;
  background: linear-gradient(180deg, #0c59b9, #139ee9 6%, #18b5f2 12%, #139beb 88%, #1290e8);
}

/* ---- start menu --------------------------------------------------------- */

.start-menu {
  position: fixed;
  left: 0;
  bottom: var(--taskbar-h);
  width: 260px;
  z-index: 100001;
  border: 1px solid #0831d9;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  background: #fff;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}
.start-menu[hidden] { display: none; }

.start-menu-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  color: #fff;
  font-size: 14px;
  text-shadow: 1px 1px 1px #000;
  background: linear-gradient(180deg, #1868ce, #0e60cb 15%, #0a5bc8 85%, #0c4fb4);
}
.start-menu-header img { border: 2px solid #fff; border-radius: 3px; background: #dfe9f7; }

.start-menu ul { list-style: none; margin: 0; padding: 6px 0; }
.start-menu li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  color: #000;
  text-decoration: none;
}
.start-menu li a:hover, .start-menu li a:focus-visible { background: var(--select); color: #fff; outline: none; }
.start-menu li.sep { height: 1px; margin: 4px 8px; background: #d3d3d3; }

.start-menu-footer {
  display: flex;
  justify-content: flex-end;
  padding: 6px 8px;
  background: linear-gradient(180deg, #4282d6, #3b85e0 10%, #3581e1 90%, #2563c6);
}

/* ---- shutdown overlay --------------------------------------------------- */

.shutdown {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: grid;
  place-items: center;
  background: #000;
  color: #f80;
  font: 20px "Perfect DOS VGA 437 Win", monospace;
  text-align: center;
  cursor: pointer;
}

/* ---- noscript ----------------------------------------------------------- */

.noscript { position: absolute; right: 16px; top: 16px; width: 300px; }

/* ---- small screens ------------------------------------------------------ */

@media (max-width: 700px) {
  .icons { flex-direction: row; flex-wrap: wrap; inset: 8px 8px auto 8px; }
  .window.app.maximized { height: 100%; }
  .task { padding-right: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
