:root {
  /* Core Palette (Dark) */
  --bg-rgb: 5, 5, 5;
  --bg: #050505;
  --bg-card: #101016;
  --bg-highlight: #0a0a12; /* Slightly darker for better contrast */
  --fg: #f9fafb;
  --muted: #a1a1aa;
  
  /* Adjusted "Harbor" Accents - slightly more electric/sky blue for dark mode */
  --accent: #0ea5e9; 
  --accent-soft: #38bdf8;
  --accent-glow: rgba(14, 165, 233, 0.2);
  
  --border: #27272f;
  --radius: 14px;
  --nav-height: 70px;
  --max-w: 1100px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  /*--bg-body: rgba(25, 39, 73, 0.936); *//* Your preferred Dark Blue */
  --bg-body: #050505; /* Neutral Dark */

  /* Region Colors (Dark Mode) */
  --region-hero: rgba(210, 255, 127, 0.05); /* Very subtle green tint */
  --region-timeline: rgba(14, 165, 233, 0.05); /* Subtle blue tint */


}

/* Light theme palette */
[data-theme="light"] {
  --bg: #fdfdfd;
  --bg-card: #ffffff;
  --bg-highlight: #f0f4f8;
  --fg: #f9fafb;
  --fg: #111827;
  --fg-strong: #030712;
  --muted: #4b5563;

  /* Darker blue for light mode readability */
  --accent: #0284c7;
  --accent-soft: #0ea5e9;
  --accent-glow: rgba(2, 132, 199, 0.15);

  --border: #d1d5db;
  --bg-body: #fdfdfd;


  /* Region Colors (Light Mode) */
  --region-hero:   --bg-body: #d2ff7f78;
  --region-timeline: #e0f2fe;  

  --bg-neutral-gradient: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
}


/* ---------------- Base ---------------- */

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

html.noscroll, body.noscroll {
  overflow: hidden !important;
  height: 100%;
}

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

/* --- New Section Block Styles --- */

.region-hero {
  background-color: var(--region-hero);
  padding: 6rem 0 4rem; /* More space for the title */
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.region-timeline {
  background-color: var(--region-timeline);
  margin-top: 0;
  padding: 8rem 0 6rem; /* Increased top padding to account for the slant */
  
  /* This creates a subtle diagonal cut at the top */
  clip-path: polygon(0 5%, 100% 0, 100% 100%, 0 100%);
  -webkit-clip-path: polygon(0 5%, 100% 0, 100% 100%, 0 100%);
}

/* Adjust the container inside regions to not have extra margin-top */
.region-hero .container, 
.region-timeline .container {
  margin-top: 0;
}

section[style*="background: var(--bg-highlight)"] {
  position: relative;
  z-index: 2;
  box-shadow: 0 15px 30px -10px rgba(0,0,0,0.1);
}

/* --- Double Slant Transition Utility --- */

.double-slant-top {
  position: relative;
  /* Increase padding so content doesn't get "cut" by the slant */
  padding-top: 12rem !important; 
  margin-top: -6rem; /* Pulls the section up to overlap the previous one */
  z-index: 1;
}

/* Layer 1: The "Accent" Slant (Top Layer) */
.double-slant-top::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* A lighter version of your accent blue or green */
  background: var(--accent-glow); 
  /* This angle is slightly different from the main one */
  clip-path: polygon(0 15%, 100% 0, 100% 100%, 0 100%);
  -webkit-clip-path: polygon(0 15%, 100% 0, 100% 100%, 0 100%);
  z-index: -2;
}

/* Layer 2: The Main Background Slant (Bottom Layer) */
/* We apply the clip-path directly to the section to hide the overlap */
.double-slant-top {
  clip-path: polygon(0 100px, 100% 0, 100% 100%, 0 100%);
  -webkit-clip-path: polygon(0 100px, 100% 0, 100% 100%, 0 100%);
}

/* Adjustments for Dark Mode Slants */
[data-theme="dark"] .double-slant-top::before {
  background: rgba(14, 165, 233, 0.15); /* Subtler for dark mode */
}

/* Ensure sections have no margin gaps */
.region-hero, .section, .region-timeline {
  margin-bottom: 0;
}

/* --------- main ------ */
h1, h2, h3, h4 { line-height: 1.1; margin: 0; letter-spacing: -0.03em; }
h1 { font-size: clamp(2.6rem, 5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.8rem, 3vw, 2.3rem); margin-bottom: 1rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }

p {
  color: var(--muted);
  margin-bottom: 1.5rem;
  font-size: 1.03rem;
  max-width: 70ch;
}

[data-theme="light"] p { color: var(--muted); } /* Kept muted for better hierarchy */
[data-theme="light"] h1, [data-theme="light"] h2, [data-theme="light"] h3 { color: var(--fg-strong); }

a { color: inherit; text-decoration: none; transition: color 0.2s ease, opacity 0.2s ease; }
a:hover { opacity: 0.85; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; }

/* 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)); }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; padding: 0.8rem 1.7rem;
  border-radius: 999px; font-weight: 600; font-size: 0.96rem;
  cursor: pointer; border: 1px solid transparent;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #ffffff;
  box-shadow: 0 14px 30px -16px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 18px 40px -18px var(--accent-glow); }

.btn-outline {
  border-color: var(--border);
  background: rgba(15, 23, 42, 0.3);
  color: var(--fg);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent-soft);
  background: rgba(15, 23, 42, 0.6);
}

/* Small Button Variant (Merged from hero-flip.css) */
.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  height: 38px;
  white-space: nowrap;
}

/* ---------------- Header ---------------- */

header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-height);
  z-index: 100;
  background: rgba(5, 5, 5, 0.85);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  display: flex; align-items: center;
}
header .container { display: flex; justify-content: space-between; align-items: center; }

.logo { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; font-size: 1.1rem; }
.logo-mark { width: 36px; height: 36px; display: block; }

.nav-link {
  font-size: 0.95rem; font-weight: 500; color: var(--muted);
  margin-right: 0.5rem; transition: color 0.2s ease;
}
.nav-link:hover { color: var(--fg); }

.header-right { display: flex; align-items: center; gap: 1rem; }

[data-theme="light"] header {
  background: rgba(255, 255, 255, 1);
  border-bottom: 1px solid #e5e7eb;
}
[data-theme="light"] .logo-text { color: #0f172a; font-weight: 700; }
[data-theme="light"] .nav-link { color: #64748b; }
[data-theme="light"] .nav-link:hover { color: var(--accent); }

/* ---------------- Theme Toggle ---------------- */
.theme-toggle {
  position: relative; width: 54px; height: 28px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-highlight); padding: 0;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; overflow: hidden;
}
.theme-toggle-icon { width: 22px; text-align: center; font-size: 0.85rem; line-height: 1; z-index: 2; pointer-events: none; }
.theme-toggle-icon--sun { margin-left: 4px; }
.theme-toggle-icon--moon { margin-right: 4px; }

.theme-toggle::after {
  content: ""; position: absolute; width: 22px; height: 22px;
  border-radius: 999px; background: #ffffff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  top: 2px; left: 3px; z-index: 3; transition: transform .25s ease;
}

[data-theme="light"] .theme-toggle::after { transform: translateX(0); }
[data-theme="dark"] .theme-toggle { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .theme-toggle::after { transform: translateX(24px); }

/* ---------------- Cards ---------------- */

.card {
  background: linear-gradient(145deg, rgba(16, 16, 22, 1), var(--bg-card));
  border: 1px solid rgba(148, 163, 184, 0.15);
  padding: 1.9rem; border-radius: var(--radius);
  cursor: pointer; display: flex; flex-direction: column; height: 100%;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-soft);
  box-shadow: 0 22px 50px -24px rgba(0, 0, 0, 0.5);
}

/* Light Theme Card Fix */
[data-theme="light"] .card {
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  border-color: #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .card:hover {
  border-color: var(--accent);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.service-card .card-media {
  width: calc(100% + 3.8rem);   /* 1.9rem left + 1.9rem right */
  margin: -1.9rem -1.9rem 1rem; /* pull to edges + keep spacing below */
  border-radius: var(--radius) var(--radius) 12px 12px;
  overflow: hidden;
}

.service-card .card-media img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}



.icon-box {
  width: 48px; height: 48px;
  background: rgba(30, 46, 84, 0.4);
  border-radius: 12px; display: grid; place-items: center;
  margin-bottom: 1rem; color: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.1);
}

.service-card .icon-box {
  margin-top: 0.25rem;
}

.icon-box svg { width: 24px; height: 24px; stroke-width: 2; }

.card-arrow {
  margin-top: auto; padding-top: 1.5rem;
  font-size: 0.88rem; font-weight: 600; color: var(--accent-soft);
  opacity: 0; transform: translateX(-10px);
  transition: all 0.25s var(--ease);
}
.card:hover .card-arrow { opacity: 1; transform: translateX(0); }

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

.offerings-wrapper, 
.expertise-wrapper { 
  width: 100%; 
  margin-top: 1.5rem;
}

/* NEW: Wrapper to confine the overlay strictly to the grid area */
.grid-stack {
  position: relative;
  width: 100%;
}

.services-grid {
  transition: opacity 0.35s ease, transform 0.35s ease, filter 0.35s ease;
  min-height: clamp(360px, 60vh, 520px);
}

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

/* ABSOLUTE POSITIONING: Confined to .grid-stack */
.service-detail {
  position: absolute;
  inset: 0;           /* Top/Left/Right/Bottom: 0 relative to .grid-stack */
  z-index: 50;
  display: flex; 
  align-items: center; 
  justify-content: center;
  padding: 0; 
  background: var(--bg); /* Prevents grid show-through */
  
  opacity: 0; 
  pointer-events: none; 
  transform: scale(0.98);
  transition: opacity 0.3s ease, transform 0.3s ease;
  
  /* Ensure it matches the grid's rounded corners */
  border-radius: var(--radius);
  overflow: hidden;
}

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

.service-detail-inner {
  position: relative; 
  background: var(--bg-card);
  width: 100%; 
  height: 100%; 
  max-width: none; 
  max-height: none;
  
  display: grid; 
  grid-template-columns: 45% 55%;
  overflow: hidden; 
}

.detail-image { 
  background: var(--bg-highlight); 
  border-right: 1px solid var(--border); 
  position: relative;
  height: 100%;
}

.detail-image img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
}

.detail-content { 
  padding: 3rem; 
  display: flex; 
  flex-direction: column; 
  justify-content: center; 
  overflow-y: auto; /* scroll text if it gets too long */
}

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

.tag{
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255,255,255,0.02);
}

a.tag:hover{
  border-color: var(--accent);
  color: var(--accent-soft);
  background: rgba(14, 165, 233, 0.08);
  opacity: 1; /* avoid your global a:hover opacity fade */
}

.tech-tags .tag {
  padding: 0.25rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--border); font-size: 0.75rem;
  text-transform: uppercase; color: var(--muted);
}



/* ---------------- Timeline & Experience ---------------- */
.timeline { position: relative; padding-left: 2rem; border-left: 2px solid var(--border); margin-top: 2rem; }
.timeline-item { position: relative; margin-bottom: 3rem; }
.timeline-marker {
  position: absolute; left: -2.65rem; 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.82rem; font-weight: 700; z-index: 2;
}

.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-soft); font-family: monospace; font-size: 1.05rem; }

/* ---------------- Transparency Box ---------------- */
.transparency-box {
  background: linear-gradient(145deg, var(--bg-card), rgba(15, 23, 42, 0.4));
  border: 1px solid var(--border); border-radius: 18px; padding: 3rem;
  display: flex; flex-direction: column; gap: 1.5rem;
  position: relative; overflow: hidden;
}
.check-list { list-style: none; padding: 0; display: grid; gap: 0.75rem; }
.check-list li { display: flex; align-items: center; gap: 0.75rem; color: var(--fg); }
.check-list svg { color: var(--accent); }

/* ---------------- Footer ---------------- */
.site-footer {
  background: var(--bg-highlight); border-top: 1px solid var(--border);
  padding: 4rem 0 2rem; 
  /*margin-top: 6rem;*/
}
.footer-content { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.social-row { display: flex; gap: 1rem; }

.site-footer .social-link{
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(255,255,255,0.02);
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
}

.site-footer .social-link svg{
  width: 20px;
  height: 20px;
}

.site-footer .social-link:hover{
  transform: translateY(-1px);
}

.site-footer {
  /* Match header's dark mode transparency and blur */
  background: rgba(5, 5, 5, 0.85);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  
  /* Match header's subtle border */
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  
  padding: 4rem 0 2rem;
  position: relative;
  z-index: 10;
}

/* Light Theme Footer Override */
[data-theme="light"] .site-footer {
  /* Match header's solid light background and border */
  background: rgba(255, 255, 255, 1);
  border-top: 1px solid #e5e7eb;
}

.site-footer .social-link:hover { background: rgba(56, 189, 248, 0.1); color: var(--accent); }



.footer-bottom {
  border-top: 1px solid rgba(148, 163, 184, 0.1); /* Matches header border */
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
}

[data-theme="light"] .footer-bottom {
  border-top: 1px solid #e5e7eb;
}

/* Ensure the footer logo looks exactly like the header logo */
.site-footer .logo-text {
  font-weight: 600;
  font-size: 1.1rem;
}

[data-theme="light"] .site-footer .logo-text {
  color: #0f172a;
  font-weight: 700;
}


/* ---------------- Contact Modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(8px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 18px; padding: 2.5rem; width: 100%; max-width: 500px;
  transform: translateY(20px); transition: transform 0.25s ease;
}
.modal-overlay.active .modal-card { transform: translateY(0); }

.form-group input, .form-group textarea {
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
  color: var(--fg); padding: 0.8rem; border-radius: 8px; width: 100%;
}
.form-group input:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent);
}

/* ---------------- Misc & Mobile ---------------- */
.lang-switch { display: inline-flex; gap: 0.25rem; border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.lang-pill { padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; color: var(--muted); }
.lang-pill.lang-active { background: var(--accent); color: white; }

.audience-toggle {
  display: flex; justify-content: center; background: rgba(255,255,255,0.03);
  padding: 5px; border-radius: 999px; margin: 0 auto 2rem; width: max-content;
}
.aud-btn { padding: 0.6rem 1.5rem; border-radius: 999px; border: none; background: transparent; color: var(--muted); cursor: pointer; display: flex; gap: 0.5rem; font-weight: 600; }
.aud-btn.active { background: var(--bg-card); color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

.close-btn {
  position: absolute; top: 1rem; right: 1rem; width: 32px; height: 32px;
  background: rgba(0,0,0,0.2); border-radius: 50%; color: white;
  border: none; cursor: pointer; display: grid; place-items: center;
}
.close-btn:hover { background: var(--accent); }

@media (max-width: 850px) {
  .service-detail-inner { 
      grid-template-columns: 1fr; 
      grid-template-rows: 240px 1fr; 
    }
  .detail-image { border-right: none; border-bottom: 1px solid var(--border); }
  .xp-grid { grid-template-columns: 1fr; gap: 0.5rem; }
  .footer-content, .footer-bottom { flex-direction: column; gap: 1.5rem; text-align: center; }
}

@media (max-width: 500px) {
  .btn-sm { padding: 0.4rem 0.6rem; font-size: 0.75rem; }
}