/* ==========================================================================
   DESIGN TOKENS
   ========================================================================== */
:root {
  --bg-void: #0a0f1c;
  --bg-panel: #131b2e;
  --bg-panel-alt: #0f1729;
  --bg-raised: #1a2338;

  --accent-cyan: #45d0d6;
  --accent-cyan-dim: #2a8a90;
  --accent-red: #e0605a;

  --text-primary: #e7edf5;
  --text-secondary: #aab6c9;
  --text-muted: #6c7c94;

  --border: #253150;
  --border-bright: #34456c;

  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius: 3px;
  --taskbar-h: 44px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: var(--accent-cyan);
}

code {
  font-family: var(--font-mono);
  background: var(--bg-raised);
  padding: 1px 5px;
  border-radius: var(--radius);
  font-size: 0.9em;
}

/* ==========================================================================
   DESKTOP SURFACE
   ========================================================================== */
#desktop {
  position: fixed;
  inset: 0 0 var(--taskbar-h) 0;
  background: var(--bg-void);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 28px 28px;
  overflow: hidden;
}

/* ==========================================================================
   DESKTOP ICONS
   ========================================================================== */
#icon-grid {
  position: absolute;
  top: 20px;
  left: 20px;
  display: grid;
  grid-template-columns: 84px;
  gap: 8px;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 4px;
  color: var(--text-secondary);
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
  background: rgba(69, 208, 214, 0.08);
  border-color: rgba(69, 208, 214, 0.25);
  color: var(--text-primary);
  outline: none;
}

.icon-glyph {
  font-size: 22px;
  color: var(--accent-cyan);
  line-height: 1;
}

.icon-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  word-break: break-word;
}

/* ==========================================================================
   WINDOWS
   ========================================================================== */
.window {
  position: absolute;
  display: none;
  flex-direction: column;
  width: 560px;
  max-width: calc(100vw - 24px);
  height: 460px;
  min-width: 300px;
  min-height: 200px;
  max-height: calc(100vh - var(--taskbar-h) - 24px);
  background: var(--bg-panel-alt);
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.window.open {
  display: flex;
}

.window.minimized {
  display: none;
}

.window.focused {
  border-color: var(--accent-cyan-dim);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(69, 208, 214, 0.15);
}

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 0 12px;
  height: 34px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  cursor: move;
  user-select: none;
}

.title-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.win-controls {
  display: flex;
  gap: 4px;
}

.win-controls button {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.win-controls button:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.win-controls button:last-child:hover {
  background: rgba(224, 96, 90, 0.18);
  color: var(--accent-red);
}

.win-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 22px;
}

.win-body::-webkit-scrollbar {
  width: 8px;
}

.win-body::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 4px;
}

.prose h2 {
  font-size: 20px;
  margin: 0 0 10px;
}

.prose h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 22px 0 8px;
}

.prose p {
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0 0 12px;
}

.prose ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--bg-panel);
}

.project-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan-dim);
  border-radius: 10px;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.project-card h3 {
  margin: 0;
  font-size: 15px;
}

.project-card p {
  margin: 0 0 10px;
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.6;
}

.project-links {
  display: flex;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.project-links a {
  text-decoration: none;
}

.project-links a:hover {
  text-decoration: underline;
}

.resume-embed {
  border: 1px dashed var(--border-bright);
  border-radius: var(--radius);
  padding: 30px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.btn {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 16px;
  background: var(--accent-cyan-dim);
  color: #04141a;
  font-family: var(--font-mono);
  font-size: 13px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}

.btn:hover {
  background: var(--accent-cyan);
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.contact-list li span {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.05em;
}

/* Terminal window */
.terminal-body {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-cyan);
  background: #060b14;
  padding: 14px 16px;
  cursor: text;
}

.terminal-body p {
  margin: 0 0 10px;
  color: var(--text-secondary);
}

.hl {
  color: var(--accent-cyan);
}

#term-lines .term-out {
  color: var(--text-secondary);
  margin: 4px 0;
  white-space: pre-wrap;
}

#term-lines .term-cmd {
  color: var(--accent-cyan);
  margin: 8px 0 2px;
}

#term-lines .term-cmd::before {
  content: "$ ";
  color: var(--text-muted);
}

.term-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.term-prompt {
  color: var(--text-muted);
  white-space: nowrap;
}

#terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Resize handle */
.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
}

.resize-handle::after {
  content: '';
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--border-bright);
  border-bottom: 2px solid var(--border-bright);
}

/* ==========================================================================
   TASKBAR
   ========================================================================== */
#taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--taskbar-h);
  background: rgba(19, 27, 46, 0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 10px;
  z-index: 500;
}

#start-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-raised);
  border: 1px solid var(--border-bright);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 14px;
  border-radius: var(--radius);
}

#start-btn:hover,
#start-btn.active {
  border-color: var(--accent-cyan-dim);
  color: var(--accent-cyan);
}

.start-glyph {
  color: var(--accent-cyan);
}

#taskbar-windows {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
}

.taskbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 6px 12px;
  border-radius: var(--radius);
  white-space: nowrap;
}

.taskbar-item.active {
  border-color: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  background: rgba(69, 208, 214, 0.06);
}

#taskbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

#clock {
  color: var(--text-secondary);
  min-width: 64px;
  text-align: right;
}

/* ==========================================================================
   START MENU
   ========================================================================== */
#start-menu {
  position: fixed;
  left: 10px;
  bottom: calc(var(--taskbar-h) + 8px);
  width: 220px;
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 600;
}

#start-menu.open {
  display: flex;
}

.start-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel-alt);
}

.start-name {
  font-size: 13px;
  font-weight: 600;
}

.start-role {
  font-size: 11px;
  color: var(--text-muted);
}

.start-item {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: left;
  padding: 11px 16px;
}

.start-item:last-child {
  border-bottom: none;
}

.start-item:hover {
  background: var(--bg-raised);
  color: var(--accent-cyan);
}

/* ==========================================================================
   RESPONSIVE — mobile treated as a simplified fullscreen desktop
   ========================================================================== */
@media (max-width: 720px) {
  #icon-grid {
    grid-template-columns: repeat(3, 1fr);
    width: calc(100% - 24px);
    left: 12px;
    right: 12px;
  }

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

  .resize-handle {
    display: none;
  }
}