/* Windows 95 Design System */

:root {
  /* Surface Colors */
  --win95-gray: #c0c0c0;
  --win95-silver: #dfdfdf;
  --win95-dark-gray: #808080;
  --win95-white: #ffffff;
  --win95-black: #000000;

  /* Desktop & Accent */
  --win95-teal: #008080;
  --win95-navy: #000080;
  --win95-blue: #1084d0;

  /* Semantic */
  --color-titlebar-active: #000080;
  --color-titlebar-inactive: #808080;
  --color-titlebar-text: #ffffff;

  /* Typography */
  --font-system: 'MS Sans Serif', Tahoma, Arial, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;

  /* Sizes */
  --titlebar-height: 22px;
  --taskbar-height: 32px;
  --icon-size: 32px;

  /* Z-index layers */
  --z-desktop: 1;
  --z-window: 10;
  --z-window-active: 100;
  --z-taskbar: 9999;
  --z-start-menu: 9998;
}

/* Reset for Win95 */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-system);
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--win95-teal);
  color: var(--win95-black);
}

/* ═══════════════════════════════════════════════════════════════
   DESKTOP
   ═══════════════════════════════════════════════════════════════ */
.desktop {
  position: fixed;
  inset: 0;
  background: var(--win95-teal);
  padding: 8px;
  padding-bottom: calc(var(--taskbar-height) + 8px);
  overflow: hidden;
  cursor: default;
}

.desktop-icons {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 16px;
  height: 100%;
  padding: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   DESKTOP ICON
   ═══════════════════════════════════════════════════════════════ */
.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 72px;
  padding: 4px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}

.desktop-icon__image {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.desktop-icon__image img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}

.desktop-icon__label {
  font-size: 11px;
  color: #ffffff;
  text-align: center;
  word-wrap: break-word;
  max-width: 64px;
  text-shadow:
    1px 1px 1px rgba(0, 0, 0, 0.8),
    -1px -1px 1px rgba(0, 0, 0, 0.3);
  line-height: 1.2;
  padding: 1px 2px;
}

.desktop-icon:focus,
.desktop-icon.selected {
  border: 1px dotted #ffffff;
  outline: none;
}

.desktop-icon.selected .desktop-icon__label {
  background: var(--win95-navy);
  color: #ffffff;
  text-shadow: none;
}

.desktop-icon:hover:not(.selected) {
  border: 1px dotted rgba(255, 255, 255, 0.5);
}

/* ═══════════════════════════════════════════════════════════════
   BEVEL SYSTEM
   ═══════════════════════════════════════════════════════════════ */
.raised {
  background: var(--win95-gray);
  border: 2px solid;
  border-color: var(--win95-white) var(--win95-black) var(--win95-black) var(--win95-white);
}

.raised-double {
  background: var(--win95-gray);
  border: 2px solid;
  border-color: var(--win95-white) var(--win95-black) var(--win95-black) var(--win95-white);
  box-shadow:
    inset 1px 1px 0 var(--win95-silver),
    inset -1px -1px 0 var(--win95-dark-gray);
}

.inset {
  background: var(--win95-white);
  border: 2px solid;
  border-color: var(--win95-dark-gray) var(--win95-white) var(--win95-white) var(--win95-dark-gray);
}

.inset-deep {
  background: var(--win95-white);
  border: 2px solid;
  border-color: var(--win95-dark-gray) var(--win95-white) var(--win95-white) var(--win95-dark-gray);
  box-shadow: inset 1px 1px 0 var(--win95-black);
}

/* ═══════════════════════════════════════════════════════════════
   WINDOW
   ═══════════════════════════════════════════════════════════════ */
.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  min-height: 100px;
  background: var(--win95-gray);
  border: 2px solid;
  border-color: var(--win95-white) var(--win95-black) var(--win95-black) var(--win95-white);
  box-shadow:
    inset 1px 1px 0 var(--win95-silver),
    inset -1px -1px 0 var(--win95-dark-gray),
    2px 2px 4px rgba(0, 0, 0, 0.3);
  z-index: var(--z-window);
}

.window.active {
  z-index: var(--z-window-active);
}

.window.minimized {
  display: none !important;
}

.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(100% - var(--taskbar-height)) !important;
  border: none;
}

/* ═══════════════════════════════════════════════════════════════
   TITLE BAR
   ═══════════════════════════════════════════════════════════════ */
.window__titlebar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--titlebar-height);
  padding: 2px 3px;
  background: linear-gradient(90deg, #000080, #1084d0);
  cursor: move;
  flex-shrink: 0;
}

.window.inactive .window__titlebar {
  background: var(--win95-dark-gray);
}

.window__titlebar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.window__titlebar-icon img {
  width: 16px;
  height: 16px;
}

.window__titlebar-text {
  flex: 1;
  font-size: 11px;
  font-weight: bold;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window__titlebar-controls {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   WINDOW BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.window__btn {
  width: 16px;
  height: 14px;
  background: var(--win95-gray);
  border: 2px solid;
  border-color: var(--win95-white) var(--win95-black) var(--win95-black) var(--win95-white);
  font-size: 9px;
  font-weight: bold;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-system);
}

.window__btn:active {
  border-color: var(--win95-black) var(--win95-white) var(--win95-white) var(--win95-black);
}

.window__btn:focus-visible {
  outline: 1px dotted var(--win95-black);
  outline-offset: -3px;
}

.window__btn--close {
  margin-left: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   WINDOW CONTENT
   ═══════════════════════════════════════════════════════════════ */
.window__content {
  flex: 1;
  margin: 2px;
  padding: 8px;
  background: var(--win95-white);
  overflow: auto;
  border: 2px solid;
  border-color: var(--win95-dark-gray) var(--win95-white) var(--win95-white) var(--win95-dark-gray);
  box-shadow: inset 1px 1px 0 var(--win95-black);
}

.window__content--gray {
  background: var(--win95-gray);
  border: none;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════
   STATUS BAR
   ═══════════════════════════════════════════════════════════════ */
.window__statusbar {
  display: flex;
  height: 20px;
  padding: 2px 4px;
  gap: 4px;
  flex-shrink: 0;
}

.window__status-section {
  flex: 1;
  font-size: 11px;
  padding: 1px 4px;
  border: 1px solid;
  border-color: var(--win95-dark-gray) var(--win95-white) var(--win95-white) var(--win95-dark-gray);
}

/* ═══════════════════════════════════════════════════════════════
   RESIZE HANDLES
   ═══════════════════════════════════════════════════════════════ */
.window__resize {
  position: absolute;
  z-index: 10;
  background: transparent;
}

.window__resize--n,
.window__resize--s {
  height: 4px;
  left: 4px;
  right: 4px;
}

.window__resize--n {
  top: 0;
  cursor: ns-resize;
  pointer-events: none; /* Disabled - titlebar handles top edge */
}

.window__resize--s {
  bottom: 0;
  cursor: ns-resize;
}

.window__resize--e,
.window__resize--w {
  width: 4px;
  top: 4px;
  bottom: 4px;
}

.window__resize--e {
  right: 0;
  cursor: ew-resize;
}

.window__resize--w {
  left: 0;
  cursor: ew-resize;
}

.window__resize--ne,
.window__resize--se,
.window__resize--sw,
.window__resize--nw {
  width: 8px;
  height: 8px;
}

.window__resize--ne {
  top: 0;
  right: 0;
  cursor: nesw-resize;
  pointer-events: none; /* Disabled - overlaps with titlebar controls */
}

.window__resize--se {
  bottom: 0;
  right: 0;
  cursor: nwse-resize;
}

.window__resize--sw {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}

.window__resize--nw {
  top: 0;
  left: 0;
  cursor: nwse-resize;
  pointer-events: none; /* Disabled - overlaps with titlebar */
}

.window.maximized .window__resize {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   TASKBAR
   ═══════════════════════════════════════════════════════════════ */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--taskbar-height);
  background: var(--win95-gray);
  display: flex;
  align-items: center;
  padding: 2px 4px;
  z-index: var(--z-taskbar);
  border-top: 2px solid var(--win95-white);
}

.taskbar__start {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 2px 6px;
  background: var(--win95-gray);
  border: 2px solid;
  border-color: var(--win95-white) var(--win95-black) var(--win95-black) var(--win95-white);
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  font-family: var(--font-system);
}

.taskbar__start:active,
.taskbar__start.active {
  border-color: var(--win95-black) var(--win95-white) var(--win95-white) var(--win95-black);
}

.taskbar__start:focus-visible {
  outline: 1px dotted var(--win95-black);
  outline-offset: -4px;
}

.taskbar__start img {
  width: 18px;
  height: 18px;
}

.taskbar__divider {
  width: 2px;
  height: 24px;
  margin: 0 4px;
  border-left: 1px solid var(--win95-dark-gray);
  border-right: 1px solid var(--win95-white);
}

.taskbar__windows {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  padding: 0 4px;
}

.taskbar__window-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 120px;
  max-width: 160px;
  height: 24px;
  padding: 2px 8px;
  background: var(--win95-gray);
  border: 2px solid;
  border-color: var(--win95-white) var(--win95-black) var(--win95-black) var(--win95-white);
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-system);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.taskbar__window-btn img {
  width: 16px;
  height: 16px;
}

.taskbar__window-btn.active {
  border-color: var(--win95-black) var(--win95-white) var(--win95-white) var(--win95-black);
  background: #e0e0e0;
}

.taskbar__tray {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 2px 8px;
  border: 1px solid;
  border-color: var(--win95-dark-gray) var(--win95-white) var(--win95-white) var(--win95-dark-gray);
  margin-left: auto;
}

.taskbar__clock {
  font-size: 11px;
  padding: 0 8px;
}

/* ═══════════════════════════════════════════════════════════════
   START MENU
   ═══════════════════════════════════════════════════════════════ */
.start-menu {
  position: fixed;
  bottom: var(--taskbar-height);
  left: 0;
  width: 180px;
  background: var(--win95-gray);
  border: 2px solid;
  border-color: var(--win95-white) var(--win95-black) var(--win95-black) var(--win95-white);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  z-index: var(--z-start-menu);
  display: none;
  flex-direction: column;
  padding: 2px;
}

.start-menu.active {
  display: flex;
}

.start-menu__sidebar {
  position: absolute;
  left: 2px;
  top: 2px;
  bottom: 2px;
  width: 24px;
  background: linear-gradient(180deg, #000080, #1084d0);
  display: flex;
  align-items: flex-end;
  padding-bottom: 8px;
}

.start-menu__sidebar span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  color: #ffffff;
  font-weight: bold;
  font-size: 16px;
  letter-spacing: 1px;
}

.start-menu__items {
  margin-left: 26px;
  display: flex;
  flex-direction: column;
}

.start-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 11px;
  cursor: pointer;
  background: transparent;
  border: none;
  text-align: left;
  font-family: var(--font-system);
  width: 100%;
}

.start-menu__item:hover {
  background: var(--win95-navy);
  color: #ffffff;
}

.start-menu__item:focus-visible {
  background: var(--win95-navy);
  color: #ffffff;
  outline: 1px dotted var(--win95-white);
  outline-offset: -2px;
}

.start-menu__item img {
  width: 16px;
  height: 16px;
}

.start-menu__divider {
  height: 1px;
  margin: 2px 4px;
  background: var(--win95-dark-gray);
  border-bottom: 1px solid var(--win95-white);
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.win95-btn {
  background: var(--win95-gray);
  border: 2px solid;
  border-color: var(--win95-white) var(--win95-black) var(--win95-black) var(--win95-white);
  padding: 4px 12px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-system);
  min-width: 75px;
}

.win95-btn:active {
  border-color: var(--win95-black) var(--win95-white) var(--win95-white) var(--win95-black);
}

.win95-btn:focus-visible {
  outline: 1px dotted var(--win95-black);
  outline-offset: -4px;
}

.win95-btn:disabled {
  color: var(--win95-dark-gray);
  text-shadow: 1px 1px 0 var(--win95-white);
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════════ */
.win95-input {
  background: var(--win95-white);
  border: 2px solid;
  border-color: var(--win95-dark-gray) var(--win95-white) var(--win95-white) var(--win95-dark-gray);
  box-shadow: inset 1px 1px 0 var(--win95-black);
  padding: 4px 6px;
  font-size: 11px;
  font-family: var(--font-system);
}

/* ═══════════════════════════════════════════════════════════════
   CONTENT STYLES
   ═══════════════════════════════════════════════════════════════ */
.win95-content h1 {
  font-size: 16px;
  font-weight: bold;
  margin: 0 0 12px 0;
}

.win95-content h2 {
  font-size: 14px;
  font-weight: bold;
  margin: 16px 0 8px 0;
}

.win95-content h3 {
  font-size: 12px;
  font-weight: bold;
  margin: 12px 0 6px 0;
}

.win95-content p {
  margin: 0 0 8px 0;
}

.win95-content a {
  color: var(--win95-navy);
  text-decoration: underline;
}

.win95-content a:hover {
  color: var(--win95-blue);
}

.win95-content ul {
  margin: 4px 0 8px 16px;
  padding: 0;
}

.win95-content li {
  margin: 2px 0;
}

/* ═══════════════════════════════════════════════════════════════
   GROUP BOX
   ═══════════════════════════════════════════════════════════════ */
.win95-groupbox {
  border: 1px solid var(--win95-dark-gray);
  border-top-color: var(--win95-white);
  border-left-color: var(--win95-white);
  padding: 12px;
  margin: 8px 0;
  position: relative;
}

.win95-groupbox__title {
  position: absolute;
  top: -8px;
  left: 8px;
  background: var(--win95-gray);
  padding: 0 4px;
  font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════════
   CARDS (Win95 Style)
   ═══════════════════════════════════════════════════════════════ */
.win95-card {
  background: var(--win95-gray);
  border: 2px solid;
  border-color: var(--win95-white) var(--win95-black) var(--win95-black) var(--win95-white);
  padding: 8px;
  margin: 4px 0;
}

.win95-card__title {
  font-weight: bold;
  font-size: 11px;
  margin-bottom: 4px;
}

.win95-card__text {
  font-size: 11px;
  color: var(--win95-black);
}

/* ═══════════════════════════════════════════════════════════════
   SIGNATURE
   ═══════════════════════════════════════════════════════════════ */
.signature-container {
  position: fixed;
  bottom: calc(var(--taskbar-height) + 16px);
  right: 16px;
  z-index: 5;
}

.signature-container img {
  height: 40px;
  opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════
   BADGE / TAG
   ═══════════════════════════════════════════════════════════════ */
.win95-badge {
  display: inline-block;
  background: var(--win95-gray);
  border: 1px solid;
  border-color: var(--win95-dark-gray) var(--win95-white) var(--win95-white) var(--win95-dark-gray);
  padding: 1px 6px;
  font-size: 10px;
  margin: 1px;
}

/* ═══════════════════════════════════════════════════════════════
   SCREENSHOTS
   ═══════════════════════════════════════════════════════════════ */
.win95-screenshot {
  border: 2px solid;
  border-color: var(--win95-dark-gray) var(--win95-white) var(--win95-white) var(--win95-dark-gray);
  box-shadow: inset 1px 1px 0 var(--win95-black);
  max-width: 100%;
  height: auto;
}

.win95-gallery {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.win95-gallery img {
  max-width: 200px;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBARS (Win95 Style)
   ═══════════════════════════════════════════════════════════════ */
.window__content::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

.window__content::-webkit-scrollbar-track {
  background: repeating-conic-gradient(var(--win95-gray) 0% 25%, var(--win95-white) 0% 50%) 50% / 2px 2px;
}

.window__content::-webkit-scrollbar-thumb {
  background: var(--win95-gray);
  border: 2px solid;
  border-color: var(--win95-white) var(--win95-black) var(--win95-black) var(--win95-white);
  box-shadow: inset 1px 1px 0 var(--win95-silver);
}

.window__content::-webkit-scrollbar-thumb:hover {
  background: var(--win95-silver);
}

.window__content::-webkit-scrollbar-thumb:active {
  border-color: var(--win95-black) var(--win95-white) var(--win95-white) var(--win95-black);
}

.window__content::-webkit-scrollbar-button {
  background: var(--win95-gray);
  border: 2px solid;
  border-color: var(--win95-white) var(--win95-black) var(--win95-black) var(--win95-white);
  height: 16px;
  width: 16px;
  display: block;
}

.window__content::-webkit-scrollbar-button:active {
  border-color: var(--win95-black) var(--win95-white) var(--win95-white) var(--win95-black);
}

/* Up arrow */
.window__content::-webkit-scrollbar-button:vertical:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M8 5L4 9h8z' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* Down arrow */
.window__content::-webkit-scrollbar-button:vertical:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M8 11L4 7h8z' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* Left arrow */
.window__content::-webkit-scrollbar-button:horizontal:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M5 8l4-4v8z' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* Right arrow */
.window__content::-webkit-scrollbar-button:horizontal:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M11 8l-4-4v8z' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.window__content::-webkit-scrollbar-corner {
  background: var(--win95-gray);
}

/* Firefox scrollbar fallback */
.window__content {
  scrollbar-width: auto;
  scrollbar-color: var(--win95-gray) var(--win95-silver);
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --taskbar-height: 40px;
  }

  .desktop-icons {
    position: fixed;
    bottom: var(--taskbar-height);
    left: 0;
    right: 0;
    flex-direction: row;
    justify-content: space-around;
    height: auto;
    padding: 8px;
    background: var(--win95-gray);
    border-top: 2px solid var(--win95-white);
    z-index: 50;
  }

  .window {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - var(--taskbar-height) - 80px) !important;
    border: none;
    min-width: unset;
    min-height: unset;
  }

  .window__titlebar {
    cursor: default;
  }

  .taskbar__window-btn {
    min-width: 80px;
    max-width: 100px;
    font-size: 10px;
  }

  .taskbar__window-btn span {
    display: none;
  }

  .signature-container {
    display: none;
  }

  .start-menu {
    width: 100%;
    bottom: var(--taskbar-height);
    left: 0;
    right: 0;
  }

  .start-menu__sidebar {
    display: none;
  }

  .start-menu__items {
    margin-left: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--win95-navy);
  color: #ffffff;
  padding: 8px 16px;
  z-index: 99999;
}

.skip-link:focus {
  top: 0;
}
