/* Desktop background */
body {
  background-color: #008080;
  background-image: url('/images/desktop-bg.png');
  background-size: cover;
  background-position: center;
  margin: 0;
  padding: 0;
  font-family: 'Pixelated MS Sans Serif', Arial, sans-serif;
  overflow: hidden;
  height: 100vh;
  user-select: none;
}

/* Full-screen desktop canvas (sits above taskbar) */
.desktop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 40px;
  overflow: hidden;
}

/* All windows are positioned absolutely by desktop.js */
.window {
  position: absolute;
  min-width: 200px;
}

/* Re-enable text selection inside window bodies */
.window-body,
.window-body * {
  user-select: text;
}

/* Window states */
.win-hidden,
.win-minimized {
  display: none !important;
}

/* ========= TASKBAR ========= */
#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  box-shadow: inset 0 -2px 0 #808080;
  display: flex;
  align-items: center;
  padding: 0 4px;
  gap: 4px;
  z-index: 99999;
}

.taskbar-start {
  height: 32px;
  padding: 0 10px;
  font-weight: bold;
  font-family: inherit;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px outset #fff;
  background: #c0c0c0;
}

.taskbar-start:active {
  border-style: inset;
}

.taskbar-divider {
  width: 4px;
  height: 28px;
  border-left: 1px solid #808080;
  border-right: 1px solid #fff;
  flex-shrink: 0;
}

#taskbar-windows {
  display: flex;
  flex: 1;
  gap: 2px;
  overflow: hidden;
  align-items: center;
}

.taskbar-btn {
  height: 28px;
  padding: 0 8px;
  max-width: 160px;
  min-width: 80px;
  font-family: inherit;
  font-size: 11px;
  background: #c0c0c0;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 2px outset #fff;
  opacity: 0.55;
}

.taskbar-btn.active {
  border-style: inset;
  background: #b8b8b8;
  opacity: 1;
}

.taskbar-btn.btn-dimmed {
  opacity: 0.55;
}

.taskbar-tray {
  display: flex;
  align-items: center;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  padding: 0 8px;
  height: 28px;
  gap: 8px;
  flex-shrink: 0;
}

#taskbar-clock {
  font-size: 11px;
  font-family: inherit;
  background: none;
  border: none;
  padding: 2px 8px;
  cursor: default;
  text-align: center;
  line-height: 1.4;
}

.tray-icon {
  font-size: 14px;
  cursor: default;
  line-height: 1;
  padding: 2px;
  display: flex;
  align-items: center;
}

#taskbar-clock .clock-time {
  display: block;
  font-size: 11px;
}

#taskbar-clock .clock-date {
  display: block;
  font-size: 10px;
}

/* ========= TRAY CALENDAR ========= */
#tray-calendar {
  display: none;
  position: fixed;
  bottom: 40px;
  right: 0;
  background: #c0c0c0;
  border: 2px outset #fff;
  box-shadow: 2px 2px 0 #000;
  padding: 4px;
  z-index: 999999;
  width: 196px;
}

#tray-calendar.open {
  display: block;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  background: #000080;
  color: #fff;
  padding: 2px 4px;
}

.cal-title {
  font-size: 11px;
  font-family: inherit;
  font-weight: bold;
}

.cal-nav {
  background: none;
  border: none;
  color: #fff;
  font-size: 10px;
  cursor: default;
  padding: 0 4px;
  font-family: inherit;
  line-height: 1;
}

.cal-nav:hover {
  background: #1084d0;
}

.cal-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-family: inherit;
}

.cal-grid th {
  text-align: center;
  padding: 2px;
  font-weight: bold;
  color: #000080;
  font-size: 10px;
}

.cal-grid td {
  text-align: center;
  padding: 2px 1px;
  cursor: default;
  width: 26px;
}

.cal-grid td:hover:not(.cal-empty) {
  background: #000080;
  color: #fff;
}

.cal-today {
  background: #000080;
  color: #fff !important;
  font-weight: bold;
}

/* ========= NAV WINDOW ========= */
.nav-window {
  width: 320px;
}

.nav-body {
  padding: 6px 8px;
}

.nav-body nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-block;
  padding: 2px 10px;
  text-decoration: none;
  color: #000;
  border: 2px solid transparent;
  user-select: none;
}

.nav-link:hover {
  border: 2px outset #fff;
  background: #c0c0c0;
}

/* ========= BLOG TABLE ========= */
.blog-table {
  width: 100%;
  border-collapse: collapse;
}

.blog-table th {
  text-align: left;
  padding: 4px 8px;
  background: #000080;
  color: #fff;
}

.blog-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #c0c0c0;
}

.blog-table tr:hover td {
  background: #000080;
  color: #fff;
}

.blog-table a {
  color: inherit;
  text-decoration: none;
}

.blog-table tr:hover a {
  color: #fff;
}

/* ========= POST ========= */
.post-window {
  width: 540px;
}

.post-body {
  padding: 12px;
  max-height: 70vh;
  overflow-y: auto;
}

.post-meta {
  color: #666;
  margin-bottom: 12px;
  font-size: 0.85em;
}

.post-content h1 {
  margin-top: 1.2em;
  font-size: 1.4em;
}

.post-content h2 {
  margin-top: 1.2em;
  font-size: 1.15em;
}

.post-content h3 {
  margin-top: 1.2em;
  font-size: 1em;
}

.post-content p {
  line-height: 1.6;
}

.post-content code {
  background: #c0c0c0;
  padding: 1px 4px;
  font-family: 'Courier New', monospace;
}

.post-content pre {
  background: #c0c0c0;
  padding: 8px;
  overflow-x: auto;
}

/* ========= PROJECTS ========= */
.projects-window {
  width: 540px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 4px;
}

/* Project cards are nested windows — keep them in flow */
.project-card {
  cursor: pointer;
  text-decoration: none;
  color: #000;
  display: block;
  position: static !important;
  width: auto !important;
  min-width: unset;
}

.project-card:hover .title-bar {
  background: #000080;
}

.project-card .window-body {
  padding: 8px;
  font-size: 0.85em;
}

/* ========= BOOKMARKS ========= */
.bookmarks-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bookmarks-list li {
  padding: 3px 0;
  border-bottom: 1px solid #c0c0c0;
}

.bookmarks-list li:last-child {
  border-bottom: none;
}

.bookmarks-list a {
  color: #000080;
  text-decoration: none;
}

.bookmarks-list a:hover {
  text-decoration: underline;
}

/* ========= SCROLLABLE ========= */
.scrollable {
  max-height: 280px;
  overflow-y: auto;
}

/* ========= LATEST POSTS ========= */
.latest-posts-window {
  width: 480px;
}

/* ========= PHOTO ALBUM ========= */
.album-window {
  width: 520px;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
}

.album-thumb {
  display: block;
  cursor: pointer;
  border: 2px outset #fff;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #000;
}

.album-thumb:hover {
  border-style: inset;
}

.album-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Lightbox window */
.lightbox-window {
  width: 640px;
}

.lightbox-body {
  padding: 8px;
  text-align: center;
  background: #000;
}

.lightbox-body img {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  margin: 0 auto;
}

.lightbox-caption {
  color: #c0c0c0;
  font-size: 14px;
  margin-top: 4px;
  font-family: inherit;
}

/* ========= START MENU ========= */
#start-menu {
  position: fixed;
  bottom: 40px;
  left: 0;
  display: none;
  flex-direction: row;
  border: 2px outset #fff;
  background: #c0c0c0;
  z-index: 999999;
  min-width: 180px;
  box-shadow: 2px 2px 0 #000;
}

#start-menu.open {
  display: flex;
}

.start-menu-banner {
  width: 22px;
  background: linear-gradient(to top, #000080, #1084d0);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  font-family: inherit;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  padding: 8px 4px;
  letter-spacing: 1px;
  flex-shrink: 0;
  user-select: none;
}

.start-menu-items {
  display: flex;
  flex-direction: column;
  padding: 2px;
  flex: 1;
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  background: none;
  border: 1px solid transparent;
  text-align: left;
  font-family: inherit;
  font-size: 12px;
  cursor: default;
  white-space: nowrap;
}

.start-menu-item:hover {
  background: #000080;
  color: #fff;
  border-color: transparent;
}

.start-menu-item-icon {
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

.start-menu-divider {
  height: 1px;
  background: #808080;
  box-shadow: 0 1px 0 #fff;
  margin: 2px 4px;
}

/* ========= DESKTOP ICONS ========= */
.desktop-icon {
  position: absolute;
  width: 72px;
  text-align: center;
  cursor: default;
  padding: 4px;
  border: 1px dotted transparent;
  border-radius: 2px;
}

.desktop-icon.selected {
  border-color: rgba(255,255,255,0.7);
  background: rgba(0, 0, 128, 0.45);
}

.desktop-icon-img {
  font-size: 34px;
  display: block;
  line-height: 1;
  margin-bottom: 4px;
  pointer-events: none;
}

.desktop-icon-label {
  font-size: 11px;
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  line-height: 1.3;
  word-break: break-word;
  pointer-events: none;
}

.desktop-icon.selected .desktop-icon-label {
  background: #000080;
  color: #fff;
}

.desktop-icon a {
  text-decoration: none;
  color: inherit;
}
