*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; }

/* ── THEMES ── */
[data-theme="light"] {
  --page-bg:    #e0e0e0;
  --white:      #ffffff;
  --sidebar-bg: #f4f4f4;
  --text:       #1a1a1a;
  --muted:      #555;
  --light:      #888;
  --border:     #ddd;
  --accent:     #2563eb;
  --accent-muted: rgba(37,99,235,0.08);
  --tag-bg:     #eef2fb;
  --tag-border: rgba(37,99,235,0.22);
  --card-bg:    #fafbff;
  --shadow:     rgba(0,0,0,0.14);
  --shadow-hover: rgba(37,99,235,0.14);
  --btn-bg:     #ffffff;
  --btn-text:   #1a1a1a;
  --btn-border: #ccc;
}

[data-theme="dark"] {
  --page-bg:    #111318;
  --white:      #1a1d27;
  --sidebar-bg: #14161f;
  --text:       #e2e8f0;
  --muted:      #9aa3b2;
  --light:      #6b7280;
  --border:     #2a2f45;
  --accent:     #4f8ef7;
  --accent-muted: rgba(79,142,247,0.10);
  --tag-bg:     #1e2235;
  --tag-border: rgba(79,142,247,0.28);
  --card-bg:    #1e2235;
  --shadow:     rgba(0,0,0,0.5);
  --shadow-hover: rgba(79,142,247,0.18);
  --btn-bg:     #22263a;
  --btn-text:   #e2e8f0;
  --btn-border: #3a4060;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.55;
  padding: 2rem 1rem 4rem;
  transition: background 0.3s, color 0.3s;
}

/* ── PAGE ── */
.page {
  max-width: 980px;
  margin: 0 auto;
  background: var(--white);
  display: grid;
  grid-template-columns: 240px 1fr;
  box-shadow: 0 6px 48px var(--shadow);
  transition: background 0.3s, box-shadow 0.3s;
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 2.5rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  transition: background 0.3s, border-color 0.3s;
}

.location {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.work-auth {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #0d9488;
  background: rgba(13,148,136,0.09);
  border: 1px solid rgba(13,148,136,0.28);
  border-radius: 4px;
  padding: 0.22rem 0.6rem;
  margin-top: 0.55rem;
}

[data-theme="dark"] .work-auth {
  color: #2dd4bf;
  background: rgba(45,212,191,0.09);
  border-color: rgba(45,212,191,0.24);
}

/* ── SIDEBAR HERO ── */
.sidebar-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.sidebar-controls {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--btn-border);
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 1px 4px var(--shadow);
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.photo-circle {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  color: var(--light);
  text-align: center;
  border: 3px solid var(--white);
  box-shadow: 0 2px 14px var(--shadow);
  overflow: hidden;
  margin-bottom: 1rem;
}

.photo-circle img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-name {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 0.3rem;
}

.sidebar-role {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 1.4rem;
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  margin-bottom: 0.2rem;
}

.download-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Sidebar sections */
.s-section { display: flex; flex-direction: column; gap: 0.65rem; }

.s-title {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--accent);
  width: fit-content;
}

.contact-list { display: flex; flex-direction: column; gap: 0.4rem; }

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  word-break: break-all;
  transition: color 0.2s;
}

.contact-item:hover { color: var(--accent); }
.contact-item svg { flex-shrink: 0; color: var(--accent); }

.edu-course { font-size: 0.83rem; font-weight: 600; color: var(--text); }
.edu-school  { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }

.skill-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.skill-list li {
  font-size: 0.8rem;
  color: var(--muted);
  padding-left: 0.85rem;
  position: relative;
}

.skill-list li::before { content: '•'; position: absolute; left: 0; color: var(--accent); }

/* ── MAIN ── */
.main {
  padding: 2.5rem 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.m-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 0.9rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--accent);
  width: fit-content;
}

#profile p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.78;
}

/* Skills grid */
.skills-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
}

.skill-group-title {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

/* Experience */
.exp-list { display: flex; flex-direction: column; gap: 1.6rem; }

.exp-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.1rem;
}

.exp-title  { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.exp-date   { font-size: 0.76rem; color: var(--light); }
.exp-company {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.company-logo {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.exp-stack {
  font-size: 0.7rem;
  color: var(--light);
  font-style: italic;
  margin-bottom: 0.55rem;
  line-height: 1.5;
}

.exp-bullets { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }

.exp-bullets li {
  font-size: 0.82rem;
  color: var(--muted);
  padding-left: 1rem;
  position: relative;
  line-height: 1.55;
}

.exp-bullets li::before { content: '•'; position: absolute; left: 0; color: var(--accent); }

/* ── PROJECTS ── */
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.project-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1.15rem 1.3rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 1px 4px var(--shadow);
  transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.18s ease;
}

.project-card:hover {
  border-color: var(--accent);
  border-top-color: var(--accent);
  box-shadow: 0 6px 20px var(--shadow-hover), 0 1px 4px var(--shadow);
  transform: translateY(-2px);
}

.project-badge {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-muted);
  border: 1px solid var(--tag-border);
  border-radius: 3px;
  padding: 0.14rem 0.45rem;
  line-height: 1.6;
}

.project-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding-right: 5.5rem;
}

.project-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.project-gh-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}

.project-gh-link svg { opacity: 0.6; flex-shrink: 0; }
.project-gh-link:hover { color: var(--accent); }
.project-gh-link:hover svg { opacity: 1; }

.project-tagline {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.58;
}

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

.tag {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 4px;
  padding: 0.16rem 0.5rem;
  letter-spacing: 0.02em;
  line-height: 1.55;
}

.project-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.05rem;
}

.project-bullets li {
  font-size: 0.79rem;
  color: var(--muted);
  padding-left: 1rem;
  position: relative;
  line-height: 1.55;
}

.project-bullets li::before { content: '▸'; position: absolute; left: 0; color: var(--accent); font-size: 0.68rem; top: 0.06em; }

/* ── PRINT ── */
@media print {
  body { background: white; padding: 0; }

  /* Hide interactive / non-essential elements */
  .sidebar-controls { display: none; }
  .download-btn     { display: none; }
  #projects         { display: none; }

  .page {
    max-width: 100%;
    box-shadow: none;
    grid-template-columns: 220px 1fr;
  }

  [data-theme="dark"] {
    --page-bg: #fff; --white: #fff; --sidebar-bg: #f4f4f4;
    --text: #1a1a1a; --muted: #555; --light: #888;
    --border: #ddd; --accent: #2563eb;
    --card-bg: #fff; --tag-bg: #eef2fb; --tag-border: rgba(37,99,235,0.22);
    --accent-muted: rgba(37,99,235,0.08);
  }

  /* Experience starts on a fresh page */
  #experience {
    break-before: page;
    page-break-before: always;
  }

  /* Keep each experience entry together */
  .exp-entry {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Keep sidebar sections from splitting mid-print */
  .s-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .project-card {
    box-shadow: none !important;
    transform: none !important;
    border: 1px solid #ddd;
    border-top: 2px solid #2563eb;
    background: #fff;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .project-badge {
    background: transparent;
    border-color: #2563eb;
    color: #2563eb;
  }
  .tag {
    border-color: #c7d7f8;
    background: #eef2fb;
  }
}

/* ── RESPONSIVE ── */
@media (max-width: 680px) {
  body { padding: 0 0 4rem; }
  .page { grid-template-columns: 1fr; box-shadow: none; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .skills-cols { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
}
