@charset "UTF-8";

/* =========================================
   VARIABLES & SEMANTIC THEME SYSTEM
   ========================================= */
:root {
  /* --- PALETTE (Base) --- */
  --p-dark: #0f172a;
  /* Slate 900 */
  --p-darker: #020617;
  /* Slate 950 */
  --p-light: #f8fafc;
  /* Slate 50 */
  --p-white: #ffffff;

  --p-brand: #38bdf8;
  /* Sky 400 */
  --p-brand-dim: #0ea5e9;
  /* Sky 500 */
  --p-accent: #a78bfa;
  /* Violet 400 */

  /* --- SEMANTIC TOKENS (Dark Mode Default) --- */
  --bg-page: #0f172a;
  --bg-surface: rgba(30, 41, 59, 0.4);
  /* Glassy slate */
  --bg-surface-hover: rgba(30, 41, 59, 0.6);
  --bg-card: rgba(15, 23, 42, 0.6);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(56, 189, 248, 0.3);

  --color-brand: var(--p-brand);
  --color-accent: var(--p-accent);

  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.15);

  /* Layout */
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;

  /* Fonts */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

/* --- LIGHT MODE OVERRIDES --- */
body.light-mode {
  --bg-page: #f8fafc;
  --bg-surface: rgba(255, 255, 255, 0.7);
  --bg-surface-hover: rgba(255, 255, 255, 0.9);
  --bg-card: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border-subtle: rgba(148, 163, 184, 0.25);
  --border-highlight: rgba(2, 132, 199, 0.3);

  --color-brand: #0284c7;
  /* Sky 600 - darker for contrast */
  --color-accent: #7c3aed;
  /* Violet 600 */

  --shadow-sm: 0 4px 6px -1px rgba(148, 163, 184, 0.15);
  --shadow-lg: 0 20px 25px -5px rgba(148, 163, 184, 0.15);
  --shadow-glow: 0 0 15px rgba(2, 132, 199, 0.15);
}

/* =========================================
   RESET & BASE STYLE
   ========================================= */
* {
  box-sizing: border-box;
  /* Firefox Scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--text-secondary) var(--bg-page);
}

/* Chrome/Edge/Safari Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
  background-color: var(--text-secondary);
  border-radius: 99px;
  border: 3px solid var(--bg-page);
  /* Creates a "floating" effect */
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-brand);
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-page);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
  animation: pageFadeIn 0.3s ease-out;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* =========================================
   ACCESSIBILITY (A11Y)
   ========================================= */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Skip to Content Link (Hidden until focused) */
.skip-link {
  position: absolute;
  top: -9999px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-brand);
  color: white;
  padding: 1rem;
  z-index: 9999;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  font-weight: bold;
}

.skip-link:focus {
  top: 0;
}

/* --- AMBIENT BACKGROUND (MESH GRADIENT) --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 10%, rgba(56, 189, 248, 0.12), transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(167, 139, 250, 0.10), transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(56, 189, 248, 0.05), transparent 60%);
  filter: blur(60px);
  pointer-events: none;
}

/* Optional patterned overlay for texture */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.25;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}


/* =========================================
   TYPOGRAPHY
   ========================================= */
h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  margin-top: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--color-brand));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

p {
  line-height: 1.7;
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

a {
  color: var(--color-brand);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-accent);
}

ul {
  line-height: 1.7;
  color: var(--text-secondary);
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}


/* =========================================
   LAYOUT & CONTAINER
   ========================================= */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8rem 2rem 4rem;
  /* Top padding for fixed header */
}

/* =========================================
   HEADER (Glassmorphism)
   ========================================= */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  padding: 1rem 0;
  /* Glass effect */
  background: var(--bg-surface);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  transition: all 0.3s ease;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* Name Badge */
.brand-strong {
  display: flex;
  flex-direction: column;
}

.big-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.big-name span {
  color: var(--color-brand);
}

/* Optional accent if user wants */
.brand-strong small {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Nav */
nav[role="tablist"] {
  display: flex;
  gap: 0.75rem;
  background: var(--bg-surface-hover);
  padding: 0.5rem;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.6rem 1.25rem;
  border-radius: 99px;
  /* Pill shape */
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: center;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(125, 125, 125, 0.1);
}

.tab-btn[aria-selected="true"] {
  background: var(--color-brand);
  color: #fff;
  /* Always white for contrast on brand color */
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

body.light-mode .tab-btn[aria-selected="true"] {
  color: #fff;
  /* Explicitly keep white in light mode too */
}


/* Header Contact Button */
/* .header-contact .btn {} */


/* =========================================
   BUTTONS
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-brand);
  color: #fff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  padding: 0.75rem 1.5rem;
  border-radius: 99px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
  /* For shine */
}

/* Shine Effect */
.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(120deg,
      transparent,
      rgba(255, 255, 255, 0.3),
      transparent);
  transition: all 0.6s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  background: #0ea5e9;
  transform: translateY(-2px);
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.4);
}

.btn:active {
  transform: translateY(0);
}


/* =========================================
   SECTIONS & CARDS
   ========================================= */
section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeIn 0.3s ease-out;
  /* Speed up from 0.6s */
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Skills Grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all 0.3s ease;
}

.skill-card:hover {
  border-color: var(--color-brand);
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.skill-icon {
  font-size: 2rem;
}

.skill-info h4 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.skill-info p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}


/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  /* Removed transform to fix lag */
  display: flex;
  flex-direction: column;
  position: relative;
}

.project-card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--color-brand);
}

.project-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-subtle);
}

.project-card h3,
.project-card:active h3,
.project-card:visited h3,
.project-card:focus h3 {
  padding: 1.25rem 1.25rem 0.5rem;
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-brand) !important;
}

.project-card p {
  padding: 0 1.25rem;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  flex: 1;
}

/* Hide lists inside cards for cleaner preview, show in modal only? 
   Or just style them simply. */
.project-card ul {
  font-size: 0.9rem;
  padding-right: 1.25rem;
  margin-bottom: 1.25rem;
}

/* Download/Action block in card */
.download-block {
  margin-top: auto;
  padding: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.download-block p {
  padding: 0;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.download-block .btn {
  width: 100%;
  justify-content: center;
  font-size: 0.9rem;
  padding: 0.6rem;
}


/* Timeline (Entreprise/Experience) */
.timeline {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid var(--border-subtle);
  margin: 2rem 0;
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -2.6rem;
  top: 0.25rem;
  width: 1rem;
  height: 1rem;
  background: var(--bg-page);
  border: 3px solid var(--color-brand);
  border-radius: 50%;
  z-index: 2;
}


/* Veille Grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.3s ease;
}

.article-card:hover {
  transform: translateY(-5px);
  border-color: var(--color-brand);
  box-shadow: var(--shadow-lg);
}

.article-card .thumb {
  display: block;
  height: 160px;
  overflow: hidden;
  position: relative;
}

.article-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.article-card:hover .thumb img {
  transform: scale(1.1);
}

.article-card .content {
  padding: 1.25rem;
}

.article-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.article-card h3 a {
  color: var(--text-primary);
}

.article-card h3 a:hover {
  color: var(--color-brand);
}

.article-card p {
  font-size: 0.9rem;
  margin-bottom: 0;
}

.source-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}


/* =========================================
   SEARCH & FILTERS
   ========================================= */
#projectSearch {
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.2rem;
  font-family: var(--font-body);
  transition: all 0.2s;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Light Mode Specific High Contrast */
body.light-mode #projectSearch {
  background: #ffffff;
  border-color: #475569;
  /* Slate 600 - High Contrast */
  color: #0f172a;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#projectSearch::placeholder {
  color: var(--text-secondary);
  opacity: 0.8;
}

#projectSearch:focus {
  outline: none;
  border-color: var(--color-brand);
  background: var(--bg-card);
  /* Lighter on focus */
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2), 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* LANG TOGGLE */
/* LANG TOGGLE */
.lang-btn {
  background: rgba(56, 189, 248, 0.1);
  /* Very subtle blue tint */
  border: 1px solid rgba(56, 189, 248, 0.3);
  /* Subtle blue border */
  color: var(--color-brand);
  /* Blue text */
  font-family: var(--font-body);
  font-weight: 700;
  /* Bold for country code */
  font-size: 0.9rem;
  padding: 0.5rem 0.8rem;
  border-radius: 99px;
  /* Pill */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-right: 0.5rem;
  letter-spacing: 0.05em;
  width: auto;
  height: auto;
}

.lang-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--color-brand);
  color: var(--text-primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.lang-btn .lang-icon {
  display: inline-block;
  /* Ensure no layout shifts */
}

/* Removed old rotate hover effect */

.tag-filter {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.4rem 0.9rem;
  border-radius: 99px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.tag-filter:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
  background: rgba(56, 189, 248, 0.05);
}

.tag-filter.is-on {
  background: var(--color-brand);
  color: #fff;
  border-color: var(--color-brand);
}


/* =========================================
   THEME TOGGLE
   ========================================= */
.theme-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--bg-card);
  /* Glassy */
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-btn:hover {
  transform: rotate(15deg) scale(1.1);
  border-color: var(--color-brand);
  color: var(--color-brand);
}

/* =========================================
   MODAL
   ========================================= */
.modal {
  background: transparent;
  padding: 0;
  border: none;
  max-width: 700px;
  width: 90%;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-box {
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg-surface);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.modal-close:hover {
  background: var(--color-brand);
  color: #fff;
}

/* =========================================
   MEDIA QUERIES
   ========================================= */
@media (max-width: 768px) {

  /* --- LAYOUT & SPACING --- */
  main {
    padding-top: 6rem;
    /* Header space */
    padding-bottom: 6rem;
    /* Bottom Nav space */
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  /* --- HEADER (Simplified) --- */
  .header-inner {
    padding: 0.75rem 1rem;
    justify-content: center;
    /* Center branding */
    position: relative;
    flex-direction: row;
    /* Keep row for positioning */
    gap: 0;
  }

  .name-badge {
    align-items: center;
    text-align: center;
    margin: 0;
    width: auto;
  }

  .big-name {
    font-size: 1.25rem;
  }

  .subtitle {
    display: none;
    /* Hide subtitle to save vertical space */
  }

  /* Lang Toggle: Absolute Position Top Right */
  .lang-btn {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    margin: 0;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    background: transparent;
    border: 1px solid var(--border-subtle);
  }

  /* Hide Header Contact (Use FAB or Nav) */
  .header-contact {
    display: none;
  }

  /* --- BOTTOM NAVIGATION BAR (Premium App-Like) --- */
  nav[role="tablist"] {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto;
    background: rgba(15, 23, 42, 0.95);
    /* Deep dark */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 0.75rem 0.5rem calc(0.75rem + env(safe-area-inset-bottom));
    /* iPhone Safe Area */
    z-index: 9999;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
    border-radius: 0;
    margin: 0;
    gap: 0;
  }

  /* Light Mode Bottom Nav */
  body.light-mode nav[role="tablist"] {
    background: rgba(255, 255, 255, 0.95);
    border-top-color: var(--border-subtle);
  }

  .nav-links {
    display: contents;
    /* Remove wrapper influence */
  }

  .tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0.7rem;
    gap: 0.3rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
  }

  .tab-btn:hover {
    background: transparent;
    color: var(--text-primary);
  }

  /* Icons via CSS (No HTML change needed) */
  .tab-btn[href*="index"]::before {
    content: "🏠";
    font-size: 1.4rem;
    line-height: 1;
    display: block;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .tab-btn[href*="entreprise"]::before {
    content: "🏢";
    font-size: 1.4rem;
    line-height: 1;
    display: block;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .tab-btn[href*="activites"]::before {
    content: "🚀";
    font-size: 1.4rem;
    line-height: 1;
    display: block;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .tab-btn[href*="veille"]::before {
    content: "🌐";
    font-size: 1.4rem;
    line-height: 1;
    display: block;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  /* Active State */
  .tab-btn[aria-selected="true"] {
    color: var(--color-brand);
    background: transparent;
    box-shadow: none;
  }

  .tab-btn[aria-selected="true"]::before {
    transform: translateY(-3px) scale(1.1);
  }

  /* Explicitly override light mode color for active state to be brand color, not white */
  body.light-mode .tab-btn[aria-selected="true"] {
    color: var(--color-brand);
  }

  /* --- FLOATING BUTTONS ADJUSTMENT --- */
  /* Move Theme Toggle & FAB above the Bottom Nav */
  .theme-btn {
    bottom: 6rem;
    /* Above nav */
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    font-size: 1.25rem;
  }

  .mobile-fab {
    bottom: 6rem;
    left: 1.5rem;
    width: 3rem;
    height: 3rem;
    font-size: 1.25rem;
  }

  #scrollTop {
    bottom: 6rem;
    right: 1.5rem;
    /* Same as theme btn, might overlap if both visible. Theme btn is usually always visible. */
  }

  /* If ScrollTop is visible, move Theme Btn up or hide it? 
     Let's Stack them: ScrollTop at 6rem, Theme at 10rem? Or Theme left?
     Better: ScrollTop replaces Theme Btn position, or sits above it.
  */
  #scrollTop.show {
    bottom: 10rem;
  }

  /* Timeline adjustment */
  .timeline {
    padding-left: 1.5rem;
    margin-left: 0;
  }
}

/* Cleaned up orphaned code */


/* =========================================
   SCROLL ANIMATIONS
   ========================================= */
.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}

.fade-in-up.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delay for repeated items if they are in the same parent (handled via JS loop, or nth-child here) */
.skills-grid .skill-card:nth-child(2) {
  transition-delay: 100ms;
}

.skills-grid .skill-card:nth-child(3) {
  transition-delay: 200ms;
}

.skills-grid .skill-card:nth-child(4) {
  transition-delay: 300ms;
}

/* =========================================
   CONTACT MODAL
   ========================================= */
dialog#contactModal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 500px;
  width: 90%;
  margin: auto;
  overflow: visible;
}

dialog#contactModal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

dialog#contactModal .modal-content {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  position: relative;
}

dialog#contactModal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

dialog#contactModal h3 {
  margin: 0;
  font-family: var(--font-heading);
  color: var(--color-brand) !important;
}

/* Also ensure Project Modal Title is blue if it has an ID */
#modalTitle {
  color: var(--color-brand) !important;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-primary);
}

/* =========================================
   PREMIUM EFFECTS (Wow Factor)
   ========================================= */

/* --- 1. Scroll Progress Bar --- */
#scrollProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-brand), #a855f7);
  /* Sky to Purple */
  width: 0%;
  z-index: 9999;
  transition: width 0.1s linear;
}

/* --- 2. Custom Cursor - REMOVED --- */

/* --- 3. Typing Effect Cursor --- */
/* Cursor effect removed */

/* --- 4. Spotlight & Tilt (Cards) --- */
/* --- 4. Spotlight & Tilt (Cards) --- */
.project-card,
.skill-card,
.article-card {
  position: relative;
  overflow: hidden;
  /* For spotlight shine */
  /* transform-style: preserve-3d; -> handled in tilt logic specific to project-card */
}

/* Spotlight Gradient */
.project-card::before,
.skill-card::before,
.article-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
      rgba(255, 255, 255, 0.08),
      transparent 40%);
  z-index: 3;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

/* Show spotlight on hover */
.project-card:hover::before,
.skill-card:hover::before,
.article-card:hover::before {
  opacity: 1;
}

/* --- 5. Gallery Modal Controls --- */
.gallery-controls {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.gallery-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.gallery-btn:hover {
  background: var(--bg-highlight);
}

/* --- Back to Top Button --- */
#backToTop {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--color-brand);
  color: white;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#backToTop.visible {
  opacity: 1;
  pointer-events: auto;
}

#backToTop:hover {
  transform: translateY(-5px);
  background: var(--color-brand-hover, #0ea5e9);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* =========================================
   RSS FILTERS
   ========================================= */
.rss-filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.rss-filter-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
}

.rss-filter-btn:hover {
  background: var(--bg-card);
  transform: translateY(-2px);
  color: var(--text-primary);
}

.rss-filter-btn.active {
  background: var(--color-brand);
  color: white;
  border-color: var(--color-brand);
  font-weight: 600;
}

/* =========================================
   PROJECT DETAIL PAGES (Consolidated)
   ========================================= */
.project-detail-main {
  padding: 8rem 2rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* STORYTELLING STYLES */
.story-block {
  margin-bottom: 3rem;
}

.story-block h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.story-block h2 .highlight {
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.2) 0%, rgba(56, 189, 248, 0) 100%);
  padding: 0 0.5rem;
  border-radius: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat-item {
  background: var(--bg-surface);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-highlight);
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--color-brand);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.project-hero {
  margin-bottom: 3rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}

.hero-content h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  color: var(--color-brand);
}

.project-content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 3rem;
}

@media(max-width: 768px) {
  .project-content-grid {
    grid-template-columns: 1fr;
  }
}

.info-card {
  background: var(--bg-surface);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-highlight);
}

.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.stack-tag {
  background: var(--bg-card);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  border: 1px solid var(--border-subtle);
}

/* =========================================
   TECH STACK GRID (Visual)
   ========================================= */
.tech-stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
  margin-bottom: 4rem;
}

.tech-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  transition: transform 0.3s ease, border-color 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}

.tech-card:hover {
  transform: translateY(-5px);
  border-color: var(--color-brand);
  background: var(--bg-surface-hover);
  box-shadow: var(--shadow-glow);
}

.tech-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: inline-block;
  background: rgba(255, 255, 255, 0.03);
  width: 80px;
  height: 80px;
  line-height: 80px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
}

.tech-card h3 {
  color: var(--color-brand);
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.tech-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.8rem;
  border-radius: 99px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.tech-badge:hover {
  background: var(--color-brand);
  color: #fff;
  border-color: var(--color-brand);
  transform: scale(1.05);
}

/* Intro Text Grid */
.skills-intro-grid {
  max-width: 800px;
  margin: 0 auto 2rem;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* =========================================
   FOOTER (Professional)
   ========================================= */
footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 4rem 2rem 2rem;
  margin-top: auto;
  /* Push to bottom */
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-col h4 {
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  font-size: 1.1rem;
}

.footer-col ul {
  padding: 0;
  list-style: none;
}

.footer-col li {
  margin-bottom: 0.75rem;
}

.footer-col a {
  color: var(--text-secondary);
  transition: color 0.2s;
}

.footer-col a:hover {
  color: var(--color-brand);
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.85rem;
}

/* Social Icons */
.social-links {
  display: flex;
  gap: 1rem;
}

.social-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  color: var(--text-primary);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.social-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  transition: transform 0.3s ease;
}

.social-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-brand);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.social-btn:hover {
  border-color: var(--color-brand);
  color: #fff;
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.social-btn:hover::before {
  opacity: 1;
}

.social-btn:hover svg {
  transform: scale(1.1);
  position: relative;
  z-index: 1;
}


/* =========================================
   404 PAGE
   ========================================= */
/* Updated to allow Header/Footer */
body.page-404 {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  /* Reset to normal font for header/footer */
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
}

/* Specific Wrapper for the terminal 404 content */
.page-404-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-direction: column;
  color: #38bdf8;
  font-family: 'Courier New', Courier, monospace;
  padding: 2rem;
}

.theme-ocean {
  --terminal-bg: #0d1b1e;
  --terminal-text: #00ffff;
  --terminal-font: 'Courier New', Courier, monospace;
}

.theme-dracula {
  --terminal-bg: #282a36;
  --terminal-text: #bd93f9;
  --terminal-font: 'Fira Code', 'Courier New', monospace;
}

.page-404 .container {
  max-width: 600px;
  padding: 2rem;
  border: 2px solid #334155;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
  position: relative;
}

.page-404 .container::before {
  content: 'SYSTEM_FAILURE';
  position: absolute;
  top: -12px;
  left: 20px;
  background: #0f172a;
  padding: 0 10px;
  color: #ef4444;
  /* Red */
  font-weight: bold;
}

.page-404 h1 {
  font-size: 5rem;
  margin: 0;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
}

.page-404 p {
  font-size: 1.2rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  color: #94a3b8;
  /* Slate 400 */
}

.page-404 .cmd {
  color: #a78bfa;
  /* Violet */
}

.page-404 .btn-404 {
  display: inline-block;
  background: #38bdf8;
  color: #0f172a;
  padding: 1rem 2rem;
  text-decoration: none;
  font-weight: bold;
  border-radius: 4px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.page-404 .btn-404:hover {
  background: #0ea5e9;
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
}

.page-404 .glitch {
  animation: glitch 1s linear infinite;
}

@keyframes glitch {

  2%,
  64% {
    transform: translate(2px, 0) skew(0deg);
  }

  4%,
  60% {
    transform: translate(-2px, 0) skew(0deg);
  }

  62% {
    transform: translate(0, 0) skew(5deg);
  }
}

/* =========================================
   ADDED FIXES
   ========================================= */

/* Active Filter State for Projects & RSS */
.tag-filter.is-on,
.rss-filter-btn.active {
  background: var(--color-brand);
  color: #fff;
  border-color: var(--color-brand);
}

/* TYPING EFFECT */
.typing-cursor {
  overflow: hidden;
  border-right: 2px solid var(--color-brand);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret .75s step-end infinite;
  display: inline-block;
  vertical-align: bottom;
}

@keyframes typing {
  from {
    width: 0
  }

  to {
    width: 100%
  }
}

@keyframes blink-caret {

  from,
  to {
    border-color: transparent
  }

  50% {
    border-color: var(--color-brand)
  }
}

/* SCROLL TO TOP */
#scrollTop {
  display: none;
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 45px;
  height: 45px;
  background: var(--color-brand);
  color: var(--p-dark);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 999;
  transition: all 0.3s ease;
  align-items: center;
  justify-content: center;
}

#scrollTop:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(56, 189, 248, 0.5);
  background: var(--p-white);
}

#scrollTop.show {
  display: flex !important;
  animation: popIn 0.3s ease-out;
}

/* THEME BUTTON IN HEADER (Moved) */
.theme-btn.in-menu {
  position: static;
  margin-left: 1rem;
  width: 40px;
  height: 40px;
  background: transparent;
  color: var(--text-primary);
  box-shadow: none;
  border: 1px solid var(--border-subtle);
  transform: none !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.theme-btn.in-menu:hover {
  transform: scale(1.1) !important;
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.theme-btn.in-menu:hover {
  transform: scale(1.1) !important;
  border-color: var(--color-brand);
  color: var(--color-brand);
}

@keyframes popIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* =========================================
   MOBILE CONTACT FAB
   ========================================= */
.mobile-fab {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 50px;
  height: 50px;
  background: var(--color-brand);
  color: white;
  border-radius: 50%;
  border: none;
  font-size: 1.5rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s ease;
  /* Delay enter removed for immediate visibility */
  animation: none;
}

.mobile-fab:hover {
  transform: scale(1.1);
  background: var(--color-brand-hover, #0ea5e9);
}

@media (min-width: 769px) {
  .mobile-fab {
    display: none;
  }
}






/* =========================================
   3D TILT EFFECT & GRAPHIC IMPROVEMENTS
   ========================================= */
.project-card {
  /* Ensure 3D context */
  transform-style: preserve-3d;
  transform: perspective(1000px);
  will-change: transform;
  /* Optimization: Removed backdrop-filter which causes lag on some GPUs */
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease;
  /* Explicitly NO transform transition here */
}

.project-card:hover {
  box-shadow: var(--shadow-lg), 0 0 20px rgba(56, 189, 248, 0.2);
  border-color: var(--border-highlight);
}

.project-card img {
  transform: translateZ(20px);
  /* Parallax Effect for Image */
  border-radius: 8px;
}

.project-card h3,
.project-card p {
  transform: translateZ(10px);
  /* Slight Text Pop */
}

/* Button Hover Polish */
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

/* =========================================
   TOAST NOTIFICATIONS
   ========================================= */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-highlight);
  border-left: 4px solid var(--color-brand);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  animation: slideInToast 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  pointer-events: auto;
  min-width: 300px;
}

.toast.success {
  border-left-color: #22c55e;
}

.toast.error {
  border-left-color: #ef4444;
}

@keyframes slideInToast {
  from {
    opacity: 0;
    transform: translateX(50px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutToast {
  to {
    opacity: 0;
    transform: translateX(50px);
  }
}

/* =========================================
   CONSOLE (TERMINAL) UI
   ========================================= */
.console-trigger {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  /* Restored */
  width: 45px;
  height: 45px;
  background: #0f172a;
  /* Dark square */
  color: #4ade80;
  /* Green text */
  border: 2px solid #4ade80;
  /* Green border */
  border-radius: 8px;
  /* Square */
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fira Code', monospace;
  font-weight: 700;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0.8;
}

.console-trigger:hover {
  transform: scale(1.1);
  background: #4ade80;
  color: #0f172a;
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.6);
  opacity: 1;
}

.console-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.console-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.console-window {
  width: 800px;
  height: 500px;
  max-width: 90vw;
  max-height: 80vh;
  background: rgba(15, 23, 42, 0.85);
  /* Slightly transparent dark */
  backdrop-filter: blur(12px);
  /* Glassmorphism */
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.95rem;
  transform: scale(0);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s;
}

@keyframes turnOn {
  0% {
    transform: scale(1, 0.002);
    opacity: 0;
  }

  50% {
    transform: scale(1, 0.002);
    opacity: 1;
  }

  100% {
    transform: scale(1, 1);
    opacity: 1;
  }
}

.console-overlay.open .console-window {
  transform: scale(1);
  opacity: 1;
  animation: turnOn 0.3s ease-out forwards;
}

/* Header (Mac-style) */
.console-header {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  font-size: 0.85rem;
  user-select: none;
}

.console-header span {
  font-weight: 500;
  letter-spacing: 0.05em;
}

#closeConsole {
  font-family: inherit;
  font-size: 1.2rem;
  line-height: 1;
  color: #ef4444;
  /* Red close button hint */
  opacity: 0.7;
  transition: opacity 0.2s;
}

#closeConsole:hover {
  opacity: 1;
}

.console-body {
  flex: 1;
  padding: 1rem;
  color: #0f0;
  overflow-y: auto;
  font-size: 1rem;
  line-height: 1.5;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.15);
}

.console-input-line {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.console-prompt {
  color: #00f;
  font-weight: bold;
}

.console-input {
  background: transparent;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: inherit;
  flex: 1;
  outline: none;
  caret-color: #0f0;
}

/* Reduced Text Glow */
.console-body {
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.2);
}

.theme-retro .console-body {
  /* Chromatic Aberration + Soft Glow */
  text-shadow:
    1px 0 rgba(74, 222, 128, 0.4),
    -1px 0 rgba(239, 68, 68, 0.4),
    0 0 8px rgba(74, 222, 128, 0.3);
}

/* Specific glows for colors (Refined) */
.console-output .success {
  color: #4ade80;
  text-shadow: 0 0 4px rgba(74, 222, 128, 0.4);
}

.console-output .error {
  color: #ef4444;
  text-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}

.console-output .warn {
  color: #f59e0b;
  text-shadow: 0 0 4px rgba(245, 158, 11, 0.4);
}

.console-output .info {
  color: #60a5fa;
  text-shadow: 0 0 4px rgba(96, 165, 250, 0.4);
}


/* CRT Flicker Animation */
@keyframes crtFlicker {
  0% {
    opacity: 0.97;
  }

  5% {
    opacity: 0.95;
  }

  10% {
    opacity: 0.99;
  }

  15% {
    opacity: 0.95;
  }

  20% {
    opacity: 0.98;
  }

  50% {
    opacity: 0.95;
  }

  55% {
    opacity: 0.99;
  }

  90% {
    opacity: 0.96;
  }

  100% {
    opacity: 0.98;
  }
}

.console-window::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: rgba(18, 16, 16, 0.1);
  opacity: 0;
  z-index: 20;
  pointer-events: none;
  animation: crtFlicker 0.15s infinite;
}

/* Scanlines (Enhanced) */
.console-window::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0.2));
  background-size: 100% 4px;
  z-index: 21;
  pointer-events: none;
  border-radius: 12px;
}

.console-output div {
  line-height: 1.5;
  white-space: pre-wrap;
  /* Preserve formatting */
  word-wrap: break-word;
  /* Wrap long lines */
  position: relative;
  z-index: 1;
}

.console-output .success {
  color: #0f0;
}

.console-output .error {
  color: #f00;
}

.console-output .pre {
  white-space: pre-wrap;
  font-family: inherit;
  line-height: 1.2;
}

/* Ensure theme variables are used */
.console-window,
.console-output {
  background-color: var(--terminal-bg, #0d1b1e);
  color: var(--terminal-text, #00ffff);
  font-family: var(--terminal-font, monospace);
}


/* =========================================
   MOBILE RESPONSIVENESS (< 768px)
   ========================================= */

/* 1. Mobile specific hide/show */
.nav-toggle {
  display: none;
  /* Hidden on desktop */
}

@media (max-width: 768px) {

  /* HIDE CONSOLE & THEME TOGGLE */
  .console-trigger,
  #themeToggle,
  .theme-btn {
    display: none !important;
  }

  /* LAYOUT ADJUSTMENTS */
  main {
    padding: 10rem 1rem 2rem;
    /* Increased padding again */
  }

  h1 {
    font-size: 2.5rem;
    /* Smaller headings */
  }

  h2 {
    font-size: 2rem;
  }

  /* HEADER & NAVIGATION */
  .header-inner {
    justify-content: space-between;
    padding: 0 1.5rem;
  }

  /* Hamburger Button */
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    /* Above mobile menu */
    padding: 0;
  }

  .nav-toggle span {
    width: 100%;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s linear;
    transform-origin: 1px;
  }

  /* Hamburger Interaction */
  .nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg);
  }

  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg);
  }

  /* Mobile Menu Overlay */
  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    /* Slide from right */
    height: 100vh;
    width: 75%;
    max-width: 300px;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateX(100%);
    /* Hidden by default */
    transition: transform 0.3s ease-in-out;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-links.open a {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s ease-in-out;
  }

  .nav-links a {
    font-size: 1.5rem;
    margin: 1.5rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease-in-out;
  }

  /* Hide Desktop specific elements in nav if needed */
  .header-contact {
    display: none;
    /* Hide header contact button on mobile, use FAB */
  }

  #langToggle {
    position: absolute;
    top: 1.2rem;
    left: 1.5rem;
    /* Move to left side */
    right: auto;
  }
}

/* =========================================
   CONSOLE EFFECTS (Shutdown & Matrix)
   ========================================= */
.shutdown-overlay {
  position: fixed;
  inset: 0;
  background: black;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2s ease-in;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f0;
  font-family: monospace;
  font-size: 2rem;
}

.shutdown-overlay.active {
  opacity: 1;
  pointer-events: all;
  cursor: none;
}

.matrix-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  /* Behind text */
  opacity: 0.15;
  pointer-events: none;
}