/**
 * Main Stylesheet for Edward Silva's Portfolio
 * 
 * A clean, modern CSS approach using CSS variables and logical organization
 * for maintainability and consistent theming.
 * 
 * Contents:
 * 1. CSS Variables (Light and Dark Theme)
 * 2. Base Styles & Typography
 * 3. Layout Components
 * 4. UI Components
 * 5. Section-specific Styles
 * 6. Animations
 * 7. Responsive Design
 * 8. Print Styles
 * 9. Accessibility
 */

/* 1. CSS Variables */
:root {
  /* Color Palette - Light Theme */
  --primary: #1a365d;
  --primary-dark: #0f2942;
  --primary-light: #2c5282;
  --secondary: #4a5568;
  --secondary-dark: #2d3748;
  --text: #1f2937;
  --text-light: #6b7280;
  --text-lighter: #9ca3af;
  --bg: #ffffff;
  --bg-alt: #f3f4f6;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  
  /* Layout & Effects */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-fast: all 0.15s ease;
  
  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  
  /* Content Dimensions */
  --container-width: 1200px;
  --content-max-width: 70ch;
  --header-height: 70px;
  
  /* Scrollbar */
  --scrollbar-opacity: 0.3;
  
  /* RGB values for rgba usage */
  --primary-rgb: 26, 54, 93;
  --secondary-rgb: 74, 85, 104;
  --bg-rgb: 255, 255, 255;
  --bg-alt-rgb: 243, 244, 246;
}

/* Dark Theme */
[data-theme="dark"] {
  --primary: #4a78b3;
  --primary-dark: #2b5694;
  --primary-light: #6e9eda;
  --secondary: #8BA8CD;
  --secondary-dark: #5c7aa8;
  --text: #e2e8f0;
  --text-light: #cbd5e1;
  --text-lighter: #94a3b8;
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --bg-card: #1e293b;
  --border: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.1);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -2px rgba(0,0,0,0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.5), 0 10px 10px -5px rgba(0,0,0,0.3);
  --primary-rgb: 74, 120, 179;
  --secondary-rgb: 139, 168, 205;
  --bg-rgb: 15, 23, 42;
  --bg-alt-rgb: 30, 41, 59;
}

/* Dark mode specific overrides */
[data-theme="dark"] {
  & h1, & h2, & h3 { color: #f8fafc; }
  & h4 { color: var(--primary-light); }
  & .timeline-date { 
    color: var(--primary-light); 
    border-left-color: var(--primary-light); 
  }
  & .skill-tag { 
    background: #334155; 
    color: #e2e8f0; 
    &:hover { background: var(--primary); color: #ffffff; }
  }
  & .theme-toggle {
    background: #334155;
    border-color: #475569;
  }
}

/* 2. Base Styles & Typography */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  font-size: 16px;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Custom scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(var(--primary-rgb), var(--scrollbar-opacity));
  border-radius: 4px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--primary-rgb), 0.7);
  border-color: rgba(var(--primary-rgb), 0.1);
}

::-webkit-scrollbar-thumb:active {
  background: rgba(var(--primary-rgb), 0.9);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox scrollbar styling */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--primary-rgb), var(--scrollbar-opacity)) transparent;
}

/* Dark theme scrollbar adjustments */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(var(--primary-rgb), calc(var(--scrollbar-opacity) + 0.2));
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--primary-rgb), 0.8);
}

/* Scrollbar container fade effect */
html {
  overflow-y: auto;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-md);
  color: var(--text);
}

h1 { 
  font-size: var(--font-size-4xl); 
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
  display: inline-block;
}

h2 { 
  font-size: var(--font-size-3xl); 
  color: var(--primary); 
  position: relative;
  &::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border-radius: 2px;
  }
}

h3 { font-size: var(--font-size-2xl); }
h4 { 
  font-size: var(--font-size-xl); 
  color: var(--primary);
}

p, li { 
  margin-bottom: var(--space-sm); 
  line-height: 1.7;
  max-width: var(--content-max-width);
}

/* Remove max-width constraint for list items inside cards */
.card li {
  max-width: none;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
  font-weight: 500;
  &:hover { color: var(--secondary); }
}

a.underline-link {
  position: relative;
  display: inline-block;
  &::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--secondary);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
  }
  &:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
  }
}

/* 3. Layout Components */
.container {
  width: 92%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--space-sm);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-lg);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-md);
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.flex {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

/* Course grid layout */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  align-items: start;
}

/* Ensure dropdown items fill the grid properly and are equally sized */
.course-grid .dropdown-item {
  width: 100%;
  margin-bottom: 0;
  height: auto;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Make all summaries the same height and prevent text wrapping issues */
.course-grid .dropdown-item summary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 1rem 1.25rem;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
  hyphens: auto;
  
  &::after {
    flex-shrink: 0;
    margin-left: 1rem;
    align-self: flex-start;
    margin-top: 0.2rem;
  }
}

/* Certifications grid layout */
.certifications-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  width: 100%;
  justify-content: center;
  align-items: start;
}

/* Responsive adjustments for certifications grid */
@media (max-width: 1024px) {
  .certifications-grid {
    gap: var(--space-md);
  }
}

@media (max-width: 768px) {
  .certifications-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

@media (max-width: 576px) {
  .certifications-grid {
    gap: var(--space-sm);
  }
}

/* 4. UI Components */
button {
  cursor: pointer;
  font-family: var(--font);
}

.btn, .resume-button, .back-to-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  transition: var(--transition);
  border: none;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  color: white;
  background: var(--primary);
  
  &:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    background: var(--primary-dark);
  }
  
  &:active {
    transform: translateY(1px);
    box-shadow: var(--shadow-sm);
  }
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
    z-index: 1;
  }
  
  &:hover::before {
    left: 100%;
  }
}

.btn {
  font-size: var(--font-size-base);
  min-height: 48px;
  gap: 0.5rem;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.1);
  
  &:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.3), var(--shadow);
  }
    &:disabled {
    opacity: 0.7;
    cursor: not-allowed;
  }
}

.resume-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.button-spacer {
  display: none; /* Hidden by default, shown on mobile */
  width: 100%;
  height: var(--space-sm);
}

.btn-primary {
  background: linear-gradient(to right, var(--primary), var(--primary-dark));
  &:hover {
    background: linear-gradient(to right, var(--primary-dark), var(--primary));
  }
}

.theme-toggle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  margin: auto 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  transition: var(--transition);
  box-shadow: var(--shadow);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 5;
  cursor: pointer;
  
  &:hover {
    box-shadow: var(--shadow-md);
  }
  
  &.rotating {
    animation: rotate 0.5s ease-in-out;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: var(--transition);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  
  &::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: var(--transition);
  }
  
  &:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    &::before { opacity: 1; }
  }
}

.dropdown-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  margin-bottom: 1rem;
  width: 100%;
  
  &:hover {
    box-shadow: var(--shadow-md);
  }
  
  & summary {
    cursor: pointer;
    padding: 1rem 1.25rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-alt);
    transition: var(--transition);
    list-style: none;
    min-height: 48px;
    position: relative;
    user-select: none;
    
    &::-webkit-details-marker {
      display: none;
    }
    
    &::after {
      content: '▼';
      font-size: 0.7rem;
      transition: transform 0.3s ease;
      opacity: 0.7;
      margin-left: 0.5rem;
    }
  }
  
  &[open] summary {
    border-bottom: 1px solid var(--border);
    &::after { transform: rotate(180deg); }
  }
  
  & .dropdown-content {
    padding: 1.25rem;
    background-color: var(--bg-card);
    font-size: var(--font-size-base);
    animation: fadeIn 0.3s ease-out;
  }
}

/* 5. Section-specific Styles */
header {
  padding: var(--space-xl) 0;
  text-align: center;
  background: var(--bg);
  position: relative;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  
  &::before, &::after {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    opacity: 0.1;
    z-index: 0;
  }
  
  &::before {
    top: -100px;
    right: -100px;
    background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
  }
  
  &::after {
    bottom: -100px;
    left: -100px;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
  }
  
  & .container {
    position: relative;
    z-index: 1;
  }
  
  & h2 {
    color: var(--text);
    font-weight: 500;
    margin-bottom: var(--space-md);
    font-size: var(--font-size-xl);
    &::after { display: none; }
  }
  
  & p {
    max-width: 600px;
    margin: 0 auto var(--space-lg) auto;
    color: var(--text-light);
  }
}

.navigation {
  position: sticky;
  top: 0;
  background-color: rgba(var(--bg-rgb), 0.8);
  box-shadow: var(--shadow);
  z-index: 50;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.nav-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  position: relative;
  padding-right: 45px;
}

@supports not (backdrop-filter: blur(10px)) {
  .navigation { background-color: var(--bg); }
}

.nav-links {
  display: flex;
  list-style: none;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 0;
  height: 100%;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  
  &::-webkit-scrollbar { display: none; }
  
  & a {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    position: relative;
    white-space: nowrap;
    font-weight: 600;
    font-size: var(--font-size-sm);
    transition: var(--transition-fast);
    color: var(--text);
    
    &::after {
      content: '';
      position: absolute;
      width: 0;
      height: 2px;
      bottom: 0;
      left: 50%;
      background: linear-gradient(to right, var(--primary), var(--secondary));
      transition: width 0.3s ease, left 0.3s ease;
      transform: translateY(5px);
    }
    
    &:hover, &.active {
      color: var(--primary);
      &::after {
        width: 80%;
        left: 10%;
      }
    }
  }
}

.contact-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: var(--space-md) 0 var(--space-lg) 0;
  justify-content: center;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-alt);
  border-radius: var(--radius);
  transition: var(--transition);
  font-weight: 500;
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
  min-height: 48px;
  position: relative;
  overflow: hidden;
  z-index: 1;
  
  &:hover {
    color: white;
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    background: var(--primary);
  }
}

.section {
  margin: var(--space-xl) 0;
  scroll-margin-top: calc(var(--header-height) + 20px);
  position: relative;
}

.section-header {
  margin-bottom: var(--space-lg);
  position: relative;
}

.timeline {
  position: relative;
  margin-bottom: var(--space-lg);
  padding-left: 30px;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 6px;
    width: 3px;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
    border-radius: 3px;
  }
}

.timeline-item {
  margin-bottom: var(--space-lg);
  position: relative;
  transition: var(--transition);
  
  &:last-child { margin-bottom: 0; }
  
  &::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 8px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.2);
    transition: var(--transition);
    z-index: 1;
  }
  
  &:hover::before {
    background: var(--secondary);
    border-color: var(--secondary);
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(74, 85, 104, 0.3);
  }
  
  & .card {
    margin-top: var(--space-xs);
    border-left: 3px solid var(--primary);
    margin-bottom: 0;
  }
  
  &:hover .card {
    border-left-color: var(--secondary);
  }
}

.timeline-date {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--space-sm);
  display: inline-block;
  padding: 0.4rem 1rem;
  background-color: var(--bg-alt);
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--primary);
}

.skill-category {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  
  &::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 50px 50px 0;
    border-color: transparent var(--primary-light) transparent transparent;
    opacity: 0.1;
    transition: var(--transition);
  }
  
  &:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    &::before { opacity: 0.2; }
  }
  
  & h3 {
    color: var(--primary);
    margin-bottom: var(--space-md);
    position: relative;
    display: inline-block;
    &::after {
      content: '';
      position: absolute;
      width: 100%;
      height: 2px;
      background: linear-gradient(to right, var(--primary), transparent);
      bottom: -5px;
      left: 0;
    }
  }
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--space-sm);
}

.skill-tag, .tech-tag {
  display: inline-block;
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  transition: var(--transition-fast);
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
  }
}

.skill-tag {
  background: var(--bg-alt);
  color: var(--primary);
  border: 1px solid var(--border);
  
  &:hover {
    background: var(--primary);
    color: white;
  }
}

.tech-tag {
  background: var(--primary-light);
  color: white;
  padding: 0.25rem 0.6rem;
  font-weight: 500;
  
  &:hover {
    background: var(--primary);
  }
}

.project-tech {
  margin: var(--space-sm) 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-list {
  list-style: none;
  margin-bottom: var(--space-sm);
  
  & li {
    position: relative;
    padding-left: 1.75rem;
    margin-bottom: 0.75rem;
    line-height: 1.6;
    
    &::before {
      content: "▹";
      color: var(--primary);
      position: absolute;
      left: 0;
      top: 0;
      font-size: 1.2rem;
      line-height: 1.6;
    }
  }
}

.education-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.education-info { flex: 1; }

.gpa-indicator {
  display: inline-flex;
  align-items: center;
  background-color: var(--primary);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
  margin-top: 0.5rem;
  box-shadow: var(--shadow-sm);
  
  & .gpa-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
    margin-right: 0.5rem;
  }
  
  & .gpa-value {
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
  }
}

footer {
  background: var(--bg-alt);
  padding: var(--space-lg);
}

/* 6. Animations */
.theme-transition {
  transition: color 0.5s ease, background-color 0.5s ease;
}

@keyframes rotate {
  0% { transform: rotate(0); }
  100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 7. Responsive Design */
@media (max-width: 1024px) {
  :root {
    --container-width: 90%;
  }
}

@media (max-width: 768px) {
  :root {
    --space-lg: 2rem;
    --space-xl: 3rem;
    --header-height: 60px;
  }

  h1 { font-size: calc(var(--font-size-3xl)); }
  h2 { font-size: calc(var(--font-size-2xl)); }
  h3 { font-size: calc(var(--font-size-xl)); }

  .container {
    width: 95%;
    padding: 0 var(--space-xs);
  }

  .grid, .skills-grid, .two-columns {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  .section {
    margin: var(--space-lg) 0;
  }

  .resume-buttons {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: var(--space-md);
  }

  .button-spacer {
    display: none;  }
}

/* Responsive course grid adjustments */
@media (max-width: 768px) {
  .course-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  
  .course-grid .dropdown-item {
    min-height: 60px;
  }
  
  .course-grid .dropdown-item summary {
    min-height: 60px;
    padding: 1rem;
    
    &::after {
      margin-left: 0.75rem;
    }
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .course-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (min-width: 1025px) {
  .course-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }
}

@media (max-width: 576px) {
  :root {
    --font-size-4xl: 1.75rem;
    --font-size-3xl: 1.5rem;
    --font-size-2xl: 1.25rem;
    --font-size-xl: 1.125rem;
    --space-md: 1.25rem;
  }

  .card {
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
  }

  .skill-category {
    padding: var(--space-md);
  }

  .timeline {
    padding-left: 20px;
  }

  .timeline-item::before {
    left: -19px;
    width: 12px;
    height: 12px;
  }

  .contact-info {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .contact-item {
    justify-content: center;
  }

  .resume-buttons {
    flex-direction: column;
    gap: 0;
  }

  .button-spacer {
    display: block;
  }
}

@media (max-width: 768px) {
  .nav-container {
    justify-content: flex-start;
    overflow-x: auto;
    padding-right: 60px; /* Space for theme toggle */
  }
  
  .nav-links {
    justify-content: flex-start;
    padding: 0.5rem 0;
    gap: 0.5rem;
  }
  
  .nav-links a {
    padding: 0.5rem;
    font-size: calc(var(--font-size-xs) + 0.05rem);
  }
  
  .theme-toggle {
    right: var(--space-xs);
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 576px) {
  .btn, .resume-button {
    width: 100%;
    justify-content: center;
    padding: 0.6rem 1rem;
  }
}

@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
  }
  
  /* Improve touch targets */
  .nav-links a, .btn, .contact-item, .skill-tag, .tech-tag, summary {
    min-height: 44px; 
    display: flex;
    align-items: center;
  }
  
  .dropdown-item summary::after {
    margin-left: 1rem; 
  }
}

@media (max-width: 576px) {
  p, h1, h2, h3, h4, li {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  
  .timeline-date {
    font-size: var(--font-size-xs);
    padding: 0.3rem 0.6rem;
  }
  
  .education-header {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* 8. Print Styles */
@media print {
  body {
    background: white;
    color: black;
    font-size: 12pt;
  }
  
  .navigation, .theme-toggle, .back-to-top {
    display: none;
  }
  
  .container {
    width: 100%;
    max-width: 100%;
  }
  
  h1, h2, h3, h4 {
    page-break-after: avoid;
    page-break-inside: avoid;
  }
  
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
  
  .card, .skill-category {
    break-inside: avoid;
  }
}

/* 9. Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

:focus {
  outline: 3px solid rgba(var(--primary-rgb), 0.5);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 3px solid rgba(var(--primary-rgb), 0.5);
  outline-offset: 2px;
}

/* Certification specific styles */
.cert-card {
  position: relative;
  height: fit-content;
  display: flex;
  flex-direction: column;
  
  & .cert-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-md);
    
    & h3 {
      margin-bottom: 0;
      color: var(--primary);
      font-size: var(--font-size-xl);
    }
  }
  
  & .skill-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
  }
}

.cert-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  
  & a {
    flex: 1;
    min-width: 180px;
    text-align: center;
    padding: 0.6rem 1rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-weight: 500;
    font-size: var(--font-size-sm);
    transition: var(--transition);
    
    &:hover {
      background: var(--primary);
      color: white;
      transform: translateY(-2px);
      box-shadow: var(--shadow-sm);
    }
  }
}

.credential-badge {
  display: flex;
  justify-content: center;
  margin: var(--space-md) 0;
  padding: var(--space-sm);
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.course-list {
  margin-top: var(--space-sm);
  
  & .nested {
    margin-left: 0;
    margin-bottom: var(--space-sm);
    border-left: 3px solid var(--primary-light);
    border-radius: var(--radius);
    overflow: hidden;
    
    & summary {
      background: var(--bg);
      font-size: var(--font-size-sm);
      padding: 1rem 1.25rem;
      font-weight: 500;
      
      &:hover {
        background: var(--bg-alt);
      }
    }
    
    & .dropdown-content {
      padding: 1.25rem;
      font-size: var(--font-size-sm);
      background: var(--bg-card);
      line-height: 1.6;
      
      & p {
        margin-bottom: var(--space-sm);
      }
      
      & a {
        display: inline-block;
        margin-top: var(--space-xs);
        padding: 0.5rem 1rem;
        background: var(--bg-alt);
        border-radius: var(--radius-sm);
        font-weight: 500;
        transition: var(--transition-fast);
        
        &:hover {
          background: var(--primary);
          color: white;
        }
      }
    }
  }
}

/* Profile Section Styles */
.profile-summary {
  margin-bottom: var(--space-xl);
}

.profile-content {
  .profile-lead {
    line-height: 1.6; 
    color: var(--text);
    margin-bottom: var(--space-lg);
    font-weight: 400;
    text-align: justify;
    max-width: none;
  }
}

.profile-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.highlight-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-alt);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
  transition: var(--transition);
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-left-color: var(--secondary);
  }
}

.highlight-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.highlight-content {
  flex: 1;
  
  h4 {
    margin: 0 0 var(--space-xs) 0;
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text);
  }
  
  p {
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--text-light);
  }
}

.profile-goal {
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.05), rgba(var(--secondary-rgb), 0.05));
  border: 1px solid rgba(var(--primary-rgb), 0.1);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-top: var(--space-lg);
  
  p {
    margin: 0;
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text);
    max-width: none;
    
    strong {
      color: var(--primary);
      font-weight: 600;
    }
  }
}

/* Responsive adjustments for profile section */
@media (max-width: 768px) {
  .profile-highlights {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  
  .highlight-item {
    padding: var(--space-sm);
  }
  
  .profile-content .profile-lead {
    font-size: var(--font-size-base);
    text-align: left;
  }
}

@media (max-width: 576px) {
  .highlight-item {
    flex-direction: column;
    text-align: center;
    
    .highlight-icon {
      margin-top: 0;
      align-self: center;
    }
  }
}

/* Responsive adjustments for certification section */
@media (max-width: 768px) {
  .cert-links {
    flex-direction: column;
    
    & a {
      min-width: auto;
      width: 100%;
    }
  }
  
  .course-list .nested {
    margin-left: 0;
    
    & summary {
      padding: 0.875rem 1rem;
    }
    
    & .dropdown-content {
      padding: 1rem;
    }
  }
}