/* ===================================================
   DESIGN SYSTEM — Chamod Fernando Portfolio
   =================================================== */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Poppins:wght@300;400;500;600;700;900&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Colors */
  --clr-bg:        #0a0a0a;
  --clr-surface:   #111111;
  --clr-surface-2: #1a1a1a;
  --clr-border:    #222222;
  --clr-border-h:  #333333;
  --clr-text:      #ffffff;
  --clr-text-dim:  #bbbbbb;
  --clr-text-muted:#888888;
  --clr-accent:    #e0e0e0;
  --clr-accent-2:  #c0c0c0;
  --clr-hero-light:#e0e0e0;
  --clr-success:   #22c55e;
  --clr-danger:    #ef4444;
  --clr-warning:   #f59e0b;

  /* Typography */
  --ff-heading: 'Poppins', sans-serif;
  --ff-body:    'Inter', 'Poppins', sans-serif;
  --fs-xs:   0.75rem;   /* 12px */
  --fs-sm:   0.875rem;  /* 14px */
  --fs-base: 1rem;      /* 16px */
  --fs-md:   1.125rem;  /* 18px */
  --fs-lg:   1.25rem;   /* 20px */
  --fs-xl:   1.5rem;    /* 24px */
  --fs-2xl:  2rem;      /* 32px */
  --fs-3xl:  2.5rem;    /* 40px */
  --fs-4xl:  3.25rem;   /* 52px */

  /* Spacing */
  --sp-xs:  0.25rem;
  --sp-sm:  0.5rem;
  --sp-md:  1rem;
  --sp-lg:  1.5rem;
  --sp-xl:  2rem;
  --sp-2xl: 3rem;
  --sp-3xl: 5rem;
  --sp-4xl: 8rem;

  /* Layout */
  --max-width: 1200px;
  --nav-h:     72px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:  0.2s;
  --dur-base:  0.35s;
  --dur-slow:  0.6s;

  /* Glassmorphism */
  --glass-bg:     rgba(17, 17, 17, 0.7);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-blur:   blur(16px);
}

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--ff-body);
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--dur-fast) var(--ease-out);
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* --- Utility Classes --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --- Section Title --- */
.section-title {
  display: inline-block;
  font-family: var(--ff-heading);
  font-size: var(--fs-xl);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  border: 2px solid var(--clr-text);
  padding: var(--sp-sm) var(--sp-2xl);
  margin-bottom: var(--sp-3xl);
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 2px;
  background: var(--clr-text);
}

.section-title--dark {
  border-color: var(--clr-bg);
  color: var(--clr-bg);
}

.section-title--dark::after {
  background: var(--clr-bg);
}

/* --- Glassmorphism Card --- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  font-family: var(--ff-heading);
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: 12px 28px;
  border-radius: var(--radius-full);
  transition: all var(--dur-base) var(--ease-out);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--dur-fast);
}

.btn:hover::before {
  opacity: 1;
}

.btn--primary {
  background: var(--clr-text);
  color: var(--clr-bg);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255,255,255,0.15);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--outline {
  background: transparent;
  color: var(--clr-text);
  border: 2px solid var(--clr-border-h);
}

.btn--outline:hover {
  border-color: var(--clr-text);
  transform: translateY(-2px);
}

.btn--outline-dark {
  background: transparent;
  color: var(--clr-bg);
  border: 2px solid var(--clr-bg);
}

.btn--outline-dark:hover {
  background: var(--clr-bg);
  color: var(--clr-text);
  transform: translateY(-2px);
}

/* --- Header / Nav --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-h);
  z-index: 1000;
  transition: all var(--dur-base) var(--ease-out);
  padding: 0 4%;
}

.site-header.scrolled {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
}

.nav-logo {
  display: flex;
  align-items: center;
  z-index: 1001;
}

.nav-logo img {
  height: 32px;
  transition: filter var(--dur-fast);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-xl);
}

.nav-links a {
  font-family: var(--ff-heading);
  font-weight: 500;
  font-size: var(--fs-sm);
  color: var(--clr-text-dim);
  letter-spacing: 0.5px;
  position: relative;
  padding: var(--sp-xs) 0;
  transition: color var(--dur-fast);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--clr-text);
  transition: width var(--dur-base) var(--ease-out);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--clr-text);
}

.nav-links a.active::after,
.nav-links a:hover::after {
  width: 100%;
}

.nav-cta {
  background: var(--clr-text);
  color: var(--clr-bg) !important;
  padding: 10px 24px !important;
  border-radius: var(--radius-full);
  font-weight: 700 !important;
  text-transform: uppercase;
  font-size: var(--fs-xs) !important;
  letter-spacing: 1px;
  transition: all var(--dur-base) var(--ease-out);
}

.nav-cta::after {
  display: none !important;
}

.nav-cta:hover {
  background: var(--clr-accent) !important;
  transform: scale(1.05);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  cursor: pointer;
  z-index: 1001;
  background: none;
  border: none;
  padding: 0;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--clr-text);
  border-radius: 2px;
  transition: all var(--dur-base) var(--ease-out);
}

.hamburger span:nth-child(1) { margin-bottom: 5px; }
.hamburger span:nth-child(2) { margin-bottom: 5px; }

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Footer --- */
.site-footer {
  padding: var(--sp-2xl) 4%;
  background: var(--clr-bg);
  border-top: 1px solid var(--clr-border);
  text-align: center;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-lg);
}

.footer-links {
  display: flex;
  gap: var(--sp-xl);
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
  transition: color var(--dur-fast);
}

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

.footer-social {
  display: flex;
  gap: var(--sp-md);
}

.footer-social a {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-dim);
  font-size: var(--fs-base);
  transition: all var(--dur-base) var(--ease-out);
}

.footer-social a:hover {
  background: var(--clr-text);
  color: var(--clr-bg);
  transform: translateY(-3px);
  border-color: var(--clr-text);
}

.footer-copy {
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
  letter-spacing: 0.5px;
}

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* --- Keyframes --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.1); }
  50%      { box-shadow: 0 0 20px 5px rgba(255,255,255,0.05); }
}

/* --- Page Wrapper (to account for fixed nav) --- */
.page-content {
  padding-top: var(--nav-h);
}

/* --- Section Base --- */
.section {
  padding: clamp(60px, 8vw, 100px) 4%;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* --- Background Text Decoration --- */
.bg-text {
  position: absolute;
  font-family: var(--ff-heading);
  font-size: clamp(80px, 15vw, 220px);
  font-weight: 900;
  color: rgba(255,255,255,0.015);
  pointer-events: none;
  user-select: none;
  z-index: 0;
  white-space: nowrap;
}

/* --- Responsive --- */

/* Tablet (768px) */
@media (max-width: 768px) {
  :root {
    --nav-h: 64px;
  }

  .hamburger {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(320px, 85vw);
    height: 100vh;
    height: 100dvh;
    background: rgba(10, 10, 10, 0.97);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    flex-direction: column;
    justify-content: center;
    gap: var(--sp-2xl);
    transition: right var(--dur-base) var(--ease-out);
    border-left: 1px solid var(--glass-border);
    padding: var(--sp-xl);
    /* CRITICAL: must be above all content on mobile */
    z-index: 1001;
  }

  .nav-links.open {
    right: 0;
  }

  .nav-links a {
    font-size: var(--fs-lg);
  }

  /* Logo is black by design (for the light-grey desktop hero).
     On mobile the nav sits on a dark background, so invert it to white. */
  .nav-logo img {
    filter: brightness(0) invert(1);
  }

  /* Always show a dark backing on mobile so the white logo is readable
     on every page (including the light Contact page background) */
  .site-header {
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .section {
    padding: clamp(40px, 6vw, 80px) 5%;
  }

  /* Prevent section title overflowing on small screens */
  .section-title {
    font-size: clamp(0.875rem, 4vw, 1.25rem);
    padding: var(--sp-sm) var(--sp-lg);
    margin-bottom: var(--sp-xl);
    letter-spacing: 2px;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Mobile (480px) */
@media (max-width: 480px) {
  .section {
    padding: clamp(32px, 5vw, 60px) 4%;
  }

  .container {
    padding: 0 var(--sp-md);
  }

  .section-title {
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    padding: 8px var(--sp-md);
  }
}

/* Desktop large */
@media (min-width: 1280px) {
  .container {
    padding: 0 var(--sp-xl);
  }
}

/* Mobile nav overlay background */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base);
}

.nav-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
