/* ========== RESET & VARIABLES ========== */
:root {
  --bg: #050a12;
  --surface: rgba(255,255,255,.04);
  --surface-hover: rgba(255,255,255,.07);
  --border: rgba(255,255,255,.08);
  --border-hover: rgba(255,255,255,.16);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.60);
  --accent: #3b82f6;
  --accent2: #10b981;
  --radius: 16px;
  --radius-sm: 12px;
  --max: 960px;
  --gap: 12px;
  --section-gap: 16px;
  --pad: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100dvh;
}

/* Subtle ambient glow */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 15% 8%, rgba(59,130,246,.12), transparent 60%),
    radial-gradient(ellipse 500px 350px at 85% 15%, rgba(16,185,129,.08), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

::selection { background: rgba(59,130,246,.30); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul { list-style: none; }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }

/* ========== LAYOUT ========== */
.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 12px 48px;
}

/* ========== NAV ========== */
.topbar {
  position: sticky;
  top: 8px;
  z-index: 100;
  margin-bottom: var(--section-gap);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 14px;
  border-radius: 999px;
  background: rgba(5,10,18,.75);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mark {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  flex-shrink: 0;
}

.brand-name {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-links {
  display: none;
  gap: 2px;
  align-items: center;
}

.nav-link {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  transition: color .15s, background .15s;
}
.nav-link:hover, .nav-link:focus-visible {
  color: #fff;
  background: rgba(255,255,255,.06);
}

/* Hamburger */
.menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background .15s;
}
.menu-btn:hover { background: var(--surface-hover); }

.menu-icon {
  width: 16px; height: 14px;
  position: relative;
}
.menu-icon span {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  border-radius: 2px;
  background: rgba(255,255,255,.8);
  transition: transform .2s ease, top .2s ease, opacity .15s ease;
}
.menu-icon span:nth-child(1) { top: 0; }
.menu-icon span:nth-child(2) { top: 6px; }
.menu-icon span:nth-child(3) { top: 12px; }

/* Mobile dropdown */
.mobile-menu {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .25s ease;
  margin-top: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(5,10,18,.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}
.mobile-menu-inner {
  overflow: hidden;
}
.mobile-menu a {
  display: block;
  padding: 14px 16px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  transition: color .15s, background .15s;
}
.mobile-menu a:first-child { border-top: none; }
.mobile-menu a:hover, .mobile-menu a:focus-visible {
  color: #fff;
  background: rgba(255,255,255,.04);
}

/* Menu open state */
.menu-open .mobile-menu { grid-template-rows: 1fr; }
.menu-open .menu-icon span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.menu-open .menu-icon span:nth-child(2) { opacity: 0; }
.menu-open .menu-icon span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

@media (min-width: 768px) {
  .menu-btn { display: none; }
  .mobile-menu { display: none; }
  .nav-links { display: flex; }
}

/* ========== SECTION SHARED ========== */
.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
}

section {
  margin-top: var(--section-gap);
}

.section-inner {
  padding: var(--pad);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: var(--gap);
}

.section-header h2 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.section-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(59,130,246,.1);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* ========== HERO ========== */
.hero {
  padding: var(--pad);
}

.hero-grid {
  display: grid;
  gap: var(--gap);
}

.hero-main {
  padding: 20px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0,0,0,.15);
}

.kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(59,130,246,.08);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

h1 {
  font-size: clamp(24px, 6vw, 36px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.025em;
  margin-bottom: 12px;
}

.grad {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  max-width: 60ch;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  font-size: 13px;
  transition: background .15s, border-color .15s, transform .08s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  width: 100%;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-hover); }
.btn:active { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(135deg, rgba(59,130,246,.25), rgba(16,185,129,.15));
  border-color: rgba(59,130,246,.25);
  color: #fff;
}
.btn.primary:hover {
  background: linear-gradient(135deg, rgba(59,130,246,.35), rgba(16,185,129,.22));
}

/* Inline SVG icons for buttons */
.btn svg {
  width: 14px; height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (min-width: 480px) {
  .btn { width: auto; }
}

/* Hero sidebar */
.hero-side {
  display: grid;
  gap: 8px;
}

.mini-card {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}

.mini-card h3 {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.40);
  margin-bottom: 6px;
}

.mini-card p {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.5;
}

/* Headshot */
.headshot-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.headshot {
  width: 72px; height: 72px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}
.headshot img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.headshot-fallback:not([hidden]) {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  color: #fff;
  background: linear-gradient(135deg, rgba(59,130,246,.3), rgba(16,185,129,.25));
}

.role-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.role-info strong {
  font-size: 14px;
  font-weight: 800;
}
.role-info span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

@media (min-width: 768px) {
  .hero-grid {
    grid-template-columns: 1.4fr .6fr;
    align-items: stretch;
  }
  .headshot { width: 88px; height: 88px; }
}

/* ========== EXPERIENCE ========== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  transition: border-color .2s;
}
.role:hover { border-color: var(--border-hover); }

.role-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.role-title {
  font-size: 14px;
  font-weight: 700;
}
.role-title a {
  color: var(--accent);
  text-decoration: none;
}
.role-title a:hover {
  text-decoration: underline;
}

.role-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  background: rgba(255,255,255,.04);
  padding: 2px 8px;
  border-radius: 999px;
}

.role ul {
  margin-top: 8px;
  padding-left: 16px;
  list-style: disc;
}

.role li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 4px 0;
}

.role .muted-text {
  color: var(--muted);
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
}

/* ========== SKILLS ========== */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.skill-tile {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  transition: border-color .2s, background .2s;
}
.skill-tile:hover {
  border-color: var(--border-hover);
  background: rgba(255,255,255,.04);
}

.skill-tile strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 4px;
}

.skill-tile p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (min-width: 480px) {
  .skills-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
  .skills-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* ========== CERTS / EDUCATION ========== */
.info-tile {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  font-size: 14px;
  line-height: 1.5;
}

.info-tile a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(59,130,246,.4);
  transition: text-decoration-color .15s;
}
.info-tile a:hover {
  text-decoration-color: var(--accent);
}

/* ========== FOOTER ========== */
footer {
  margin-top: 32px;
  padding: 16px;
  text-align: center;
  color: rgba(255,255,255,.35);
  font-size: 12px;
  font-weight: 500;
}

/* ========== FADE-IN ANIMATION ========== */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .4s ease, transform .4s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 767px) {
  .role-top {
    flex-direction: column;
  }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .fade-in { opacity: 1; transform: none; }
}

/* ========== SAFE AREA (notch devices) ========== */
@supports (padding: env(safe-area-inset-bottom)) {
  .wrap {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(48px, env(safe-area-inset-bottom));
  }
}
