/* ==========================================================================
   Mac System 7.5 Design System
   ========================================================================== */

:root {
  --white: #ffffff;
  --black: #000000;
  --gray: #c0c0c0;
  --dark-gray: #808080;
  --light-gray: #dfdfdf;
  --highlight: #000080;
  --font-ui: 'ChicagoFLF', 'Geneva', 'Lucida Grande', sans-serif;
  --font-body: 'Geneva', 'Lucida Grande', 'Helvetica Neue', sans-serif;
  --font-mono: 'Monaco', 'Courier New', monospace;
}

/* --- Reset & Base --- */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.4;
  color: var(--black);
  background-color: var(--gray);
  overflow: hidden;
  height: 100vh;
}

/* --- Desktop Pattern (crosshatch) --- */

.desktop {
  position: fixed;
  top: 20px;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--gray);
  background-image: url('../img/desktop-pattern.png');
  background-repeat: repeat;
  image-rendering: pixelated;
  overflow: auto;
}

/* Fallback crosshatch via CSS if image not found */
.desktop--fallback {
  background-image:
    linear-gradient(45deg, var(--dark-gray) 25%, transparent 25%),
    linear-gradient(-45deg, var(--dark-gray) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--dark-gray) 75%),
    linear-gradient(-45deg, transparent 75%, var(--dark-gray) 75%);
  background-size: 2px 2px;
  background-position: 0 0, 0 1px, 1px -1px, -1px 0;
}

/* --- Menu Bar --- */

.menu-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: var(--white);
  border-bottom: 2px solid var(--black);
  display: flex;
  align-items: center;
  padding: 0 8px;
  z-index: 10000;
  font-family: var(--font-ui);
  font-size: 12px;
  user-select: none;
}

.menu-bar__apple {
  display: flex;
  align-items: center;
  padding: 0 8px 0 4px;
  height: 100%;
  cursor: default;
}

.menu-bar__apple img {
  height: 14px;
  width: auto;
}

.menu-bar__item {
  position: relative;
  padding: 2px 12px;
  height: 100%;
  display: flex;
  align-items: center;
  cursor: default;
  white-space: nowrap;
}

.menu-bar__item:hover,
.menu-bar__item--active {
  background: var(--black);
  color: var(--white);
}

.menu-bar__dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  background: var(--white);
  border: 1px solid var(--black);
  box-shadow: 2px 2px 0 var(--black);
  z-index: 10001;
  padding: 2px 0;
}

.menu-bar__item--active .menu-bar__dropdown {
  display: block;
}

.menu-bar__dropdown a {
  display: block;
  padding: 2px 16px;
  color: var(--black);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 12px;
}

.menu-bar__dropdown a:hover {
  background: var(--black);
  color: var(--white);
}

.menu-bar__dropdown hr {
  margin: 2px 0;
  border: none;
  border-top: 1px solid var(--dark-gray);
}

.menu-bar__spacer {
  flex: 1;
}

/* --- Window Chrome --- */

.window {
  position: absolute;
  background: var(--white);
  border: 1px solid var(--black);
  box-shadow: 1px 1px 0 var(--black), 2px 2px 0 var(--black);
  min-width: 200px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
}

.window--focused {
  z-index: 100;
}

.window__titlebar {
  display: flex;
  align-items: center;
  height: 20px;
  background: var(--white);
  border-bottom: 1px solid var(--black);
  padding: 0 4px;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}

.window__titlebar:active {
  cursor: grabbing;
}

.window--focused .window__titlebar {
  background:
    repeating-linear-gradient(
      to bottom,
      var(--white) 0px,
      var(--white) 1px,
      var(--black) 1px,
      var(--black) 2px,
      var(--white) 2px,
      var(--white) 3px
    );
}

.window__close {
  width: 12px;
  height: 12px;
  border: 1px solid var(--black);
  background: var(--white);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.window__close:active {
  background: var(--black);
}

.window__title {
  flex: 1;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: normal;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--white);
  margin: 0 4px;
}

.window__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
}

/* Window body scrollbar styling */
.window__body::-webkit-scrollbar {
  width: 16px;
}

.window__body::-webkit-scrollbar-track {
  background:
    repeating-linear-gradient(
      to bottom,
      var(--white) 0px,
      var(--white) 1px,
      var(--gray) 1px,
      var(--gray) 2px
    );
  border-left: 1px solid var(--black);
}

.window__body::-webkit-scrollbar-thumb {
  background: var(--light-gray);
  border: 1px solid var(--black);
}

.window__body::-webkit-scrollbar-button {
  height: 16px;
  background: var(--light-gray);
  border: 1px solid var(--black);
}

/* Resize grip */
.window__resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  border-left: 1px solid var(--black);
  border-top: 1px solid var(--black);
  background: var(--light-gray);
}

/* --- Buttons --- */

.btn {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 4px 16px;
  border: 2px solid var(--black);
  border-radius: 6px;
  background: var(--white);
  color: var(--black);
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  text-align: center;
  line-height: 1.3;
}

.btn:hover {
  background: var(--light-gray);
}

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

.btn--primary {
  box-shadow: 0 0 0 2px var(--black);
  border-radius: 8px;
}

.btn--disabled {
  color: var(--dark-gray);
  border-color: var(--dark-gray);
  cursor: default;
  box-shadow: none;
}

.btn--disabled:hover,
.btn--disabled:active {
  background: var(--white);
  color: var(--dark-gray);
}

/* --- Desktop Icons --- */

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80px;
  padding: 4px;
  cursor: default;
  text-decoration: none;
  color: var(--black);
}

.desktop-icon:hover .desktop-icon__label {
  background: var(--black);
  color: var(--white);
}

.desktop-icon__img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  margin-bottom: 4px;
}

.desktop-icon__label {
  font-family: var(--font-ui);
  font-size: 10px;
  text-align: center;
  padding: 1px 3px;
  word-break: break-word;
  line-height: 1.2;
}

.desktop-icons {
  position: absolute;
  top: 40px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Spec Table --- */

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 12px;
  margin: 12px 0;
}

.spec-table th,
.spec-table td {
  border: 1px solid var(--black);
  padding: 4px 8px;
  text-align: left;
  vertical-align: top;
}

.spec-table th {
  background: var(--light-gray);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: normal;
}

.spec-table tr:nth-child(even) td {
  background: #f5f5f5;
}

/* --- Badge --- */

.badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--black);
  background: var(--light-gray);
}

.badge--dev {
  background: var(--black);
  color: var(--white);
}

/* --- Content Typography --- */

.window__body h2 {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: normal;
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--black);
}

.window__body h2:first-child {
  margin-top: 0;
}

.window__body h3 {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: normal;
  margin: 12px 0 6px;
}

.window__body p {
  margin: 0 0 8px;
}

.window__body ul {
  margin: 4px 0 8px;
  padding-left: 20px;
}

.window__body li {
  margin-bottom: 4px;
}

.window__body a {
  color: var(--black);
  text-decoration: underline;
}

.window__body img,
.window__body svg {
  max-width: 100%;
  height: auto;
}

.window__body .hero-img {
  display: block;
  margin: 0 auto 12px;
  border: 1px solid var(--black);
  padding: 8px;
  background: var(--white);
}

.window__body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--light-gray);
  padding: 1px 4px;
  border: 1px solid var(--dark-gray);
}

/* --- Welcome Window (Landing) --- */

.welcome {
  text-align: center;
  padding: 24px;
}

.welcome__logo {
  width: 120px;
  height: auto;
  margin-bottom: 12px;
}

.welcome__title {
  font-family: var(--font-ui);
  font-size: 18px;
  margin: 0 0 8px;
  font-weight: normal;
}

.welcome__tagline {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--dark-gray);
  margin: 0 0 16px;
}

/* --- Price --- */

.price {
  font-family: var(--font-ui);
  font-size: 18px;
  margin: 12px 0;
}

.price__note {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--dark-gray);
}

/* --- Feature List --- */

.feature-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.feature-list li {
  padding: 4px 0 4px 20px;
  position: relative;
}

.feature-list li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* --- Kit Contents Grid --- */

.kit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  font-size: 12px;
  margin: 8px 0;
}

.kit-grid dt {
  font-family: var(--font-ui);
}

.kit-grid dd {
  margin: 0;
  color: var(--dark-gray);
}

/* --- Block Diagram (ASCII-style) --- */

.block-diagram {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.3;
  white-space: pre;
  background: var(--white);
  border: 1px solid var(--black);
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
}

/* --- Responsive / Mobile --- */

@media (max-width: 768px) {
  body {
    overflow: auto;
    height: auto;
  }

  .desktop {
    position: relative;
    top: 0;
    padding: 24px 8px 8px;
    min-height: 100vh;
    overflow: visible;
  }

  .menu-bar {
    position: sticky;
  }

  .window {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    margin-bottom: 12px;
    box-shadow: 1px 1px 0 var(--black);
  }

  .window__titlebar {
    cursor: default;
  }

  .window__resize {
    display: none;
  }

  .desktop-icons {
    position: relative;
    top: auto;
    right: auto;
    flex-direction: row;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
  }

  .kit-grid {
    grid-template-columns: 1fr;
  }

  .block-diagram {
    font-size: 9px;
  }
}

/* --- Utility --- */

.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
