/* ==========================================================================
   Software Engineer Portfolio - Core Stylesheet
   Dark/Light Theme, Terminal Interface, Glassmorphism & Interactive Demos
   ========================================================================== */

:root {
  /* Color Palette - Dark Theme Default */
  --bg-primary: #0a0d14;
  --bg-secondary: #121824;
  --bg-card: rgba(18, 24, 36, 0.75);
  --bg-card-hover: rgba(26, 35, 52, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.3);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;
  --accent-green: #22c55e;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --glow-cyan: 0 0 20px rgba(56, 189, 248, 0.25);
  --glow-purple: 0 0 20px rgba(168, 85, 247, 0.25);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(241, 245, 249, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.75);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(56, 189, 248, 0.4);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --glow-cyan: 0 0 15px rgba(56, 189, 248, 0.15);
  --glow-purple: 0 0 15px rgba(168, 85, 247, 0.15);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.1);
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.28) 0px, transparent 55%),
    radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.28) 0px, transparent 55%),
    radial-gradient(at 50% 50%, rgba(37, 99, 235, 0.18) 0px, transparent 65%),
    radial-gradient(at 80% 85%, rgba(244, 63, 94, 0.16) 0px, transparent 50%),
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

[data-theme="light"] body {
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.18) 0px, transparent 55%),
    radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.18) 0px, transparent 55%),
    radial-gradient(at 50% 50%, rgba(37, 99, 235, 0.12) 0px, transparent 60%),
    linear-gradient(to right, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 40px 40px, 40px 40px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* Layout Containers */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 5rem 0;
  position: relative;
}

/* Section Header */
.section-title-wrap {
  text-align: center;
  margin-bottom: 3.5rem;
}
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(56, 189, 248, 0.2);
  margin-bottom: 1rem;
}
.section-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}
.section-subtitle {
  color: var(--text-secondary);
  max-width: 650px;
  margin: 0.75rem auto 0;
  font-size: 1.1rem;
}

/* Navigation Bar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-normal);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.25rem;
  width: 100%;
  padding: 0 2.5rem;
}

@media (max-width: 768px) {
  .nav-container {
    padding: 0 1.25rem;
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
}
.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  box-shadow: var(--glow-cyan);
}
.logo-text span {
  color: var(--accent-cyan);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}
.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color var(--transition-fast);
}
.nav-link:hover {
  color: var(--accent-cyan);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cmd-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.cmd-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}
.cmd-kbd {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.theme-toggle:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.lang-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  height: 38px;
  padding: 0 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.lang-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Hero Section & Terminal */
.hero-section {
  padding-top: 8rem;
  padding-bottom: 5rem;
  min-height: 90vh;
  display: flex;
  align-items: center;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--accent-green);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  margin-bottom: 1.25rem;
  line-height: 1.2;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  min-height: 8px;
  flex-shrink: 0;
  background-color: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse 2s infinite;
  display: inline-block;
}
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.hero-headline {
  font-size: 3.25rem;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  letter-spacing: -0.03em;
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-desc {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 540px;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #2563eb);
  color: #fff;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}
.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}
.btn-secondary:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-2px);
}

/* Terminal Component */
.terminal-window {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: #e2e8f0;
}
.terminal-header {
  background: #111827;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.terminal-dots {
  display: flex;
  gap: 0.4rem;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.terminal-title {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.terminal-body {
  padding: 1.25rem;
  min-height: 280px;
  max-height: 380px;
  overflow-y: auto;
}
.term-line {
  margin-bottom: 0.6rem;
  line-height: 1.5;
}
.term-prompt {
  color: var(--accent-green);
  font-weight: 700;
  white-space: nowrap;
}
.term-prompt-wrap {
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center;
  flex-shrink: 0 !important;
}
.term-path {
  color: var(--accent-cyan);
}
.term-cmd {
  color: #fff;
  font-weight: 600;
}
.term-out {
  color: #94a3b8;
  padding-left: 0.5rem;
}
.term-input-row {
  display: flex !important;
  align-items: center;
  flex-wrap: nowrap !important;
  gap: 0.35rem;
  width: 100%;
}
.term-input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  flex: 1;
  min-width: 0;
}

/* Credentials Box / Static Access Widget */
.credentials-banner {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.9));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 4rem;
  box-shadow: var(--shadow-lg);
}

.credentials-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.cred-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.35rem;
  font-weight: 700;
}
.cred-title i {
  color: var(--accent-amber);
}

.cred-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.cred-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all var(--transition-fast);
}
.cred-card:hover {
  border-color: var(--accent-cyan);
}
.cred-role-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.role-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  font-weight: 700;
}
.role-admin { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.3); }
.role-tech { background: rgba(56, 189, 248, 0.15); color: var(--accent-cyan); border: 1px solid rgba(56, 189, 248, 0.3); }
.role-user { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); border: 1px solid rgba(34, 197, 94, 0.3); }

.cred-details {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: var(--bg-primary);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.cred-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.copy-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}
.copy-btn:hover {
  color: var(--accent-cyan);
}

/* Projects Cards Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 560px));
  justify-content: center;
  gap: 2rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  backdrop-filter: blur(12px);
}
.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-lg), var(--glow-cyan);
}

.project-banner {
  height: 200px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-preview-icon {
  font-size: 4rem;
  color: var(--accent-cyan);
  opacity: 0.85;
}
.project-tag-overlay {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
  letter-spacing: 0.2px;
}

[dir="rtl"] .project-tag-overlay {
  right: auto;
  left: 0.85rem;
}

.project-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.project-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.project-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}
.tech-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.16rem 0.45rem;
  border-radius: 4px;
  line-height: 1.25;
}

.project-actions {
  margin-top: auto;
  display: flex;
  gap: 0.75rem;
}
.project-btn {
  flex: 1;
  text-align: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
}

/* Skills Matrix Section */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.skill-category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all var(--transition-fast);
}
.skill-category-card:hover {
  border-color: var(--accent-purple);
}

.skill-cat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  font-size: 1.1rem;
  font-weight: 700;
}
.skill-cat-header i {
  color: var(--accent-purple);
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.skill-item-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}
.skill-bar-bg {
  height: 6px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.skill-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  border-radius: var(--radius-full);
  transition: width 1s ease-in-out;
}

/* Timeline Experience */
.timeline-wrap {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}
.timeline-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  width: 2px;
  background: var(--border-color);
}
.timeline-item {
  position: relative;
  padding-left: 3rem;
  margin-bottom: 2.5rem;
}
.timeline-dot {
  position: absolute;
  left: 11px;
  top: 4px;
  width: 20px;
  height: 20px;
  background: var(--bg-primary);
  border: 3px solid var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-cyan);
}
.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: var(--radius-md);
}
.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  margin-bottom: 0.4rem;
}
.timeline-role {
  font-size: 1.2rem;
  font-weight: 700;
}
.timeline-org {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.85rem;
}
.timeline-bullets {
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.925rem;
}
.timeline-bullets li {
  margin-bottom: 0.4rem;
}

/* ==========================================================================
   Trophies Showcase (Microsoft Learn & Engineering Milestones)
   ========================================================================== */
.trophies-wrapper {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.6) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  border-radius: 20px;
  padding: 1.75rem 1.5rem;
  margin-bottom: 2.25rem;
  position: relative;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] .trophies-wrapper {
  background: linear-gradient(135deg, #fef3c7 0%, #f1f5f9 100%);
  border: 1.5px solid rgba(217, 119, 6, 0.3);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.trophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.trophy-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

[data-theme="light"] .trophy-card {
  background: rgba(255, 255, 255, 0.9);
}

.trophy-card:hover {
  transform: translateY(-4px);
  border-color: #fbbf24;
  box-shadow: 0 12px 30px rgba(245, 158, 11, 0.25);
}

.trophy-icon-box {
  width: 62px;
  height: 62px;
  min-width: 62px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fef08a 0%, #eab308 50%, #854d0e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  color: #78350f;
  box-shadow: 0 6px 15px rgba(234, 179, 8, 0.4), inset 0 2px 3px rgba(255,255,255,0.7);
}

.trophy-meta-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.trophy-meta-issuer {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.trophy-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  display: inline-block;
  margin-bottom: 0.3rem;
}

/* ==========================================================================
   Badges of Achievement Rack (Pure Badge Logos Showcase)
   ========================================================================== */
.military-rack-wrapper {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(2, 6, 23, 0.98) 100%);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 24px;
  padding: 2.25rem 2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: visible;
}

[data-theme="light"] .military-rack-wrapper {
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  border: 1px solid rgba(212, 175, 55, 0.4);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
}

.rack-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(212, 175, 55, 0.2);
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.rack-badge-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.military-medals-rack {
  display: flex;
  flex-wrap: wrap;
  gap: 2.25rem 1.75rem;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  padding: 1rem 0;
}

/* Individual Badge Emblem Assembly */
.military-medal-item {
  position: relative;
  width: 140px;
  cursor: pointer;
  perspective: 1000px;
  z-index: 10;
  transition: z-index 0s ease 0.15s;
  outline: none;
}

.military-medal-item:hover,
.military-medal-item:focus-within {
  z-index: 100;
  transition: z-index 0s;
}

/* Badge Emblem Body */
.medal-hanger {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.military-medal-item:hover .medal-hanger,
.military-medal-item:focus-within .medal-hanger {
  transform: translateY(-8px) scale(1.08);
}

/* 3D Round Badge Bevel Rim */
.medal-disc {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5), inset 0 2px 4px rgba(255,255,255,0.4);
  transition: all 0.3s ease;
  padding: 4px;
}

/* Medal Tiers & Metallic Rim */
.tier-gold {
  background: radial-gradient(circle at 35% 35%, #fef08a 0%, #eab308 50%, #854d0e 90%, #d97706 100%);
  border: 2.5px solid #fde047;
  box-shadow: 0 10px 25px rgba(234, 179, 8, 0.3), inset 0 2px 4px rgba(255,255,255,0.5);
}
.tier-platinum {
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #cbd5e1 50%, #475569 90%, #94a3b8 100%);
  border: 2.5px solid #e2e8f0;
  box-shadow: 0 10px 25px rgba(226, 232, 240, 0.25), inset 0 2px 4px rgba(255,255,255,0.6);
}
.tier-silver {
  background: radial-gradient(circle at 35% 35%, #f1f5f9 0%, #94a3b8 50%, #334155 90%, #64748b 100%);
  border: 2.5px solid #cbd5e1;
  box-shadow: 0 10px 25px rgba(148, 163, 184, 0.25);
}
.tier-bronze {
  background: radial-gradient(circle at 35% 35%, #fed7aa 0%, #ea580c 50%, #7c2d12 90%, #c2410c 100%);
  border: 2.5px solid #fdba74;
  box-shadow: 0 10px 25px rgba(234, 88, 12, 0.25);
}

/* Inner Enamel Center */
.medal-inner-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #0b1329;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2rem;
  overflow: hidden;
  padding: 8px;
}

.medal-inner-core img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Medal Label (Compact View Below) */
.medal-label-short {
  margin-top: 0.6rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  max-width: 125px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.medal-issuer-tag {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 0.2rem;
  font-weight: 500;
}

/* ==========================================================================
   Hover Extension Card (Unfolds on Hover)
   ========================================================================== */
.medal-expand-card {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(12px) scale(0.92);
  width: 290px;
  background: var(--bg-card);
  border: 1.5px solid rgba(212, 175, 55, 0.5);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.7), 0 0 25px rgba(245, 158, 11, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 200;
  text-align: left;
}

[dir="rtl"] .medal-expand-card {
  text-align: right;
}

/* Pointing Arrow */
.medal-expand-card::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid rgba(212, 175, 55, 0.5);
}
.medal-expand-card::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid var(--bg-card);
}

.military-medal-item:hover .medal-expand-card,
.military-medal-item:focus-within .medal-expand-card {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

.medal-expand-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.medal-tier-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-tier-gold {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.badge-tier-platinum {
  background: rgba(226, 232, 240, 0.15);
  color: #f8fafc;
  border: 1px solid rgba(226, 232, 240, 0.35);
}
.badge-tier-silver {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
}
.badge-tier-bronze {
  background: rgba(234, 88, 12, 0.15);
  color: #fb923c;
  border: 1px solid rgba(234, 88, 12, 0.35);
}

.medal-expand-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 0.35rem 0;
  line-height: 1.35;
}

.medal-expand-issuer {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.medal-expand-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.medal-action-btn {
  flex: 1;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.38rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.medal-action-btn:hover {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

/* Command Palette Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.cmd-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.cmd-modal-input-wrap {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0.75rem;
}
.cmd-modal-input-wrap i {
  color: var(--text-muted);
  font-size: 1.1rem;
}
.cmd-modal-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  width: 100%;
}
.cmd-modal-list {
  list-style: none;
  max-height: 350px;
  overflow-y: auto;
  padding: 0.5rem;
}
.cmd-modal-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.cmd-modal-item:hover, .cmd-modal-item.selected {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.cmd-modal-item-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Architecture View Modal */
.arch-modal {
  max-width: 900px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.arch-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}
.close-modal-btn:hover {
  color: var(--text-primary);
}

.arch-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}
.arch-tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
}
.arch-tab.active {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-cyan);
}

.arch-diagram-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  color: #a7f3d0;
}

/* Toast Banners for Demo Mode */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast-banner {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-cyan);
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Footer */
footer {
  border-top: 1px solid var(--border-color);
  padding: 2.5rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-family: var(--font-mono);
}

/* Responsive Media Queries */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .hero-headline {
    font-size: 2.5rem;
  }
  .nav-links {
    display: none;
  }
  .section-title {
    font-size: 2.0rem;
  }
}

/* Dedicated Lightbox Overlay for Certificate Previews */
.cert-lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 12, 23, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 1.5rem;
  box-sizing: border-box;
  opacity: 1;
  pointer-events: auto;
  overflow: hidden;
  animation: fadeIn 0.25s ease-out;
}
.cert-lightbox-overlay.hidden {
  display: none !important;
}

.modal-card-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  border-radius: 20px;
  max-width: 820px;
  width: 92%;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  box-shadow: 0 25px 70px rgba(0,0,0,0.6);
  animation: modalFade 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalFade {
  from { transform: scale(0.94) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* Certifications Grid */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  transition: all var(--transition-fast);
}
.cert-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.1);
}
.cert-icon-wrap {
  font-size: 2.2rem;
  color: var(--accent-cyan);
  flex-shrink: 0;
}
.cert-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.cert-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.cert-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-indigo);
}

/* Recommendations Grid */
.recs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.rec-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition-fast);
}
.rec-card:hover {
  border-color: var(--accent-green);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(34, 197, 94, 0.1);
}
.rec-quote {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  font-style: italic;
  margin-bottom: 1.25rem;
  position: relative;
}
.rec-author {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}
.rec-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.rec-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.1rem;
}
.rec-role {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* RTL (Right-to-Left Arabic) Support Rules */
html[dir="rtl"] {
  font-family: 'Cairo', 'Tajawal', system-ui, -apple-system, sans-serif;
}
html[dir="rtl"] body {
  text-align: right;
}
html[dir="rtl"] .hero-desc,
html[dir="rtl"] .section-subtitle,
html[dir="rtl"] .section-title-wrap {
  text-align: right;
}
html[dir="rtl"] .pulse-dot {
  margin-right: 0;
  margin-left: 8px;
}
html[dir="rtl"] .timeline-wrap::before {
  left: auto;
  right: 20px;
}
html[dir="rtl"] .timeline-item {
  padding-left: 0;
  padding-right: 3rem;
}
html[dir="rtl"] .timeline-dot {
  left: auto;
  right: 11px;
}
html[dir="rtl"] .timeline-bullets {
  padding-left: 0;
  padding-right: 1.25rem;
}
html[dir="rtl"] .term-header,
html[dir="rtl"] .term-body {
  direction: ltr;
  text-align: left;
}
