/* ---------- Theme tokens ---------- */
:root,
:root[data-theme="dark"] {
  --bg: #0d1117;
  --bg-alt: #11161d;
  --surface: #161b22;
  --surface-hover: #1c232c;
  --border: #232a34;
  --text: #e6edf3;
  --text-muted: #9aa7b5;
  --accent: #4fd1c5;
  --accent-strong: #38b8ac;
  --accent-contrast: #04211e;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
}

:root[data-theme="light"] {
  --bg: #f7f9fb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f0f4f6;
  --border: #e2e8ef;
  --text: #1a2027;
  --text-muted: #5b6572;
  --accent: #0f8f82;
  --accent-strong: #0c7168;
  --accent-contrast: #ffffff;
  --shadow: 0 8px 24px rgba(15, 32, 45, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.25s ease, color 0.25s ease;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.nowrap { white-space: nowrap; }
.muted { color: var(--text-muted); font-weight: 400; font-size: 0.7em; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.5px;
}
.brand span { color: var(--accent); }

.main-nav {
  display: flex;
  gap: 28px;
}

.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease;
}
.main-nav a:hover { color: var(--accent); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text);
}
#theme-toggle:hover { background: var(--surface-hover); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  width: 38px;
  height: 38px;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 22px;
  background: var(--text);
  margin: 0 auto;
}

/* ---------- Hero ---------- */
.hero {
  padding: 96px 0 72px;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 48px;
}

.hero-text { flex: 1; min-width: 0; }

.hero-photo {
  flex-shrink: 0;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--accent);
  box-shadow: var(--shadow);
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 760px) {
  .hero-inner {
    flex-direction: column-reverse;
    text-align: center;
    gap: 28px;
  }
  .hero-photo { width: 160px; height: 160px; }
  .hero-meta, .cta-row { justify-content: center; }
}

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin: 0 0 8px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 0 0 12px;
  line-height: 1.15;
}

.role {
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 20px;
}

.lede {
  max-width: 680px;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0 0 28px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 11px 22px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { background: var(--accent-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section.alt { background: var(--bg-alt); }

.section-title {
  font-size: 1.7rem;
  margin: 0 0 36px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.tag {
  font-family: "SFMono-Regular", Consolas, monospace;
  color: var(--accent);
  font-size: 0.9rem;
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 6px;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 32px;
  align-items: start;
}

.about-text {
  color: var(--text-muted);
  font-size: 1.02rem;
  margin: 0;
}
.about-text strong { color: var(--text); }

.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.about-card h3 { margin: 0 0 14px; font-size: 1rem; color: var(--accent); }

.facts-list { list-style: none; margin: 0; padding: 0; }
.facts-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  color: var(--text-muted);
}
.facts-list li:last-child { border-bottom: none; }
.facts-list strong { color: var(--text); display: block; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }

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

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.skill-card h3 { margin: 0 0 14px; font-size: 1rem; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 28px;
  border-left: 2px solid var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 40px;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -34px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  justify-content: space-between;
}
.timeline-head h3 { margin: 0; font-size: 1.1rem; }

.timeline-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  white-space: nowrap;
}

.timeline-org { color: var(--accent); font-weight: 600; font-size: 0.92rem; margin: 4px 0 12px; }

.timeline-content ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-muted);
}
.timeline-content li { margin-bottom: 6px; font-size: 0.95rem; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  font-size: 0.9rem;
  list-style: none;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- Education ---------- */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.edu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
}
.edu-card h3 { margin: 0 0 8px; font-size: 1.02rem; }
.edu-org { margin: 0 0 4px; color: var(--accent); font-size: 0.9rem; font-weight: 600; }
.edu-date { margin: 0 0 10px; color: var(--text-muted); font-size: 0.85rem; font-family: "SFMono-Regular", Consolas, monospace; }
.edu-note { margin: 0; color: var(--text-muted); font-size: 0.88rem; }

/* ---------- Certifications ---------- */
.cert-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.cert-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
.cert-tab.active,
.cert-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.cert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.cert-card h3 { margin: 0 0 8px; font-size: 0.98rem; }
.cert-issuer { margin: 0 0 4px; color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.cert-date { margin: 0; color: var(--text-muted); font-size: 0.82rem; font-family: "SFMono-Regular", Consolas, monospace; }

/* ---------- Contact ---------- */
.contact-lede { color: var(--text-muted); margin: -20px 0 32px; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.contact-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.contact-icon { font-size: 1.4rem; }
.contact-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; }
.contact-value { font-weight: 600; word-break: break-word; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- HTMX indicator ---------- */
.spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
  animation: spin 0.7s linear infinite;
}
.htmx-request.spinner,
.htmx-request .spinner { display: inline-block; }
.htmx-indicator { opacity: 0; }
.htmx-request.htmx-indicator,
.htmx-request .htmx-indicator { opacity: 1; }

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

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .main-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 16px;
    display: none;
  }
  .main-nav.open { display: flex; }
  .nav-toggle { display: flex; }
  .about-grid { grid-template-columns: 1fr; }
}
