/* ==========================================================================
   RETRO OS - Personal Website Design System
   Inspired by cyanbanister.com
   ========================================================================== */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=VT323&family=Press+Start+2P&family=Share+Tech+Mono&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  --green-primary: #39FF14;
  --green-dim: #2ecc0f;
  --green-dark: #1a8a0e;
  --green-glow: rgba(57, 255, 20, 0.4);
  --green-subtle: rgba(57, 255, 20, 0.08);

  --pink-primary: #FF1493;
  --pink-light: #FF69B4;
  --pink-bg: #FF1493;
  --pink-glow: rgba(255, 20, 147, 0.3);

  --blue-primary: #4488FF;
  --blue-light: #6699FF;
  --blue-dark: #2255AA;

  --bg-body: #0a0e0a;
  --bg-dark: #050805;
  --bg-window: #0d0d0d;
  --bg-titlebar: #1a1a2e;

  --text-primary: #e0e0e0;
  --text-green: #39FF14;
  --text-dim: #888;

  --border-green: #39FF14;
  --border-dim: #2a3a2a;

  --font-pixel: 'VT323', monospace;
  --font-heading: 'Press Start 2P', cursive;
  --font-mono: 'Share Tech Mono', monospace;

  --window-radius: 4px;
  --z-matrix: 1;
  --z-crt: 2;
  --z-desktop: 10;
  --z-window-base: 100;
  --z-menu: 9999;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-pixel);
  background: var(--bg-body);
  color: var(--text-primary);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  cursor: default;
  user-select: none;
}

a {
  color: var(--green-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-shadow: 0 0 8px var(--green-glow);
}

/* ---------- Matrix Rain Canvas ---------- */
#matrix-rain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-matrix);
  pointer-events: none;
  opacity: 0.35;
}

/* ---------- CRT Overlay ---------- */
.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-crt);
  pointer-events: none;
  background: repeating-linear-gradient(0deg,
      rgba(0, 0, 0, 0.15) 0px,
      rgba(0, 0, 0, 0.15) 1px,
      transparent 1px,
      transparent 3px);
  animation: crt-flicker 0.15s infinite alternate;
}

.crt-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center,
      transparent 60%,
      rgba(0, 0, 0, 0.4) 100%);
}

@keyframes crt-flicker {
  0% {
    opacity: 0.97;
  }

  100% {
    opacity: 1;
  }
}

/* ---------- Boot Screen ---------- */
.boot-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  color: var(--green-primary);
  transition: opacity 0.5s ease;
}

.boot-screen.fade-out {
  opacity: 0;
}

.boot-text {
  font-size: 1.5rem;
  text-align: left;
  line-height: 2;
  max-width: 600px;
}

.boot-text .cursor-blink {
  animation: blink 0.6s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---------- Menu Bar ---------- */
.menu-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background: linear-gradient(180deg, #1a2a1a 0%, #0d1a0d 100%);
  border-bottom: 2px solid var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: var(--z-menu);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.menu-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 2px solid transparent;
  color: var(--green-primary);
  font-family: var(--font-pixel);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 4px;
  transition: all 0.2s;
}

.menu-trigger:hover,
.menu-trigger.active {
  background: rgba(57, 255, 20, 0.1);
  border-color: var(--green-dark);
}

.menu-trigger .avatar-icon {
  width: 24px;
  height: 24px;
}

.menu-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--green-primary);
  opacity: 0.7;
  transition: all 0.25s;
  border-radius: 4px;
}

.social-link:hover {
  opacity: 1;
  text-decoration: none;
  transform: scale(1.15);
  text-shadow: 0 0 8px var(--green-glow);
}

.social-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ---------- Dropdown Menu ---------- */
.dropdown-menu {
  position: fixed;
  top: 40px;
  left: 8px;
  background: linear-gradient(180deg, #1a2a1a 0%, #0d1a0d 100%);
  border: 2px solid var(--green-dark);
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: var(--z-menu);
  min-width: 220px;
  padding: 6px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  transform-origin: top left;
  animation: menu-slide 0.15s ease-out;
}

.dropdown-menu.hidden {
  display: none;
}

@keyframes menu-slide {
  from {
    opacity: 0;
    transform: scaleY(0.8);
  }

  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

.dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-pixel);
  font-size: 1.15rem;
  padding: 8px 18px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.dropdown-menu button:hover {
  background: rgba(57, 255, 20, 0.12);
  color: var(--green-primary);
}

.dropdown-menu button svg,
.dropdown-menu button .menu-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.dropdown-menu .divider {
  height: 1px;
  background: var(--border-dim);
  margin: 4px 12px;
}

/* ---------- Desktop Area ---------- */
.desktop {
  position: fixed;
  top: 40px;
  left: 0;
  width: 100%;
  height: calc(100vh - 40px);
  z-index: var(--z-desktop);
  display: flex;
  padding: 24px;
  gap: 24px;
}

/* ---------- Icon Grid ---------- */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(3, 120px);
  grid-template-rows: repeat(3, 130px);
  gap: 16px;
  align-content: start;
  flex-shrink: 0;
  padding-top: 8px;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.desktop-icon:hover {
  background: var(--green-subtle);
  border-color: rgba(57, 255, 20, 0.2);
  transform: translateY(-2px);
}

.desktop-icon:hover .icon-image {
  filter: drop-shadow(0 0 8px var(--green-glow));
}

.desktop-icon:active {
  transform: translateY(0);
}

.desktop-icon.selected {
  background: rgba(57, 255, 20, 0.15);
  border-color: var(--green-dark);
}

.icon-image {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.2s;
  image-rendering: pixelated;
}

.icon-image svg {
  width: 64px;
  height: 64px;
  shape-rendering: crispEdges;
}

.icon-label {
  font-family: var(--font-heading);
  font-size: 0.55rem;
  color: var(--green-primary);
  text-align: center;
  padding: 2px 8px;
  background: rgba(57, 255, 20, 0.12);
  border: 1px solid var(--green-dark);
  border-radius: 3px;
  letter-spacing: 0.5px;
  text-shadow: 0 0 6px var(--green-glow);
  white-space: nowrap;
}

/* ---------- Windows Area (right side for sticky notes) ---------- */
.windows-area {
  flex: 1;
  position: relative;
  pointer-events: none;
}

/* ---------- Window System ---------- */
.os-window {
  position: absolute;
  min-width: 280px;
  min-height: 180px;
  background: var(--bg-window);
  border: 2px solid var(--green-dark);
  border-radius: var(--window-radius);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5),
    0 0 20px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  animation: window-open 0.2s ease-out;
}

.os-window.closing {
  animation: window-close 0.15s ease-in forwards;
}

@keyframes window-open {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes window-close {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

/* Window Title Bar */
.window-titlebar {
  display: flex;
  align-items: center;
  height: 28px;
  padding: 0 4px 0 6px;
  cursor: grab;
  flex-shrink: 0;
  position: relative;
  gap: 6px;
}

.window-titlebar:active {
  cursor: grabbing;
}

/* Blue title bar (default) */
.os-window.type-default .window-titlebar {
  background: repeating-linear-gradient(0deg,
      var(--blue-primary) 0px,
      var(--blue-primary) 2px,
      var(--blue-dark) 2px,
      var(--blue-dark) 4px);
}

/* Pink title bar (sticky note) */
.os-window.type-sticky .window-titlebar {
  background: repeating-linear-gradient(0deg,
      var(--pink-primary) 0px,
      var(--pink-primary) 2px,
      #cc1177 2px,
      #cc1177 4px);
}

/* Green title bar (terminal) */
.os-window.type-terminal .window-titlebar {
  background: repeating-linear-gradient(0deg,
      var(--green-primary) 0px,
      var(--green-primary) 2px,
      var(--green-dark) 2px,
      var(--green-dark) 4px);
}

.window-titlebar-buttons {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.window-btn {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-pixel);
  line-height: 1;
  transition: background 0.15s;
}

.window-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.window-btn-close:hover {
  background: rgba(255, 60, 60, 0.5);
}

.window-title-text {
  flex: 1;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 0.95rem;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Stripe decoration on title bar */
.titlebar-stripes {
  flex: 1;
  height: 100%;
  min-width: 20px;
}

/* Window Content */
.window-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-primary);
  scrollbar-width: thin;
  scrollbar-color: var(--green-dark) var(--bg-dark);
}

.window-content::-webkit-scrollbar {
  width: 8px;
}

.window-content::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

.window-content::-webkit-scrollbar-thumb {
  background: var(--green-dark);
  border-radius: 4px;
}

/* Window Resize Handle */
.window-resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background: linear-gradient(135deg,
      transparent 40%,
      var(--green-dark) 40%,
      var(--green-dark) 50%,
      transparent 50%,
      transparent 65%,
      var(--green-dark) 65%,
      var(--green-dark) 75%,
      transparent 75%);
  opacity: 0.5;
}

.window-resize:hover {
  opacity: 1;
}

/* ---------- Sticky Note Window ---------- */
.os-window.type-sticky {
  border-color: var(--pink-primary);
  box-shadow: 4px 4px 0 rgba(255, 20, 147, 0.2),
    0 0 30px rgba(255, 20, 147, 0.1);
}

.os-window.type-sticky .window-content {
  background: var(--pink-primary);
  color: #1a0a10;
  font-size: 1.2rem;
  line-height: 1.7;
}

.os-window.type-sticky .window-content strong {
  font-weight: 700;
}

/* ---------- Terminal Window ---------- */
.os-window.type-terminal {
  border-color: var(--green-primary);
  box-shadow: 4px 4px 0 rgba(57, 255, 20, 0.15),
    0 0 20px rgba(57, 255, 20, 0.08);
}

.os-window.type-terminal .window-content {
  background: #000;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--green-primary);
  line-height: 1.5;
}

.terminal-output {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.terminal-output .cmd-line {
  color: var(--green-primary);
}

.terminal-output .cmd-response {
  color: #aaffaa;
  margin-bottom: 8px;
  display: block;
}

.terminal-output .cmd-error {
  color: #ff6666;
}

.terminal-input-line {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 4px;
}

.terminal-prompt {
  color: var(--green-primary);
  white-space: pre;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--green-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  caret-color: var(--green-primary);
}

/* ---------- About Me Content ---------- */
.about-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.about-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.about-avatar {
  width: 80px;
  height: 80px;
  border: 2px solid var(--green-primary);
  border-radius: 4px;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  image-rendering: pixelated;
}

.about-avatar svg {
  width: 60px;
  height: 60px;
}

.about-bio {
  flex: 1;
}

.about-bio h2 {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  color: var(--green-primary);
  margin-bottom: 8px;
  text-shadow: 0 0 8px var(--green-glow);
}

.about-bio p {
  color: var(--text-primary);
  font-size: 1.1rem;
  line-height: 1.6;
}

.about-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.about-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--green-dark);
  border-radius: 4px;
  color: var(--green-primary);
  font-size: 1rem;
  transition: all 0.2s;
}

.about-links a:hover {
  background: rgba(57, 255, 20, 0.1);
  text-decoration: none;
  border-color: var(--green-primary);
}

/* ---------- Projects / Folder Grid ---------- */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
  padding: 8px;
}

.folder-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.folder-item:hover {
  background: rgba(57, 255, 20, 0.08);
}

.folder-item svg {
  width: 48px;
  height: 48px;
  shape-rendering: crispEdges;
}

.folder-item .folder-label {
  font-family: var(--font-heading);
  font-size: 0.45rem;
  color: var(--green-primary);
  text-align: center;
  padding: 2px 6px;
  background: rgba(57, 255, 20, 0.12);
  border: 1px solid var(--green-dark);
  border-radius: 3px;
}

/* ---------- Content Lists ---------- */
.content-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.content-list li {
  padding: 10px 14px;
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  transition: all 0.2s;
  cursor: pointer;
}

.content-list li:hover {
  border-color: var(--green-dark);
  background: rgba(57, 255, 20, 0.05);
}

.content-list li .item-title {
  color: var(--green-primary);
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.content-list li .item-desc {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* ---------- Contact Content ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  transition: all 0.2s;
  cursor: pointer;
}

.contact-item:hover {
  border-color: var(--green-primary);
  background: rgba(57, 255, 20, 0.06);
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.1);
}

.contact-item svg {
  width: 24px;
  height: 24px;
  fill: var(--green-primary);
  flex-shrink: 0;
}

.contact-item span {
  color: var(--text-primary);
  font-size: 1.05rem;
}

/* ---------- Gallery Grid ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gallery-thumb {
  aspect-ratio: 1;
  background: var(--bg-dark);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
}

.gallery-thumb:hover {
  border-color: var(--green-primary);
  box-shadow: 0 0 12px var(--green-glow);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  filter: contrast(1.2) saturate(0.8);
}

/* ---------- Favorites/Bag Icon (right side) ---------- */
.favorites-icon {
  position: absolute;
  top: 8px;
  right: 24px;
  z-index: var(--z-desktop);
}

/* ---------- Animations ---------- */
@keyframes scanline-scroll {
  from {
    background-position: 0 0;
  }

  to {
    background-position: 0 100%;
  }
}

@keyframes glow-pulse {

  0%,
  100% {
    text-shadow: 0 0 4px var(--green-glow);
  }

  50% {
    text-shadow: 0 0 12px var(--green-glow), 0 0 20px var(--green-glow);
  }
}

@keyframes icon-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .icon-grid {
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 110px);
    gap: 10px;
  }

  .icon-image {
    width: 56px;
    height: 56px;
  }

  .icon-image svg {
    width: 48px;
    height: 48px;
  }

  .icon-label {
    font-size: 0.45rem;
  }

  .desktop {
    padding: 12px;
    gap: 12px;
  }
}

@media (max-width: 680px) {
  .desktop {
    flex-direction: column;
    overflow-y: auto;
  }

  .icon-grid {
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }

  .os-window {
    width: calc(100vw - 24px) !important;
    left: 12px !important;
    min-width: unset;
  }

  .windows-area {
    min-height: 400px;
  }

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

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .favorites-icon {
    display: none;
  }
}

/* ---------- Utility ---------- */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}