/* ==========================================================
   HTMAA site - Windows XP desktop
   Sections:
     1. Fonts and colour tokens
     2. Base
     3. Desktop and icons
     4. Taskbar
     5. Week window (title bar + content area)
     6. Week content typography (what your weekNN.html looks like)
     7. Trash dialog
     8. About popup
     9. Small screens
    10. Motion
   ========================================================== */


/* 1. Fonts and colour tokens ------------------------------ */

@font-face {
  font-family: "Silkscreen";
  src: url("fonts/silkscreen-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("fonts/silkscreen-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
/* Digits only (0-9) come from Press Start 2P, whose numerals are clearer
   than Silkscreen's. Listed first in the stack, it only kicks in for digits. */
@font-face {
  font-family: "Pixel Digits";
  src: url("fonts/pixel-digits.woff2") format("woff2");
  unicode-range: U+30-39;
  size-adjust: 71.5%;   /* matches Silkscreen's capital height */
  font-display: swap;
}

:root {
  /* Windows XP "Luna" colours */
  --xp-blue-light: #3d95ff;
  --xp-blue: #0058ee;
  --xp-blue-dark: #0040c0;
  --xp-navy: #0a246a;
  --xp-frame: #0831d9;
  --xp-face: #ece9d8;        /* beige of windows and dialogs */
  --xp-face-dark: #aca899;
  --xp-green-light: #5fd35f; /* Start button */
  --xp-green: #3c9a3c;
  --xp-green-dark: #2e8b2e;

  --title-gradient: linear-gradient(to bottom, var(--xp-blue-light) 0%, var(--xp-blue) 18%, #0050e0 82%, var(--xp-blue-dark) 100%);

  --font-pixel: "Pixel Digits", "Silkscreen", "Courier New", monospace;   /* UI chrome */
  --font-body: Tahoma, Verdana, "Segoe UI", sans-serif;      /* UI text */
  --font-reading: Verdana, Tahoma, sans-serif;               /* week content */

  --taskbar-height: 60px;
  /* Folder size follows the screen height: as large as allows five folders
     per column, between 120px (small laptops) and 176px (large monitors).
     Anything that does not fit in one column simply wraps to the next. */
  --icon-size: clamp(120px, calc((100vh - var(--taskbar-height) - 80px) / 5 - 78px), 176px);
  --icon-cell: calc(var(--icon-size) + 50px);
}


/* 2. Base ------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #000;
  font-family: var(--font-body);
  background: #3a6ea5 url("assets/home/wallpaper.jpg") center / cover no-repeat;
}

button { font: inherit; cursor: pointer; }

:focus-visible { outline: 3px solid #ffd54a; outline-offset: 2px; }

[hidden] { display: none !important; }


/* 3. Desktop and icons ------------------------------------ */

.desktop {
  position: relative;
  flex: 1;
  min-height: 0;
}

/* Icons stack top to bottom, XP style, and wrap into a new column when the screen is full */
.icon-column {
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 24px;
  right: calc(var(--icon-cell) + 48px);   /* leave room for the About and Trash column */
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
}

.desktop-icon {
  width: var(--icon-cell);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 2px solid transparent;
  background: transparent;
  color: #fff;
  font: 400 18px/1.25 var(--font-pixel);
  text-align: center;
  text-decoration: none;
  text-shadow: 1px 1px 0 #000, 2px 2px 0 rgba(0, 0, 0, 0.55);
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
  background: rgba(49, 106, 197, 0.55);
  border-color: rgba(255, 255, 255, 0.6);
}

.icon-image {
  position: relative;
  width: var(--icon-size);
  height: var(--icon-size);
}

.icon-image svg { width: 100%; height: 100%; display: block; }

/* Wide icon (the F1 car): same width, height cut to its 35x13 shape */
.icon-image.icon-wide { height: calc(var(--icon-size) * 13 / 35); }

/* Big week number printed on the folder */
.icon-number {
  position: absolute;
  right: 0;
  left: 0;
  bottom: 12%;
  font: 700 calc(var(--icon-size) * 0.35)/1 var(--font-pixel);
  color: #4a2e05;
  text-shadow: none;
}

.icon-label { padding: 2px 6px; }

/* About and trash, stacked in the top-right corner */
.right-icons {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}


/* 4. Taskbar ---------------------------------------------- */

.taskbar {
  flex: none;
  height: var(--taskbar-height);
  display: flex;
  align-items: stretch;
  color: #fff;
  font-family: var(--font-pixel);
  background: linear-gradient(to bottom, #3168d5 0%, #4993e6 5%, #2b63d6 10%, #245edc 55%, #2158d0 90%, #1941a5 100%);
  border-top: 2px solid #0f3c9b;
}

.start-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 30px 0 14px;
  border: 0;
  border-radius: 0 14px 14px 0;
  color: #fff;
  font: 700 17px/1.1 var(--font-pixel);
  text-align: left;
  text-shadow: 1px 1px 0 #1f5a1f;
  background: linear-gradient(to bottom, var(--xp-green-light) 0%, var(--xp-green) 45%, var(--xp-green-dark) 100%);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.35), inset -2px -2px 0 rgba(0, 0, 0, 0.25);
}

.start-button svg { width: 32px; height: 32px; flex: none; }

.start-button:hover { filter: brightness(1.1); }

.start-button.is-open {
  filter: brightness(0.85);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.45);
}

.taskbar-tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  overflow: hidden;
}

.taskbar-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  min-width: 0;                 /* tabs shrink (with an ellipsis) when space is short */
  padding: 0 18px;
  border: 1px solid #1e4fb8;
  color: #fff;
  font: 400 15px/1 var(--font-pixel);
  text-decoration: none;
  white-space: nowrap;
  background: #3c81f3;
  box-shadow: inset 1px 1px 0 #6aa4ff, inset -1px -1px 0 #1a48b0;
}

.taskbar-tab svg { width: 24px; height: 24px; flex: none; }

.taskbar-tab span { overflow: hidden; text-overflow: ellipsis; }

.taskbar-tab:hover { background: #53a3ff; }

.taskbar-tab.is-active {
  background: #1e52ae;
  box-shadow: inset 1px 1px 4px rgba(0, 0, 0, 0.55);
}

.taskbar-tray {
  display: flex;
  align-items: center;
  padding: 0 22px;
  font-size: 15px;
  text-shadow: 1px 1px 0 #0a246a;
  background: linear-gradient(to bottom, #1290e9 0%, #0b63d0 30%, #0c56c0 90%, #08409b 100%);
  border-left: 2px solid #0a3c96;
  box-shadow: inset 2px 0 0 #1a8ee6;
}


/* 5. Week window ------------------------------------------ */

.window {
  position: absolute;
  top: 0;
  right: 0;
  bottom: var(--taskbar-height);
  left: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--xp-face);
  border: 4px solid var(--xp-frame);
  border-top: 0;
}

.titlebar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 8px 0 12px;
  color: #fff;
  font-family: var(--font-pixel);
  background: var(--title-gradient);
  text-shadow: 1px 1px 0 var(--xp-navy);
}

.titlebar-icon { width: 32px; height: 32px; flex: none; }

.titlebar-title {
  margin: 0;
  font: 700 20px/1 var(--font-pixel);
  white-space: nowrap;
}

.titlebar-subtitle {
  min-width: 0;
  margin-left: 12px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.9;
}

.titlebar-buttons {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.titlebar-button {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 4px;
  color: #fff;
  background: linear-gradient(to bottom, #3c8cff, var(--xp-blue));
  box-shadow: inset -1px -1px 0 rgba(0, 0, 0, 0.3);
}

.titlebar-button svg { width: 22px; height: 22px; }

.titlebar-close { background: linear-gradient(to bottom, #e8734f, #c9391c 45%, #b02e12); }

.titlebar-close:hover { filter: brightness(1.15); }

.window-content {
  flex: 1;
  min-height: 0;
  margin: 6px;
  padding: 36px 48px 80px;
  overflow-y: auto;
  background: #fdfcf7;
  border: 1px solid #7f9db9;
}


/* 6. Week content typography ------------------------------
   Anything you write in weeks/weekNN.html is styled here.
   Plain tags only: h1, h2, h3, p, ul, ol, a, img, figure, pre, table.
   --------------------------------------------------------- */

.window-content {
  font: 17px/1.65 var(--font-reading);
  color: #1e1e1e;
}


.window-content h1,
.window-content h2 {
  margin: 0 0 20px;
  font: 700 32px/1.3 var(--font-pixel);
  color: var(--xp-navy);
}

.window-content h2 {
  margin: 36px 0 10px;
  font-size: 26px;
}

.window-content h3 {
  margin: 28px 0 10px;
  font-size: 19px;
  line-height: 1.3;
}

.window-content p,
.window-content ul,
.window-content ol { margin: 0 0 18px; }


.window-content p,
.window-content ul,
.window-content ol { max-width: 120ch; }

.window-content a,
.about-text a { color: #0645ad; }

.window-content img,
.window-content video {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--xp-face-dark);
}

.window-content figure { margin: 28px 0; }

.window-content figcaption {
  margin-top: 8px;
  font-size: 15px;
  color: #444;
}

.window-content pre,
.window-content code {
  font-size: 15px;
  background: #f4f4f4;
  border: 1px solid #ddd;
}

.window-content code { padding: 1px 5px; }

.window-content pre {
  padding: 14px 16px;
  overflow-x: auto;
}

/* Tables: wrap in <div class="table-wrap"> so wide ones scroll instead of overflowing. */
.window-content .table-wrap { overflow-x: auto; max-width: 100%; }

.window-content table {
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  background: #fff;
  border: 1px solid var(--xp-face-dark);
}

.window-content th,
.window-content td {
  padding: 6px 12px;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--xp-face-dark);
}

.window-content thead th {
  font-weight: 700;
  color: var(--xp-navy);
  background: var(--xp-face);
}

.window-content tbody th { font-weight: 700; background: #f6f5ef; }

.window-content pre code { padding: 0; border: 0; background: none; }


/* 7. Trash dialog ----------------------------------------- */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
}

.dialog {
  width: min(500px, calc(100vw - 32px));
  background: var(--xp-face);
  border: 3px solid var(--xp-frame);
  border-radius: 8px 8px 0 0;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.35);
}

.dialog .titlebar {
  height: 46px;
  border-radius: 4px 4px 0 0;
}

.dialog .titlebar-title { font-size: 16px; }

.dialog .titlebar-button { width: 32px; height: 32px; }

.dialog .titlebar-button svg { width: 16px; height: 16px; }

.dialog-body {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px 28px 20px;
  font: 400 16px/1.6 var(--font-pixel);
}

.dialog-body svg { width: 64px; height: 64px; flex: none; }

.dialog-body p { margin: 0; }

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  padding: 0 28px 24px;
}

.xp-button {
  min-width: 110px;
  padding: 9px 22px;
  border: 1px solid #003c74;
  border-radius: 3px;
  font: 700 15px/1 var(--font-pixel);
  color: #000;
  background: var(--xp-face);
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #a0a0a0;
}

.xp-button:hover { box-shadow: inset 0 0 0 2px #f8b330; }


/* 8. About popup ------------------------------------------ */

.about-popup {
  position: absolute;
  left: 0;
  bottom: var(--taskbar-height);
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: min(550px, 100vw);
  height: min(650px, calc(100vh - var(--taskbar-height) - 24px));   /* taller than wide, like the XP Start menu */
  background: var(--xp-face);
  border: 3px solid var(--xp-frame);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  box-shadow: 6px 0 0 rgba(0, 0, 0, 0.3);
}

.about-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px;
  color: #fff;
  font: 700 22px/1.2 var(--font-pixel);
  text-shadow: 1px 1px 0 var(--xp-navy);
  background: var(--title-gradient);
  border-radius: 4px 4px 0 0;
}

.about-photo {
  width: 150px;
  height: 150px;
  flex: none;
  border: 3px solid #fff;
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--xp-navy);
}

.about-text {
  flex: 1;
  margin: 0;
  padding: 24px 28px;
  overflow-y: auto;
  font: 400 17px/1.6 var(--font-body);
}


/* 9. Small screens ----------------------------------------
   9a. up to 1260px wide, or under 500px tall: compact taskbar, icons only
   9b. phones, portrait (narrow) or landscape (short): smaller icons and window chrome
   9c. portrait phones: the Start label wraps onto several lines
   --------------------------------------------------------- */

/* 9a */
@media (max-width: 1260px), (max-height: 500px) {
  .start-button { gap: 8px; padding: 0 18px 0 10px; font-size: 12px; }

  .taskbar-tabs { gap: 4px; padding: 0 8px; }
  .taskbar-tab { padding: 0 10px; }
  .taskbar-tab span { display: none; }       /* icons only */
  .taskbar-tab.is-active { display: none; }  /* the window title bar already names the week */

  .taskbar-tray { padding: 0 12px; font-size: 12px; }
}

/* 9b */
@media (max-width: 720px), (max-height: 500px) {
  :root {
    --icon-size: 80px;
    --icon-cell: 108px;
  }

  /* Icons flow left to right in rows and the desktop scrolls if needed */
  .icon-column {
    top: 16px;
    left: 16px;
    right: 132px;
    bottom: 16px;
    flex-direction: row;
    overflow-y: auto;
  }

  .desktop-icon { font-size: 14px; }
  .icon-number { font-size: 30px; }
  .right-icons { top: 16px; right: 16px; }

  .titlebar { height: 52px; gap: 8px; padding-left: 8px; }
  .titlebar-title { font-size: 16px; }
  .titlebar-subtitle { display: none; }
  .titlebar-button { width: 36px; height: 36px; }

  .window { border-width: 3px; }
  .window-content { margin: 4px; padding: 20px 16px 60px; font-size: 15px; }
  .window-content h1 { font-size: 24px; }
  .window-content h2 { font-size: 20px; }
  .window-content h3 { font-size: 17px; }

  .about-popup { height: auto; }
  .about-header { gap: 16px; padding: 16px; font-size: 17px; }
  .about-photo { width: 80px; height: 80px; }
  .about-text { flex: none; padding: 18px 20px; }
}

/* 9c */
@media (max-width: 720px) {
  .start-button span { max-width: 120px; white-space: normal; }
}


/* 10. Motion ---------------------------------------------- */

@keyframes window-open {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: none;        opacity: 1; }
}

.window { animation: window-open 120ms ease-out; }

@media (prefers-reduced-motion: reduce) {
  .window { animation: none; }
}

/* Figures ------------------------------------------------
   Every photo is the same height so rows and single figures line
   up. Use class="figure-small" or "figure-large" (on the figure or
   on the row) to shrink or enlarge.
   Side by side: wrap several <figure> in <div class="figure-row">,
   or several <img> in <figure class="figure-row"> for one shared caption.
   --------------------------------------------------------- */
.window-content figure img,
.window-content figure video {
  max-height: 350px;
  width: auto;
  max-width: 100%;
}

.window-content .figure-small img, .window-content .figure-small video { max-height: 265px; }
.window-content .figure-large img, .window-content .figure-large video { max-height: 530px; }

.window-content .figure-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
  margin: 28px 0;
}

.window-content .figure-row figure { margin: 0; }
.window-content .figure-row > figcaption { flex-basis: 100%; margin-top: -16px; }

@media (max-width: 720px) {
  .window-content figure img, .window-content figure video { max-height: 265px; }
  .window-content .figure-small img, .window-content .figure-small video { max-height: 200px; }
  .window-content .figure-large img, .window-content .figure-large video { max-height: 400px; }
}

/* Image Viewer: the whole picture fits the window, no scrolling */
.window-content.is-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 32px;
  overflow: hidden;
}

/* The picture shrinks to leave room for its caption underneath */
.window-content.is-image figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
}

.window-content.is-image img {
  width: auto;
  min-height: 0;
  max-height: 100%;
}

.window-content.is-image figcaption {
  flex: none;
  text-align: center;
}

@media (max-width: 720px) {
  .window-content.is-image { padding: 13px 11px; }
}

/* Zoomed: the picture shrinks, or grows past the window and scrolls.
   Auto margins keep it centred while it is still smaller than the window. */
.window-content.is-image.is-zoomed {
  align-items: flex-start;
  justify-content: flex-start;
  overflow: auto;
}

.window-content.is-image.is-zoomed figure {
  flex: none;
  max-width: none;
  max-height: none;
  margin: auto;
}

.window-content.is-image.is-zoomed img {
  max-width: none;
  max-height: none;
  height: auto;
}

/* Zoom slider under the image viewer, like an XP status bar */
.zoom-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 6px 6px;
  padding: 6px 14px;
  font: 700 16px/1 var(--font-pixel);
  color: var(--xp-navy);
  background: var(--xp-face);
  border: 1px solid var(--xp-face-dark);
}

.zoom-bar svg { width: 28px; height: 28px; flex: none; }
.zoom-bar input { width: min(320px, 100%); min-width: 0; accent-color: var(--xp-blue); }
.zoom-value { min-width: 4ch; font-variant-numeric: tabular-nums; }

.window-content:not(.is-image) img { cursor: zoom-in; }

/* Week section tabs, like Internet Explorer on Windows XP.
   The strip overlaps the page's top border by 1px so the
   current (white) tab joins the page. */
.page-tabs {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 2px;
  margin: 6px 6px -7px;
  padding: 0 8px;
  overflow-x: auto;
}

.page-tab {
  flex: none;
  max-width: 500px;
  margin: 3px 0 1px;
  padding: 6px 17px 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 17px var(--font-body);
  background: linear-gradient(to bottom, #fff, #ecebe6 80%, #d8d4c4);
  border: 1px solid #919b9c;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.page-tab:hover { box-shadow: inset 0 2px #ffc83c; }

.page-tab.is-current {
  margin: 0;
  padding: 7px 17px 6px;
  background: #fff;
  border-top: 3px solid #e68b2c;
  box-shadow: none;
}

.window-content h2 { scroll-margin-top: 16px; }

@media (max-width: 720px), (max-height: 500px) {
  .page-tabs { margin: 4px 4px -5px; }
  .page-tab { font-size: 14px; }
}

/* Music player: note button in the tray, popup above it */
.music-button { padding: 0 19px; border-width: 0 0 0 2px; }   /* the whole tray box is the button */

.music-button svg {
  width: 34px;
  height: 34px;
}

@media (max-width: 1260px), (max-height: 500px) {
  .music-button { padding: 0 10px; }
}

.music-popup {
  position: absolute;
  right: 0;
  bottom: var(--taskbar-height);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(260px, 100vw);
  padding: 10px;
  background: var(--xp-face);
  border: 3px solid var(--xp-frame);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  box-shadow: -6px 0 0 rgba(0, 0, 0, 0.3);
}

.music-track {
  padding: 8px 12px;
  border: 0;
  text-align: left;
  font: 700 16px/1 var(--font-pixel);
  background: none;
}

.music-track:hover,
.music-track.is-current { color: #fff; background: #316ac5; }

.music-volume {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 12px;
}

.music-volume svg { width: 28px; height: 28px; flex: none; }
.music-volume input { flex: 1; min-width: 0; accent-color: var(--xp-blue); }

.music-play { align-self: center; min-width: 80px; padding: 6px 22px; }
.music-play svg { display: block; width: 28px; height: 28px; margin: auto; }
