/* =========================================================================
   www.helge.de  –  Windows-XP-Luna-Stil, reines CSS (kein JavaScript)
   =========================================================================

   Hell-/Dunkelmodus (Doppel-Build, ohne JavaScript):
   Die Theme-Variablen liegen auf .theme-root. Standard ist HELL. Die dunkle
   Seitenvariante setzt zusaetzlich die Klasse .is-dark, die alle Variablen
   auf dunkle Werte umstellt:

     1) .theme-root           -> HELL  (Basis, *.html)
     2) .theme-root.is-dark   -> DUNKEL (*.dark.html)

   Der Umschalter ist ein echter Link auf die andere Variante derselben
   Seite. Da alle Links innerhalb einer Modus-Familie auf gleichartige
   Varianten zeigen, bleibt der Modus beim Navigieren erhalten.
   ========================================================================= */

/* ----------------------------- Reset / Basis ---------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Tahoma, "Segoe UI", Verdana, Geneva, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
img { display: block; }
a { color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* --------------------------- Theme-Variablen ---------------------------- */
/* (1) HELL = Basis */
.theme-root {
  --titlebar-from:  #0058e6;
  --titlebar-mid:   #2f8bf5;
  --titlebar-to:    #0046cc;
  --titlebar-text:  #ffffff;
  --win-frame:      #0831d9;
  --win-chrome:     #ece9d8;
  --content-bg:     #ffffff;
  --content-fg:     #101010;
  --content-muted:  #555555;
  --link:           #0b3fb5;
  --link-visited:   #6a1aa1;
  --rule:           #d9d4c2;
  --code-bg:        #f3f1e7;

  --desktop-tint:   rgba(0, 0, 0, 0);
  --taskbar-from:   #3d6ee8;
  --taskbar-mid:    #295bd6;
  --taskbar-to:     #1b46b0;
  --taskbar-top:    #6c9bf6;

  --start-from:     #5bb13a;
  --start-mid:      #44951f;
  --start-to:       #2f7d12;

  --menu-bg:        #ffffff;
  --menu-fg:        #0a0a0a;
  --menu-side:      #2b72e0;
  --menu-hover:     #2f6fd6;
  --menu-hover-fg:  #ffffff;

  --icon-label:        #ffffff;
  --icon-label-shadow: rgba(0, 0, 0, .85);

  --tray-bg:        #1b52d6;
}

/* (2) DUNKEL (wird beim Build als eigene Seitenvariante gesetzt) */
.theme-root.is-dark {
  --titlebar-from:  #1f3a78;
  --titlebar-mid:   #2c5bb0;
  --titlebar-to:    #16285a;
  --titlebar-text:  #eef3ff;
  --win-frame:      #0a1b52;
  --win-chrome:     #2b2b30;
  --content-bg:     #1d1d21;
  --content-fg:     #e7e7ea;
  --content-muted:  #a8a8b0;
  --link:           #7bb6ff;
  --link-visited:   #c79bff;
  --rule:           #3a3a42;
  --code-bg:        #26262c;
  --desktop-tint:   rgba(0, 0, 0, .5);
  --taskbar-from:   #1f3a78;
  --taskbar-mid:    #152a5e;
  --taskbar-to:     #0c1838;
  --taskbar-top:    #355192;
  --start-from:     #3d7a28;
  --start-mid:      #2c5e18;
  --start-to:       #1e440f;
  --menu-bg:        #24242a;
  --menu-fg:        #e7e7ea;
  --menu-side:      #16285a;
  --menu-hover:     #2c5bb0;
  --menu-hover-fg:  #ffffff;
  --icon-label:        #f0f0f5;
  --icon-label-shadow: rgba(0, 0, 0, .95);
  --tray-bg:        #122150;
}

/* ----------------------------- Desktop ---------------------------------- */
.theme-root { height: 100%; }

.desktop-surface {
  position: relative;
  min-height: 100vh;
  background-color: #5a7edc;          /* Fallback, falls Wallpaper fehlt */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 12px 12px 56px;            /* Platz fuer die Taskleiste unten */
  overflow: hidden;
}
.desktop-surface::before {           /* Abdunkelung im Dunkelmodus */
  content: "";
  position: absolute; inset: 0;
  background: var(--desktop-tint);
  pointer-events: none;
}

/* ----------------------------- Desktop-Icons ---------------------------- */
.desktop-icons {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 1;
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px 18px;
  max-height: calc(100vh - 80px);
}
.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 84px;
  padding: 6px 4px;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 2px;
}
.desktop-icon:hover  { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); }
.desktop-icon:focus-visible { outline: 1px dotted #fff; }
.desktop-icon__img img { width: 48px; height: 48px; filter: drop-shadow(1px 1px 1px rgba(0,0,0,.4)); }
.desktop-icon__label {
  margin-top: 5px;
  text-align: center;
  color: var(--icon-label);
  text-shadow: 0 1px 3px var(--icon-label-shadow);
  line-height: 1.2;
}

/* ----------------------------- Taskleiste ------------------------------- */
.taskbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 40px;
  display: flex;
  align-items: stretch;
  background: linear-gradient(to bottom,
    var(--taskbar-top) 0, var(--taskbar-from) 8%,
    var(--taskbar-mid) 50%, var(--taskbar-to) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 -1px 2px rgba(0,0,0,.3);
  z-index: 100;
}

/* Start-Button (gruen, abgerundet rechts) */
.start-button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 22px 4px 12px;
  margin-right: 8px;
  border-radius: 0 14px 14px 0;
  background: linear-gradient(to bottom,
    var(--start-from) 0, var(--start-mid) 55%, var(--start-to) 100%);
  color: #fff;
  font-style: italic;
  font-weight: bold;
  font-size: 17px;
  text-shadow: 1px 1px 1px rgba(0,0,0,.5);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset -2px -2px 4px rgba(0,0,0,.25);
  user-select: none;
}
.start-button:hover { filter: brightness(1.08); }
.start-button__flag {
  width: 18px; height: 18px;
  border-radius: 3px;
  background:
    conic-gradient(from 0deg at 50% 50%,
      #f64f3b 0 25%, #6cbf3b 25% 50%, #2a8ff0 50% 75%, #ffd23b 75% 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.6);
}

.taskbar__tasks {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  min-width: 0;
}
.task-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  padding: 4px 10px;
  border-radius: 3px;
  color: #fff;
  background: rgba(255,255,255,.12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.task-button--active {
  background: rgba(0,0,0,.22);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.4);
}
.task-button img { width: 16px; height: 16px; }

.taskbar__tray {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 10px;
  background: var(--tray-bg);
  box-shadow: inset 1px 0 0 rgba(0,0,0,.35), inset 2px 0 0 rgba(255,255,255,.15);
  color: #eaf0ff;
}
.taskbar__clock { font-size: 12px; }

/* Tray-Umschalter Hell/Dunkel */
.tray-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 22px;
  border-radius: 3px;
  cursor: pointer;
  background: rgba(255,255,255,.15);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
  color: #fff;
  font-size: 14px;
  line-height: 1;
}
.tray-toggle:hover { background: rgba(255,255,255,.28); }

/* ----------------------------- Startmenue ------------------------------- */
.start-overlay {
  display: none;
  position: fixed; inset: 0;
  z-index: 90;
}
#start-toggle:checked ~ .desktop-surface .start-overlay { display: block; }

.start-menu {
  display: none;
  position: fixed;
  left: 6px; bottom: 42px;
  width: 380px; max-width: calc(100vw - 12px);
  z-index: 95;
  background: var(--menu-bg);
  color: var(--menu-fg);
  border: 1px solid var(--win-frame);
  border-radius: 8px 8px 2px 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  overflow: hidden;
}
#start-toggle:checked ~ .desktop-surface .start-menu { display: block; }

.start-menu__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #fff;
  background: linear-gradient(to bottom, var(--titlebar-from), var(--titlebar-to));
  border-bottom: 2px solid #ed9a2e;
}
.start-menu__avatar {
  width: 34px; height: 34px;
  border-radius: 4px;
  background: radial-gradient(circle at 35% 30%, #ffe7a8, #d98b2b);
  box-shadow: 0 0 0 2px rgba(255,255,255,.7);
}
.start-menu__user { font-weight: bold; font-size: 15px; text-shadow: 1px 1px 1px rgba(0,0,0,.4); }

.start-menu__body { display: flex; }
.start-menu__col { list-style: none; margin: 0; padding: 6px; }
.start-menu__col--left  { flex: 1; background: var(--menu-bg); }
.start-menu__col--right {
  width: 140px;
  background: color-mix(in srgb, var(--menu-side) 12%, var(--menu-bg));
  border-left: 1px solid var(--rule);
}
.start-menu__col a {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px;
  text-decoration: none;
  color: var(--menu-fg);
  border-radius: 3px;
}
.start-menu__col a:hover { background: var(--menu-hover); color: var(--menu-hover-fg); }
.start-menu__col img { width: 24px; height: 24px; }

.start-menu__footer {
  display: flex; justify-content: flex-end;
  padding: 8px 12px;
  background: linear-gradient(to bottom, var(--titlebar-mid), var(--titlebar-to));
}
.start-menu__action {
  cursor: pointer;
  color: #fff;
  padding: 5px 12px;
  border-radius: 3px;
  background: rgba(255,255,255,.12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
}
.start-menu__action:hover { background: rgba(255,255,255,.25); }

/* ----------------------------- XP-Fenster ------------------------------- */
.window-view .desktop-surface {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.xp-window {
  position: relative;
  width: min(860px, 100%);
  margin: 24px auto 0;
  background: var(--win-frame);
  border-radius: 8px 8px 3px 3px;
  padding: 3px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  z-index: 10;
}
.xp-window__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 4px 0 8px;
  border-radius: 6px 6px 0 0;
  color: var(--titlebar-text);
  background: linear-gradient(to bottom,
    var(--titlebar-from) 0, var(--titlebar-mid) 8%,
    var(--titlebar-from) 40%, var(--titlebar-to) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.xp-window__title {
  display: flex; align-items: center; gap: 7px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,.5);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.xp-window__title img { width: 16px; height: 16px; }
.xp-window__buttons { display: flex; gap: 3px; }
.xp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 21px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 3px;
  font-size: 11px; line-height: 1;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(to bottom, #5e9bf0, #1f5fd6);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.xp-btn--close { background: linear-gradient(to bottom, #f08f6e, #d94f2a); }
.xp-btn:hover { filter: brightness(1.1); }
.xp-btn--close:hover { filter: brightness(1.12); }

.xp-window__body {
  background: var(--win-chrome);
  border-radius: 0 0 2px 2px;
  padding: 3px;
}
.content {
  background: var(--content-bg);
  color: var(--content-fg);
  border: 1px solid color-mix(in srgb, var(--win-frame) 35%, transparent);
  padding: 22px 26px;
  min-height: 240px;
  max-height: calc(100vh - 130px);
  overflow: auto;
}

/* ----------------------------- Inhaltstypografie ------------------------ */
.content h1, .content h2, .content h3 { line-height: 1.25; margin: 1.2em 0 .5em; }
.content h1 { font-size: 22px; }
.content h2 { font-size: 18px; border-bottom: 1px solid var(--rule); padding-bottom: 4px; }
.content h3 { font-size: 15px; }
.content > :first-child { margin-top: 0; }
.content p, .content li { line-height: 1.6; }
.content a { color: var(--link); }
.content a:visited { color: var(--link-visited); }
.content img { max-width: 100%; height: auto; border-radius: 3px; margin: 10px 0; }
.content pre, .content code {
  font-family: "Consolas", "Courier New", monospace;
  background: var(--code-bg);
}
.content code { padding: 1px 5px; border-radius: 3px; }
.content pre { padding: 12px 14px; border-radius: 4px; overflow: auto; }
.content pre code { background: none; padding: 0; }
.content blockquote {
  margin: 1em 0; padding: 6px 14px;
  border-left: 4px solid var(--titlebar-from);
  color: var(--content-muted);
}
.content table { border-collapse: collapse; margin: 1em 0; }
.content th, .content td { border: 1px solid var(--rule); padding: 6px 10px; text-align: left; }
.content hr { border: 0; border-top: 1px solid var(--rule); margin: 1.4em 0; }

/* ----------------------------- Folder-Ansichten ------------------------ */
/* Gemeinsamer "Inhaltskasten" im Fensterkoerper (wie .content). */
.folder-grid, .folder-list, .folder-empty {
  background: var(--content-bg);
  color: var(--content-fg);
  border: 1px solid color-mix(in srgb, var(--win-frame) 35%, transparent);
  max-height: calc(100vh - 130px);
  overflow: auto;
}

/* Icon-Ansicht (wenige Eintraege) */
.folder-grid {
  list-style: none; margin: 0;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
  gap: 6px;
  align-content: start;
  min-height: 240px;
}
.folder-item {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 12px 6px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--content-fg);
  text-align: center;
}
.folder-item:hover  { background: color-mix(in srgb, var(--menu-side) 16%, transparent); }
.folder-item:focus-visible { outline: 1px dotted var(--menu-side); }
.folder-item__img img { width: 48px; height: 48px; }
.folder-item__label {
  font-size: 12px; line-height: 1.25;
  word-break: break-word; hyphens: auto;
}

/* Detailliste (viele Eintraege): scrollbar, Kopf bleibt stehen */
.folder-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.folder-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--win-chrome);
  color: var(--content-fg);
  text-align: left; font-weight: bold;
  padding: 6px 10px;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
}
.folder-table thead th:last-child { border-right: 0; }
.folder-table .col-name { width: 58%; }
.folder-table .col-date { width: 26%; }
.folder-table tbody td {
  padding: 4px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 55%, transparent);
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.folder-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--menu-side) 6%, transparent);
}
.folder-table tbody tr:hover {
  background: color-mix(in srgb, var(--menu-side) 15%, transparent);
}
.folder-table .col-name a {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--link); text-decoration: none;
}
.folder-table .col-name a:hover { text-decoration: underline; }
.folder-table .col-name img { width: 16px; height: 16px; flex: none; }
.folder-table .col-date, .folder-table .col-type { color: var(--content-muted); }

/* Leerer Ordner */
.folder-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 160px;
  padding: 40px 26px;
  color: var(--content-muted);
  font-style: italic;
}

/* ----------------------------- Responsiv -------------------------------- */
@media (max-width: 640px) {
  .desktop-icons { max-height: none; }
  .xp-window { margin-top: 10px; }
  .content { padding: 16px; max-height: none; }
  .folder-grid, .folder-list, .folder-empty { max-height: none; }
  .start-button__label { font-size: 15px; }
  .taskbar__clock { display: none; }
}
