/* Base */
:root {
  --bg: #0b1020;
  --surface: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --text: #e6e6ea;
  --muted: #b3b3be;
  --accent: #0ea5e9; /* cyan */
  --accent-2: #a78bfa; /* violet */
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --blur: saturate(140%) blur(8px);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fb;
    --surface: rgba(0, 10, 30, 0.04);
    --border: rgba(0, 10, 30, 0.12);
    --text: #0a0a0f;
    --muted: #505062;
  }
}

html, body { height: 100%; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* Theming via data-theme */
body[data-theme="dark"] {
  --bg: #0b1020;
  --surface: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --text: #e6e6ea;
  --muted: #b3b3be;
}

/* Explicit light theme override */
body[data-theme="light"] {
  --bg: #f7f8fb;
  --surface: rgba(0, 10, 30, 0.04);
  --border: rgba(0, 10, 30, 0.12);
  --text: #0a0a0f;
  --muted: #505062;
}

.bg-gradient {
  position: fixed;
  inset: -20% -10% -10% -10%;
  z-index: -2;
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(14,165,233,0.18), transparent 60%),
    radial-gradient(1000px 500px at 90% 20%, rgba(167,139,250,0.18), transparent 58%),
    radial-gradient(800px 400px at 20% 80%, rgba(34,197,94,0.14), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
  filter: saturate(110%);
}

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

.section { padding: 80px 0; }
.section h2 { font-size: 2rem; margin: 0 0 14px; letter-spacing: 0.2px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 36px;
}

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

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px min(5vw, 28px);
  backdrop-filter: var(--blur);
  background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.0));
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow); font-size: 14px; }
.brand-text { letter-spacing: 0.4px; }

.nav-list { display: flex; align-items: center; gap: 18px; list-style: none; margin: 0; padding: 0; }
.nav-list a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.nav-list a:hover { color: var(--text); background: var(--surface); }

.nav-toggle { display: none; background: transparent; border: 0; padding: 8px; border-radius: 8px; }
.nav-toggle span { display: block; width: 24px; height: 2px; margin: 5px 0; background: var(--text); transition: 0.3s; }

.theme-toggle { background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 12px; padding: 8px 10px; cursor: pointer; }
.theme-toggle:hover { filter: brightness(1.1); }

@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  .nav-list { position: absolute; right: 14px; top: 64px; flex-direction: column; align-items: stretch; width: min(280px, 90vw); background: rgba(0,0,0,0.5); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: 14px; padding: 8px; display: none; }
  .nav-list.open { display: flex; }
  .nav-list a { padding: 12px; }
}

/* Hero */
.hero .headline { font-size: clamp(2.2rem, 4vw, 3.2rem); line-height: 1.15; margin: 0 0 12px; }
.accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtitle { color: var(--muted); margin: 0 0 18px; }

.cta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; padding: 10px 14px; border-radius: 12px; border: 1px solid transparent; font-weight: 600; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; box-shadow: var(--shadow); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn:hover { transform: translateY(-1px); transition: transform 160ms ease; }

.social { display: flex; gap: 14px; list-style: none; padding: 0; margin: 18px 0 0; }
.social a { color: var(--muted); text-decoration: none; background: var(--surface); border: 1px solid var(--border); padding: 8px 12px; border-radius: 999px; }
.social a:hover { color: var(--text); }

.hero-media { display: grid; place-items: center; }
.avatar { position: relative; width: 260px; height: 260px; display: grid; place-items: center; }
.avatar-ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent)); filter: blur(12px) saturate(140%); opacity: 0.8; animation: spin 8s linear infinite; }
.avatar-inner { position: relative; width: 220px; height: 220px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,0.06); border: 1px solid var(--border); font-size: 42px; font-weight: 800; letter-spacing: 2px; backdrop-filter: var(--blur); overflow: hidden; }

.avatar-inner img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; border-radius: 50%; transform: scale(0.8); transform-origin: center; }

@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }

/* About */
.highlights { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; padding: 0; list-style: none; }
.highlights li { background: rgba(255,255,255,0.06); border: 1px solid var(--border); padding: 10px 12px; border-radius: 12px; }
.facts { display: grid; gap: 10px; margin: 0; }
.facts div { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: center; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

@media (max-width: 700px) {
  .highlights { grid-template-columns: 1fr; }
  .facts div { grid-template-columns: 1fr; }
}

/* Make CV short profile highlights adaptive and wrap nicely */
#cv .highlights { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
#cv .highlights li { overflow-wrap: anywhere; word-break: normal; hyphens: auto; font-size: clamp(0.95rem, 1.8vw, 1rem); line-height: 1.5; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.skill { display: grid; gap: 6px; }
.skill span { font-size: 22px; }
.skill h3 { margin: 4px 0; }
.skill p { color: var(--muted); margin: 0; }

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

/* Projects */
.projects-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.projects-cta { display: grid; place-items: center; gap: 10px; padding: 24px; }
.btn-large { padding: 12px 18px; font-size: 1rem; }
.project-media { height: 160px; border-radius: 12px; background: linear-gradient(135deg, rgba(14,165,233,0.25), rgba(167,139,250,0.25)); border: 1px solid var(--border); }
.project-body h3 { margin: 12px 0 8px; }
.project-body p { color: var(--muted); margin: 0 0 10px; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tags span { font-size: 12px; padding: 6px 8px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,0.05); color: var(--muted); }
.project-actions { margin-top: 12px; display: flex; gap: 10px; }

.shimmer { position: relative; overflow: hidden; }
.shimmer::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.18) 30%, transparent 60%); animation: shimmer 2.2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

@media (max-width: 1000px) { .projects-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .projects-grid { grid-template-columns: 1fr; } }

/* References */
.logos-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 14px; align-items: center; }
.logo { display: grid; place-items: center; height: 80px; font-weight: 700; color: var(--muted); background: rgba(255,255,255,0.04); }
@media (max-width: 1000px) { .logos-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media (max-width: 640px) { .logos-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* Blog */
.blog-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.post .post-meta { color: var(--muted); font-size: 0.9rem; }
.post h3 { margin: 8px 0; }
.post p { color: var(--muted); margin: 0 0 10px; }
@media (max-width: 1000px) { .blog-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .blog-grid { grid-template-columns: 1fr; } }

/* CV */
.cv-actions .btn-primary { min-width: 200px; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 12px; top: 0; bottom: 0; width: 2px; background: linear-gradient(var(--accent), var(--accent-2)); opacity: 0.6; }
.timeline-item { display: grid; grid-template-columns: 80px 1fr; gap: 14px; position: relative; padding-left: 26px; }
.timeline-item .time { color: var(--muted); }
.timeline-item .content { position: relative; }
.timeline-item::marker { content: none; }
.timeline-item::after { content: ""; position: absolute; left: 6px; top: 10px; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fff, var(--accent)); box-shadow: 0 0 0 3px rgba(14,165,233,0.25); }

/* Contact */
.contact-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.form-row { display: grid; gap: 6px; margin-bottom: 12px; }
label { font-weight: 600; }
input, textarea { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,0.25); }
.form-actions { display: flex; align-items: center; gap: 12px; }
#form-status { color: var(--muted); font-size: 0.95rem; }

/* Footer */
.site-footer { padding: 26px 0 40px; border-top: 1px solid var(--border); background: linear-gradient(180deg, rgba(0,0,0,0.0), rgba(0,0,0,0.25)); }
.footer-content { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.back-to-top { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; opacity: 0.8; }
.back-to-top.show { opacity: 1; }

/* Reveal Animations */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 500ms ease, transform 500ms ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Utilities */
a { color: inherit; }
::selection { background: rgba(14,165,233,0.35); color: #fff; }
