/* =========================================================================
   Design tokens — "soft slate": light, professional, recruiter-friendly
   ========================================================================= */
:root {
  --bg: #edf1f4;
  --surface: #ffffff;
  --surface-alt: #e3e9ed;
  --border: #d3dbe1;
  --text: #14212f;
  --text-muted: #4c5f72;
  --text-faint: #7c8a98;
  --accent: #1b3a5c;
  --accent-dim: #35526f;
  --accent-soft: rgba(27, 58, 92, 0.08);
  --gold: #c99a3f;
  --gold-soft: rgba(201, 154, 63, 0.14);
  --danger: #b3432f;
  --danger-soft: rgba(179, 67, 47, 0.1);

  --font-heading: "Fraunces", "Georgia", serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --max-width: 1120px;
  --transition: 180ms ease;
  --shadow-soft: 0 1px 2px rgba(20, 33, 47, 0.04), 0 8px 24px -12px rgba(20, 33, 47, 0.12);
}

/* =========================================================================
   Reset
   ========================================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  margin: 0;
  line-height: 1.2;
  font-weight: 600;
}

p {
  margin: 0 0 1em;
}
p:last-child {
  margin-bottom: 0;
}

.mono {
  font-family: var(--font-mono);
}

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

/* Focus visibility */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #ffffff;
  padding: 0.6em 1em;
  z-index: 200;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
}
.skip-link:focus {
  left: 1em;
  top: 1em;
}

/* =========================================================================
   Layout helpers
   ========================================================================= */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

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

/* Gentle reveal-on-scroll. Sections are fully visible by default — this is
   progressive enhancement, not a requirement to show content: JS opts a
   section into `.reveal-pending` (making it briefly transparent) only right
   before animating it to `.is-visible`. If JS errors out or
   prefers-reduced-motion is set, content simply stays at its default full
   opacity and nothing is ever hidden. */
.section.reveal-pending {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.section.reveal-pending.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .section.reveal-pending {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
/* Printing/"Save as PDF" lays out the full page without ever firing a
   scroll event, so a section that never got revealed on-screen must still
   print in full — force it regardless of scroll-reveal state. */
@media print {
  .section.reveal-pending {
    opacity: 1 !important;
    transform: none !important;
  }
}

.section-heading {
  font-size: clamp(1.5rem, 2vw + 1rem, 2rem);
  margin-bottom: 40px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: var(--text);
}
.section-heading__tag {
  font-family: var(--font-mono);
  font-size: 0.6em;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.empty-state {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* =========================================================================
   Header / Nav
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(237, 241, 244, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 16px;
  flex-wrap: wrap;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
}
.nav-brand__mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: block;
}

.footer-mark {
  vertical-align: middle;
  margin-right: 6px;
}

.nav-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 0.92rem;
}
.nav-links a {
  color: var(--text-muted);
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.nav-links a:hover {
  color: var(--text);
}
.nav-links a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* =========================================================================
   Buttons / pills / tags / badges
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.75em 1.4em;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform var(--transition), background var(--transition), border-color var(--transition);
}
.btn[hidden] {
  display: none;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn--primary {
  background: var(--accent);
  color: #ffffff;
}
.btn--primary:hover {
  background: var(--accent-dim);
}
.btn--secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn--secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid rgba(201, 154, 63, 0.4);
  color: #8a6a2a;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  margin: 0 0 20px;
  width: fit-content;
}
.status-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.tag--skill {
  color: var(--text);
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.badge--live {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.badge--demo {
  color: #8a6a2a;
  border-color: rgba(201, 154, 63, 0.5);
  background: var(--gold-soft);
}
.badge--source {
  color: var(--text-muted);
  background: var(--surface-alt);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pill {
  font-size: 0.88rem;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

/* =========================================================================
   Hero
   ========================================================================= */
.hero-section {
  padding-top: 72px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.hero-name {
  font-size: clamp(2.2rem, 4vw + 1rem, 3.4rem);
  margin-bottom: 8px;
  color: var(--text);
}

.hero-role {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1.05rem;
  margin-bottom: 18px;
}

.hero-tagline {
  font-size: 1.2rem;
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 14px;
}

.hero-intro {
  color: var(--text-muted);
  max-width: 54ch;
  margin-bottom: 28px;
}

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

.snapshot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-soft);
}
.snapshot-card__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 18px;
}
.snapshot-card__list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.snapshot-card__row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.snapshot-card__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.snapshot-card__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.snapshot-card__value {
  font-size: 0.98rem;
  color: var(--text);
  font-weight: 500;
}

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

.about-photo__img,
.about-photo__placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  object-fit: cover;
}
.about-photo__placeholder {
  display: grid;
  place-items: center;
  background: var(--surface-alt);
  color: var(--text-faint);
  font-size: 0.85rem;
  text-align: center;
  padding: 16px;
}

.about-paragraph {
  color: var(--text-muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-soft);
}
.stat-card__value {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  color: var(--accent);
  font-weight: 600;
}
.stat-card__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
}

/* =========================================================================
   Cards / Projects / Certificates
   ========================================================================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card-grid--certs {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card-grid--research {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-soft);
  transition: border-color var(--transition), transform var(--transition);
}
.card[hidden] {
  display: none;
}
.card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}

.project-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.project-card__logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}
.project-card__title {
  font-size: 1.15rem;
  color: var(--text);
}
.project-card__desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex-grow: 1;
}
.project-card__link,
.cert-card__link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  width: fit-content;
  /* It's a <button> (opens the lightbox, doesn't navigate), styled to read
     exactly like the plain-link it visually replaces. */
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.project-card__link:hover,
.cert-card__link:hover,
.research-card__link:hover {
  text-decoration: underline;
}

.cert-card__name {
  font-size: 1.05rem;
  color: var(--text);
}
.cert-card__meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Certificate category filter pills */
.cert-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}
.filter-pill {
  font-size: 0.85rem;
  font-family: inherit;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.filter-pill:hover {
  border-color: var(--accent-dim);
  color: var(--text);
}
.filter-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Certificate "Show more" collapse */
.cert-showmore-row {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}
.cert-card {
  opacity: 1;
  transition: border-color var(--transition), transform var(--transition), opacity 260ms ease;
}
.cert-card.cert-card--enter {
  opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
  .cert-card {
    transition: border-color var(--transition), transform var(--transition);
  }
  .cert-card.cert-card--enter {
    opacity: 1;
  }
}

/* Certificate thumbnails */
.cert-card--clickable {
  cursor: pointer;
}
.cert-card__thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cert-card__thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cert-card__thumb--pdf {
  color: var(--text-faint);
}

/* Certificate lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}
.lightbox[hidden] {
  display: none;
}
.lightbox__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 33, 47, 0.6);
}
.lightbox__content {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  width: fit-content;
  max-width: 92vw;
  max-height: 88vh;
  padding: 40px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  overflow: auto;
}
.lightbox__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.lightbox__close:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}
.lightbox__body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}
.lightbox__image {
  display: block;
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.lightbox__frame {
  width: min(90vw, 900px);
  height: 70vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}
.lightbox__external {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}
.lightbox__external:hover {
  text-decoration: underline;
}

.research-card__title {
  font-size: 1.1rem;
  color: var(--text);
}
.research-card__context {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.research-card__desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex-grow: 1;
}
.research-card__link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  width: fit-content;
}

/* =========================================================================
   Skills
   ========================================================================= */
.skill-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.skill-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}
.skill-group__title {
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: 14px;
  font-family: var(--font-heading);
}

/* =========================================================================
   Timeline (simple line-and-dot, understated)
   ========================================================================= */
.timeline-list {
  position: relative;
  padding-left: 28px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.timeline-entry {
  position: relative;
}
.timeline-entry__marker {
  position: absolute;
  left: -33px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
}
.timeline-entry__date {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.timeline-entry__title {
  font-size: 1.12rem;
  margin-bottom: 2px;
  color: var(--text);
}
.timeline-entry__org {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.timeline-entry__desc {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* =========================================================================
   Contact
   ========================================================================= */
.contact-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: space-between;
  align-items: center;
}
.contact-block {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.contact-block--socials {
  font-size: 0.92rem;
  color: var(--text-muted);
}
.contact-link:hover {
  color: var(--accent);
}

/* =========================================================================
   Footer / states
   ========================================================================= */
.site-footer {
  padding: 32px 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.82rem;
}

.load-state {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text-muted);
  z-index: 300;
}
.load-state[hidden] {
  display: none;
}
.load-state--error {
  color: var(--danger);
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
  .about-photo {
    max-width: 200px;
  }
  .section {
    padding: 64px 0;
  }
}

@media (max-width: 560px) {
  .nav-links {
    gap: 14px;
    font-size: 0.82rem;
  }
  .contact-grid {
    flex-direction: column;
    align-items: flex-start;
  }
}
