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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

:root {
  /* Default: Cyber Green Theme */
  --bg: #060a06;
  --panel-bg: rgba(15, 23, 15, 0.8);
  --screen-bg: #0b120b;
  --text: #a3e635;
  --text-dim: #4d7c0f;
  --accent: #22c55e;
  --accent-glow: rgba(34, 197, 94, 0.5);
  --border: #14532d;
  --grid-line: rgba(34, 197, 94, 0.08);
  --panel-border-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Space Grotesk', sans-serif;
  --scanline-opacity: 0.2;
  --inner-shadow: rgba(0, 0, 0, 0.9);
}

[data-theme="cyber-green"] {
  --bg: #060a06;
  --panel-bg: rgba(15, 23, 15, 0.8);
  --screen-bg: #0b120b;
  --text: #a3e635;
  --text-dim: #4d7c0f;
  --accent: #22c55e;
  --accent-glow: rgba(34, 197, 94, 0.5);
  --border: #14532d;
  --grid-line: rgba(34, 197, 94, 0.08);
  --scanline-opacity: 0.2;
  --inner-shadow: rgba(0, 0, 0, 0.9);
}

[data-theme="rose-gold"] {
  --bg: #0e0a0b;
  --panel-bg: rgba(28, 18, 20, 0.8);
  --screen-bg: #130a0c;
  --text: #ffe4e6;
  --text-dim: #fb7185;
  --accent: #f43f5e;
  --accent-glow: rgba(244, 63, 94, 0.5);
  --border: #4c0519;
  --grid-line: rgba(244, 63, 94, 0.06);
  --scanline-opacity: 0.16;
  --inner-shadow: rgba(0, 0, 0, 0.9);
}

[data-theme="monochrome"] {
  --bg: #000000;
  --panel-bg: #000000;
  --screen-bg: #000000;
  --text: #d4d4d8;
  --text-dim: #71717a;
  --accent: #e4e4e7;
  --accent-glow: rgba(228, 228, 231, 0.25);
  --border: #3f3f46;
  --grid-line: rgba(255, 255, 255, 0.04);
  --scanline-opacity: 0.12;
  --inner-shadow: rgba(0, 0, 0, 0.9);
}

[data-theme="light"] {
  --bg: #e2e8f0;
  --panel-bg: rgba(255, 255, 255, 0.95);
  --screen-bg: #f1f5f9;
  --text: #0f172a;
  --text-dim: #475569;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.4);
  --border: #cbd5e1;
  --grid-line: rgba(0, 0, 0, 0.04);
  --scanline-opacity: 0.05;
  --inner-shadow: rgba(0, 0, 0, 0.05);
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  height: 100dvh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Background Grids & Parallax */
.bg-grid-mesh {
  position: absolute;
  top: -50px;
  left: -50px;
  right: -50px;
  bottom: -50px;
  background-image: 
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center;
  z-index: 1;
  pointer-events: none;
  transform: translate(calc(var(--move-x, 0) * 0.12px), calc(var(--move-y, 0) * 0.12px));
  transition: transform 0.1s cubic-bezier(0.1, 0.8, 0.3, 1);
}

.bg-parallax-particles {
  position: absolute;
  top: -100px;
  left: -100px;
  right: -100px;
  bottom: -100px;
  background-image: 
    radial-gradient(circle, var(--accent) 1px, transparent 1.5px),
    radial-gradient(circle, var(--accent) 1.5px, transparent 2px),
    radial-gradient(circle, var(--text-dim) 1px, transparent 1.5px);
  background-size: 250px 250px, 350px 350px, 180px 180px;
  background-position: 40px 60px, 150px 190px, 90px 30px;
  opacity: 0.15;
  z-index: 2;
  pointer-events: none;
  transform: translate(calc(var(--move-x, 0) * 0.35px), calc(var(--move-y, 0) * 0.35px));
  transition: transform 0.15s cubic-bezier(0.1, 0.8, 0.3, 1);
}

.trail-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}



/* Initial Intro Loader */
.intro-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg);
  background-image: 
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center;
  z-index: 9999999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.intro-loader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.tile-matrix {
  display: grid;
  grid-template-columns: repeat(25, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 4px;
  width: 100%;
  max-width: 500px;
  padding: 0 40px;
}

.matrix-tile {
  background-color: transparent;
  border-radius: 4px;
  aspect-ratio: 1;
  transition: background-color 0.1s ease, box-shadow 0.1s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform: scale(0);
}

.matrix-tile.active {
  background-color: var(--text);
  box-shadow: 0 0 10px rgba(229, 229, 229, 0.5);
  transform: scale(1);
}

.matrix-tile.active-accent {
  background-color: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
  transform: scale(1.1);
}

/* Console Container */
.console-shell {
  width: 100%;
  height: 100%;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px solid var(--border);
  box-shadow: var(--panel-border-glow), 0 0 20px rgba(0,0,0,0.4);
  border-radius: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

/* Header Component */
.console-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  background: rgba(0, 0, 0, 0.2);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.status-dot.pulsing {
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.logo-text {
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 0 4px var(--accent-glow);
}

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

/* Buttons and Controls */
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--text);
  background-color: rgba(255, 255, 255, 0.05);
}

.icon-btn:active {
  transform: scale(0.95);
}

.theme-selector-wrapper {
  position: relative;
}

.theme-menu {
  position: absolute;
  top: 34px;
  right: 0;
  background: var(--screen-bg);
  border: 2px solid var(--border);
  border-radius: 6px;
  width: 140px;
  padding: 4px;
  z-index: 100;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.theme-opt {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 6px 10px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
}

.theme-opt:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* Main CRT Screen Section */
.console-screen-wrapper {
  flex: 1;
  position: relative;
  background-color: var(--screen-bg);
  overflow: hidden;
  margin: 16px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--screen-bg);
  box-shadow: inset 0 0 20px var(--inner-shadow);
}

.crt-bezel-shadow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  box-shadow: inset 0 0 30px var(--inner-shadow);
  pointer-events: none;
  z-index: 40;
}

.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 4px, 3px 100%;
  pointer-events: none;
  z-index: 50;
  opacity: var(--scanline-opacity);
}

/* CRT Screen content */
.crt-screen {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* OSD page counter styling */
.screen-osd {
  position: absolute;
  top: 16px;
  right: 16px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  z-index: 45;
  pointer-events: none;
  background: var(--panel-bg);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Main dynamic viewport for slides */
.slide-viewport {
  width: 100%;
  height: 100%;
  padding: 32px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.slide-viewport::-webkit-scrollbar {
  width: 6px;
}
.slide-viewport::-webkit-scrollbar-track {
  background: transparent;
}
.slide-viewport::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

.slide-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 120px;
  justify-content: center;
}

/* Custom slide styles */
.slide-heading {
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  color: var(--text);
  text-shadow: 0 0 8px var(--accent-glow);
}

.slide-body {
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 3.5vw, 0.95rem);
  line-height: 1.6;
  color: var(--text-dim);
  white-space: pre-wrap;
}

.slide-body span.highlight {
  color: var(--accent);
  font-weight: 500;
}

/* Typing cursor indicator */
.typing-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background-color: var(--accent);
  margin-left: 2px;
  vertical-align: middle;
  box-shadow: 0 0 4px var(--accent-glow);
  animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Custom Mouse Cursor */
.custom-cursor {
  width: 10px;
  height: 10px;
  background-color: var(--accent);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 99999;
  box-shadow: 0 0 8px var(--accent-glow);
  transition: transform 0.08s ease, width 0.15s ease, height 0.15s ease, background-color 0.15s ease;
}

.custom-cursor.cursor-hover {
  width: 16px;
  height: 16px;
  background-color: transparent;
  border: 2px solid var(--accent);
  box-shadow: none;
}


/* Styled lists in slides */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.tech-card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.tech-card:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.tech-card-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent);
}

/* Projects Slide Layout */
.projects-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.project-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.project-item:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.02);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.project-url {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.project-desc {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Contact/Form Slide */
.contact-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.contact-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.contact-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.contact-btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.contact-btn-outline:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: none;
}

/* Loader style */
.terminal-loader {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-dim);
}

@keyframes loader-blink {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.loader-cursor {
  animation: loader-blink 1.2s infinite;
}

/* Console Control Pad Component */
.console-controls {
  height: 80px;
  padding: 0 24px;
  border-top: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.1);
}

.control-pad {
  display: flex;
  gap: 12px;
}

.control-btn {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 8px;
  height: 42px;
  padding: 0 16px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 2px 2px 0px var(--border);
  transition: all 0.1s ease;
}

.control-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.control-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px transparent;
}

.control-keyboard-tip {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.key-badge {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: var(--font-mono);
}

/* Footer Section */
.console-footer {
  height: 38px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.25);
}

.footer-left, .footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
/* Timeline Component */
.timeline {
  position: relative;
  padding-left: 20px;
  border-left: 2px solid var(--border);
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -27px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--screen-bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.timeline-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.timeline-desc {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.4;
}

/* Terminal Component */
.terminal-window {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  height: 200px;
  display: flex;
  flex-direction: column;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: none; /* Hide scrollbar for cleaner look */
}

.terminal-line {
  color: var(--text-dim);
  word-break: break-all;
}

.terminal-line.cmd-echo {
  color: var(--text);
}

.terminal-line.error {
  color: #f43f5e;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
}

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

/* Comments Component */
.comments-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.comment-input, .comment-textarea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 8px;
  border-radius: 4px;
  outline: none;
}

.comment-textarea {
  resize: none;
  height: 60px;
}

.comment-input:focus, .comment-textarea:focus {
  border-color: var(--accent);
}

.comment-submit {
  align-self: flex-end;
  background: var(--accent);
  color: #000;
  border: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.comment-submit:hover {
  opacity: 0.8;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.comment-box {
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--border);
  padding: 8px 12px;
  border-radius: 0 4px 4px 0;
}

.comment-author {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.comment-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Layout Wrapper */
.layout-wrapper {
  position: relative;
  width: 90vw;
  max-width: 680px;
  height: 90dvh;
  max-height: 800px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Side Navigation Component */
.side-nav {
  position: absolute;
  left: -40px; /* Next to the console */
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 0;
  height: 100%;
  justify-content: center;
  transition: all 0.3s ease;
}


.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  transition: color 0.2s ease, transform 0.2s ease;
  position: relative;
  padding: 16px 12px;
}

.sidebar-item:hover {
  color: var(--accent);
  transform: translateX(4px);
}

.sidebar-item.active {
  color: var(--text);
}

.sidebar-item.active .sidebar-dot {
  background-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.sidebar-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: currentColor;
  transition: all 0.2s ease;
}

.sidebar-text {
  position: absolute;
  left: 32px;
  white-space: nowrap;
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.sidebar-item:hover .sidebar-text {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

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

/* Responsive and Mobile-friendly overrides */
@media (max-width: 768px) {
  .side-nav {
    display: none !important;
  }
  .logo-text {
    font-size: 0.65rem;
  }
  .console-header {
    padding: 0 8px;
  }
  .console-screen-wrapper {
    margin: 8px;
    border-radius: 4px;
  }
  .slide-viewport {
    padding: 16px;
  }
  .console-controls {
    padding: 0 12px;
    height: 72px;
  }
  .control-btn {
    height: 38px;
    padding: 0 10px;
    font-size: 0.65rem;
  }
  .console-footer {
    height: 32px;
    font-size: 0.6rem;
  }
  .control-keyboard-tip {
    display: none;
  }
  .tile-matrix {
    gap: 2px;
    padding: 0 24px;
  }
}
