/* ===== CSS Variables (Light Theme) ===== */
:root {
  --bg-primary: #f8f9fa;
  --bg-card: #ffffff;
  --bg-header: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  --text-primary: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #888;
  --accent: #2c5364;
  --accent-light: #3a7bd5;
  --accent-gradient: linear-gradient(135deg, #2c5364, #3a7bd5);
  --border: #e8eaed;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.12);
  --pill-bg: #e8f0fe;
  --pill-text: #1a56db;
  --tag-bg: #f0f4f8;
  --header-text: #ffffff;
  --header-sub: rgba(255, 255, 255, 0.85);
  --divider: #e0e0e0;
  --toggle-bg: #e8eaed;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --bg-primary: #0d1117;
  --bg-card: #161b22;
  --bg-header: linear-gradient(135deg, #0d1117, #161b22, #1a2332);
  --text-primary: #e6edf3;
  --text-secondary: #b0b8c4;
  --text-muted: #7d8590;
  --accent: #58a6ff;
  --accent-light: #79c0ff;
  --accent-gradient: linear-gradient(135deg, #58a6ff, #79c0ff);
  --border: #30363d;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
  --pill-bg: #1a2332;
  --pill-text: #58a6ff;
  --tag-bg: #1a2332;
  --header-text: #e6edf3;
  --header-sub: rgba(230, 237, 243, 0.8);
  --divider: #30363d;
  --toggle-bg: #30363d;
}

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

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: var(--accent);
  transition: color 0.2s ease;
}

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

/* ===== Container ===== */
.container {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  z-index: 100;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: none;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  box-shadow: var(--shadow-hover);
  transform: scale(1.1);
}

/* ===== Print Button ===== */
.print-btn {
  position: fixed;
  top: 1.2rem;
  right: 4.5rem;
  z-index: 100;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: none;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.print-btn:hover {
  box-shadow: var(--shadow-hover);
  transform: scale(1.1);
}

/* ===== Header ===== */
.header {
  position: relative;
  text-align: center;
  padding: 2.5rem 2rem 2rem;
  border-radius: 1rem;
  margin-bottom: 1.2rem;
  overflow: hidden;
  background: var(--bg-header);
}

.header-bg {
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.header-content {
  position: relative;
  z-index: 1;
}

.header-title {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  color: var(--header-text);
  margin-bottom: 0.3rem;
}

.header-sub-title {
  font-size: 1rem;
  font-weight: 400;
  color: var(--header-sub);
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}

/* ===== Contact Section ===== */
.contact-section {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 0.8rem;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  color: var(--header-text);
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.contact-item:hover {
  background: rgba(255, 255, 255, 0.2);
}

.contact-item a {
  color: var(--header-text) !important;
}

.contact-logo {
  font-size: 0.8rem;
  opacity: 0.9;
}

.contact-info {
  font-size: 0.85rem;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: 0.75rem;
  padding: 1.4rem 1.6rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow 0.3s ease, transform 0.3s ease,
    background-color 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

/* ===== Section Headers ===== */
.cat-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.7rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--divider);
}

.cat-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.cat-title {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12rem;
  color: var(--text-primary);
}

/* ===== About / Summary ===== */
.about-intro {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.75;
  text-align: justify;
}

/* ===== Skills ===== */
.skill-grid {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.skill-category {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.skill-category-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  min-width: 8rem;
  padding-top: 0.3rem;
  flex-shrink: 0;
}

.skill-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.skill-pill {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  background: var(--pill-bg);
  color: var(--pill-text);
  border-radius: 2rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.skill-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===== Experience ===== */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.exp-entry {
  position: relative;
  padding-left: 1.2rem;
  border-left: 2px solid var(--accent);
}

.exp-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.8rem;
  margin-bottom: 0.5rem;
}

.exp-org {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.exp-role {
  color: var(--accent);
  font-weight: 500;
  font-size: 0.9rem;
}

.exp-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  margin-left: auto;
}

.exp-details {
  list-style: none;
  padding: 0;
}

.exp-details li {
  position: relative;
  padding: 0.25rem 0 0.25rem 1.2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.exp-details li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

/* ===== Projects ===== */
.project-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.project-card {
  padding: 1rem;
  border-radius: 0.5rem;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.project-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.project-duration {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.project-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.project-link a {
  font-size: 0.8rem;
  display: inline-block;
  margin-top: 0.3rem;
}

/* ===== Education ===== */
.education-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.edu-entry {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.edu-info {
  flex: 1;
}

.edu-alma {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.edu-std {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.edu-duration {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
}

.edu-score {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: var(--accent-gradient);
  color: #fff;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.3rem;
}

/* ===== Certifications ===== */
.cert-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.cert-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.cert-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.cert-desc {
  font-size: 0.9rem;
  color: var(--text-primary);
  flex: 1;
}

.cert-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  padding-left: 1rem;
  white-space: nowrap;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ===== Animations ===== */
.animate-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

/* Stagger children */
.card:nth-child(2) { transition-delay: 0.05s; }
.card:nth-child(3) { transition-delay: 0.1s; }
.card:nth-child(4) { transition-delay: 0.15s; }
.card:nth-child(5) { transition-delay: 0.2s; }
.card:nth-child(6) { transition-delay: 0.25s; }
.card:nth-child(7) { transition-delay: 0.3s; }

/* ===== Print Styles ===== */
@media print {
  * {
    color: #000 !important;
    background: #fff !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 11pt;
    line-height: 1.4;
  }

  .theme-toggle,
  .print-btn {
    display: none !important;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .header {
    background: none !important;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    border-radius: 0;
    border-bottom: 2px solid #000;
  }

  .header-title {
    color: #000 !important;
    font-size: 1.6rem;
  }

  .header-sub-title {
    color: #333 !important;
  }

  .contact-item {
    background: none !important;
    color: #000 !important;
    padding: 0.1rem 0.3rem;
  }

  .contact-item a {
    color: #000 !important;
  }

  .card {
    border: none !important;
    padding: 0.5rem 0;
    margin-bottom: 0.3rem;
    page-break-inside: avoid;
  }

  .cat-indicator {
    background: none !important;
    color: #000 !important;
    border: 1px solid #000;
  }

  .skill-pill {
    border: 1px solid #ccc;
    background: none !important;
    color: #000 !important;
  }

  .exp-entry {
    border-left-color: #000;
  }

  .project-card {
    border: 1px solid #ccc;
    background: none !important;
  }

  .animate-in {
    opacity: 1 !important;
    transform: none !important;
  }

  .footer {
    display: none;
  }

  a::after {
    content: " (" attr(href) ")";
    font-size: 0.7em;
    color: #666 !important;
  }

  .contact-item a::after {
    content: none;
  }
}

/* ===== Responsive ===== */
@media screen and (max-width: 640px) {
  html {
    font-size: 15px;
  }

  .container {
    padding: 1rem 0.75rem;
  }

  .header {
    padding: 2rem 1.2rem 1.5rem;
  }

  .header-title {
    font-size: 1.7rem;
    letter-spacing: 0.08rem;
  }

  .header-sub-title {
    font-size: 0.8rem;
    letter-spacing: 0.08rem;
  }

  .contact-section {
    gap: 0.3rem;
  }

  .contact-item {
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
  }

  .card {
    padding: 1rem 1.1rem;
  }

  .skill-category {
    flex-direction: column;
    gap: 0.3rem;
  }

  .skill-category-title {
    min-width: auto;
  }

  .exp-date {
    margin-left: 0;
    width: 100%;
  }

  .project-list {
    grid-template-columns: 1fr;
  }

  .edu-entry {
    flex-direction: column;
    gap: 0.2rem;
  }

  .cert-entry {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .cert-date {
    padding-left: 0;
  }

  .theme-toggle {
    top: 0.8rem;
    right: 0.8rem;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 0.95rem;
  }

  .print-btn {
    top: 0.8rem;
    right: 3.5rem;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 0.95rem;
  }
}
