/**
 * Modern High-Tech Portfolio Stylesheet
 * Developer: Mohammad Hassan Ghasabi (محمدحسن قصابی)
 * Full-Stack Software Engineer & System Architect
 * Features: Fluid Responsive Typography, Soft Border-Radii, Light & Dark Themes, Local-Only Zero-CDN
 */

/* ==========================================================================
   1. Design Tokens & Color Variables
   ========================================================================== */
:root {
  --app-font: 'Peyda', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono-font: 'Peyda', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --trans-fast: 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  --trans-norm: 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  --trans-slow: 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Soft Border Radius System (No sharp edges) */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-pill: 50px;
}

/* Light Theme: Clean Industrial High-Tech (Default) */
[data-bs-theme="light"] {
  --bg-primary: #f4f7fb;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-input: #f8fafc;

  /* Primary High-Tech Accents */
  --cyber-cyan: #0284c7;
  --cyber-cyan-rgb: 2, 132, 199;
  --cyber-amber: #d97706;
  --cyber-amber-rgb: 217, 119, 6;
  --cyber-crimson: #e11d48;
  --cyber-crimson-rgb: 225, 29, 72;
  --cyber-green: #059669;
  --cyber-green-rgb: 5, 150, 105;

  /* Typography */
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;
  --text-cyan: #0284c7;

  /* Borders & Shadows */
  --border-cyber: rgba(2, 132, 199, 0.22);
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-active: #0284c7;
  --grid-line-color: rgba(2, 132, 199, 0.04);

  --shadow-subtle: 0 4px 16px rgba(15, 23, 42, 0.05);
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 16px 36px rgba(2, 132, 199, 0.12);
  --shadow-cyber: 0 8px 24px rgba(2, 132, 199, 0.14);

  --nav-bg: rgba(255, 255, 255, 0.92);
  --nav-border: rgba(226, 232, 240, 0.9);
  --footer-bg: #e9eff7;
}

/* Dark Theme: Carbon & Cyber Neon */
[data-bs-theme="dark"] {
  --bg-primary: #07090e;
  --bg-surface: rgba(13, 19, 31, 0.88);
  --bg-surface-elevated: rgba(18, 26, 42, 0.95);
  --bg-card: rgba(13, 19, 31, 0.8);
  --bg-card-hover: rgba(20, 29, 48, 0.96);
  --bg-input: #0b101a;

  --cyber-cyan: #00f0ff;
  --cyber-cyan-rgb: 0, 240, 255;
  --cyber-amber: #ffb800;
  --cyber-amber-rgb: 255, 184, 0;
  --cyber-crimson: #ff0055;
  --cyber-crimson-rgb: 255, 0, 85;
  --cyber-green: #00ff9d;
  --cyber-green-rgb: 0, 255, 157;

  --text-main: #f1f5f9;
  --text-muted: #8b9bb4;
  --text-light: #52637a;
  --text-cyan: #00f0ff;

  --border-cyber: rgba(0, 240, 255, 0.22);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: #00f0ff;
  --grid-line-color: rgba(0, 240, 255, 0.045);

  --shadow-subtle: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-hover: 0 16px 40px rgba(0, 240, 255, 0.22), 0 10px 30px rgba(0, 0, 0, 0.85);
  --shadow-cyber: 0 0 24px rgba(0, 240, 255, 0.2);

  --nav-bg: rgba(7, 9, 14, 0.88);
  --nav-border: rgba(0, 240, 255, 0.18);
  --footer-bg: #05060a;
}

/* ==========================================================================
   2. Fluid Responsive Typography & Global Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: var(--app-font);
  scroll-behavior: smooth;
  scroll-padding-top: 82px;
  font-size: clamp(14px, 0.85vw + 4px, 16px);
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--app-font);
  background-color: var(--bg-primary);
  color: var(--text-main);
  transition: background-color var(--trans-norm), color var(--trans-norm);
  overflow-x: hidden;
  max-width: 100%;
  position: relative;
  min-height: 100vh;
  line-height: 1.75;
}

.font-mono, .hud-mono {
  font-family: var(--app-font) !important;
}

/* ==========================================================================
   Peyda 10-Weight Hierarchy System
   ========================================================================== */
.font-thin        { font-weight: 100 !important; }
.font-extralight  { font-weight: 200 !important; }
.font-light       { font-weight: 300 !important; }
.font-regular     { font-weight: 400 !important; }
.font-medium      { font-weight: 500 !important; }
.font-semibold    { font-weight: 600 !important; }
.font-bold        { font-weight: 700 !important; }
.font-extrabold   { font-weight: 800 !important; }
.font-black       { font-weight: 900 !important; }
.font-extrablack  { font-weight: 950 !important; }

/* Semantic Weight Assignments */
p, li, span:not([class*="fa-"]), input, textarea, select {
  font-weight: 400;
}

.text-muted,
small,
p.small,
span.small:not([class*="fa-"]),
div.small,
a.small,
label.small {
  font-weight: 300;
}

/* ==========================================================================
   FontAwesome Icon System Protection
   Guarantees icons always render with accurate font-family and required weights,
   preventing missing glyph boxes (tofu / ☒) caused by inherited typography or utility classes.
   ========================================================================== */
.fa,
.fas,
.fa-solid {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
  font-style: normal !important;
}

.far,
.fa-regular {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 400 !important;
  font-style: normal !important;
}

.fab,
.fa-brands {
  font-family: "Font Awesome 6 Brands" !important;
  font-weight: 400 !important;
  font-style: normal !important;
}

i[class*="fa-"],
span[class*="fa-"] {
  font-style: normal !important;
}

.legal-fineprint, .tech-watermark-footnote {
  font-weight: 200;
}

.tech-watermark-number {
  font-weight: 100;
}

.nav-link, .project-tagline {
  font-weight: 500;
}

.brand-subtitle, .cyber-stat-label {
  font-weight: 600;
}

.cyber-btn-primary, .cyber-btn-outline, .hud-badge, .section-tag, h4, h5, h6, .h4, .h5, .h6, .hero-role-title {
  font-weight: 700;
}

.section-title, .brand-text, h2, .h2 {
  font-weight: 800;
}

h1, .h1, .cyber-stat-number {
  font-weight: 900;
}

.hero-title, .cyber-gradient-text {
  font-weight: 950;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--app-font);
  line-height: 1.35;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

::selection {
  background-color: var(--cyber-cyan);
  color: #ffffff;
}

[data-bs-theme="dark"] ::selection {
  color: #07090e;
}

/* ==========================================================================
   3. Background Grid & Ambient Overlays
   ========================================================================== */
.cyber-grid-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, var(--grid-line-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line-color) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
}

.cyber-grid-canvas::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 25%, transparent 30%, var(--bg-primary) 85%);
  pointer-events: none;
}

.ambient-energy-1 {
  position: absolute;
  top: -80px;
  right: -60px;
  width: 480px;
  max-width: 90vw;
  height: 480px;
  background: radial-gradient(circle, rgba(var(--cyber-cyan-rgb), 0.12) 0%, transparent 70%);
  filter: blur(80px);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-energy-2 {
  position: absolute;
  top: 45%;
  left: -100px;
  width: 500px;
  max-width: 90vw;
  height: 500px;
  background: radial-gradient(circle, rgba(var(--cyber-amber-rgb), 0.08) 0%, transparent 70%);
  filter: blur(90px);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

main, footer {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   4. Soft Card & Panel System (Rounded & Elegant)
   ========================================================================== */
.cyber-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  transition: all var(--trans-norm);
}

.cyber-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform var(--trans-norm), border-color var(--trans-norm), box-shadow var(--trans-norm);
}

.cyber-card:hover {
  transform: translateY(-4px);
  border-color: var(--cyber-cyan);
  box-shadow: var(--shadow-hover);
}

/* ==========================================================================
   5. Badges, Status LEDs & Title Gradients
   ========================================================================== */
.hud-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.85rem;
  font-family: var(--mono-font);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  background: rgba(var(--cyber-cyan-rgb), 0.08);
  border: 1px solid var(--border-cyber);
  color: var(--cyber-cyan);
  white-space: nowrap;
}

.hud-badge-amber {
  background: rgba(var(--cyber-amber-rgb), 0.1);
  border-color: rgba(var(--cyber-amber-rgb), 0.35);
  color: var(--cyber-amber);
}

.hud-badge-green {
  background: rgba(var(--cyber-green-rgb), 0.1);
  border-color: rgba(var(--cyber-green-rgb), 0.35);
  color: var(--cyber-green);
}

.hud-badge-crimson {
  background: rgba(var(--cyber-crimson-rgb), 0.1);
  border-color: rgba(var(--cyber-crimson-rgb), 0.35);
  color: var(--cyber-crimson);
}

.status-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-led-online {
  background-color: var(--cyber-green);
  box-shadow: 0 0 8px var(--cyber-green);
  animation: ledPulse 2s infinite ease-in-out;
}

@keyframes ledPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.cyber-gradient-text {
  background: linear-gradient(115deg, #0f172a 15%, var(--cyber-cyan) 65%, var(--cyber-amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

[data-bs-theme="dark"] .cyber-gradient-text {
  background: linear-gradient(115deg, #ffffff 15%, var(--cyber-cyan) 65%, var(--cyber-amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   6. Buttons & Controls (Soft Rounded)
   ========================================================================== */
.cyber-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.65rem clamp(0.9rem, 1.2vw, 1.5rem);
  font-weight: 700;
  font-size: clamp(0.82rem, 0.85vw, 0.95rem);
  background: var(--cyber-cyan);
  color: #ffffff !important;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(var(--cyber-cyan-rgb), 0.3);
  transition: all var(--trans-norm);
}

[data-bs-theme="dark"] .cyber-btn-primary {
  color: #07090e !important;
}

.cyber-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(var(--cyber-cyan-rgb), 0.45);
  filter: brightness(1.06);
}

.cyber-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.65rem clamp(0.9rem, 1.2vw, 1.5rem);
  font-weight: 700;
  font-size: clamp(0.82rem, 0.85vw, 0.95rem);
  background: rgba(var(--cyber-cyan-rgb), 0.06);
  color: var(--cyber-cyan) !important;
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--trans-norm);
}

.cyber-btn-outline:hover {
  background: rgba(var(--cyber-cyan-rgb), 0.14);
  border-color: var(--cyber-cyan);
  transform: translateY(-2px);
}

.btn-control-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--cyber-cyan-rgb), 0.05);
  border: 1px solid var(--border-cyber);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--trans-norm);
}

.btn-control-icon:hover {
  background: rgba(var(--cyber-cyan-rgb), 0.15);
  border-color: var(--cyber-cyan);
  color: var(--cyber-cyan);
  transform: translateY(-2px);
}

/* ==========================================================================
   7. Navigation Bar (Responsive, Zero-Cramping, Soft Radius)
   ========================================================================== */
.main-navbar {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1040 !important;
  background: var(--nav-bg) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--nav-border);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  transition: all var(--trans-norm);
}

.main-navbar.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  border-bottom-color: var(--cyber-cyan);
}

.navbar-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  white-space: nowrap;
}

.brand-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, rgba(var(--cyber-cyan-rgb), 0.18) 0%, rgba(var(--cyber-amber-rgb), 0.18) 100%);
  border: 1px solid var(--cyber-cyan);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyber-cyan);
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(var(--cyber-cyan-rgb), 0.2);
}

.brand-text {
  font-weight: 800;
  font-size: clamp(0.95rem, 1.1vw, 1.15rem);
  color: var(--text-main);
  white-space: nowrap;
  line-height: 1.25;
}

.brand-subtitle {
  font-size: clamp(0.65rem, 0.75vw, 0.75rem);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Navbar Links: Fluid font & padding, single horizontal line, soft hover */
.navbar-nav {
  gap: clamp(0.15rem, 0.45vw, 0.55rem);
  align-items: center;
}

.nav-link {
  font-weight: 600;
  font-size: clamp(0.78rem, 0.82vw + 0.05rem, 0.92rem);
  color: var(--text-muted) !important;
  padding: 0.45rem clamp(0.45rem, 0.6vw, 0.85rem) !important;
  border-radius: var(--radius-sm);
  white-space: nowrap !important;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--trans-norm);
}

.nav-link:hover {
  color: var(--cyber-cyan) !important;
  background: rgba(var(--cyber-cyan-rgb), 0.08);
}

.nav-link.active {
  color: var(--cyber-cyan) !important;
  background: rgba(var(--cyber-cyan-rgb), 0.12);
  font-weight: 700;
}

.nav-telemetry-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  background: rgba(var(--cyber-cyan-rgb), 0.06);
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-xs);
  font-family: var(--mono-font);
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Mobile Collapse Styling */
@media (max-width: 1199.98px) {
  .navbar-collapse {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-cyber);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-top: 0.85rem;
    box-shadow: var(--shadow-card);
  }

  .navbar-nav {
    align-items: stretch;
    gap: 0.4rem;
  }

  .nav-link {
    padding: 0.65rem 1rem !important;
    justify-content: flex-start;
  }
}

/* ==========================================================================
   8. Hero Section & Avatar Squircle
   ========================================================================== */
.hero-section {
  padding-top: clamp(3rem, 6vw, 5rem);
  padding-bottom: clamp(3rem, 6vw, 5.5rem);
  position: relative;
  overflow: hidden;
}

.hero-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1.15rem;
  background: rgba(var(--cyber-cyan-rgb), 0.08);
  border: 1px solid var(--border-cyber);
  color: var(--cyber-cyan);
  font-family: var(--mono-font);
  font-size: 0.82rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-pill);
}

.hero-title {
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 1.25rem;
}

.hero-role-title {
  font-size: clamp(1.05rem, 2.2vw, 1.4rem);
  font-weight: 700;
  color: var(--cyber-amber);
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.hero-bio {
  font-size: clamp(0.95rem, 1.1vw, 1.08rem);
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 2rem;
  max-width: 650px;
}

/* Avatar Soft Squircle Box */
.hero-avatar-container {
  position: relative;
  width: clamp(250px, 28vw, 320px);
  height: clamp(250px, 28vw, 320px);
  margin: 0 auto;
}

.avatar-squircle-box {
  width: 100%;
  height: 100%;
  background: var(--bg-surface);
  border: 2px solid var(--border-cyber);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--trans-norm), border-color var(--trans-norm);
}

.avatar-squircle-box:hover {
  transform: scale(1.02);
  border-color: var(--cyber-cyan);
}

.avatar-squircle-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  transition: transform var(--trans-norm);
}

/* Floating Subsystem Badges */
.floating-cyber-pill {
  position: absolute;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-family: var(--mono-font);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: var(--shadow-card);
  z-index: 2;
  transition: transform var(--trans-norm);
}

.floating-pill-1 { top: 10px; right: -20px; border-color: var(--cyber-cyan); }
.floating-pill-2 { bottom: 15px; left: -25px; border-color: var(--cyber-amber); }

.floating-cyber-pill:hover {
  transform: translateY(-3px);
}

/* Telemetry Stats */
.cyber-stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 2vw, 1.5rem);
  box-shadow: var(--shadow-subtle);
  transition: all var(--trans-norm);
}

.cyber-stat-box:hover {
  border-color: var(--cyber-cyan);
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.cyber-stat-number {
  font-family: var(--mono-font);
  font-size: clamp(1.8rem, 2.5vw, 2.3rem);
  font-weight: 900;
  color: var(--cyber-cyan);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.cyber-stat-label {
  font-size: clamp(0.78rem, 0.9vw, 0.88rem);
  color: var(--text-muted);
  font-weight: 600;
}

/* ==========================================================================
   9. Section Header Framework
   ========================================================================== */
.section-header {
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  background: rgba(var(--cyber-amber-rgb), 0.08);
  border: 1px solid rgba(var(--cyber-amber-rgb), 0.35);
  color: var(--cyber-amber);
  font-family: var(--mono-font);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 1rem;
  border-radius: var(--radius-pill);
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  font-weight: 900;
  margin-bottom: 0.85rem;
}

.section-subtitle {
  font-size: clamp(0.92rem, 1.1vw, 1.05rem);
  color: var(--text-muted);
  max-width: 680px;
  line-height: 1.8;
}

/* ==========================================================================
   10. Engineering Dossier (About Component)
   ========================================================================== */
.dossier-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  box-shadow: var(--shadow-card);
}

.dossier-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.85rem;
  margin-bottom: 1.35rem;
  font-family: var(--mono-font);
  font-size: 0.75rem;
  color: var(--cyber-cyan);
}

.tech-spec-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem;
  background: rgba(var(--cyber-cyan-rgb), 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
  transition: all var(--trans-norm);
}

.tech-spec-item:hover {
  background: rgba(var(--cyber-cyan-rgb), 0.07);
  border-color: var(--cyber-cyan);
}

/* ==========================================================================
   11. Skills Subsystems Power Grid
   ========================================================================== */
.skill-module-card {
  background: var(--bg-card);
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.5vw, 1.85rem);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: all var(--trans-norm);
}

.skill-module-card:hover {
  border-color: var(--cyber-cyan);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.skill-module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.skill-item-row {
  background: rgba(var(--cyber-cyan-rgb), 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  transition: all var(--trans-norm);
}

.skill-item-row:hover {
  background: rgba(var(--cyber-cyan-rgb), 0.07);
  border-color: var(--border-cyber);
}

.power-gauge {
  display: flex;
  gap: 4px;
  margin-top: 0.5rem;
}

.power-bar-segment {
  height: 5px;
  flex: 1;
  border-radius: 4px;
  background: rgba(125, 125, 125, 0.18);
  transition: background-color var(--trans-norm);
}

.power-bar-segment.active {
  background: var(--cyber-cyan);
  box-shadow: 0 0 6px rgba(var(--cyber-cyan-rgb), 0.4);
}

.power-bar-segment.active-amber {
  background: var(--cyber-amber);
  box-shadow: 0 0 6px rgba(var(--cyber-amber-rgb), 0.4);
}

/* ==========================================================================
   12. Projects Portfolio (Deployed Systems)
   ========================================================================== */
.project-cyber-card {
  background: var(--bg-card);
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: all var(--trans-norm);
}

.project-cyber-card:hover {
  border-color: var(--cyber-cyan);
  box-shadow: var(--shadow-hover);
  transform: translateY(-5px);
}

.project-telemetry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--mono-font);
  font-size: 0.75rem;
  color: var(--text-muted);
}

[data-bs-theme="dark"] .project-telemetry-header {
  background: rgba(0, 0, 0, 0.35);
}

.project-body {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.project-tech-pill {
  font-family: var(--mono-font);
  font-size: 0.72rem;
  padding: 0.25rem 0.65rem;
  background: rgba(var(--cyber-cyan-rgb), 0.08);
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-xs);
  color: var(--cyber-cyan);
}

/* ==========================================================================
   13. Contact Uplink Terminal & Inputs
   ========================================================================== */
.contact-uplink-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  box-shadow: var(--shadow-card);
}

.cyber-input {
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border-cyber) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-main) !important;
  padding: 0.75rem 1rem !important;
  font-family: var(--app-font);
  font-size: 0.95rem;
  transition: all var(--trans-norm);
}

.cyber-input:focus {
  border-color: var(--cyber-cyan) !important;
  box-shadow: 0 0 16px rgba(var(--cyber-cyan-rgb), 0.25) !important;
  outline: none;
}

.cyber-input::placeholder {
  color: var(--text-light);
}

select.cyber-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2300e5ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 1rem center !important;
  background-size: 14px !important;
  padding-right: 2.5rem !important;
  cursor: pointer;
}

/* Custom CAPTCHA */
.captcha-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.captcha-display-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.captcha-display-wrapper canvas {
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  display: block;
}

.captcha-refresh-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  color: var(--cyber-cyan);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--trans-norm);
}

.captcha-refresh-btn:hover {
  background: rgba(var(--cyber-cyan-rgb), 0.1);
  border-color: var(--cyber-cyan);
  transform: rotate(90deg);
}

.captcha-input {
  flex: 1;
  min-width: 140px;
  letter-spacing: 4px;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem !important;
}

/* ==========================================================================
   14. Fixed PWA Floating Toast & Offline Banner (Never Stuck at Top!)
   ========================================================================== */
.pwa-toast-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050;
  max-width: 410px;
  width: calc(100% - 48px);
  background: var(--bg-surface-elevated);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-cyber);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  display: none; /* Controlled by pwa.js beforeinstallprompt */
  animation: pwaSlideUp 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.offline-alert-badge {
  position: fixed;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1060;
  background: var(--cyber-crimson);
  color: #ffffff;
  padding: 0.45rem 1.25rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  display: none;
}

/* ==========================================================================
   15. Industrial Footer & Back to Top
   ========================================================================== */
.main-footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border-cyber);
  padding-top: 3.5rem;
  padding-bottom: 2rem;
  position: relative;
}

.btn-back-to-top {
  position: fixed;
  bottom: 25px;
  left: 25px;
  width: 44px;
  height: 44px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--cyber-cyan);
  border-radius: var(--radius-md);
  color: var(--cyber-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--trans-norm);
  box-shadow: var(--shadow-subtle);
}

.btn-back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.btn-back-to-top:hover {
  background: var(--cyber-cyan);
  color: #ffffff;
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

/* ==========================================================================
   16. Comprehensive Mobile Responsiveness & Overflow Prevention
   ========================================================================== */
@media (max-width: 991.98px) {
  .floating-pill-1,
  .floating-pill-2 {
    position: static;
    margin: 0.5rem auto;
    display: inline-flex;
    max-width: 100%;
  }

  .hero-avatar-container {
    margin-top: 2rem;
    width: min(280px, 80vw);
    height: min(280px, 80vw);
  }
}

@media (max-width: 575.98px) {
  /* Prevent header brand badge overflowing into controls */
  .navbar-brand-badge {
    max-width: calc(100% - 105px);
    overflow: hidden;
  }

  .brand-text {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-subtitle {
    font-size: 0.65rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 170px;
  }

  /* Captcha responsive flex */
  .captcha-box {
    flex-direction: column;
    align-items: stretch;
  }

  .captcha-display-wrapper {
    width: 100%;
    justify-content: space-between;
  }

  .captcha-display-wrapper img,
  .captcha-display-wrapper canvas {
    max-width: calc(100% - 50px);
    height: auto;
  }

  .captcha-input {
    width: 100%;
    min-width: unset;
  }

  /* PWA Toast Banner on small screens */
  .pwa-toast-banner {
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: calc(100% - 24px);
    max-width: none;
    padding: 1rem;
  }

  /* Hero & Headings spacing */
  .hero-section {
    padding-top: 2rem;
    padding-bottom: 2.5rem;
  }

  .hero-title {
    font-size: 1.85rem;
    word-break: break-word;
  }

  .hero-role-title {
    font-size: 1.05rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Buttons on mobile */
  .cyber-btn-primary,
  .cyber-btn-outline {
    width: 100%;
    max-width: 100%;
    white-space: normal;
    text-align: center;
    justify-content: center;
  }

  /* Tech spec items & cards */
  .tech-spec-item {
    padding: 0.85rem;
    word-break: break-word;
  }

  .dossier-panel,
  .contact-uplink-card,
  .skill-module-card {
    padding: 1.25rem 1rem;
  }

  /* Back to top button position */
  .btn-back-to-top {
    bottom: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
  }
}
