/* =========================================
   1. CSS VARIABLES & BASE STYLES
   ========================================= */
:root {
  /* Bento Grid Vars */
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --card-radius: 24px;
  --text-main: #0f172a;
  --text-sub: #64748b;
  --accent: #2563eb;
  
  /* Sidebar Vars */
  --nav-w-collapsed: 54px;
  --nav-w-expanded: 210px;
  --nav-bg: #ffffff;
  --nav-border: #e2e8f0;
  --nav-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.1);
  --text-idle: #94a3b8;
  --text-hover: #0f172a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  background-color: #f8fafc; /* Slight off-white to make cards pop */
  color: var(--text-main);
  padding-left: 80px !important; /* Make room for the floating sidebar */
}

/* =========================================
   2. BENTO GRID (GLOBAL)
   ========================================= */
.bento-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 1100px;
  margin: 60px auto;
  padding: 0 20px;
}

/* Base Card Typographics */
.card-label {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.card-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px 0;
}
.card-desc {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.5;
  margin: 0 0 16px 0;
}

/* =========================================
   3. PROJECT PAGE SPECIFICS
   ========================================= */
.portfolio-container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
}

.page-header {
  margin-bottom: 30px;
}

.intro-name {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  margin: 10px 0;
  letter-spacing: -1px;
}

/* Filter Buttons */
.filter-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-sub);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: #cbd5e1;
  color: var(--text-main);
}

.filter-btn.active {
  background: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}

/* Project Card Layout */
.bento-project {
  flex-direction: row; /* Split Content / Visual */
  align-items: center;
  padding: 0;
}

.project-content {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.p-tag {
  font-size: 11px;
  font-weight: 600;
  background: #eef2ff;
  color: #4f46e5;
  padding: 2px 8px;
  border-radius: 4px;
}

.project-footer {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-top: auto;
}

/* Modern Project Card Effects */
.project-visual {
  width: 40%;
  height: 100%;
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--card-border);
  background: #f8fafc;
}

.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.bento-project:hover .project-img {
  transform: scale(1.08);
}

.visual-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 15%, rgba(0,0,0,0.05) 100%);
  z-index: 1;
  pointer-events: none;
}

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

.bento-project {
  animation: fadeInUp 0.5s ease forwards;
}

/* =========================================
   4. SIDEBAR NAVIGATION
   ========================================= */
.dev-sidebar {
  position: fixed;
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
  width: var(--nav-w-collapsed);
  height: auto;
  min-height: 200px;
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  border-radius: 27px;
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 9999;
  box-shadow: var(--nav-shadow);
  overflow: hidden;
}

.dev-sidebar:hover {
  width: var(--nav-w-expanded);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid transparent;
  transition: border 0.3s;
}

.dev-sidebar:hover .sidebar-header {
  border-bottom-color: #f1f5f9;
}

.brand-dot {
  width: 32px;
  height: 32px;
  background: #0f172a;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  text-decoration: none;
  font-size: 14px;
}

.sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-links a {
  display: flex;
  align-items: center;
  height: 40px;
  text-decoration: none;
  color: var(--text-idle);
  white-space: nowrap;
  transition: all 0.2s;
}

.icon-box {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: calc((var(--nav-w-collapsed) - 32px) / 2);
  margin-right: 15px;
  flex-shrink: 0;
  background: transparent;
  color: var(--text-idle);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.icon-box svg {
  width: 18px;
  height: 18px;
}

.dev-sidebar:hover .sidebar-links li:nth-child(2) .icon-box,
.dev-sidebar:hover .sidebar-links li:nth-child(4) .icon-box {
  margin-left: calc(((var(--nav-w-collapsed) - 32px) / 2) + 8px);
}

.dev-sidebar:hover .sidebar-links li:nth-child(3) .icon-box {
  margin-left: calc(((var(--nav-w-collapsed) - 32px) / 2) + 16px);
}

.sidebar-links a:hover .icon-box {
  background: var(--hover-color);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 12px -2px var(--hover-color);
}

.sidebar-links a:hover .link-text {
  color: var(--text-hover);
}

.link-text {
  opacity: 0;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
  pointer-events: none;
}

.dev-sidebar:hover .link-text {
  opacity: 1;
  transition-delay: 0.1s;
}

/* =========================================
   5. PAGINATION STYLES
   ========================================= */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  margin-bottom: 60px;
  grid-column: span 4; /* Ensures it spans across the whole grid width */
  width: 100%;
}

.page-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-sub);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover:not(.disabled) {
  border-color: #cbd5e1;
  color: var(--text-main);
  transform: translateY(-2px);
}

.page-btn.active {
  background: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}

.page-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f1f5f9;
}

/* =========================================
   6. HEADER ENHANCEMENTS
   ========================================= */
.header-subtitle {
  font-size: 16px;
  color: var(--text-sub);
  max-width: 650px; /* Prevents text from stretching too far on wide screens */
  line-height: 1.6;
  margin: 16px 0 20px 0;
}

.header-badges {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.h-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

/* Reusing your pulse dot from the home page */
.h-badge .status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  animation: pulse 2s infinite;
}

/* =========================================
   7. PROFESSIONAL CASE STUDY LAYOUT
   ========================================= */
.case-study {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 0 80px 0;
  animation: fadeInUp 0.5s ease forwards;
}

/* Header & Typography */
.cs-header {
  margin-bottom: 50px;
}

.back-link {
  color: var(--text-sub);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
  display: inline-block;
  margin-bottom: 24px;
}

.back-link:hover {
  color: var(--text-main);
  transform: translateX(-4px);
}

.cs-title {
  font-size: 48px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -1px;
  margin: 0 0 20px 0;
}

.cs-desc {
  font-size: 20px;
  color: var(--text-sub);
  line-height: 1.6;
  max-width: 800px;
  margin: 0 0 40px 0;
}

/* Clean Metadata Row (No Boxes) */
.cs-meta {
  display: flex;
  gap: 40px;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  padding: 20px 0;
  flex-wrap: wrap;
}

.cs-meta-item {
  display: flex;
  flex-direction: column;
}

.cs-meta-label {
  font-size: 11px;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.cs-meta-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.meta-link {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}
.meta-link:hover {
  opacity: 0.8;
}

/* Update your existing gallery track */
.gallery-track {
  display: flex;
  gap: 0; /* Removed the gap for a seamless slider */
  overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}

/* Update your existing gallery image */
.cs-gallery-img {
  height: 450px; /* Made slightly taller for full-width view */
  min-width: 100%; /* THE MAGIC FIX: exactly 1 image per slide */
  width: 100%;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.1);
  flex-shrink: 0;
  scroll-snap-align: center; /* Locks the image dead center */
}

/* Image Gallery (Clean Track) */
.cs-gallery-section {
  margin-bottom: 60px;
}

.gallery-track::-webkit-scrollbar {
  height: 6px;
}
.gallery-track::-webkit-scrollbar-track {
  background: transparent;
}
.gallery-track::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 10px;
}

/* Two-Column Body Layout */
.cs-body {
  display: grid;
  grid-template-columns: 2fr 1fr; /* 66% Left, 33% Right */
  gap: 60px;
}

.cs-section {
  margin-bottom: 40px;
}

.cs-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 16px 0;
}

.cs-text {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-main);
  margin: 0;
}

/* Right Sidebar Elements */
.cs-impact-block {
  background: #0f172a; /* Keep the dark highlight for impact */
  padding: 30px;
  border-radius: 16px;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.3);
}

.cs-impact-text {
  color: #10b981;
  font-size: 24px;
  line-height: 1.4;
  font-weight: 700;
  margin: 0;
}

/* Mobile Responsiveness for Case Study */
@media (max-width: 900px) {
  .cs-body {
    grid-template-columns: 1fr; /* Stack columns on small screens */
    gap: 40px;
  }
  .cs-title {
    font-size: 36px;
  }
  .cs-gallery-img {
    height: 250px;
    min-width: 350px;
  }
}


/* NEW: Slider Button Styles */
.slider-controls {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-end; /* Aligns buttons to the right */
}

.slider-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.slider-btn:hover {
  background: var(--text-main);
  color: #fff;
  border-color: var(--text-main);
  transform: scale(1.05);
}

/* =========================================
   9. MODERN TECH BADGES (DETAIL PAGE)
   ========================================= */
.modern-tech-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.modern-tech-badge {
  padding: 8px 16px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  border-radius: 24px; /* Pill shape */
  border: 1px solid #e2e8f0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* The invisible background that slides up on hover */
.modern-tech-badge::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--text-main); /* Deep dark blue/black */
  z-index: -1;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* The Hover State */
.modern-tech-badge:hover {
  color: #ffffff;
  border-color: var(--text-main);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -4px rgba(15, 23, 42, 0.2);
}

.modern-tech-badge:hover::before {
  transform: scaleY(1);
}

/* =========================================
   10. BLOG LIST PAGE
   ========================================= */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 60px;
}

.blog-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.blog-card-img-wrapper {
  height: 200px;
  width: 100%;
  overflow: hidden;
  border-bottom: 1px solid var(--card-border);
}

.blog-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.blog-card:hover .blog-card-img {
  transform: scale(1.05);
}

.blog-card-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.blog-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.blog-meta-text {
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 500;
}

.blog-card-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.blog-card-excerpt {
  font-size: 15px;
  color: var(--text-sub);
  line-height: 1.5;
  margin: 0 0 20px 0;
  flex: 1;
}

.blog-read-more {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

/* =========================================
   11. BLOG DETAIL PAGE (ARTICLE READING)
   ========================================= */
.article-container {
  max-width: 800px; /* Narrower width for optimal reading line-length */
  margin: 0 auto;
  padding: 40px 0 80px 0;
  animation: fadeInUp 0.5s ease forwards;
}

.article-header {
  margin-bottom: 40px;
  text-align: center;
}

.article-header .back-link {
  display: inline-block;
  margin-bottom: 30px;
}

.article-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.article-title {
  font-size: 42px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  letter-spacing: -1px;
  margin: 0 0 30px 0;
}

.article-cover-wrapper {
  width: 100%;
  height: auto;
  max-height: 450px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.1);
}

.article-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Typography for the actual writing */
.article-content {
  font-size: 18px;
  line-height: 1.8;
  color: #334155;
}

.article-content h2 {
  font-size: 28px;
  color: var(--text-main);
  margin: 40px 0 20px 0;
}

.article-content h3 {
  font-size: 22px;
  color: var(--text-main);
  margin: 30px 0 16px 0;
}

.article-content p {
  margin: 0 0 24px 0;
}

.article-content pre,
.article-content code {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 8px;
  font-family: 'Courier New', Courier, monospace;
}

.article-content pre {
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 24px;
}

.article-content code {
  padding: 2px 6px;
  font-size: 15px;
}

.article-footer {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
  .article-title { font-size: 32px; }
  .article-content { font-size: 16px; }
}

/* =========================================
   12. CONTACT PAGE
   ========================================= */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 2fr; /* 33% Left, 66% Right */
  gap: 60px;
  margin-top: 40px;
}

/* Left Column Info */
.contact-info-block {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-label {
  font-size: 11px;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.info-value, .info-link {
  font-size: 16px;
  color: var(--text-main);
  font-weight: 600;
}

.info-link {
  text-decoration: none;
  color: var(--accent);
  transition: opacity 0.2s;
}

.info-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.contact-socials {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Right Column Form */
.contact-form-block {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.05);
}

.form-group {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-main);
  background: #f8fafc;
  transition: all 0.3s;
  box-sizing: border-box;
}

.form-input::placeholder {
  color: #94a3b8;
}

/* Modern Glow Effect on Focus */
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 150px;
}

.submit-btn {
  background: var(--text-main);
  color: #ffffff;
  border: none;
  padding: 16px 32px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -10px rgba(15, 23, 42, 0.5);
  background: #1e293b;
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Status Messages */
.form-status {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  display: none; /* Hidden by default in CSS, JS shows it */
}

.form-status.success {
  display: block;
  background: #ecfdf5;
  color: #10b981;
  border: 1px solid #a7f3d0;
}

.form-status.error {
  display: block;
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid #fecaca;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .contact-form-block {
    padding: 24px;
  }
}

/* =========================================
   13. GLOBAL FOOTER
   ========================================= */
.site-footer {
  margin-top: 80px;
  padding: 60px 20px;
  border-top: 1px solid var(--card-border);
  background: #f8fafc; /* Matches the body background */
}

.footer-content {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 32px;
}

/* Left Column: Brand */
.footer-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 450px;
}

.footer-logo {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.footer-text {
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

/* Right Column: Links */
.footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-copyright {
  color: #94a3b8;
  font-size: 13px;
  margin: 0;
  font-weight: 500;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .site-footer {
    padding-bottom: 120px; /* Critical: Prevents footer from hiding behind mobile bottom nav */
    padding-top: 40px;
  }
  .footer-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .footer-right {
    align-items: flex-start;
  }
  .footer-links {
    flex-wrap: wrap;
    gap: 16px;
  }
}

/* =========================================
   DYNAMIC BLOG CARD (HOMEPAGE)
   ========================================= */

/* Setup the background image properties */
.bento-blog.has-bg-image {
  background-size: cover;
  background-position: center;
  border: none; /* Remove the border since the image fills the card */
  justify-content: space-between; /* Pushes top content up, bottom content down */
}

/* The dark gradient mask for text readability */
.card-overlay {
  position: absolute;
  inset: 0;
  /* Fades from barely dark at the top to very dark at the bottom */
  background: linear-gradient(to bottom, rgba(15,23,42,0.1) 0%, rgba(15,23,42,0.9) 100%);
  z-index: 1;
  transition: all 0.3s ease;
}

/* Darken the image slightly when hovered */
.bento-blog.has-bg-image:hover .card-overlay {
  background: linear-gradient(to bottom, rgba(15,23,42,0.3) 0%, rgba(15,23,42,0.95) 100%);
}

/* Ensure the text sits strictly above the overlay */
.card-content-top, .card-content-bottom {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
}

/* Override the title hover color so it looks good against the dark background */
.bento-blog.has-bg-image:hover .blog-title {
  color: #60a5fa !important; /* A bright, techy blue */
}

/* =========================================
   TERMINAL ARSENAL CARD
   ========================================= */
.terminal-card {
  background-color: #0f172a !important; /* Deep terminal dark */
  border-color: #1e293b !important;
  padding: 0 !important; /* Remove bento padding so header touches edges */
  display: flex;
  flex-direction: column;
  font-family: 'Courier New', Courier, monospace; /* Monospace font */
}

/* macOS style window bar */
.terminal-header {
  background-color: #1e293b;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #334155;
  position: relative;
}

.term-dots {
  display: flex;
  gap: 8px;
}

.term-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.term-dot.close { background: #ef4444; }
.term-dot.min { background: #f59e0b; }
.term-dot.max { background: #10b981; }

.term-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Console Body */
.terminal-body {
  padding: 20px;
  flex: 1;
  color: #e2e8f0;
  font-size: 14px;
}

.term-prompt {
  color: #10b981; /* Hacker Green */
  font-weight: bold;
  margin-right: 8px;
}

.term-typing {
  color: #f8fafc;
}

.term-cursor {
  color: #94a3b8;
  margin-left: 2px;
}

.term-cursor.blink {
  animation: blink 1s step-end infinite;
}

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

/* Console Output Grid */
.term-output-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.t-item {
  color: #60a5fa; /* Terminal syntax blue */
  transition: transform 0.2s, color 0.2s;
  cursor: default;
}

.t-arr {
  color: #f59e0b; /* Orange arrow for visual pop */
  margin-right: 6px;
}

.t-item:hover {
  color: #38bdf8;
  transform: translateX(4px);
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .term-output-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .term-title { display: none; } /* Hide title if it collides with dots */
}

/* =========================================
   PREMIUM BENTO INTERACTIVITY & EFFECTS
   ========================================= */

/* 1. Staggered Entrance Animation */
@keyframes fadeUpEntrance {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   THE "SCATTER TO GRID" FLIGHT ANIMATION
   ========================================= */

@keyframes scatterFlight {
  0% {
    /* Cards start at their custom chaotic coordinates */
    transform: translate(var(--start-x), var(--start-y)) rotate(var(--start-rot)) scale(var(--start-scale));
    opacity: 0;
  }
  100% {
    /* Cards snap perfectly into their grid position */
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
}

.bento-card {
  opacity: 0; /* Hidden before the animation starts */
  
  /* We use a 'cubic-bezier' that makes them fly fast, then smoothly decelerate into place */
  animation: scatterFlight 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  
  position: relative; 
  overflow: hidden; 
}

/* --- THE FLIGHT PATHS --- */
/* Card 1: Intro (Flies in from top left, spinning inward) */
.bento-card:nth-child(1) {
  --start-x: -100vw; --start-y: -100vh; --start-rot: -45deg; --start-scale: 0.5;
  animation-delay: 0.1s;
}

/* Card 2: Terminal (Flies in from top right, huge) */
.bento-card:nth-child(2) {
  --start-x: 100vw; --start-y: -80vh; --start-rot: 45deg; --start-scale: 1.5;
  animation-delay: 0.2s;
}

/* Card 3: Project (Flies in from bottom left, spinning heavy) */
.bento-card:nth-child(3) {
  --start-x: -100vw; --start-y: 100vh; --start-rot: -90deg; --start-scale: 0.8;
  animation-delay: 0.3s;
}

/* Card 4: Blog (Flies in from bottom right) */
.bento-card:nth-child(4) {
  --start-x: 100vw; --start-y: 100vh; --start-rot: 90deg; --start-scale: 1.2;
  animation-delay: 0.4s;
}

/* Card 5: Contact (Shoots straight up from the bottom) */
.bento-card:nth-child(5) {
  --start-x: 0; --start-y: 150vh; --start-rot: 180deg; --start-scale: 0.3;
  animation-delay: 0.5s;
}

/* Ensure Hover Lift still works after they land */
.bento-card:hover {
  transform: translateY(-4px) scale(1.01) !important;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

/* =========================================
   GLOBAL CURSOR SPOTLIGHT (STRESS TEST)
   ========================================= */
.global-spotlight {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none; 
  z-index: 9999; 
  
/* A dark, moody orb that follows the cursor */
  background: radial-gradient(
    circle 20px at var(--mouse-x, 50vw) var(--mouse-y, 50vh),
    rgba(15, 23, 42, 0.25), /* A heavy, dark slate color */
    transparent 80%
  );
}

@keyframes fadeInGlow {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Optional: Hide the global spotlight on mobile devices where there is no mouse */
@media (max-width: 768px) {
  .global-spotlight {
    display: none;
  }
}

/* =========================================
   PROJECTS ARCHIVE (FOOLPROOF BENTO STYLE)
   ========================================= */

/* 1. The Grid Layout */
#projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* Exactly 2 columns */
  gap: 20px;
  max-width: 1100px;
  margin: 40px auto 0;
}

/* 2. Lock the Card Structure & Kill Default Link Styles */
#projects-grid .bento-project {
  display: flex !important;
  flex-direction: row !important; /* Text left, Image right */
  height: 260px; /* Lock height so they perfectly match */
  padding: 0 !important; /* Remove inner padding so image touches the edge */
  overflow: hidden;
  text-decoration: none !important; /* Kills the blue underlines */
  color: var(--text-main) !important; /* Kills the purple visited link color */
  background: #ffffff; /* Forces the white card look */
  border: 1px solid #e2e8f0;
  border-radius: 24px; /* Restores your rounded corners */
  transition: all 0.3s ease;
}

#projects-grid .bento-project:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

/* 3. The Text Side (Left) */
#projects-grid .project-content {
  flex: 1; /* Takes up remaining space */
  padding: 24px;
  display: flex;
  flex-direction: column;
}

#projects-grid .card-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: #0f172a !important; /* Ensure title is dark */
}

/* 4. The Image Side (Right) */
#projects-grid .project-visual {
  width: 40%; /* Locks image to 40% of the card */
  height: 100%;
  background: #f8fafc;
  border-left: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
}

#projects-grid .project-img {
  width: 100%;
  height: 100%;
  object-fit: cover !important; /* PERFECTLY crops the image without stretching */
  transition: transform 0.4s ease;
}

#projects-grid .bento-project:hover .project-img {
  transform: scale(1.05); /* Smooth zoom on hover */
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  #projects-grid {
    grid-template-columns: 1fr; /* 1 column on phones */
  }
  
  #projects-grid .bento-project {
    flex-direction: column !important; /* Stack image under text */
    height: auto; /* Let it expand to fit the text */
  }
  
  #projects-grid .project-visual {
    width: 100%;
    height: 200px;
    border-left: none;
    border-top: 1px solid #e2e8f0;
  }
}