/* CSS Variables - Design System */
:root {
  /* Base Colors */
  --color-bg-primary: #0f172a;
  --color-bg-secondary: #1e293b;
  --color-bg-tertiary: #334155;
  
  /* Text Colors */
  --color-text-primary: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  
  /* Accent Colors */
  --color-active: #10b981;
  --color-expired: #f59e0b;
  --color-no-expiry: #6b7280;
  --color-link: #60a5fa;
  
  /* Borders */
  --color-border: #334155;
  --color-border-active: #10b981;
  
  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  
  /* Type Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  
  /* Layout */
  --container-max-width: 1200px;
  --content-max-width: 65ch;
  
  /* Breakpoints */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  min-height: 100vh;
}

/* Normalize and reset elements */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* Typography - Headings */
h1 {
  font-size: var(--text-5xl);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text-primary);
  margin-bottom: var(--space-6);
}

h2 {
  font-size: var(--text-3xl);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text-primary);
  margin-bottom: var(--space-5);
}

h3 {
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
}

h4 {
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
}

h5 {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.5;
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
}

h6 {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.5;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

/* Typography Utilities */
.font-mono {
  font-family: var(--font-mono);
}

.text-mono {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* Responsive typography adjustments */
@media (max-width: 768px) {
  h1 {
    font-size: var(--text-4xl);
  }
  
  h2 {
    font-size: var(--text-2xl);
  }
  
  h3 {
    font-size: var(--text-xl);
  }
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Container */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--space-4); /* Mobile: tighter padding */
}

/* Desktop: wider padding */
@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-6);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--space-8);
  }
}

/* Section Styles */
section {
  padding: var(--space-16) 0;
}

.section-title {
  font-size: var(--text-3xl);
  font-weight: 600;
  margin-bottom: var(--space-8);
  color: var(--color-text-primary);
}

/* Desktop: increase section padding */
@media (min-width: 768px) {
  section {
    padding: var(--space-20) 0;
  }
  
  .section-title {
    margin-bottom: var(--space-12);
  }
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) 0;
}

.hero__container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-10);
}

.hero__identity {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.hero__name {
  font-size: var(--text-5xl);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text-primary);
  margin-bottom: 0;
}

.hero__title {
  font-size: var(--text-xl);
  color: var(--color-text-secondary);
  font-weight: 500;
  line-height: 1.4;
}

.hero__location {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  font-weight: 400;
}

.hero__metrics {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
}

.hero__links {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--color-text-secondary);
  transition: color 0.2s ease, transform 0.2s ease;
  border-radius: 8px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  touch-action: manipulation; /* Reduce 300ms tap delay on mobile */
}

.social-link:hover {
  color: var(--color-active);
  transform: translateY(-2px);
  border-color: var(--color-active);
}

.social-link:focus {
  outline: 2px solid var(--color-active);
  outline-offset: 2px;
  color: var(--color-active);
}

.social-link:active {
  transform: translateY(0);
}

.social-link svg {
  width: 24px;
  height: 24px;
  pointer-events: none; /* Prevent tap conflicts */
}

/* Mobile adjustments for Hero */
@media (max-width: 768px) {
  .hero {
    min-height: auto;
    padding: var(--space-12) 0;
  }
  
  .hero__container {
    gap: var(--space-6);
    padding: 0 var(--space-4);
  }
  
  .hero__name {
    font-size: var(--text-3xl);
    line-height: 1.1;
  }
  
  .hero__title {
    font-size: var(--text-base);
    line-height: 1.5;
  }
  
  .hero__location {
    font-size: var(--text-sm);
  }
  
  .hero__links {
    gap: var(--space-4);
  }
}

/* Extra small phones (< 375px) */
@media (max-width: 374px) {
  .hero__name {
    font-size: var(--text-2xl);
  }
  
  .hero__title {
    font-size: var(--text-sm);
  }
}

/* About Section */
.about__summary {
  max-width: var(--content-max-width); /* 65ch for readable line length */
  font-size: var(--text-base); /* Mobile: base size */
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin: 0 auto; /* Center the text block */
}

/* Desktop: larger font size */
@media (min-width: 768px) {
  .about__summary {
    font-size: var(--text-lg);
    line-height: 1.8;
  }
}

/* Skills Section */
.skills-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr; /* Mobile: single column */
}

.skill-category {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.skill-category:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.skill-category__title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--color-border);
}

.skill-category__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.skill-category__list li {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  padding-left: var(--space-4);
  position: relative;
}

.skill-category__list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--color-active);
  font-weight: 500;
}

/* Tablet and Desktop: 2 column grid (2x2 for 4 categories) */
@media (min-width: 768px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Styles for future components will be added in subsequent tasks */

/* Component Styles */

/* Metric Card Component */
.metric-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.metric-card__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.metric-card__value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  color: var(--color-active);
  font-weight: 500;
  line-height: 1.2;
}

/* Status Badge Component (for certifications) */
.cert-badge {
  display: none; /* HIDDEN temporarily */
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: 0.05em;
  line-height: 1;
}

.cert-badge--active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-active);
  border: 1px solid var(--color-active);
}

.cert-badge--expired {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-expired);
  border: 1px solid var(--color-expired);
}

.cert-badge--no-expiry {
  background: rgba(107, 114, 128, 0.1);
  color: var(--color-no-expiry);
  border: 1px solid var(--color-no-expiry);
}

/* Button Component */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  line-height: 1.5;
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  touch-action: manipulation; /* Reduce tap delay */
}

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

.btn--primary:hover {
  background: #0ea572;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn--primary:focus {
  outline: 2px solid var(--color-active);
  outline-offset: 2px;
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
  background: #0d9a68;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Form Elements */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.form-group label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.form-group input,
.form-group textarea {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: var(--space-3) var(--space-4);
  transition: all 0.2s ease;
  width: 100%;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-active);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-text-muted);
}

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

/* Form validation states */
.form-group input:invalid:not(:focus):not(:placeholder-shown),
.form-group textarea:invalid:not(:focus):not(:placeholder-shown) {
  border-color: var(--color-expired);
}

.form-group input:valid:not(:focus):not(:placeholder-shown),
.form-group textarea:valid:not(:focus):not(:placeholder-shown) {
  border-color: var(--color-active);
}

/* Form status messages */
.form-status {
  padding: var(--space-4);
  border-radius: 6px;
  font-size: var(--text-sm);
  margin-top: var(--space-4);
}

.form-status--success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-active);
  border: 1px solid var(--color-active);
}

.form-status--error {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-expired);
  border: 1px solid var(--color-expired);
}

/* Experience Timeline Component */
.timeline {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

.timeline-entry {
  position: relative;
  padding-left: var(--space-8);
  margin-bottom: var(--space-12);
}

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

/* Vertical line connecting entries */
.timeline-entry::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

/* Current role gets green vertical line */
.timeline-entry--current::before {
  background: var(--color-active);
}

/* Timeline entry header */
.timeline-entry__header {
  margin-bottom: var(--space-4);
}

/* Meta section with date and badge */
.timeline-entry__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

/* Date styling with monospace font */
.timeline-entry__date {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

/* Current badge */
.timeline-entry__badge--current {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  padding: var(--space-1) var(--space-3);
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: 0.05em;
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-active);
  border: 1px solid var(--color-active);
}

/* Role title */
.timeline-entry__title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

/* Company name */
.timeline-entry__company {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  font-weight: 500;
  margin-bottom: 0;
}

/* Toggle button for collapsible details */
.timeline-entry__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  padding: var(--space-2) var(--space-4);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  transition: all 0.2s ease;
  margin-top: var(--space-4);
  touch-action: manipulation; /* Reduce tap delay on mobile */
}

.timeline-entry__toggle:hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-active);
  color: var(--color-text-primary);
}

.timeline-entry__toggle:focus {
  outline: 2px solid var(--color-active);
  outline-offset: 2px;
}

.timeline-entry__toggle:active {
  background: var(--color-bg-tertiary);
  transform: scale(0.98);
}

.timeline-entry__toggle .toggle-icon {
  font-size: var(--text-xs);
  transition: transform 0.2s ease;
}

/* Collapsible details section */
.timeline-entry__details {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.timeline-entry__details:not([hidden]) {
  max-height: 2000px;
  opacity: 1;
  margin-top: var(--space-4);
}

/* List of responsibilities */
.timeline-entry__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline-entry__list li {
  position: relative;
  padding-left: var(--space-6);
  margin-bottom: var(--space-3);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.timeline-entry__list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--color-active);
  font-size: var(--text-sm);
}

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

/* Consolidated entry styling */
.timeline-entry--consolidated {
  /* Consolidated entries with no toggle button */
}

.timeline-entry--consolidated::before {
  background: var(--color-text-muted);
}

.timeline-entry--consolidated .timeline-entry__summary {
  margin-top: var(--space-4);
  color: var(--color-text-secondary);
  line-height: 1.6;
  font-size: var(--text-base);
}

.timeline-entry--consolidated .timeline-entry__companies {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-style: italic;
  line-height: 1.5;
}

/* Responsive adjustments for timeline */
@media (max-width: 768px) {
  /* Reduce spacing between entries on mobile */
  .timeline-entry {
    padding-left: var(--space-5);
    margin-bottom: var(--space-10);
  }
  
  /* Reduce font sizes for mobile */
  .timeline-entry__title {
    font-size: var(--text-lg);
    line-height: 1.3;
  }
  
  .timeline-entry__company {
    font-size: var(--text-sm);
    line-height: 1.4;
  }
  
  .timeline-entry__date {
    font-size: var(--text-xs);
  }
  
  /* Stack date and badge vertically on mobile */
  .timeline-entry__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  
  /* Touch-optimized toggle buttons */
  .timeline-entry__toggle {
    min-height: 44px;
    min-width: 100px;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
  }
  
  /* Adjust list item spacing on mobile */
  .timeline-entry__list li {
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    line-height: 1.6;
    padding-left: var(--space-5);
  }
  
  /* Reduce padding in details section */
  .timeline-entry__details:not([hidden]) {
    margin-top: var(--space-4);
  }
  
  /* Adjust consolidated entry text size */
  .timeline-entry--consolidated .timeline-entry__summary {
    font-size: var(--text-sm);
    line-height: 1.6;
  }
  
  .timeline-entry--consolidated .timeline-entry__companies {
    font-size: var(--text-xs);
    line-height: 1.5;
  }
}

/* Certifications Section */
.certifications-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr; /* Mobile: single column */
}

/* Education Section */
.education-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr; /* Mobile: single column */
  max-width: 900px;
  margin: 0 auto;
}

/* Education Card Component */
.education-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.education-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.education-card__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.education-card__degree {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0;
  line-height: 1.4;
}

.education-card__institution {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  font-weight: 500;
  margin-bottom: 0;
}

.education-card__date {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
  display: block;
}

/* Tablet: 2 columns for education */
@media (min-width: 768px) {
  .education-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Certifications Section */
.certifications-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr; /* Mobile: single column */
}

/* Certification Card Component */
.cert-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.cert-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.cert-card__name {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0;
  line-height: 1.4;
}

.cert-card__issuer {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  font-weight: 500;
  margin-bottom: 0;
}

.cert-card__dates {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.cert-card__dates time {
  display: block;
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
  .certifications-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop: 3 columns */
@media (min-width: 1024px) {
  .certifications-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Scroll Animation Styles */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.animate-on-scroll.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Disable animations when user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
