/* Base styles */
:root {
  --bg: #0f1220;
  --panel: #151a2d;
  --text: #e6e8ef;
  --muted: #a7acc0;
  --accent: #5dd6a2;
  --accent-2: #7aa2f7;
  --chip: #242a45;
  --border: rgba(255,255,255,0.08);
  --ring: 0 0 0 3px rgba(93,214,162,0.35);
}

/* Light theme */
:root[data-theme="light"] {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #0b1324;
  --muted: #475569;
  --accent: #2563eb;
  --accent-2: #9333ea;
  --chip: #eef2ff;
  --border: rgba(0,0,0,0.08);
  --ring: 0 0 0 3px rgba(37,99,235,0.25);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s ease, color .25s ease;
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.section {
  padding: 64px 0;
}
.section.alt {
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.03) 20%, transparent 100%);
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 8px 0 16px; }
.muted { color: var(--muted); }

.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: transparent; color: var(--text);
  padding: 10px 14px; border-radius: 10px; text-decoration: none; font-weight: 600;
  transition: transform .12s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary { background: var(--accent); color: #081315; }
.btn.sm { padding: 6px 10px; font-size: .9rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(20,24,41,0.6);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background-color .25s ease, border-color .25s ease;
}
[data-theme="light"] .site-header { background: rgba(255,255,255,0.7); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.1rem; }
.nav-links { list-style: none; display: flex; gap: 18px; padding: 0; margin: 0; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 600; transition: color .2s ease; }
.nav-links a:hover { color: var(--text); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 10px; padding: 8px 10px; cursor: pointer; line-height: 1; transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .12s ease; }
.icon-btn:hover { border-color: color-mix(in oklab, var(--border), transparent 40%); transform: translateY(-1px); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .nav-links { display: none; position: absolute; right: 4%; top: 60px; flex-direction: column; background: var(--panel); padding: 12px; border-radius: 12px; border: 1px solid var(--border); }
  .nav-links.open { display: flex; }
}

/* Hero */
.hero { padding-top: 72px; }
.hero-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 32px; align-items: center; --avatar-x: 26%; --avatar-y: 2%; --avatar-scale: 1.5; }
.hero-text h1 { font-size: clamp(32px, 5vw, 48px); }
.hero-media { display: flex; justify-content: center; }
.avatar-wrap { width: 250px; height: 250px; border-radius: 50%; overflow: hidden; position: relative; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.avatar { width: 100%; height: 100%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); object-fit: cover; object-position: var(--avatar-x, 50%) var(--avatar-y, 50%); transform: scale(var(--avatar-scale, 1)); transform-origin: var(--avatar-x, 50%) var(--avatar-y, 50%); display: block; transition: transform .15s ease, object-position .15s ease; }
.avatar-overlay { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed rgba(255,255,255,.25); pointer-events: none; opacity: 0; transition: opacity .15s ease; }
.avatar-controls { margin-top: 10px; display: flex; gap: 8px; justify-content: center; }
.avatar-editing .avatar-overlay { opacity: 1; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
}

/* Availability section */
.availability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.availability-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.availability-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.availability-card h3 {
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.availability-period {
  color: var(--accent-2);
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.availability-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

@media (max-width: 600px) {
  .availability-grid {
    grid-template-columns: 1fr;
  }
  
  .availability-card {
    padding: 20px;
  }
}

/* Timeline */
.timeline { list-style: none; margin: 24px 0 0; padding: 0; border-left: 2px dashed var(--border); }
.timeline-item { position: relative; margin: 0 0 24px 18px; padding-left: 18px; }
.timeline-item::before { content: ""; position: absolute; left: -10px; top: .5rem; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(93,214,162,0.18); }
.tl-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; justify-content: space-between; }
.tags { list-style: none; display: flex; gap: 8px; padding: 0; margin: 8px 0 0; flex-wrap: wrap; }
.tags li { background: var(--chip); color: var(--text); padding: 6px 10px; border-radius: 999px; font-size: .9rem; border: 1px solid var(--border); }

/* Projects */
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; }
.filter-btn { background: var(--panel); color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 8px 12px; cursor: pointer; transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
.filter-btn.active, .filter-btn:hover { color: var(--text); border-color: color-mix(in oklab, var(--border), transparent 40%); }

.grid { display: grid; gap: 20px; }
.projects-grid { grid-template-columns: repeat(12, 1fr); margin-top: 20px; }
.project { grid-column: span 4; }
@media (max-width: 1000px) { .project { grid-column: span 6; } }
@media (max-width: 640px) { .project { grid-column: span 12; } }

.card { 
  background: var(--panel); 
  border: 1px solid var(--border); 
  border-radius: 14px; 
  padding: 20px; 
  box-shadow: 0 10px 30px rgba(0,0,0,0.18); 
  transition: background-color .25s ease, border-color .25s ease, color .25s ease;
  display: flex;
  flex-direction: column;
  height: fit-content;
}

.card h3 { margin-bottom: 12px; }
.card p { 
  line-height: 1.6; 
  margin: 0 0 16px; 
  flex-grow: 1;
}

.project-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: flex-start; 
  gap: 12px; 
  margin-bottom: 12px; 
}
.project-header h3 { margin-bottom: 0; }

.project-type { 
  font-size: 0.75rem; 
  font-weight: 600; 
  padding: 4px 8px; 
  border-radius: 12px; 
  white-space: nowrap; 
  flex-shrink: 0;
}
.project-type-academic { 
  background: rgba(37, 99, 235, 0.15); 
  color: var(--accent); 
  border: 1px solid rgba(37, 99, 235, 0.3); 
}
.project-type-personal { 
  background: rgba(139, 69, 19, 0.15); 
  color: #d2691e; 
  border: 1px solid rgba(139, 69, 19, 0.3); 
}
[data-theme="light"] .project-type-personal { 
  background: rgba(139, 69, 19, 0.1); 
  color: #8b4513; 
}
.card .links { display: flex; gap: 8px; margin-top: 8px; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 760px) { .skills-grid { grid-template-columns: 1fr; } }
.chips { list-style: none; display: flex; gap: 8px; padding: 0; margin: 8px 0 0; flex-wrap: wrap; }
.chips li { background: var(--chip); border: 1px solid var(--border); color: var(--text); padding: 6px 10px; border-radius: 999px; font-weight: 600; }

/* Contact */
.contact-list { list-style: none; padding: 0; margin: 8px 0 0; }
.contact-list { display: flex; gap: 10px; align-items: center; }
.icon-link { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; color: var(--accent); background: var(--panel); border: 1px solid var(--border); transition: transform .12s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.icon-link:hover { transform: translateY(-1px); border-color: color-mix(in oklab, var(--border), transparent 40%); }
.icon-link:focus-visible { outline: none; box-shadow: var(--ring); }
.icon-link svg { width: 20px; height: 20px; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Footer */
.site-footer { border-top: 1px solid rgba(255,255,255,0.06); padding: 24px 0; margin-top: 32px; color: var(--muted); }
