/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --page-bg: #0c0c0c;
  --dark-bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text-secondary: #7d8590;
  --text-muted: #6e7681;
  --accent: #a371f7;
  --accent-secondary: #b794f6;
  --gradient: linear-gradient(135deg, #a371f7, #b794f6);
  --glow: 0 0 20px rgba(163, 113, 247, 0.3);
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --font-body: "Inter", system-ui, sans-serif;
  --font-heading: "Poppins", sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-heading); margin: 0; line-height: 1.3; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img { display: block; max-width: 100%; }
svg { flex-shrink: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(13, 17, 23, 0.6); border-radius: 999px; }
::-webkit-scrollbar-thumb { background: var(--gradient); border-radius: 999px; }

/* ── Background ────────────────────────────────────────────── */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Layout ────────────────────────────────────────────────── */
.layout {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 16px;
}

.panel {
  background: rgba(13, 17, 23, 0.7);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(48, 54, 61, 0.5);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

.sidebar-wrap { margin-bottom: 32px; }
.sidebar { padding: 24px; }
.content-wrap { min-width: 0; }
.content { padding: 24px; outline: none; }

@media (min-width: 768px) {
  .content { padding: 32px; }
}

@media (min-width: 1024px) {
  .layout { display: flex; gap: 32px; align-items: flex-start; }
  .sidebar-wrap { width: 320px; flex-shrink: 0; margin-bottom: 0; position: sticky; top: 32px; }
  .content-wrap { flex: 1; }
  .sidebar,
  .content { height: min(1000px, calc(100dvh - 64px)); min-height: 640px; overflow-y: auto; }
  .content { padding: 40px; }
}

.site-footer {
  position: relative;
  z-index: 1;
  padding: 8px 16px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.profile {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.avatar {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: var(--gradient);
  padding: 4px;
}

.avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  display: grid;
  place-items: center;
}

.avatar-inner img { width: 100%; height: 100%; object-fit: cover; }

.avatar-initials {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.profile-text { flex: 1; min-width: 0; }
.profile-name { font-size: 24px; font-weight: 700; margin-bottom: 4px; }

.pill {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 8px;
  background: var(--surface-hover);
  color: var(--text-secondary);
  font-size: 14px;
}

.contacts-toggle {
  margin-left: auto;
  padding: 8px;
  border-radius: 8px;
  color: var(--accent);
  transition: background-color 0.2s;
}
.contacts-toggle:hover { background: var(--surface-hover); }
.contacts-toggle svg { transition: transform 0.25s; }
.contacts-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.divider { height: 1px; background: var(--border); }

.contacts { display: none; }
.contacts.open { display: block; }
.contacts-inner { display: grid; gap: 16px; margin-bottom: 24px; }

.contact-list { display: grid; gap: 12px; }

.contact-item { display: flex; align-items: flex-start; gap: 12px; }

.icon-box {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-hover);
  color: var(--accent);
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.contact-item:hover .icon-box { background: rgba(163, 113, 247, 0.1); }

.contact-label { font-size: 12px; line-height: 16px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.contact-value {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s;
}
a.contact-value:hover { color: var(--accent); }

.socials { display: flex; justify-content: center; gap: 16px; }
.socials .icon-box { color: var(--text-secondary); }
.socials .icon-box:hover { color: var(--accent); background: rgba(163, 113, 247, 0.1); transform: scale(1.1); box-shadow: var(--glow); }

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
  transition: color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.nav-btn:hover { color: var(--text); background: var(--surface-hover); }
.nav-btn.active { background: var(--gradient); color: #fff; box-shadow: var(--glow); }

.nav-divider { display: none; }

@media (max-width: 480px) {
  .profile { gap: 14px; margin-bottom: 20px; }
  .avatar { width: 64px; height: 64px; border-radius: 14px; }
  .avatar-inner { border-radius: 10px; }
  .avatar-initials { font-size: 22px; }
  .profile-name { font-size: 21px; }
  .profile .pill { padding: 3px 10px; font-size: 13px; white-space: nowrap; }
}

@media (min-width: 1024px) {
  .profile { flex-direction: column; text-align: center; }
  .avatar { width: 128px; height: 128px; }
  .avatar-initials { font-size: 44px; }
  .profile-text { flex: none; }
  .profile-name { font-size: 30px; }
  .contacts-toggle { display: none; }
  .contacts { display: block; }
  .nav-divider { display: block; margin-bottom: 24px; }
  .nav-list { display: grid; gap: 8px; }
  .nav-btn { width: 100%; padding: 12px 16px; }
}

/* ── Section basics ────────────────────────────────────────── */
.section { animation: fade-in 0.45s ease both; }

.section-header { margin-bottom: 32px; }

.section-title {
  position: relative;
  display: inline-block;
  font-size: 30px;
  font-weight: 700;
  padding-bottom: 8px;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 4px;
  border-radius: 999px;
  background: var(--gradient);
}

@media (min-width: 768px) {
  .section-title { font-size: 36px; line-height: 40px; }
}

.subheading { font-size: 24px; font-weight: 700; margin: 48px 0 24px; }

.lede { display: grid; gap: 16px; color: var(--text-secondary); line-height: 1.7; }

.muted-note { color: var(--text-secondary); font-size: 14px; font-style: italic; line-height: 1.6; margin-bottom: 32px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

.grid-2 { display: grid; gap: 24px; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.stack-header { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.stack-header h3 { font-size: 24px; font-weight: 700; }
.gradient-box {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--gradient);
  color: #fff;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ── About ─────────────────────────────────────────────────── */
.service {
  padding: 24px;
  display: flex;
  gap: 16px;
  transition: transform 0.2s;
}
.service:hover { transform: scale(1.02); }
.service-icon { color: var(--accent); transition: transform 0.2s; }
.service:hover .service-icon { transform: scale(1.1); }
.service h4 { font-size: 18px; font-weight: 600; margin-bottom: 8px; transition: color 0.2s; }
.service:hover h4 { color: var(--accent); }
.service p { color: var(--text-secondary); font-size: 14px; line-height: 1.65; }

/* ── Skills ────────────────────────────────────────────────── */
.skill-groups { display: grid; gap: 32px; }

.soft-panel {
  background: rgba(22, 27, 34, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.skill-group h4 { font-size: 18px; font-weight: 600; color: var(--accent); margin-bottom: 16px; }
.skill-list { display: flex; flex-wrap: wrap; gap: 16px; }

.skill { position: relative; }
.skill-box {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: color 0.2s, transform 0.2s, border-color 0.2s, background-color 0.2s;
}
.skill:hover .skill-box,
.skill:focus-within .skill-box { color: var(--accent); transform: scale(1.1); border-color: var(--accent); background: var(--surface); }

.skill-icon {
  width: 32px;
  height: 32px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translate(-50%, 4px);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 2;
}
.skill:hover .tooltip,
.skill:focus-within .tooltip { opacity: 1; transform: translate(-50%, 0); }

/* ── Timeline (education / experience) ─────────────────────── */
.timeline { display: grid; gap: 24px; }

.timeline-item {
  position: relative;
  padding: 0 0 32px 32px;
  border-left: 2px solid var(--border);
  transition: border-color 0.2s;
  animation: fade-in 0.45s ease both;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:hover { border-color: var(--accent); }

.timeline-dot {
  position: absolute;
  left: -9px;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  transition: transform 0.2s;
}
.timeline-item:hover .timeline-dot { transform: scale(1.25); }

.timeline-body { background: rgba(22, 27, 34, 0.5); border-radius: 12px; padding: 24px; transition: background-color 0.2s; }
.timeline-item:hover .timeline-body { background: var(--surface); }
.timeline-body h4 { font-size: 20px; font-weight: 600; margin-bottom: 8px; transition: color 0.2s; }
.timeline-item:hover .timeline-body h4 { color: var(--accent); }
.timeline-org { color: var(--accent-secondary); font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.timeline-period { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }

.bullets { display: grid; gap: 8px; }
.bullets li { display: flex; gap: 8px; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.bullets li::before { content: "•"; color: var(--accent); }

/* ── Projects ──────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 32px; }

.chip-btn {
  padding: 8px 24px;
  border-radius: 12px;
  font-weight: 500;
  text-transform: capitalize;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.chip-btn:hover { color: var(--text); background: var(--surface-hover); }
.chip-btn.active { background: var(--gradient); color: #fff; border-color: transparent; box-shadow: var(--glow); }

.project-card {
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  width: 100%;
  animation: fade-in 0.45s ease both;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.project-card:hover { border-color: rgba(163, 113, 247, 0.5); }

.project-media { position: relative; height: 192px; overflow: hidden; background: var(--surface-hover); }
.project-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.project-card:hover .project-media img { transform: scale(1.1); }

.project-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(to top, var(--dark-bg), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  color: #fff;
}
.project-card:hover .project-overlay,
.project-card:focus-visible .project-overlay { opacity: 1; }

.live-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.75);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(163, 113, 247, 0.4);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #3fb950; box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.6); animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.6); }
  70% { box-shadow: 0 0 0 6px rgba(63, 185, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}

.project-body { padding: 24px; display: flex; flex-direction: column; flex: 1; }
.project-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.project-top h3 { font-size: 18px; font-weight: 600; flex: 1; transition: color 0.2s; }
.project-card:hover .project-top h3 { color: var(--accent); }

.badge {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: capitalize;
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.project-summary {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 12px;
}
.tag.more { color: var(--text-muted); }

.project-footer {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.project-footer-spacer { height: 16px; }
.text-link { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 14px; transition: color 0.2s; }
.text-link:hover { color: var(--accent-secondary); }

.empty-state { color: var(--text-secondary); font-size: 14px; padding: 32px 0; text-align: center; }

/* ── Buttons & forms ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 500;
  transition: box-shadow 0.2s, transform 0.2s, background-color 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn-primary { background: var(--gradient); color: #fff; }
.btn-primary:hover { box-shadow: var(--glow); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-secondary { background: var(--surface-hover); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); }

.form { display: grid; gap: 24px; }
.form-row { display: grid; gap: 24px; }
@media (min-width: 768px) { .form-row { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.field .req { color: #ef4444; }
.input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input::placeholder { color: var(--text-muted); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(163, 113, 247, 0.35); }
textarea.input { resize: vertical; min-height: 140px; }

.contact-card { padding: 24px; }
.contact-card h3 { font-size: 20px; font-weight: 600; margin-bottom: 24px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.form-hint { color: var(--text-muted); font-size: 13px; }
.form-hint a { color: var(--accent); }
.form-hint a:hover { color: var(--accent-secondary); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: modal-fade 0.2s ease both;
}
.modal[hidden] { display: none; }

.modal-dialog {
  width: 100%;
  max-width: 896px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  animation: modal-pop 0.25s ease both;
}

@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } }

.modal-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.modal-category { color: var(--accent); font-size: 14px; text-transform: capitalize; }

.modal-close {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-hover);
  transition: background-color 0.2s;
}
.modal-close:hover { background: rgba(239, 68, 68, 0.2); }

.modal-body { padding: 24px; display: grid; gap: 32px; }
.modal-body h3 { font-size: 20px; font-weight: 600; margin-bottom: 12px; }

.demo-frame {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}
.demo-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.demo-caption { margin-top: 10px; color: var(--text-muted); font-size: 13px; text-align: center; }

@media (max-width: 640px) { .demo-frame { aspect-ratio: 3 / 4; } }

.feature-list { display: grid; gap: 12px; }
@media (min-width: 768px) { .feature-list { grid-template-columns: 1fr 1fr; } }
.feature-list li { display: flex; gap: 10px; color: var(--text-secondary); line-height: 1.55; }
.feature-list li::before { content: "✓"; color: var(--accent); }

.tech-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tech-chip {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 14px;
  transition: border-color 0.2s;
}
.tech-chip:hover { border-color: var(--accent); }

.gallery { display: grid; gap: 16px; }
@media (min-width: 640px) { .gallery { grid-template-columns: 1fr 1fr; } }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 12px; border: 1px solid var(--border); background: #000; }
.gallery figcaption { margin-top: 8px; color: var(--text-muted); font-size: 13px; }

.modal-actions { display: flex; flex-wrap: wrap; gap: 16px; }

body.modal-open { overflow: hidden; }

/* ── Motion preferences ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
