/* ==========================================================================
   BIS PORTFOLIO - THARUKA GUNARATNE
   Design System & Styling
   ========================================================================== */

/* 1. CSS CUSTOM PROPERTIES / THEME TOKENS */
:root {
  /* Color Palette - Dark Mode (Default) */
  --bg-primary: #0b0f17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-highlight: rgba(59, 130, 246, 0.4);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-heading: #ffffff;
  
  --accent-primary: #3b82f6;      /* Electric Blue */
  --accent-secondary: #8b5cf6;    /* Vibrant Violet */
  --accent-emerald: #10b981;      /* Emerald Green */
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
  --accent-glow: 0 0 25px rgba(59, 130, 246, 0.35);

  --nav-bg: rgba(11, 15, 23, 0.8);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);

  /* Fonts */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Override */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --border-color: rgba(203, 213, 225, 0.6);
  --border-highlight: rgba(37, 99, 235, 0.5);

  --text-main: #334155;
  --text-muted: #64748b;
  --text-heading: #0f172a;

  --nav-bg: rgba(248, 250, 252, 0.85);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --accent-glow: 0 0 20px rgba(59, 130, 246, 0.15);
}

/* 2. BASE STYLING & RESET */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-secondary);
}

ul {
  list-style: none;
}

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

/* Container */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* 3. TYPOGRAPHY & UTILITIES */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-heading);
  line-height: 1.2;
  font-weight: 700;
}

.section-padding {
  padding: 6rem 0;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-subtitle {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
  display: block;
}

.section-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.section-description {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
  font-size: 1.05rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.3);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.8rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  color: var(--text-heading);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.btn-outline:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.05);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card:hover {
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-lg);
}

/* 4. HEADER & NAVIGATION */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-normal);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-heading);
  display: inline-block;
  white-space: nowrap;
}

.logo i {
  margin-right: 0.4rem;
}

.logo span {
  color: #3b82f6 !important;
  font-weight: 800;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding: 0.5rem 0;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-heading);
}

.nav-link.active::after,
.nav-link:hover::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
}

.hamburger span {
  width: 25px;
  height: 2.5px;
  background: var(--text-heading);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

/* 5. HERO SECTION */
.hero {
  padding-top: 10rem;
  padding-bottom: 6rem;
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 950px;
  gap: 3rem;
  align-items: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-status {
  width: fit-content;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.hero-title {
  font-size: 3.2rem;
  line-height: 1.15;
}

.hero-subtitle {
  font-size: 1.3rem;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.typewriter-text {
  color: var(--accent-primary);
  font-weight: 700;
  border-right: 2px solid var(--accent-primary);
  padding-right: 4px;
  white-space: nowrap;
  animation: blink 0.75s step-end infinite;
}

@keyframes blink {
  from, to { border-color: transparent }
  50% { border-color: var(--accent-primary); }
}

.hero-description {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 580px;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.stat-item h4 {
  font-size: 1.8rem;
  color: var(--accent-primary);
}

.stat-item p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-avatar-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
}

.avatar-frame {
  position: relative;
  width: 320px;
  height: 380px;
  border-radius: 24px;
  overflow: hidden;
  border: 2px solid var(--border-highlight);
  box-shadow: var(--shadow-lg), var(--accent-glow);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  transition: transform var(--transition-normal);
}

.avatar-frame:hover .avatar-img {
  transform: scale(1.04);
}

.avatar-badge {
  position: absolute;
  bottom: 20px;
  left: -20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.8rem 1.2rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

.avatar-badge i {
  font-size: 1.5rem;
  color: var(--accent-primary);
}

.avatar-badge-text h5 {
  font-size: 0.9rem;
  line-height: 1.2;
}

.avatar-badge-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 6. ABOUT ME SECTION */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.about-bio p {
  margin-bottom: 1.2rem;
  color: var(--text-muted);
}

.qualifications-list {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.qual-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.qual-item i {
  color: var(--accent-emerald);
  margin-top: 4px;
}

.education-timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
}

.timeline-item {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid var(--border-color);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary);
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--accent-primary);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.timeline-title {
  font-size: 1.1rem;
  margin-bottom: 0.2rem;
}

.timeline-institution {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.interests-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.interest-tag {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-secondary);
  border: 1px solid rgba(139, 92, 246, 0.25);
  padding: 0.4rem 0.9rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Download CV Banner */
.cv-download-banner {
  margin-top: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid var(--border-highlight);
  border-radius: 20px;
  padding: 2rem;
}

.cv-info h3 {
  font-size: 1.4rem;
  margin-bottom: 0.3rem;
}

.cv-info p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* 7. SKILLS SECTION */
.skills-filter {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.6rem 1.4rem;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: var(--accent-glow);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.skill-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.skill-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.skill-name-wrapper h4 {
  font-size: 1.05rem;
}

.skill-name-wrapper span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 10px;
  width: 0%;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 8. PROJECTS SECTION */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.project-img-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
}

.project-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.project-card:hover .project-img-wrapper img {
  transform: scale(1.06);
}

.project-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 23, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.project-card:hover .project-overlay {
  opacity: 1;
}

.project-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  flex-grow: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tech-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.project-title {
  font-size: 1.25rem;
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-grow: 1;
}

/* Keep comparable project information aligned in each grid row. */
.project-card .project-desc {
  flex-grow: 0;
  min-height: 9.2rem;
}

.project-card .project-technologies {
  min-height: 11.25rem;
  align-content: flex-start;
}

@media (max-width: 760px) {
  .project-card .project-desc,
  .project-card .project-technologies {
    min-height: 0;
  }
}

.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-color);
}

/* Project Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  padding: 1rem;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  max-width: 750px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-heading);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background var(--transition-fast);
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

/* 9. CONTACT SECTION */
.contact-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 2.5rem;
}

.contact-info-cards {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.info-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.info-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.info-details h5 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.info-details p, .info-details a {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-heading);
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.social-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-heading);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition-fast);
}

.social-btn:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  transform: translateY(-3px);
  box-shadow: var(--accent-glow);
}

/* Contact Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-heading);
}

.form-control {
  width: 100%;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  color: var(--text-heading);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast);
}

[data-theme="light"] .form-control {
  background: rgba(241, 245, 249, 0.8);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

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

.form-error {
  font-size: 0.8rem;
  color: #ef4444;
  display: none;
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-emerald);
  border-radius: 14px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-normal);
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  color: var(--accent-emerald);
  font-size: 1.3rem;
}

/* 10. FOOTER */
.footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  text-align: center;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.footer-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* 11. RESPONSIVE MEDIA QUERIES */
@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-content {
    align-items: center;
  }
  .hero-description {
    margin: 0 auto;
  }
  .hero-buttons {
    justify-content: center;
  }
  .hero-stats {
    justify-content: center;
  }
  .about-grid, .contact-grid {
    grid-template-columns: 1fr;
  }
  .cv-download-banner {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .nav-menu {
    position: fixed;
    top: 80px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 80px);
    background: var(--bg-secondary);
    flex-direction: column;
    justify-content: center;
    transition: left var(--transition-normal);
  }
  .nav-menu.active {
    left: 0;
  }
  .hamburger {
    display: flex;
  }
  .hero-title {
    font-size: 2.3rem;
  }
  .section-title {
    font-size: 2rem;
  }
}
