/* ═══════════════════════════════════════════════════════════════════════════
   Mac OS System 7 Theme
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'ChiKareGo';
  src: url('fonts/ChiKareGo.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --black:     #000000;
  --white:     #ffffff;
  --gray-light:#cccccc;
  --gray:      #999999;
  --gray-dark: #555555;
  --desktop:   #6688aa;
  --accent:    #DADAFC;
  --pinstripe: #969696;
  --font:      Geneva, 'Lucida Grande', 'Helvetica Neue', sans-serif;
  --font-title: 'ChiKareGo', Chicago, Geneva, sans-serif;
  --win-scale:  1.5;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */

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

html {
  font-size: 13px;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  text-rendering: optimizeSpeed;
}

body {
  font-family: var(--font);
  color: var(--black);
  min-height: 100vh;
  background-color: var(--desktop);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect x='0' y='0' width='2' height='2' fill='%23556E8B'/%3E%3Crect x='2' y='2' width='2' height='2' fill='%23556E8B'/%3E%3Crect x='2' y='0' width='2' height='2' fill='%237B98B5'/%3E%3Crect x='0' y='2' width='2' height='2' fill='%237B98B5'/%3E%3C/svg%3E");
  background-size: 4px 4px;
  image-rendering: pixelated;
  padding: 0;
}

/* ─── Menu Bar ───────────────────────────────────────────────────────────── */

.menu-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--white);
  border-bottom: 2px solid var(--black);
  display: flex;
  align-items: stretch;
  padding: 0;
  height: 20px;
  gap: 0;
  font-family: var(--font);
  font-size: 12px;
  font-weight: bold;
  line-height: 20px;
  user-select: none;
  zoom: var(--win-scale);
}

.menu-top {
  position: relative;
  display: flex;
  align-items: center;
  cursor: default;
}

.menu-top .menu-label,
.menu-top .menu-apple {
  padding: 0 10px;
  height: 20px;
  line-height: 20px;
  display: block;
}

.menu-top .menu-apple {
  font-size: 15px;
  padding: 0 12px 0 8px;
}

.menu-top.open > .menu-label,
.menu-top.open > .menu-apple {
  background: var(--black);
  color: var(--white);
}

/* ─── Dropdown ───────────────────────────────────────────────────────────── */

.menu-dropdown {
  display: none;
  position: absolute;
  top: 20px;
  left: 0;
  min-width: 200px;
  background: var(--white);
  border: 2px solid var(--black);
  box-shadow: 1px 1px 0 var(--black);
  padding: 2px 0;
  z-index: 1001;
}

.menu-top.open > .menu-dropdown {
  display: block;
}

.menu-entry {
  padding: 1px 18px 1px 16px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: normal;
  line-height: 18px;
  cursor: default;
  position: relative;
}

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

.menu-entry.disabled {
  color: var(--gray);
}

.menu-entry.disabled:hover {
  background: var(--white);
  color: var(--gray);
}

.menu-entry.checked::before {
  content: '✓';
  position: absolute;
  left: 4px;
}

.menu-key {
  margin-left: auto;
  font-family: var(--font);
  font-size: 12px;
}

.menu-entry:hover .menu-key {
  color: var(--white);
}

.menu-sep {
  height: 0;
  border-top: 1px solid var(--black);
  margin: 3px 0;
}

.menu-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid var(--black);
  flex-shrink: 0;
}

/* ─── Top Stickies ──────────────────────────────────────────────────────── */

#top-stickies {
  display: flex;
  gap: 16px;
  padding: 24px 24px 0;
  max-width: 1200px;
  margin: 0 auto;
}

.sticky-wide {
  flex: 3;
  width: auto;
  margin: 0;
  font-size: 13px;
  padding: 10px 14px 12px;
}

.sticky-wip {
  flex: 1;
  width: auto;
  margin: 0;
  font-size: 14px;
  font-weight: bold;
  padding: 10px 18px 12px;
  align-self: flex-start;
}

/* ─── Projects Grid ──────────────────────────────────────────────────────── */

#projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(630px, 1fr));
  gap: 32px;
  padding: 28px 24px 48px;
  max-width: 1800px;
  margin: 0 auto;
}

.project-group {
  display: flex;
  align-items: flex-start;
  gap: 0;
  position: relative;
}

.project-group .win {
  flex: 1;
  min-width: 0;
}

/* ─── Stickies (System 7.5) ─────────────────────────────────────────────── */

.sticky {
  width: 160px;
  flex-shrink: 0;
  background: #fdec6e;
  box-shadow: 1px 1px 0 #000;
  margin-left: 10px;
  margin-top: 28px;
  align-self: flex-start;
  position: relative;
  z-index: 1;
  padding: 8px 8px 10px;
  font-family: Geneva, 'Lucida Grande', sans-serif;
  font-size: 12px;
  line-height: 1.45;
  color: #000;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
  text-rendering: auto;
  letter-spacing: normal;
}

/* ═══════════════════════════════════════════════════════════════════════════
   System 7 Window
   ═══════════════════════════════════════════════════════════════════════════ */

.win {
  position: relative;
  background: var(--white);
  border: 1px solid var(--black);
  box-shadow: 1px 1px 0 var(--black);
  display: flex;
  flex-direction: column;
  zoom: var(--win-scale);
}

/* ─── Title Bar ──────────────────────────────────────────────────────────── */

.win-titlebar {
  display: flex;
  align-items: center;
  height: 18px;
  border-left: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  box-shadow: 0 1px 0 var(--black);
  position: relative;
  user-select: none;
  background: #F3F3F3;
}

.win-titlebar::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(to bottom,
    var(--accent) 0px,  var(--accent) 1px,
    #F3F3F3  1px,  #F3F3F3  3px,
    var(--pinstripe) 3px, var(--pinstripe) 4px,
    #F3F3F3 4px,  #F3F3F3  5px,
    var(--pinstripe) 5px, var(--pinstripe) 6px,
    #F3F3F3 6px,  #F3F3F3  7px,
    var(--pinstripe) 7px, var(--pinstripe) 8px,
    #F3F3F3 8px,  #F3F3F3  9px,
    var(--pinstripe) 9px, var(--pinstripe) 10px,
    #F3F3F3 10px, #F3F3F3  11px,
    var(--pinstripe) 11px, var(--pinstripe) 12px,
    #F3F3F3 12px, #F3F3F3 13px,
    var(--pinstripe) 13px, var(--pinstripe) 14px,
    #F3F3F3 14px, #F3F3F3 16px,
    var(--accent) 16px, var(--accent) 17px
  );
}

.win-close {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  cursor: default;
  margin: 0 0 0 8px;
  box-shadow: -1px 0 0 var(--white), 1px 0 0 var(--white);
  image-rendering: pixelated;
}

.win-title {
  text-align: center;
  font-family: var(--font-title);
  font-size: calc(24px / var(--win-scale));
  font-weight: normal;
  letter-spacing: 0.5px;
  height: 14px;
  line-height: 14px;
  background: #F3F3F3;
  padding: 0 calc(7px / var(--win-scale));
  margin: 2px auto 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  z-index: 2;
  max-width: calc(100% - 50px);
}

.win-zoom {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  cursor: default;
  margin: 0 8px 0 0;
  box-shadow: -1px 0 0 var(--white), 1px 0 0 var(--white);
  image-rendering: pixelated;
}

/* ─── Window Content ─────────────────────────────────────────────────────── */

.win-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-right: 15px;
}

/* ─── Screenshot ─────────────────────────────────────────────────────────── */

.win-screenshot {
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid var(--black);
  overflow: hidden;
  position: relative;
  background: var(--white);
  cursor: pointer;
}

.win-screenshot.no-img {
  background:
    repeating-linear-gradient(
      -45deg,
      var(--white) 0px,
      var(--white) 4px,
      var(--gray-light) 4px,
      var(--gray-light) 5px
    );
  display: flex;
  align-items: center;
  justify-content: center;
}

.win-screenshot.no-img::before {
  content: 'No preview available';
  font-size: 11px;
  color: var(--gray-dark);
  background: var(--white);
  padding: 2px 8px;
  border: 1px solid var(--gray);
}

.win-screenshot.no-img img {
  display: none;
}

.win-screenshot img {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  top: 0;
}

/* ─── Floating Button ────────────────────────────────────────────────────── */

.win-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 3;
  display: inline-block;
  font-family: var(--font);
  font-size: 11px;
  font-weight: bold;
  text-decoration: none;
  color: var(--black);
  background: var(--white);
  padding: 4px 20px 5px;
  border: 2px solid var(--black);
  border-radius: 8px;
  box-shadow:
    inset -1px -1px 0 var(--gray),
    inset 1px 1px 0 var(--white);
  cursor: pointer;
  user-select: none;
}

.win-btn:hover {
  background: var(--black);
  color: var(--white);
  box-shadow: none;
}

.win-btn:active {
  background: var(--black);
  color: var(--white);
  box-shadow: inset 1px 1px 0 var(--gray-dark);
}

.win-size {
  font-size: 10px;
  color: var(--gray-dark);
  font-style: italic;
}

/* ─── Scrollbar (wider, authentic) ───────────────────────────────────────── */

.win-scrollbar {
  position: absolute;
  top: 19px;
  right: 0;
  bottom: 15px;  /* 14px grow box + 1px border */
  width: 15px;   /* 14px + 1px border-left */
  border-left: 1px solid var(--black);
  background: var(--white);
  display: flex;
  flex-direction: column;
}

.win-scroll-up,
.win-scroll-down {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: default;
  box-shadow: 0 1px 0 var(--black);
}

.win-scroll-down {
  margin-top: auto;
  box-shadow: 0 1px 0 var(--black);
}

.scroll-arrow {
  image-rendering: pixelated;
}

.win-scroll-track {
  flex: 1;
  background: url('design/svg/scroll_pattern_right.svg') repeat;
  background-size: 14px 2px;
  image-rendering: pixelated;
  position: relative;
}

.win-scroll-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 16px;
  image-rendering: pixelated;
}

/* ─── Grow Box ──────────────────────────────────────────────────────────── */

.win-grow {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 15px;   /* 14px + 1px left border */
  height: 15px;  /* 14px + 1px top border */
  border-top: 1px solid var(--black);
  border-left: 1px solid var(--black);
  image-rendering: pixelated;
  object-position: bottom right;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 520px) {
  #projects {
    grid-template-columns: 1fr;
    padding: 16px 12px 32px;
    gap: 20px;
  }

  .project-group {
    flex-direction: column;
  }

  .sticky {
    width: 100%;
    margin-left: 0;
    margin-top: -1px;
  }
}
