/* ============ FONTS (self-hosted, latin subset) ============ */
@font-face {
  font-family: 'Space Grotesk';
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/space-grotesk-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Space Grotesk';
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/space-grotesk-latin-700-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Press Start 2P';
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/press-start-2p-latin-400-normal.woff2') format('woff2');
}

/* ============ DESIGN TOKENS ============ */
/* Dark palette; [data-theme="light"] overrides it. */
:root {
  --bg: #17181b;
  --surface: #1e2024;
  --text: #f2f0ec;
  --text-muted: #9a9ca3;
  --border: #2f323a;
  --red: #e3272c;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-arcade: 'Press Start 2P', monospace;

  --max-width: 780px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --nav-morph: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --text: #141414;
  --text-muted: #6a6a6e;
  --border: #e5e2dc;
  --red: #d41f24;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  padding-top: 96px;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

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

/* ============ FLOATING PILL NAV ============ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--red);
  z-index: 200;
  transform: scaleX(0);
  transform-origin: left;
}

.nav {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 100px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  width: fit-content;
  max-width: calc(100vw - 32px);
  transition: left var(--nav-morph), top var(--nav-morph);
}

.nav-expand-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.nav-expand-btn span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

.nav-inner {
  padding: 14px 14px 14px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
  font-size: 0.94rem;
}

.nav-links a {
  color: var(--text-muted);
  transition: color var(--transition);
  padding: 4px 0;
}

.nav-links a:hover { color: var(--text); }

.nav-links a.active { color: var(--red); }

.nav-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.nav-logo span { color: var(--red); }

.theme-toggle {
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  width: 74px;
  height: 38px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] .toggle-thumb {
  transform: translateX(36px);
}

.toggle-icon {
  width: 20px;
  height: 20px;
  color: #fff;
  position: absolute;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon-bat {
  opacity: 0;
  transform: rotate(90deg) scale(0.4);
}

[data-theme="dark"] .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.4);
}

[data-theme="dark"] .icon-bat {
  opacity: 1;
  transform: none;
}

/* ============ HERO ============ */
.hero {
  padding-top: 100px;
  padding-bottom: 80px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
}

.hero-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 28px 56px rgba(0,0,0,0.4);
}

.hero-photo picture {
  display: block;
  width: 100%;
  height: 100%;
}

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

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--red);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-eyebrow::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.hero-subtitle {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text-muted);
  height: 1.6em;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
}

.hero-subtitle .cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--red);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero .lede {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 36px;
}

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

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--red);
  color: #fff;
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--red) 85%, black);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    transform: translateY(-1px);
  }
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--red);
  color: var(--red);
}

/* After the :hover rules so press feedback wins the tie while clicking. */
.btn:active {
  transform: scale(0.97);
}

/* ============ SECTIONS ============ */
.section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  color: var(--red);
  margin-bottom: 12px;
}

.section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 40px;
}

/* ============ ABOUT ============ */
.about-text {
  max-width: 720px;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.about-text strong { color: var(--text); font-weight: 600; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-top: 32px;
}

.stat {
  background: var(--surface);
  padding: 20px 16px;
}

.stat-num {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--red);
  display: block;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============ EXPERIENCE ============ */
.pipeline-item {
  position: relative;
  padding-left: 32px;
  padding-bottom: 48px;
  border-left: 2px solid var(--border);
}

.pipeline-item:last-child {
  padding-bottom: 0;
}

.pipeline-item::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--red);
}

.pipeline-item.current::before {
  background: var(--red);
}

.pipeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.pipeline-role {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}

.pipeline-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pipeline-company {
  color: var(--red);
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.pipeline-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
  max-width: 600px;
}

.pipeline-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 10px;
}

.metric-chip b { color: var(--red); }

/* ============ SKILLS ============ */
.skills-groups {
  display: grid;
  gap: 28px;
}

.skill-group-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-family: var(--font-mono);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag,
.tool-tag {
  font-size: 0.88rem;
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color var(--transition);
}

.skill-tag:hover,
.tool-tag:hover {
  border-color: var(--red);
}

.tool-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
}

.tool-tag img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

[data-theme="dark"] .icon-invert-dark {
  filter: invert(1);
}

/* ============ ACHIEVEMENTS / CERTIFICATIONS ============ */
.achievements-list {
  display: grid;
  gap: 20px;
}

.achievement {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.achievement-icon {
  font-size: 1.3rem;
}

.achievement-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.achievement-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ============ SIDE PROJECTS ============ */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
}

.project-banner {
  border-bottom: 1px solid var(--border);
}

.project-banner img {
  width: 100%;
  height: auto;
}

.project-body {
  padding: 40px;
}

.project-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--red);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.project-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.98rem;
  margin-bottom: 20px;
  max-width: 560px;
}

.project-principles {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
  list-style: none;
  max-width: 560px;
}

.project-principles li {
  position: relative;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.project-principles li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

.project-metrics,
.project-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.project-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ============ EDUCATION ============ */
.education-list {
  display: grid;
  gap: 20px;
}

.education-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.education-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 5px;
  overflow: hidden;
}

.education-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.education-degree {
  font-weight: 600;
  margin-bottom: 2px;
}

.education-school {
  color: var(--red);
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.education-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============ CONTACT ============ */
.contact-intro {
  color: var(--text-muted);
  max-width: 500px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: border-color var(--transition), transform var(--transition);
}

@media (hover: hover) and (pointer: fine) {
  .contact-link:hover {
    border-color: var(--red);
    transform: translateX(4px);
  }
}

.contact-link:active {
  transform: scale(0.98);
}

.contact-link-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.contact-link-value {
  font-weight: 500;
}

.contact-link-value span { white-space: nowrap; }

/* ============ FOOTER ============ */
footer {
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

/* ============ DARK MODE TOAST ============ */
.toast {
  position: fixed;
  top: 90px;
  right: 24px;
  background: rgba(10, 10, 10, 0.92);
  border-left: 4px solid var(--red);
  border-radius: 0 14px 14px 0;
  padding: 16px 22px;
  z-index: 1000;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1);
  max-width: min(360px, 85vw);
  text-align: right;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

/* Slower on the way in than on the way out. */
.toast.show {
  transform: translateX(0);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-title {
  font-family: var(--font-arcade);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--red);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.6);
  display: block;
  line-height: 1.5;
  margin-bottom: 8px;
}

.toast-desc {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #e8e6e0;
  display: block;
}

/* ============ RESUME PAGE ============ */
.resume-page {
  padding-top: 56px;
  padding-bottom: 80px;
}

.resume-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 48px;
}

.resume-header h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
}

.resume-summary {
  color: var(--text-muted);
  max-width: 620px;
}

.resume-block {
  margin-bottom: 40px;
}

.resume-block-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--red);
  margin-bottom: 16px;
}

.resume-entry {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.resume-entry:last-child { border-bottom: none; }

.resume-entry-top {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.resume-entry-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.resume-entry-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.resume-entry-sub {
  color: var(--red);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.resume-entry-sub a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.resume-entry ul {
  color: var(--text-muted);
  font-size: 0.92rem;
  padding-left: 20px;
}

.resume-entry li { margin-bottom: 6px; }

.resume-list {
  list-style: none;
}

.resume-list li { margin-bottom: 8px; }

.resume-list span { color: var(--text-muted); }

.resume-skill-group { margin-bottom: 20px; }

/* ============ SCROLL-TRIGGERED REVEALS ============ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left {
  transform: translateX(-24px);
}

.reveal.reveal-visible {
  opacity: 1;
  transform: none;
}

.reveal-stagger .reveal:nth-child(2) { transition-delay: 0.06s; }
.reveal-stagger .reveal:nth-child(3) { transition-delay: 0.12s; }
.reveal-stagger .reveal:nth-child(4) { transition-delay: 0.18s; }
.reveal-stagger .reveal:nth-child(5) { transition-delay: 0.24s; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .stat-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .project-body {
    padding: 32px;
  }
}

@media (max-width: 640px) {
  body { padding-top: 82px; }

  .container {
    padding-left: 28px;
    padding-right: 28px;
  }

  .hero { padding-top: 40px; padding-bottom: 56px; }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .hero-photo {
    order: -1;
    max-width: 280px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
  }

  .stat-strip {
    grid-template-columns: 1fr;
  }

  .project-card {
    border-radius: 18px;
  }
  .project-body {
    padding: 24px;
  }

  .resume-header { flex-direction: column; align-items: flex-start; }

  .toast {
    top: 76px;
    right: 16px;
    left: 16px;
    max-width: none;
    padding: 12px 16px;
    text-align: left;
  }
  .toast-title { font-size: 0.6rem; margin-bottom: 6px; }
  .toast-desc { font-size: 0.78rem; }

  /* Pill nav: full width at the top, morphs into a hamburger once scrolled. */
  .nav {
    top: 10px;
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    height: 58px;
    overflow: hidden;
    transition: left var(--nav-morph), top var(--nav-morph), width var(--nav-morph);
  }
  .nav-inner {
    position: absolute;
    inset: 0;
    padding: 12px 8px 12px 14px;
    gap: 4px;
    transition: opacity 0.25s ease;
  }
  .nav-logo {
    font-size: 0.92rem;
  }
  .nav-links {
    gap: 4px;
    font-size: 0.6rem;
  }

  .theme-toggle {
    width: 42px;
    height: 24px;
  }
  .toggle-thumb {
    width: 18px;
    height: 18px;
  }
  [data-theme="dark"] .toggle-thumb {
    transform: translateX(18px);
  }
  .toggle-icon {
    width: 12px;
    height: 12px;
  }

  .nav-expand-btn {
    display: flex;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .nav.nav-collapsed {
    left: calc(100% - 37px);
    width: 58px;
  }
  .nav.nav-collapsed .nav-inner {
    opacity: 0;
    pointer-events: none;
  }
  .nav.nav-collapsed .nav-expand-btn {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
