/* ============================================================
   Theme tokens
   - Default (no data-theme + system=dark, OR data-theme="dark"):
     dark palette below in :root
   - data-theme="light" OR (no data-theme + system=light):
     light palette in the override blocks
   ============================================================ */
:root {
  --bg: #0a0e1a;
  --bg-elev: #111728;
  --bg-card: #141b2e;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e6e9f2;
  --text-dim: #9aa3b8;
  --text-faint: #6b7390;
  --accent: #6ee7b7;
  --accent-2: #38bdf8;
  --accent-3: #c084fc;
  --warning: #fbbf24;
  --chip-bg: rgba(255, 255, 255, 0.04);
  --hero-name-grad: linear-gradient(180deg, #ffffff 0%, #b8c0d8 100%);
  --mark-shadow: 0 8px 24px rgba(56, 189, 248, 0.25);
  --body-glow:
    radial-gradient(circle at 15% 0%, rgba(56, 189, 248, 0.10), transparent 45%),
    radial-gradient(circle at 85% 10%, rgba(110, 231, 183, 0.08), transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(192, 132, 252, 0.06), transparent 60%);
  --toggle-bg: rgba(255, 255, 255, 0.04);
  --toggle-bg-hover: rgba(255, 255, 255, 0.10);
  --maxw: 1080px;
  --radius: 14px;
  --radius-sm: 8px;
  color-scheme: dark;
}

/* Light overrides */
:root[data-theme="light"],
:root:not([data-theme="dark"]) {
  /* placeholder so the media query below can target unset state */
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fbfcfe;
    --bg-elev: #f1f4fb;
    --bg-card: #ffffff;
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.18);
    --text: #0f1729;
    --text-dim: #475569;
    --text-faint: #94a3b8;
    --accent: #0d9488;
    --accent-2: #0369a1;
    --accent-3: #7c3aed;
    --warning: #b45309;
    --chip-bg: rgba(15, 23, 42, 0.04);
    --hero-name-grad: linear-gradient(180deg, #0f1729 0%, #3b4763 100%);
    --mark-shadow: 0 8px 24px rgba(3, 105, 161, 0.18);
    --body-glow:
      radial-gradient(circle at 15% 0%, rgba(56, 189, 248, 0.12), transparent 45%),
      radial-gradient(circle at 85% 10%, rgba(13, 148, 136, 0.10), transparent 50%),
      radial-gradient(circle at 50% 100%, rgba(124, 58, 237, 0.07), transparent 60%);
    --toggle-bg: rgba(15, 23, 42, 0.04);
    --toggle-bg-hover: rgba(15, 23, 42, 0.10);
    color-scheme: light;
  }
}

/* Explicit user choice — always wins over system pref */
:root[data-theme="light"] {
  --bg: #fbfcfe;
  --bg-elev: #f1f4fb;
  --bg-card: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #0f1729;
  --text-dim: #475569;
  --text-faint: #94a3b8;
  --accent: #0d9488;
  --accent-2: #0369a1;
  --accent-3: #7c3aed;
  --warning: #b45309;
  --chip-bg: rgba(15, 23, 42, 0.04);
  --hero-name-grad: linear-gradient(180deg, #0f1729 0%, #3b4763 100%);
  --mark-shadow: 0 8px 24px rgba(3, 105, 161, 0.18);
  --body-glow:
    radial-gradient(circle at 15% 0%, rgba(56, 189, 248, 0.12), transparent 45%),
    radial-gradient(circle at 85% 10%, rgba(13, 148, 136, 0.10), transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(124, 58, 237, 0.07), transparent 60%);
  --toggle-bg: rgba(15, 23, 42, 0.04);
  --toggle-bg-hover: rgba(15, 23, 42, 0.10);
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image: var(--body-glow);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

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

.skip-link {
  position: absolute; left: -10000px; top: auto;
  background: var(--accent); color: var(--bg);
  padding: 8px 14px; border-radius: 4px; font-weight: 600;
}
.skip-link:focus { left: 16px; top: 16px; }

/* Hero */
.hero {
  padding: 32px 0 56px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.hero__top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; margin-bottom: 48px;
}

.hero__mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--bg);
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.05em;
  box-shadow: var(--mark-shadow);
}

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

.hero__nav {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.hero__nav a {
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.hero__nav a:hover {
  color: var(--text);
  background: var(--bg-elev);
}

/* Theme toggle */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  background: var(--toggle-bg);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.theme-toggle:hover {
  background: var(--toggle-bg-hover);
  color: var(--text);
  border-color: var(--border-strong);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
.theme-toggle:active { transform: scale(0.95); }
.theme-toggle svg { display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: none; }
}

.hero__eyebrow {
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  margin: 0 0 18px;
  letter-spacing: 0.02em;
}

.hero__name {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  background: var(--hero-name-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero__tagline {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-dim);
  max-width: 720px;
  margin: 0 0 32px;
  line-height: 1.55;
}

.accent { color: var(--accent); font-weight: 500; }

.hero__contacts {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-wrap: wrap;
  gap: 10px 14px;
}

.hero__contacts li, .hero__contacts a {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-dim);
  font-size: 14px;
  padding: 8px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.15s ease;
}
.hero__contacts a:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--bg-card);
}
.hero__contacts svg { flex-shrink: 0; opacity: 0.7; }

/* Sections */
.section {
  padding: 64px 0;
  border-bottom: 1px solid var(--border);
}
.section:last-of-type { border-bottom: none; }

.section__title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 32px;
  display: flex; align-items: center; gap: 14px;
}
.section__title::before {
  content: '';
  width: 28px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}

.prose {
  color: var(--text-dim);
  font-size: 1.0625rem;
  line-height: 1.7;
  max-width: 820px;
  margin: 0 0 16px;
}
.prose strong { color: var(--text); font-weight: 600; }

/* Skills */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.25s ease;
}
.skill-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.skill-card h3 {
  margin: 0 0 14px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.chips {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.chips li {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  padding: 5px 10px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

/* Experience */
.job {
  position: relative;
  padding: 0 0 36px 28px;
  margin-bottom: 8px;
  border-left: 2px solid var(--border);
}
.job::before {
  content: '';
  position: absolute;
  left: -7px; top: 6px;
  width: 12px; height: 12px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--bg);
}
.job:last-child { border-left-color: transparent; padding-bottom: 0; }

.job__header {
  display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: baseline;
  gap: 8px 24px;
  margin-bottom: 14px;
}

.job__role {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}
.job__company {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.job__period {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--accent);
  white-space: nowrap;
}

.job__points {
  list-style: none;
  padding: 0; margin: 0;
}
.job__points li {
  position: relative;
  padding: 6px 0 6px 20px;
  color: var(--text-dim);
  font-size: 0.97rem;
  line-height: 1.65;
}
.job__points li::before {
  content: '▸';
  position: absolute;
  left: 0; top: 6px;
  color: var(--accent);
  font-size: 0.85rem;
}
.job__points strong { color: var(--text); font-weight: 600; }

/* Projects */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.project {
  padding: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.25s ease;
}
.project:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.project h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
}
.project__stack {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent-2);
  margin: 0 0 12px;
  letter-spacing: 0.02em;
}
.project p:last-child {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.93rem;
  line-height: 1.6;
}

/* Education */
.education {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.edu {
  padding: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.25s ease;
}
.edu h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
}
.edu__note {
  font-weight: 400;
  font-size: 0.8em;
  color: var(--text-faint);
}
.edu__school {
  margin: 0 0 4px;
  color: var(--text-dim);
  font-size: 0.92rem;
}
.edu__period {
  margin: 0;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

/* Footer */
.footer {
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.85rem;
  text-align: center;
}
.footer p { margin: 4px 0; }
.footer__meta { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }

/* Responsive */
@media (max-width: 640px) {
  .hero { padding: 24px 0 40px; }
  .hero__top { margin-bottom: 32px; }
  .hero__nav { display: none; }
  .section { padding: 48px 0; }
  .section__title { font-size: 1.3rem; }
  .job { padding-left: 22px; }
  .job__header { flex-direction: column; }
  .job__period { font-size: 0.75rem; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Print — keep the same site usable as a printable CV */
@media print {
  body { background: white; color: black; }
  .hero, .section, .footer { border-color: #ddd; }
  .hero__nav, .skip-link, .theme-toggle { display: none; }
  .hero__name { -webkit-text-fill-color: black; background: none; }
  .skill-card, .project, .edu { background: white; border-color: #ddd; }
  .chips li { background: #f5f5f5; }
  a { color: black; text-decoration: underline; }
}
