:root {
  /* Core Palette */
  --bg: #050505;
  --bg-card: #111111;
  --bg-highlight: #1a1a1a;
  --fg: #f0f0f0;
  --muted: #a1a1aa;
  --accent: #3b82f6; 
  --accent-glow: rgba(59, 130, 246, 0.15);
  --border: #27272a;
  
  --radius: 12px;
  --nav-height: 70px;
  --max-w: 1100px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-card: #f8fafc;
  --bg-highlight: #f1f5f9;
  --fg: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.1);
  --border: #e2e8f0;
}

/* --- Base --- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 800; }
h2 { font-size: clamp(1.75rem, 3vw, 2.2rem); margin-bottom: 1rem; }
h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
p { color: var(--muted); margin-bottom: 1.5rem; font-size: 1.05rem; max-width: 65ch; }
a { color: inherit; text-decoration: none; }

/* --- Utilities --- */
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }
.grid { display: grid; gap: 2rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.5rem; border-radius: 8px; font-weight: 600; transition: all 0.2s ease; cursor: pointer; border: 1px solid transparent; font-size: 0.95rem; }
.btn-primary { background: var(--accent); color: white; box-shadow: 0 4px 15px var(--accent-glow); }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(110%); }
.btn-outline { border-color: var(--border); background: transparent; color: var(--fg); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* --- Header --- */
header { position: fixed; top: 0; left: 0; right: 0; height: var(--nav-height); z-index: 100; background: rgba(var(--bg), 0.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); display: flex; align-items: center; }
header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-weight: 700; font-size: 1.2rem; display: flex; align-items: center; gap: 0.5rem; }
.logo-dot { width: 10px; height: 10px; background: var(--accent); border-radius: 50%; }

/* --- Hero --- */
.hero { padding-top: calc(var(--nav-height) + 4rem); padding-bottom: 4rem; align-items: center; }
.hero-image { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5); }
.hero-image img { width: 100%; height: auto; display: block; filter: saturate(0.8); }

/* --- Sections --- */
.section { padding: 5rem 0; }

/* --- CARDS (Standard & Interactive) --- */
.card {
  background: var(--bg-card); border: 1px solid var(--border); padding: 2rem;
  border-radius: var(--radius); cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.3s;
  display: flex; flex-direction: column; height: 100%;
}
.card:hover { transform: translateY(-4px); border-color: var(--muted); }

.icon-box {
  width: 48px; height: 48px; background: var(--bg-highlight); border-radius: 8px;
  display: grid; place-items: center; margin-bottom: 1rem; color: var(--accent);
}
.icon-box svg { width: 24px; height: 24px; stroke-width: 2; }
.card-arrow { margin-top: auto; padding-top: 1.5rem; font-size: 0.9rem; font-weight: 600; color: var(--accent); opacity: 0; transform: translateX(-10px); transition: all 0.3s var(--ease); }
.card:hover .card-arrow { opacity: 1; transform: translateX(0); }

/* --- Interactive Details (Seamless Cross-Fade) --- */
.services-wrapper { 
  position: relative; 
  /* This ensures the container is at least as tall as the grid */
  min-height: 400px; 
}

/* THE GRID (unchanged) */
.services-grid {
  opacity: 1;
  transform: scale(1);
  filter: blur(0px);
  transition: opacity 0.4s ease, transform 0.4s ease, filter 0.4s ease;
}

.services-grid.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  filter: blur(10px);
}

/* =========================================
   SERVICE DETAIL OVERLAY – CLEAN VERSION
   ========================================= */

/* THE DETAIL OVERLAY */
.service-detail {
  position: absolute; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; /* Matches the grid height */
  background: var(--bg-card); 
  border: 1px solid var(--border); 
  border-radius: var(--radius);
  
  /* Layout */
  display: grid; 
  grid-template-columns: 1fr 1.2fr; 
  overflow: hidden; 
  z-index: 10;

  /* Animation State: Default Hidden */
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =============== SERVICE DETAIL (correct structure) =============== */


/* THE DETAIL OVERLAY */
.service-detail {
  position: absolute; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; /* Matches the grid height */
  background: var(--bg-card); 
  border: 1px solid var(--border); 
  border-radius: var(--radius);
  
  /* Layout */
  display: grid; 
  grid-template-columns: minmax(260px, 1fr) minmax(0, 1.4fr);
  overflow: hidden; 
  z-index: 10;

  /* Animation State: Default Hidden */
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.service-detail.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

.detail-image { 
  background: var(--bg-highlight); 
  position: relative; 
  overflow: hidden; 
  border-right: 1px solid var(--border); 
}
.detail-image img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
}
.detail-content {
  padding: 2.5rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;              /* space between title, text, tags */
  max-width: 560px;          /* avoid overly long lines */
}

/* Title inside the detail card */
.detail-content h2 {
  font-size: 1.8rem;
  margin: 0 0 0.35rem;
}

/* Main paragraph text */
.detail-content p {
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 50ch;           /* comfortable reading width */
}

/* Included services tags (only inside the detail panel) */
.tech-tags span.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-highlight);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  margin: 0;                 /* gap handled via flex below */
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Mobile Adjustments */
@media (max-width: 850px) {
  .service-detail { 
    grid-template-columns: 1fr; 
    grid-template-rows: 200px 1fr; /* Force image height */
    height: auto; /* Allow growth on mobile */
    min-height: 100%;
    bottom: 0;
  }
  .detail-image { 
    border-right: none; 
    border-bottom: 1px solid var(--border); 
  }
}

/* =========================================
   RESTORED: TIMELINE & TRANSPARENCY BOX
   ========================================= */

/* Timeline Styles */
.timeline {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid var(--border);
  margin-top: 2rem;
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -2.65rem; /* Puts the circle on top of the border line */
  top: 0;
  width: 2rem;
  height: 2rem;
  background: var(--bg);
  border: 2px solid var(--accent);
  color: var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 2;
}

/* Transparency Box Styles */
.transparency-box {
  background: linear-gradient(145deg, var(--bg-card), var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.3);
}

.transparency-box::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 150px; height: 150px;
  background: var(--accent);
  filter: blur(80px);
  opacity: 0.1;
  pointer-events: none;
}

.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.check-list li { display: flex; align-items: center; gap: 0.75rem; font-size: 1rem; color: var(--fg); }
.check-list svg { color: var(--accent); flex-shrink: 0; }

/* ========================================= */

/* --- About / History --- */
.about-section { margin-top: 4rem; }
.xp-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 2rem; border-top: 1px solid var(--border); padding-top: 2rem; margin-top: 2rem; }
.xp-date { font-weight: 700; color: var(--accent); font-family: monospace; font-size: 1.1rem; }
.xp-details .role { color: var(--muted); font-size: 0.95rem; display: block; margin-bottom: 0.5rem; }
.xp-details ul { padding-left: 1rem; color: var(--muted); }

/* --- Footer --- */
footer { border-top: 1px solid var(--border); padding: 2rem 0; color: var(--muted); text-align: center; margin-top: 4rem; }
.theme-toggle { background: none; border: none; cursor: pointer; color: var(--fg); padding: 0.5rem; }

/* Mobile */
@media (max-width: 850px) {
  .service-detail { grid-template-columns: 1fr; }
  .detail-image { height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
  .detail-content { padding: 2rem; }
  .hero-image { order: -1; margin-bottom: 2rem; }
  .transparency-box { padding: 1.5rem; }
  .xp-grid { grid-template-columns: 1fr; gap: 0.5rem; }
}

[data-theme="dark"] .hero-image img { content: url('../images/hero-dark.png'); }
[data-theme="light"] .hero-image img { content: url('../images/hero-light.png'); }


/* --- FIX FOR HUGE BUTTON --- */
.close-btn {
  position: absolute; /* This pulls it out of the grid flow */
  top: 1.5rem;
  right: 1.5rem;
  width: 36px;
  height: 36px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 50; /* Ensures it sits on top of everything */
}

.close-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/* =========================================
   MINIMALIST FOOTER STYLES
   ========================================= */

footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding-top: 3rem;
  padding-bottom: 2rem;
  margin-top: 6rem;
}

/* The Main Row (Logo Left / Icons Right) */
.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

/* Social Icons (No Text) */
.social-row {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.social-link {
  color: var(--muted);
  transition: color 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 8px;
}

.social-link:hover {
  color: var(--accent);
  background: var(--bg-highlight);
  transform: translateY(-2px);
}

.social-link svg {
  width: 22px; 
  height: 22px;
}

/* Bottom Bar */
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Mobile Layout */
@media (max-width: 600px) {
  .footer-content {
    flex-direction: column;
    gap: 1.5rem;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 0.8rem;
    text-align: center;
  }
}

/* --- FORCE FOOTER ICON SIZE --- */
footer .social-link svg {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px; /* Prevents squishing on mobile */
  display: block;
}

/* Ensure the container doesn't stretch */
footer .social-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- CONTACT MODAL STYLES --- */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1; pointer-events: all;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%; max-width: 500px;
  position: relative;
  transform: translateY(20px); transition: transform 0.3s ease;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.contact-form {
  display: flex; flex-direction: column; gap: 1.5rem; margin-top: 1.5rem;
}

.form-group {
  display: flex; flex-direction: column; gap: 0.5rem;
}

.form-group label {
  font-size: 0.9rem; font-weight: 600; color: var(--fg);
}

.form-group input, .form-group textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 0.8rem;
  border-radius: 6px;
  font-family: inherit; font-size: 1rem;
}

.form-group input:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}