/* RISC OS 3 Aesthetic Stylesheet */

:root {
  /* RISC OS 3 color palette - accurate to reference */
  --iconbar-bg: rgb(221, 221, 221);      /* Bottom icon bar */
  --desktop-bg: rgb(119, 119, 119);       /* Main desktop background */
  --window-bg: rgb(221, 221, 221);        /* Window interior */
  --toolbar-bg: rgb(187, 187, 187);       /* Toolbar background */
  --white: #ffffff;
  --black: #000000;
  --border-color: #000000;                /* Simple black borders */
  --selection: #0088dd;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 13px;
  overflow: hidden;
  line-height: 1.4;
}

/* Desktop */
.desktop {
  width: 100vw;
  height: 100vh;
  background-color: var(--desktop-bg);
  background-image: url('../images/assets/background_tile.png');
  background-repeat: repeat;
  position: relative;
}

/* Icon Bar (bottom) */
.iconbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background-color: var(--iconbar-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
}

.iconbar-left,
.iconbar-right {
  display: flex;
  gap: 16px;
}

.icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
  gap: 4px;
  height: 70px;
}

.icon span {
  font-size: 12px;
  color: var(--black);
}

.icon-placeholder {
  width: 48px;
  height: 48px;
  background-color: var(--window-bg);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 10px;
}

/* Content Area */
.content-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 80px;
}

/* Window */
.window {
  position: absolute;
  width: 800px;
  min-height: 600px;
  background-color: var(--window-bg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.window-background {
  pointer-events: none;
}

/* Window Title Bar */
.window-titlebar {
  height: 36px;
  background-color: var(--toolbar-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 4px;
  gap: 2px;
}

.window-btn {
  width: 36px;
  height: 28px;
  background-color: var(--toolbar-bg);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.window-btn:active {
  background-color: var(--window-bg);
}

.window-title {
  flex: 1;
  text-align: center;
  font-weight: bold;
  font-size: 14px;
  padding: 0 8px;
}

.window-scrollbar-top {
  display: flex;
  gap: 0;
  flex-shrink: 0;
}

/* Window Content */
.window-content {
  flex: 1;
  background-color: var(--white);
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border-color);
  margin: 4px;
  max-height: 520px;
}

.window-content h1 {
  font-size: 16px;
  margin-bottom: 16px;
  font-weight: bold;
}

.window-content p {
  margin-bottom: 14px;
  line-height: 1.6;
  font-size: 14px;
}

.window-content a {
  color: var(--selection);
  text-decoration: underline;
}

.window-content a:hover {
  background-color: var(--selection);
  color: var(--white);
}

/* Menu List */
.menu-list {
  margin-top: 24px;
  display: flex;
  flex-direction: row;
  gap: 24px;
  flex-wrap: wrap;
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px;
  color: var(--black);
  text-decoration: none;
  font-weight: normal;
  cursor: pointer;
  min-width: 90px;
}

.menu-item:hover {
  background-color: var(--toolbar-bg);
}

.menu-item:active {
  background-color: var(--selection);
  color: var(--white);
}

.menu-item-icon {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.menu-item span {
  font-size: 13px;
  text-align: center;
}

.scroll-btn {
  width: 36px;
  height: 28px;
  background-color: var(--toolbar-bg);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.scroll-btn:active {
  background-color: var(--window-bg);
}

/* Resize button in bottom right */
.window-resize-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  background-color: var(--toolbar-bg);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-right: none;
  cursor: nwse-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.window-resize-btn:active {
  background-color: var(--window-bg);
}

/* Icon image styles */
.icon-img {
  width: 48px;
  height: auto;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.window-icon {
  max-width: 24px;
  max-height: 24px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.toolbar-icon {
  max-width: 20px;
  max-height: 20px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.scroll-icon {
  max-width: 16px;
  max-height: 16px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* CSS-based window control icons */
.icon-toggle-size,
.icon-close,
.icon-menu,
.icon-arrow-up,
.icon-arrow-down,
.icon-resize {
  width: 16px;
  height: 16px;
  position: relative;
  display: inline-block;
}

/* Toggle size icon (two overlapping squares) */
.icon-toggle-size::before,
.icon-toggle-size::after {
  content: '';
  position: absolute;
  border: 2px solid var(--black);
  background: transparent;
}

.icon-toggle-size::before {
  width: 10px;
  height: 10px;
  top: 0;
  left: 0;
}

.icon-toggle-size::after {
  width: 10px;
  height: 10px;
  bottom: 0;
  right: 0;
}

/* Close icon (X) */
.icon-close::before,
.icon-close::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 2px;
  background: var(--black);
  top: 50%;
  left: 50%;
}

.icon-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.icon-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Menu icon (three horizontal lines) */
.icon-menu::before,
.icon-menu::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 2px;
  background: var(--black);
  left: 2px;
}

.icon-menu::before {
  top: 3px;
  box-shadow: 0 4px 0 var(--black), 0 8px 0 var(--black);
}

/* Up arrow */
.icon-arrow-up::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid var(--black);
  top: 4px;
  left: 2px;
}

/* Down arrow */
.icon-arrow-down::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--black);
  top: 4px;
  left: 2px;
}

/* Resize icon (corner grip with dots) */
.icon-resize::before,
.icon-resize::after {
  content: '';
  position: absolute;
  background: var(--black);
}

.icon-resize::before {
  width: 2px;
  height: 2px;
  bottom: 2px;
  right: 2px;
  box-shadow:
    -4px 0 0 var(--black),
    -8px 0 0 var(--black),
    0 -4px 0 var(--black),
    -4px -4px 0 var(--black),
    0 -8px 0 var(--black);
}

.icon-resize::after {
  display: none;
}

/* Mobile Responsive Styles */
@media screen and (max-width: 768px) {
  /* Allow scrolling on mobile */
  body {
    overflow: auto;
  }

  /* Make desktop scrollable */
  .desktop {
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
  }

  /* Adjust content area for mobile */
  .content-area {
    position: relative;
    bottom: 0;
    padding-bottom: 80px;
  }

  /* Make windows full-width on mobile */
  .window {
    position: relative !important;
    width: calc(100vw - 20px) !important;
    max-width: 100%;
    min-height: auto !important;
    left: 10px !important;
    top: 10px !important;
    margin-bottom: 20px;
  }

  /* Stack background windows vertically */
  .window-background {
    position: relative !important;
    left: 10px !important;
    top: 0 !important;
    opacity: 1 !important;
  }

  /* Reduce window content max-height on mobile */
  .window-content {
    max-height: none;
    padding: 16px;
  }

  /* Make icon bar fixed at bottom */
  .iconbar {
    position: fixed;
    z-index: 1000;
  }

  /* Reduce icon sizes on mobile */
  .icon {
    height: 56px;
  }

  .icon-img {
    width: 28px;
  }

  .icon span {
    font-size: 10px;
  }

  /* Adjust window title font size */
  .window-title {
    font-size: 11px;
  }

  /* Make menu items stack better on mobile */
  .menu-list {
    gap: 16px;
    justify-content: center;
  }

  .menu-item {
    min-width: 70px;
  }

  .menu-item-icon {
    width: 44px;
    height: 44px;
  }

  /* Adjust button sizes */
  .window-btn,
  .scroll-btn {
    min-width: 24px;
    width: 24px;
    height: 24px;
  }

  /* Smaller content font */
  .window-content p {
    font-size: 13px;
    line-height: 1.6;
  }

  .window-content h1 {
    font-size: 15px;
  }
}

@media screen and (max-width: 480px) {
  /* Extra small screens */
  .window {
    width: calc(100vw - 10px) !important;
    left: 5px !important;
  }

  .iconbar {
    height: 70px;
    padding: 0 4px;
  }

  .iconbar-left,
  .iconbar-right {
    gap: 8px;
  }

  .icon {
    height: 50px;
  }

  .icon-img {
    width: 24px;
  }

  .icon span {
    font-size: 9px;
  }

  .window-title {
    font-size: 10px;
  }

  .menu-item-icon {
    width: 36px;
    height: 36px;
  }

  .window-content {
    padding: 12px;
  }

  .window-content p {
    font-size: 12px;
  }

  .window-content h1 {
    font-size: 14px;
  }
}
