/* ---------- Tokens ---------- */
:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1b1d21;
  --muted: #5d636e;
  --border: #e4e4e0;
  --accent: #1f5eff;
  --accent-soft: #e8eeff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111215;
    --surface: #1a1c20;
    --text: #e9eaec;
    --muted: #9aa0aa;
    --border: #2a2d33;
    --accent: #7c9cff;
    --accent-soft: #1e2640;
    --shadow: none;
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

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

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

a { color: var(--accent); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 2.75rem); letter-spacing: -.02em; }
h2 { font-size: 1.5rem; letter-spacing: -.01em; margin-bottom: 1.25rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.container { max-width: 880px; margin: 0 auto; padding: 0 20px; }

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

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

.brand { font-weight: 700; color: var(--text); text-decoration: none; }

.nav { display: flex; gap: 24px; }
.nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--text); }

.nav-toggle { display: none; }

@media (max-width: 640px) {
  .nav-toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 6px;
    width: 40px; height: 40px; padding: 8px;
    background: none; border: 0; cursor: pointer;
  }
  .nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s; }
  .nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

  .nav {
    display: none;
    position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .nav.open { display: flex; }
  .nav a { padding: 14px 20px; border-top: 1px solid var(--border); }
}

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section + .section { border-top: 1px solid var(--border); }

.hero { padding-top: 72px; }
.hero-inner { display: grid; grid-template-columns: 180px 1fr; gap: 40px; align-items: center; }
.avatar { width: 180px; height: 180px; border-radius: 50%; object-fit: cover; border: 4px solid var(--surface); box-shadow: var(--shadow); }
.eyebrow { color: var(--muted); margin-bottom: .25em; }
.lead { font-size: 1.15rem; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 1.25em 0 0; }
.tags li { background: var(--accent-soft); color: var(--accent); font-size: .85rem; font-weight: 500; padding: 4px 12px; border-radius: 999px; }

@media (max-width: 640px) {
  .hero-inner { grid-template-columns: 1fr; gap: 24px; text-align: center; }
  .avatar { width: 140px; height: 140px; margin: 0 auto; }
  .tags { justify-content: center; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 24px; }
.card-body { padding: 24px; }
.card-body > :last-child { margin-bottom: 0; }

.meta { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .5em; }

.link { font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Image + text side by side (certificates, projects) */
.cert, .project { display: grid; grid-template-columns: 280px 1fr; align-items: center; }
.cert-image, .project-image { display: block; height: 100%; background: var(--bg); }
.cert-image img, .project-image img { width: 100%; height: 100%; object-fit: cover; }
.cert-image img { object-fit: contain; padding: 16px; }
.project-image img { object-position: left center; }

@media (max-width: 640px) {
  .cert, .project { grid-template-columns: 1fr; }
}

/* Small clickable document inside a card (e.g. award certificate) */
.award { display: flex; align-items: center; gap: 16px; margin-bottom: 1em; }
.award .gallery-item { flex: 0 0 120px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.award img { display: block; width: 100%; height: auto; transition: transform .3s; }
.award .gallery-item:hover img { transform: scale(1.04); }
.award p { margin: 0; font-size: .95rem; }

/* ---------- Gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  padding: 0 24px 24px;
}
.gallery .gallery-item { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--bg); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

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

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .92);
  padding: 56px 64px;
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; max-width: 100%; max-height: 100%; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 160px); object-fit: contain; border-radius: 6px; }
.lightbox figcaption { color: #ddd; font-size: .95rem; margin-top: 12px; text-align: center; }

.lb-btn {
  position: absolute;
  background: rgba(255, 255, 255, .1); color: #fff;
  border: 0; border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 28px; line-height: 1; cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, .2); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }

@media (max-width: 640px) {
  .lightbox { padding: 56px 8px; }
  .lb-prev, .lb-next { top: auto; bottom: 12px; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
