/* ========================================
   MiRiS OS v1.0 - Styles
   ======================================== */

:root {
  /* Palette */
  --color-void-blue: #0D0D1A;
  --color-midnight-panel: #1A1A2E;
  --color-nebula-dark: #2A2A3E;
  --color-mint-circuit: #7FE5C4;
  --color-frost-lavender: #C4B8D8;
  --color-signal-red: #E63946;
  --color-compiler-yellow: #E8C547;
  --color-pale-iris: #D0D0E8;
  --color-ghost-white: #E8E0F0;
  --color-translucent-frost: rgba(127, 229, 196, 0.15);

  /* Font Families */
  --font-system: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-display: 'Orbitron', sans-serif;
  --font-handwritten: 'Kalam', cursive;

  /* Sizing */
  --window-main-width: 60vw;
  --window-main-height: 70vh;
  --window-terminal-width: 35vw;
  --window-terminal-height: 30vh;
  --window-image-width: 30vw;
  --window-image-height: 35vh;
  --window-notes-width: 25vw;
  --window-notes-height: 20vh;
}

/* ========================================
   Base Styles
   ======================================== */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--color-void-blue);
  color: var(--color-pale-iris);
  font-family: var(--font-system);
  font-weight: 400;
  font-size: clamp(0.9rem, 1.1vw, 1.05rem);
  line-height: 1.7;
  letter-spacing: 0.005em;
}

body {
  position: relative;
}

/* ========================================
   Organic Blob Background
   ======================================== */

.blob-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0;
  animation: blobDrift 30s ease-in-out infinite;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background-color: var(--color-mint-circuit);
  opacity: 0.08;
  top: 10%;
  left: 15%;
  animation-delay: 0s;
}

.blob-2 {
  width: 350px;
  height: 350px;
  background-color: var(--color-signal-red);
  opacity: 0.05;
  top: 50%;
  right: 10%;
  animation-delay: 5s;
}

.blob-3 {
  width: 380px;
  height: 380px;
  background-color: var(--color-frost-lavender);
  opacity: 0.06;
  bottom: 15%;
  left: 40%;
  animation-delay: 10s;
}

@keyframes blobDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -50px) scale(1.05); }
  50% { transform: translate(-40px, 30px) scale(0.95); }
  75% { transform: translate(20px, 40px) scale(1.08); }
}

/* ========================================
   Boot Sequence
   ======================================== */

.boot-sequence {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background-color: var(--color-void-blue);
  pointer-events: none;
  animation: bootFadeOut 300ms ease-in forwards 2700ms;
}

.boot-cursor {
  width: 1px;
  height: 16px;
  background-color: var(--color-mint-circuit);
  animation: bootCursorBlink 500ms step-start infinite;
  opacity: 0;
  animation-delay: 0ms;
}

.boot-text {
  position: absolute;
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 0.95vw, 0.95rem);
  color: var(--color-mint-circuit);
  white-space: pre;
  opacity: 0;
  animation: bootTextType 8000ms steps(50, end) 500ms forwards;
}

@keyframes bootCursorBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes bootTextType {
  0% {
    width: 0;
    opacity: 1;
  }
  85% {
    width: auto;
    opacity: 1;
  }
  100% {
    width: auto;
    opacity: 0;
  }
}

@keyframes bootFadeOut {
  from { opacity: 1; pointer-events: all; }
  to { opacity: 0; pointer-events: none; }
}

/* ========================================
   Title Bar (Menu Bar)
   ======================================== */

.title-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 36px;
  background-color: var(--color-void-blue);
  border-bottom: 1px solid var(--color-translucent-frost);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 0.95vw, 0.95rem);
  color: var(--color-mint-circuit);
  z-index: 100;
  user-select: none;
  animation: titleBarSlide 400ms ease-out 1200ms backwards;
}

@keyframes titleBarSlide {
  from { transform: translateY(-36px); }
  to { transform: translateY(0); }
}

.title-bar-left, .title-bar-right {
  display: flex;
  gap: 24px;
  cursor: pointer;
}

.title-bar-left > span, .title-bar-right > span {
  padding: 4px 8px;
  border-radius: 2px;
  transition: background-color 200ms ease;
}

.title-bar-left > span:hover, .title-bar-right > span:hover {
  background-color: rgba(127, 229, 196, 0.1);
}

/* ========================================
   Menu Dropdowns
   ======================================== */

.menu-dropdown {
  position: absolute;
  top: 36px;
  background-color: var(--color-midnight-panel);
  border: 1px solid var(--color-translucent-frost);
  border-radius: 2px;
  min-width: 140px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

#fileMenu {
  left: 16px;
}

#editMenu {
  left: 80px;
}

.menu-item {
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 0.95vw, 0.95rem);
  color: var(--color-pale-iris);
  cursor: pointer;
  transition: background-color 150ms ease;
}

.menu-item:hover:not(.disabled) {
  background-color: rgba(127, 229, 196, 0.1);
}

.menu-item.disabled {
  color: #666;
  cursor: not-allowed;
}

/* ========================================
   Windows
   ======================================== */

.window {
  position: fixed;
  background-color: var(--color-midnight-panel);
  border: 1px solid var(--color-translucent-frost);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 1px rgba(127, 229, 196, 0.2);
  display: flex;
  flex-direction: column;
  cursor: grab;
  user-select: none;
  z-index: 10;
  opacity: 0;
  filter: blur(12px);
  scale: 0.9;
  animation: windowAppear 400ms ease-out forwards;
}

.window.focused {
  filter: blur(0);
  opacity: 1;
  z-index: 50;
}

.window:not(.focused) {
  filter: blur(2px);
  opacity: 0.7;
}

@keyframes windowAppear {
  from {
    opacity: 0;
    filter: blur(12px);
    scale: 0.9;
  }
  to {
    opacity: 1;
    filter: blur(0);
    scale: 1;
  }
}

.window.main-window {
  width: var(--window-main-width);
  height: var(--window-main-height);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 1800ms;
}

.window.terminal-window {
  width: var(--window-terminal-width);
  height: var(--window-terminal-height);
  top: calc(50% + 200px);
  left: calc(50% - 400px);
  animation-delay: 2200ms;
}

.window.image-window {
  width: var(--window-image-width);
  height: var(--window-image-height);
  top: calc(50% - 150px);
  right: 40px;
  left: auto;
  animation-delay: 2000ms;
}

.window.notes-window {
  width: var(--window-notes-width);
  height: var(--window-notes-height);
  bottom: 60px;
  right: 40px;
  top: auto;
  animation-delay: 2400ms;
  background-color: var(--color-nebula-dark);
}

.window-titlebar {
  height: 28px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(127, 229, 196, 0.1);
  cursor: grab;
  background-color: rgba(0, 0, 0, 0.3);
}

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

.window-title-buttons {
  display: flex;
  gap: 6px;
}

.window-button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: opacity 150ms ease;
}

.window-button.close {
  background-color: var(--color-signal-red);
}

.window-button.minimize {
  background-color: var(--color-compiler-yellow);
}

.window-button.maximize {
  background-color: #3A7D5C;
}

.window-button:hover {
  opacity: 0.8;
}

.window-title {
  flex: 1;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: clamp(0.75rem, 0.9vw, 0.9rem);
  color: var(--color-mint-circuit);
  text-align: center;
}

.window-content {
  flex: 1;
  padding: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ========================================
   Main Window Content
   ======================================== */

.main-window .window-content {
  overflow: hidden;
}

.hero-text {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-ghost-white);
  text-shadow: 0 0 20px rgba(127, 229, 196, 0.3);
  margin-bottom: 16px;
  line-height: 1.2;
}

.window-scroll-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  scroll-behavior: smooth;
}

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

.window-scroll-content::-webkit-scrollbar-track {
  background: transparent;
}

.window-scroll-content::-webkit-scrollbar-thumb {
  background: var(--color-mint-circuit);
  opacity: 0.3;
  border-radius: 3px;
}

.content-section {
  margin-bottom: 24px;
}

.content-section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-frost-lavender);
  margin-bottom: 8px;
}

.content-section p {
  color: var(--color-pale-iris);
  margin-bottom: 12px;
}

/* ========================================
   Terminal Window
   ======================================== */

.terminal-window .window-content {
  background-color: var(--color-void-blue);
  padding: 8px;
  overflow: hidden;
}

.terminal-content {
  font-family: var(--font-mono);
  font-size: clamp(0.75rem, 0.9vw, 0.9rem);
  color: var(--color-mint-circuit);
  line-height: 1.5;
  overflow: hidden;
}

.terminal-scroll {
  max-height: 100%;
  overflow-y: auto;
}

.terminal-scroll::-webkit-scrollbar {
  width: 4px;
}

.terminal-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.terminal-scroll::-webkit-scrollbar-thumb {
  background: var(--color-mint-circuit);
  opacity: 0.3;
  border-radius: 2px;
}

.terminal-line {
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 4px;
  opacity: 0;
  animation: terminalLineAppear 300ms ease-out forwards;
}

.terminal-prompt {
  color: var(--color-compiler-yellow);
  margin-right: 4px;
}

@keyframes terminalLineAppear {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Image Window
   ======================================== */

.image-window .window-content {
  padding: 0;
  background-color: rgba(0, 0, 0, 0.2);
}

.gradient-mesh {
  width: 100%;
  height: 100%;
  display: block;
}

/* ========================================
   Notes Window
   ======================================== */

.notes-window .window-content {
  padding: 12px;
  justify-content: center;
}

.notes-text {
  font-family: var(--font-handwritten);
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
  color: var(--color-frost-lavender);
  line-height: 1.8;
  text-align: left;
}

.notes-text p {
  margin-bottom: 8px;
}

/* ========================================
   Circuit Paths
   ======================================== */

.circuit-paths {
  z-index: 5;
}

.circuit-path {
  stroke: var(--color-mint-circuit);
  stroke-width: 1px;
  stroke-opacity: 0.3;
  fill: none;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: circuitDraw 2s ease-in-out forwards;
}

.circuit-path:nth-child(1) {
  animation-delay: 2200ms;
}

.circuit-path:nth-child(2) {
  animation-delay: 2400ms;
}

.circuit-path:nth-child(3) {
  animation-delay: 2600ms;
}

@keyframes circuitDraw {
  from {
    stroke-dashoffset: 1000;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* ========================================
   Cursor Trail
   ======================================== */

.cursor-trail {
  position: fixed;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background-color: var(--color-mint-circuit);
  pointer-events: none;
  z-index: 1;
}

/* ========================================
   Depth of Field Effect
   ======================================== */

body.window-focused .window:not(.focused) {
  filter: blur(2px);
  opacity: 0.7;
  transition: filter 200ms ease, opacity 200ms ease;
}

body.window-focused .window.focused {
  filter: blur(0);
  opacity: 1;
  transition: filter 200ms ease, opacity 200ms ease;
}

body.desktop-focused .window {
  filter: blur(0);
  opacity: 1;
  transition: filter 200ms ease, opacity 200ms ease;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 1200px) {
  .window.main-window {
    width: 80vw;
    height: 60vh;
  }

  .window.terminal-window {
    width: 50vw;
    height: 25vh;
  }

  .window.image-window {
    width: 40vw;
    height: 30vh;
  }

  .window.notes-window {
    width: 35vw;
    height: 18vh;
  }
}

@media (max-width: 768px) {
  .window.main-window {
    width: 95vw;
    height: 70vh;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }

  .window.terminal-window {
    width: 95vw;
    height: 25vh;
    top: auto !important;
    left: 50% !important;
    bottom: 120px;
    transform: translateX(-50%);
  }

  .window.image-window {
    display: none;
  }

  .window.notes-window {
    display: none;
  }
}
