/* ==========================================================================
   1. VARIABLES & COLOR PALETTE
   ========================================================================== */
:root {
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  --text-main: #18181b;
  --text-muted: #52525b;
  --text-light: #71717a;
  --bg-page: #fafaf9;
  --bg-card: #ffffff;
  --border: #e4e4e7;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height: 1.6;
  --max-width: 860px;
}

/* Dark Mode */
body.dark-mode {
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-light: #71717a;
  --bg-page: #09090b;
  --bg-card: #18181b;
  --border: #27272a;
  --primary-light: rgba(79, 70, 229, 0.15);
  --primary-border: rgba(79, 70, 229, 0.3);
}

/* ==========================================================================
   2. BASE RESET & PAGE LAYOUT
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: var(--line-height);
  padding: 2.5rem 1rem;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
}

.cv-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

/* Floating Action Bar (Ignored during Print) */
.action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  max-width: var(--max-width);
  margin: 0 auto 1.25rem auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-primary:hover {
  filter: brightness(1.1);
  color: #ffffff;
}

/* ==========================================================================
   3. HEADER & CONTACTS
   ========================================================================== */
.cv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 2rem;
}

.header-info h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text-main);
}

.header-info .job-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 0.35rem;
}

.contacts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.contacts-grid a, .contacts-grid span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  text-decoration: none;
}

.contacts-grid a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ==========================================================================
   4. SECTIONS & TYPOGRAPHY
   ========================================================================== */
.section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main);
  margin-bottom: 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 2px;
}

.summary-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* Timeline Items (Experience / Education) */
.timeline-item {
  margin-bottom: 1.5rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.item-role {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

.item-company {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--primary);
}

.item-date {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 500;
}

.item-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.item-highlights {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.item-highlights li {
  margin-bottom: 0.35rem;
}

/* 2-Column Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

/* Skills Badges */
.skill-group {
  margin-bottom: 1rem;
}

.skill-group-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.skills-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.skill-pill {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: 4px;
}

/* Project Cards */
.project-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--bg-card);
}

/* ==========================================================================
   5. PRINT & RESPONSIVE RULES
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
  }

  .action-bar {
    display: none !important;
  }

  .cv-wrapper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .timeline-item, .project-card {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .skill-pill {
    border: 1px solid #d1d5db !important;
    background: #f3f4f6 !important;
    color: #111827 !important;
  }
}

@media (max-width: 768px) {
  .cv-wrapper {
    padding: 1.5rem;
  }
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .header-info h1 {
    font-size: 1.75rem;
  }
}