/* ===========================
   1. CSS VARIABLES & RESET
=========================== */
:root {
  --bg: #04050d;
  --bg2: #07091a;
  --mint: #7DF9C2;
  --purple: #A78BFA;
  --text: #e8eaf0;
  --muted: #6b7280;
  --glass: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  cursor: none;
}

/* ===========================
   2. CUSTOM CURSOR & ANIMATIONS
=========================== */
#cursor-dot {
  position: fixed; width: 8px; height: 8px; background: var(--mint);
  border-radius: 50%; pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, background 0.2s;
  box-shadow: 0 0 10px var(--mint), 0 0 20px var(--mint);
}
#cursor-ring {
  position: fixed; width: 36px; height: 36px;
  border: 1px solid rgba(125,249,194,0.4); border-radius: 50%;
  pointer-events: none; z-index: 9998;
  transform: translate(-50%, -50%); transition: border-color 0.3s;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===========================
   3. BACKGROUND & PARTICLES
=========================== */
#particles { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.ghibli-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.ghibli-sky {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 30% 20%, rgba(25,14,60,0.95) 0%, transparent 70%),
              radial-gradient(ellipse 60% 80% at 80% 10%, rgba(10,30,80,0.8) 0%, transparent 60%),
              linear-gradient(180deg, #0a0a2e 0%, #0d1a3e 20%, #0f2347 40%, #081c3a 60%, #050d1f 80%, #04050d 100%);
}
.ghibli-stars {
  position: absolute; inset: 0;
  background-image: radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.8) 0%, transparent 100%),
                    radial-gradient(1.5px 1.5px at 40% 20%, rgba(255,255,255,0.9) 0%, transparent 100%),
                    radial-gradient(1px 1px at 70% 18%, rgba(255,255,255,0.5) 0%, transparent 100%);
}
.ghibli-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(4,5,13,0.55) 0%, rgba(4,5,13,0.3) 40%, rgba(4,5,13,0.7) 75%, rgba(4,5,13,1) 100%);
}

/* ===========================
   4. NAVIGATION
=========================== */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 4rem; background: rgba(4,5,13,0.5);
  backdrop-filter: blur(16px); border-bottom: 1px solid var(--glass-border);
}
.nav-logo img { transition: transform 0.3s, filter 0.3s; }
.nav-logo:hover img { transform: scale(1.05); filter: drop-shadow(0 0 8px rgba(125,249,194,0.4)); }
.nav-links { display: flex; gap: 2.5rem; list-style: none; }
.nav-links a {
  color: var(--muted); text-decoration: none; font-size: 0.88rem;
  font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; transition: color 0.3s;
}
.nav-links a:hover { color: var(--mint); }

.nav-logo {
  font-family: 'Syne', sans-serif; 
  font-weight: 800; 
  font-size: 1.2rem;
  color: var(--mint); 
  letter-spacing: -0.02em; 
  text-decoration: none;
  transition: opacity 0.3s;
}

.nav-logo:hover {
  opacity: 0.8;
}

/* ===========================
   5. PORTFOLIO HUB & LAYOUT
=========================== */
section { position: relative; z-index: 1; padding: 4rem 4rem; max-width: 1100px; margin: 0 auto; }
.section-label { font-size: 0.75rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--mint); margin-bottom: 1rem; }
.section-heading { font-family: 'Syne', sans-serif; font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.1; margin-bottom: 1rem; }

.portfolio-header { padding: 10rem 2rem 4rem; text-align: center; position: relative; z-index: 2; }
.portfolio-header h1 { font-family: 'Syne', sans-serif; font-size: clamp(3rem, 6vw, 5rem); font-weight: 800; color: var(--text); margin-bottom: 1rem; }
.portfolio-header p { color: var(--muted); max-width: 600px; margin: 0 auto; font-size: 1.1rem; line-height: 1.6; }

/* Grid & Cards */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 3rem; }
.projects-grid > a {
  display: flex;
  height: 100%;
  text-decoration: none; /* Cleans up inline style requirement */
}
.project-card {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 20px; padding: 2rem; backdrop-filter: blur(16px);
  cursor: none; transition: border-color 0.3s, box-shadow 0.3s; transform-style: preserve-3d;
  height: 100%; /* Fill the wrapper anchor */
  display: flex; /* Becomes a vertical flex container */
  flex-direction: column;
}
.project-card:hover { border-color: rgba(125,249,194,0.2); box-shadow: 0 30px 80px rgba(0,0,0,0.5), 0 0 40px rgba(125,249,194,0.06); }
.project-img {
  width: 100%; aspect-ratio: 16/9; border-radius: 12px; margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #0f1a3e 0%, #1a0f3e 100%);
  border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: center; position: relative;
}
.project-icon { font-size: 2.5rem; position: relative; z-index: 1; opacity: 0.6; filter: drop-shadow(0 0 12px currentColor); }
.project-card h3 { font-family: 'Syne', sans-serif; font-size: 1.15rem; font-weight: 700; margin-bottom: 0.6rem; }
.project-card p { font-size: 0.88rem; color: var(--muted); line-height: 1.65; margin-bottom: 1.5rem; }
.project-link { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--mint); font-weight: 500; margin-top: auto;}

/* ===========================
   ARTICLE / CASE STUDY LAYOUT
=========================== */
.article-container {
  max-width: 1000px; margin: 0 auto;
  padding: 8rem 2rem 6rem;
  position: relative; z-index: 2;
}
.article-card {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 24px; padding: 4rem;
  backdrop-filter: blur(20px); box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.article-card h1, .article-card h2, .article-card h3 {
  font-family: 'Syne', sans-serif; color: var(--mint);
  letter-spacing: -0.02em;
}
.article-card h1 { font-size: 2.5rem; color: var(--text); margin-bottom: 1.5rem; }

/* This fixes the spacing issue you circled in red */
.article-card h2 { 
  font-size: 2rem; 
  margin: 4.5rem 0 1.5rem; 
  border-bottom: 1px solid var(--glass-border); 
  padding-bottom: 0.8rem; 
}

.article-card h3 { font-size: 1.4rem; color: var(--purple); margin: 2rem 0 1rem; }
.article-card p, .article-card li {
  color: var(--text); line-height: 1.8; font-size: 1.05rem; margin-bottom: 1.2rem; opacity: 0.85;
}
.article-card ul { margin-left: 1.5rem; margin-bottom: 1.5rem; }
.article-card ul ul { margin-top: 0.5rem; margin-bottom: 0.5rem; list-style-type: circle; }

/* Image styling */
.article-card img {
  width: 100%; border-radius: 12px; border: 1px solid var(--glass-border);
  margin: 2rem 0 3rem; box-shadow: 0 10px 40px rgba(0,0,0,0.5); display: block;
}

/* Callout Box */
.callout-box {
  display: flex; gap: 1.5rem; align-items: flex-start;
  background: rgba(125,249,194,0.05); border-left: 4px solid var(--mint);
  padding: 1.5rem; border-radius: 0 12px 12px 0; margin: 2rem 0;
}
.callout-icon { font-size: 1.5rem; line-height: 1; }
.callout-text { color: var(--text); font-size: 0.95rem; line-height: 1.6; opacity: 0.9; }

@media (max-width: 768px) {
  .article-container { padding: 6rem 1rem 4rem; }
  .article-card { padding: 2rem 1.5rem; }
  .article-card h2 { margin: 3rem 0 1rem; }
}

/* Fix for transparent PNG flowcharts with black text */
.article-card img.flowchart-img {
  background: linear-gradient(135deg, #d8fceb 0%, #e6dffd 100%); /* Pale Mint to Pale Purple */
  padding: 1.5rem;
  border: 1px solid rgba(167,139,250,0.4);
}

/* ===========================
   IMAGE LIGHTBOX
=========================== */
.lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(4, 5, 13, 0.95); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
  cursor: zoom-out; /* Changes cursor to show clicking closes it */
}
.lightbox.active {
  opacity: 1; pointer-events: auto;
}
.lightbox img {
  max-width: 90%; max-height: 90vh;
  object-fit: contain; border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  transform: scale(0.95); transition: transform 0.3s ease;
}
.lightbox.active img {
  transform: scale(1);
}
.lightbox-close {
  position: absolute; top: 2rem; right: 2.5rem;
  color: var(--text); font-size: 3rem; font-weight: 300;
  cursor: pointer; transition: color 0.3s;
}
.lightbox-close:hover { color: var(--mint); }

/* Make the article images look clickable */
.article-card img { cursor: zoom-in; }

/* ===========================
   FOOTER
=========================== */
footer {
  text-align: center;
  padding: 2rem;
  margin-top: 4rem;
  border-top: 1px solid var(--glass-border);
  color: var(--muted);
  font-size: 0.9rem;
  position: relative;
  z-index: 2;
}
footer span {
  color: var(--mint);
  font-weight: 500;
}

/* ===========================
   STICKY PROFILE WIDGET
=========================== */
#sticky-widget {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 200;
  width: 220px;
  background: rgba(7, 9, 26, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.2rem;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(125,249,194,0.05);
  transform: translateY(120px);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
  cursor: none;
}
#sticky-widget.visible { transform: translateY(0); opacity: 1; }
#sticky-widget:hover {
  border-color: rgba(125,249,194,0.2);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 30px rgba(125,249,194,0.08);
}
.widget-header {
  display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.9rem;
}
.widget-avatar {
  width: 42px; height: 42px; border-radius: 50%; overflow: hidden;
  border: 1.5px solid rgba(125,249,194,0.4); flex-shrink: 0;
  box-shadow: 0 0 12px rgba(125,249,194,0.2);
}
.widget-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.widget-info { flex: 1; min-width: 0; }
.widget-name { font-family: 'Syne', sans-serif; font-size: 0.82rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget-title { font-size: 0.68rem; color: var(--muted); margin-top: 1px; }
.widget-role-badge {
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(167,139,250,0.08);
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: 10px; padding: 0.5rem 0.8rem; margin-bottom: 0.9rem;
}
.widget-role-icon { font-size: 0.9rem; }
.widget-role-text { font-size: 0.7rem; color: var(--purple); line-height: 1.3; }
.widget-role-text strong { color: var(--text); display: block; font-size: 0.72rem; }
.widget-actions { display: flex; gap: 0.5rem; }
.widget-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.3rem;
  padding: 0.45rem 0.5rem; border-radius: 10px; font-size: 0.7rem; font-weight: 600;
  text-decoration: none; transition: all 0.2s; cursor: none;
}
.widget-btn-primary { background: var(--mint); color: #04050d; }
.widget-btn-primary:hover { box-shadow: 0 0 16px rgba(125,249,194,0.4); transform: translateY(-1px); }
.widget-btn-secondary { background: var(--glass); border: 1px solid var(--glass-border); color: var(--muted); }
.widget-btn-secondary:hover { border-color: rgba(167,139,250,0.4); color: var(--text); transform: translateY(-1px); }

/* Mobile responsiveness for the widget */
@media (max-width: 768px) {
  #sticky-widget { bottom: 1rem; right: 1rem; left: 1rem; width: auto; }
}

@media (max-width: 768px) {
  nav { padding: 1rem 1.5rem; }
  section { padding: 4rem 1.5rem; }
}