/* Terminal Theme - Main Stylesheet */
:root {
  /* Color Variables */
  --terminal-bg: #111111;
  --terminal-text: #4cd964;
  --terminal-text-cyan: #00F5FF;
  --terminal-prompt: #888;
  --terminal-highlight: #4cd964;
  --terminal-success: #4cd964;
  --terminal-error: #ff5f56;
  --terminal-header-bg: #2d2d2d;
  --terminal-border: #444;
  --terminal-selection: rgba(76, 217, 100, 0.3);
  
  /* Typography */
  --terminal-font: 'Fira Code', 'JetBrains Mono', 'Source Code Pro', 'Cascadia Code', 'Ubuntu Mono', monospace;
  
  /* Animations */
  --cursor-blink-speed: 1s;
  --type-speed: 150ms;
  --fade-speed: 400ms;
}

/* Apply terminal theme to the entire body */
body.terminal-theme {
  background-color: var(--terminal-bg);
  background-image: linear-gradient(135deg, #111111 0%, #1a1a1a 100%);
  color: var(--terminal-text);
  font-family: var(--terminal-font);
  line-height: 1.5;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  padding-top: 90px; /* Increased from 80px to account for navbar being 10px lower */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga", "tnum", "case", "calt", "zero", "ss01", "locl";
  -webkit-overflow-scrolling: touch;
  -webkit-text-size-adjust: 100%;
  flex-direction: column;
  transition: all ease-in 0.2s;
}

/* Custom scrollbars for terminal theme */
body.terminal-theme::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background: #111;
}

body.terminal-theme::-webkit-scrollbar-thumb {
  background: rgba(76, 217, 100, 0.5);
  border-radius: 4px;
}

body.terminal-theme::-webkit-scrollbar-thumb:hover {
  background: rgba(76, 217, 100, 0.8);
}

body.terminal-theme::-webkit-scrollbar-track {
  background: rgba(20, 20, 20, 0.7);
  border-radius: 4px;
}

/* Terminal Window Styling */
.terminal-window {
  background-color: var(--terminal-bg);
  border-radius: 8px;
  border: 1px solid var(--terminal-border);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 
              0 0 30px rgba(76, 217, 100, 0.1);
  margin-bottom: 20px;
  overflow: hidden;
}

.terminal-header {
  background-color: var(--terminal-header-bg);
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--terminal-border);
}

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

.terminal-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.terminal-btn.close {
  background-color: #ff5f56;
  border: 1px solid #e0443e;
}

.terminal-btn.minimize {
  background-color: #ffbd2e;
  border: 1px solid #dea123;
}

.terminal-btn.maximize {
  background-color: #27c93f;
  border: 1px solid #1aab29;
}

.terminal-title {
  color: #ddd;
  font-size: 0.85rem;
  font-weight: bold;
  flex: 1;
  text-align: center;
}

.terminal-body {
  padding: 15px;
  overflow: auto;
  max-height: 80vh;
}

/* Terminal text styles */
.terminal-prompt {
  color: var(--terminal-prompt);
  margin-right: 8px;
  user-select: none;
}

.term-path {
  color: var(--terminal-highlight);
}

.terminal-command {
  color: var(--terminal-text);
}

.terminal-output {
  color: var(--terminal-text);
  margin: 10px 0;
  padding-left: 20px;
}

.terminal-success {
  color: var(--terminal-success);
}

.terminal-error {
  color: var(--terminal-error);
}

/* System information bar */
.system-info-bar {
  background-color: var(--terminal-header-bg);
  color: var(--terminal-text-cyan);
  padding: 4px 10px;
  font-size: 0.75rem;
  display: flex;
  justify-content: flex-end;
  border-bottom: 1px solid var(--terminal-border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
}

.system-info-bar span {
  font-family: var(--terminal-font);
  color: var(--terminal-text);
  opacity: 0.8;
  letter-spacing: 0.5px;
}

/* Cursor animation */
.terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  background-color: var(--terminal-text);
  animation: blinker var(--cursor-blink-speed) steps(1) infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
  box-shadow: 0 0 5px rgba(76, 217, 100, 0.5);
}

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

/* Scanlines effect */
.terminal-scanline {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100vw;
  background: rgba(76, 217, 100, 0.15);
  pointer-events: none;
  z-index: 2002;
  opacity: 0.7;
  animation: scanline 3s linear infinite;
  box-shadow: 0 0 5px rgba(76, 217, 100, 0.3);
}

@keyframes scanline {
  0% { transform: translateY(0); }
  100% { transform: translateY(100vh); }
}

/* CRT effect */
.crt-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: 
    radial-gradient(
      ellipse at center,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 0.2) 90%,
      rgba(0, 0, 0, 0.4) 100%
    ),
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.15),
      rgba(0, 0, 0, 0.15) 1px,
      transparent 1px,
      transparent 2px
    );
  pointer-events: none;
  z-index: 2001;
  opacity: 0.3;
}

/* Terminal-style header */
.site-header.terminal-style {
  position: fixed;
  top: 15px;
  left: 0;
  width: 100%;
  z-index: 1000;
  transition: all 0.3s ease;
  padding: 4px 10px; /* Reduced padding */
}

.site-header.terminal-style.scrolled .terminal-frame {
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
}

.site-header.terminal-style .terminal-frame {
  background-color: #000000;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 
              0 0 30px rgba(76, 217, 100, 0.1);
  max-width: 1400px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}

.site-header.terminal-style .terminal-header {
  display: flex;
  align-items: center;
  background-color: #2d2d2d;
  padding: 5px 10px;
  border-bottom: 1px solid #444;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.site-header.terminal-style .terminal-title {
  color: #ddd;
  font-size: 0.78rem; /* Reduced font size */
  font-weight: bold;
  flex: 1;
  text-align: center;
}

.site-header.terminal-style .logo-link .cli {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
  font-family: "Fira Code", monospace;
  padding: 5px 10px; /* Reduced padding */
  background: transparent;
  color: #4cd964;
  border: 1px solid rgba(76, 217, 100, 0.3);
  border-radius: 4px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  font-size: 0.78rem; /* Reduced font size */
  white-space: nowrap; /* Prevent text from wrapping */
  min-width: fit-content; /* Ensure the container can fit the text */
}

.site-header.terminal-style .logo-link .cli:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(76, 217, 100, 0.05);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.site-header.terminal-style .logo-link .cli:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(76, 217, 100, 0.5), transparent);
  animation: scanGlow 2s linear infinite;
}

@keyframes scanGlow {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.site-header.terminal-style .logo-link .cli:hover {
  transform: translateY(-2px);
  border-color: rgba(76, 217, 100, 0.6);
  box-shadow: 0 0 15px rgba(76, 217, 100, 0.3);
}

.site-header.terminal-style .logo-link .cli:hover:before {
  opacity: 1;
}

/* Navigation styling */
.nav-menu.terminal-style {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 3px; /* Reduced gap */
  position: relative;
  z-index: 2;
  font-family: "Fira Code", "Courier New", monospace;
}

.nav-item.terminal-style {
  position: relative;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.nav-item.terminal-style:hover {
  border-color: rgba(76, 217, 100, 0.2);
  background-color: rgba(76, 217, 100, 0.05);
}

.nav-link.terminal-style {
  display: flex;
  align-items: center;
  padding: 5px 9px; /* Reduced padding */
  color: #4cd964;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  font-size: 0.78rem; /* Reduced font size */
  letter-spacing: 0;
  white-space: nowrap;
}

.nav-link.terminal-style .terminal-prompt {
  color: #888;
  margin-right: 4px; /* Reduced margin */
  font-family: "Fira Code", "Courier New", monospace;
  font-size: 0.7rem; /* Reduced font size */
}

.nav-link.terminal-style .term-path {
  color: #4cd964;
}

.nav-link.terminal-style .nav-text {
  position: relative;
  z-index: 2;
  color: #ddd;
}

.nav-link.terminal-style:before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background-color: #4cd964;
  transition: width 0.3s ease;
}

.nav-link.terminal-style:hover {
  color: #fff;
}

.nav-link.terminal-style:hover:before {
  width: 100%;
}

.nav-link.terminal-style:hover .terminal-prompt {
  color: #4cd964;
}

.nav-link.terminal-style:hover .nav-text {
  color: #fff;
  text-shadow: 0 0 3px rgba(76, 217, 100, 0.5);
}

.nav-link.terminal-style:hover::after {
  content: '';
  position: absolute;
  right: 10px;
  top: calc(100% - 3px);
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-bottom: 3px solid #4cd964;
  opacity: 0.8;
  animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 0.8; }
}

.nav-link.terminal-style.active {
  background-color: rgba(76, 217, 100, 0.08);
}

.nav-link.terminal-style.active .terminal-prompt,
.nav-link.terminal-style.active .term-path {
  color: #4cd964;
}

.nav-link.terminal-style.active .nav-text {
  color: #fff;
  text-shadow: 0 0 5px rgba(76, 217, 100, 0.3);
}

.nav-link.terminal-style.active::before {
  width: 100%;
  height: 1px;
  background-color: #4cd964;
  box-shadow: 0 0 5px rgba(76, 217, 100, 0.5);
}

/* Content area styling */
.content.terminal-theme {
  background-color: var(--terminal-bg);
  color: var(--terminal-text);
  padding: 20px; /* Standardized padding */
  margin-top: 30px; /* Adjusted margin */
}

.content.terminal-theme h1,
.content.terminal-theme h2,
.content.terminal-theme h3,
.content.terminal-theme h4,
.content.terminal-theme h5,
.content.terminal-theme h6 {
  color: var(--terminal-highlight);
}

/* Section dividers */
.terminal-divider {
  border: none;
  height: 1px;
  background: var(--terminal-border);
  position: relative;
  margin: 30px 0;
}

.terminal-divider:before {
  content: '--------------------';
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  background: var(--terminal-bg);
  padding: 0 15px;
  color: var(--terminal-border);
  font-family: var(--terminal-font);
}

/* Terminal-style buttons */
.terminal-btn-action {
  display: inline-block;
  background-color: transparent;
  color: var(--terminal-text);
  font-family: var(--terminal-font);
  border: 1px solid rgba(76, 217, 100, 0.3);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 10px 0;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.terminal-btn-action:before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(76, 217, 100, 0.1), transparent);
  transition: all 0.5s ease;
}

.terminal-btn-action:hover {
  background-color: rgba(76, 217, 100, 0.05);
  transform: translateY(-2px);
  border-color: rgba(76, 217, 100, 0.6);
  box-shadow: 0 0 15px rgba(76, 217, 100, 0.3);
}

.terminal-btn-action:hover:before {
  left: 100%;
}

/* Terminal-style links */
a.terminal-link {
  color: var(--terminal-highlight);
  text-decoration: none;
  border-bottom: 1px dotted var(--terminal-highlight);
  padding-bottom: 1px;
  transition: all 0.2s ease;
}

a.terminal-link:hover {
  color: var(--terminal-text-cyan);
  border-bottom: 1px solid var(--terminal-text-cyan);
  text-shadow: 0 0 5px rgba(76, 217, 100, 0.3);
}

/* Terminal-style sections */
.terminal-section {
  margin: 30px 0;
  padding: 15px;
  border: 1px solid var(--terminal-border);
  border-radius: 4px;
}

.terminal-section-title {
  color: var(--terminal-highlight);
  font-size: 1.2rem;
  margin-bottom: 15px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--terminal-border);
}

/* Type-in animation for headings */
.type-in {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  margin: 0;
  animation: typing 3s steps(40, end);
}

@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

/* Progress bars styled as ASCII/Unicode loading bars */
.ascii-progress {
  font-family: var(--terminal-font);
  color: var(--terminal-text);
  margin: 10px 0;
}

.ascii-progress-bar {
  display: inline-block;
  width: 200px;
  height: 18px;
  border: 1px solid var(--terminal-border);
  margin: 0 10px;
  position: relative;
}

.ascii-progress-bar-fill {
  height: 100%;
  background-color: rgba(76, 217, 100, 0.3);
  width: 0%; /* Will be set via JavaScript */
  transition: width 1s ease;
}

.ascii-progress-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8rem;
  color: var(--terminal-text);
}

/* Mobile adaptations */
@media (max-width: 768px) {
  .terminal-window {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .system-info-bar {
    font-size: 0.7rem;
  }
  
  .site-header.terminal-style {
    top: 10px;
    padding: 4px 8px; /* Reduced padding for mobile */
  }
  
  .header-container {
    padding: 8px 15px; /* Reduced padding for mobile */
  }
  
  .terminal-header {
    padding: 6px 10px;
  }
  
  .terminal-buttons {
    gap: 5px;
  }
  
  .terminal-btn {
    width: 10px;
    height: 10px;
  }
  
  .terminal-title {
    font-size: 0.8rem;
  }
  
  .terminal-body {
    padding: 12px;
  }
  
  .terminal-prompt {
    font-size: 0.9rem;
  }
  
  .nav-menu.terminal-style {
    gap: 10px;
  }
  
  .nav-item.terminal-style {
    margin-right: 5px;
  }
  
  .nav-link.terminal-style {
    font-size: 0.85rem;
    padding: 4px 6px;
  }
}

@media (max-width: 480px) {
  .terminal-window {
    margin: 10px;
  }
  
  .system-info-bar {
    font-size: 0.65rem;
    padding: 3px 8px;
  }
  
  .site-header.terminal-style {
    top: 5px;
  }
  
  .terminal-body {
    padding: 10px;
  }
  
  .terminal-prompt {
    font-size: 0.85rem;
  }
  
  .terminal-command {
    font-size: 0.85rem;
  }
  
  .terminal-output {
    font-size: 0.85rem;
    margin-bottom: 8px;
  }
  
  .nav-link.terminal-style {
    font-size: 0.8rem;
    padding: 3px 4px;
  }
  
  .nav-link.terminal-style .terminal-prompt {
    font-size: 0.8rem;
  }
}

@media (max-width: 360px) {
  .terminal-window {
    margin: 8px;
  }
  
  .terminal-body {
    padding: 8px;
  }
  
  .terminal-prompt {
    font-size: 0.8rem;
  }
  
  .nav-menu.terminal-style {
    gap: 6px;
  }
  
  .nav-link.terminal-style {
    font-size: 0.75rem;
  }
}

/* Custom selection color */
.terminal-theme ::selection {
  background: var(--terminal-selection);
  color: var(--terminal-text);
}

/* Tag styling — excludes .project and .feat which now own their own
   minimalist hairline chips via projects.css / feats.css. */
.terminal-theme .chip,
.terminal-theme .skill-category .tag,
.terminal-theme .profile-card .tag {
  background-color: rgba(76, 217, 100, 0.1);
  color: var(--terminal-text);
  border: 1px solid rgba(76, 217, 100, 0.3);
  transition: all 0.3s ease;
  border-radius: 20px;
}

.terminal-theme .chip:hover,
.terminal-theme .skill-category .tag:hover,
.terminal-theme .profile-card .tag:hover {
  background-color: rgba(76, 217, 100, 0.2);
  color: #fff;
  border-color: rgba(76, 217, 100, 0.6);
  box-shadow: 0 0 8px rgba(76, 217, 100, 0.3);
}

/* Fix content color in terminal theme */
.terminal-theme .content p,
.terminal-theme .content li,
.terminal-theme .content code,
.terminal-theme .content div {
  color: #ddd;
}

/* Card styling for terminal theme · only non-project/feat surfaces.
   The projects + accomplishments pages own their own card chrome via
   design-tokens.css and projects.css / feats.css. */
.skill-category, .profile-card {
  background-color: rgba(25, 25, 25, 0.7);
  border: 1px solid rgba(76, 217, 100, 0.2);
  color: #ddd;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.skill-category:hover, .profile-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(76, 217, 100, 0.1);
  border-color: rgba(76, 217, 100, 0.5);
}

/* Project, feat and skill titles */
.terminal-theme .project .title,
.terminal-theme .feat .title,
.terminal-theme .category-title,
.terminal-theme .profile-name,
.terminal-theme .timeline-content h3 {
  color: var(--terminal-highlight) !important;
}

/* Timeline styling */
.terminal-theme .timeline::before {
  background-color: rgba(76, 217, 100, 0.2);
}

.terminal-theme .timeline-dot {
  background-color: var(--terminal-highlight);
  box-shadow: 0 0 10px rgba(76, 217, 100, 0.5);
}

/* Section titles · terminal-theme default (pages can override) */
.terminal-theme .section-title {
  color: var(--terminal-highlight);
}

/* Links */
.terminal-theme .connect svg {
  color: var(--terminal-text);
}

.terminal-theme .connect:hover svg {
  color: var(--terminal-highlight);
  filter: drop-shadow(0 0 3px rgba(76, 217, 100, 0.5));
}

/* Footer styling */
.terminal-theme .footer {
  border-top: 1px solid var(--terminal-border);
  background-color: rgba(25, 25, 25, 0.8);
  color: #888;
}

.terminal-theme .footer a {
  color: var(--terminal-highlight);
}

.terminal-theme .footer a:hover {
  text-shadow: 0 0 5px rgba(76, 217, 100, 0.5);
}

/* Load animation for terminal content */
.terminal-theme .fade-in {
  opacity: 0;
  animation: fadeIn var(--fade-speed) ease forwards;
  animation-delay: calc(var(--delay, 0) * 100ms);
}

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

/* Terminal container specific styles */
.terminal-container {
  width: 100%;
  max-width: 1000px;
  margin: 50px auto; /* Increased top margin from 40px to 50px to account for lower navbar */
  background-color: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(76, 217, 100, 0.1);
  border: 1px solid #333;
  height: 70vh;
  display: flex;
  flex-direction: column;
}

.terminal-output-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 25px; /* Increased padding */
  font-family: var(--terminal-font);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  color: #ddd;
}

.terminal-input-container {
  display: flex;
  align-items: center;
  padding: 15px 25px; /* Increased and standardized padding */
  background: rgba(20, 20, 20, 0.8);
  border-top: 1px solid #333;
}

.terminal-input-prompt {
  color: var(--terminal-prompt);
  margin-right: 8px;
  font-family: var(--terminal-font);
  user-select: none;
}

.terminal-input-prompt .term-path {
  color: var(--terminal-highlight);
}

.terminal-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: #ddd;
  font-family: var(--terminal-font);
  font-size: 0.95rem;
  outline: none;
  padding: 5px 0;
}

.command-line {
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
}

.output-line {
  margin-bottom: 10px;
  color: #ddd;
}

.output-error {
  color: var(--terminal-error);
}

.output-success {
  color: var(--terminal-success);
}

.output-highlight {
  color: var(--terminal-highlight);
}

.sound-toggle {
  position: fixed;
  top: 80px; /* Increased from 70px to account for navbar being 10px lower */
  background: rgba(25, 25, 25, 0.7);
  color: var(--terminal-highlight);
  border: 1px solid rgba(76, 217, 100, 0.3);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.2rem;
}

.sound-toggle:hover {
  background: rgba(76, 217, 100, 0.1);
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(76, 217, 100, 0.5);
}

/* Help table styling */
.help-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
}

.help-table th, .help-table td {
  text-align: left;
  padding: 8px 15px;
  border-bottom: 1px solid #333;
}

.help-table th {
  color: var(--terminal-highlight);
  font-weight: normal;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.help-table tr:hover td {
  background: rgba(76, 217, 100, 0.05);
}
