/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; }
[hidden] { display: none !important; }

/* ===== Tokens (light) ===== */
:root {
  --bg: #ffffff;
  --bg-alt: #fafaf9;
  --surface: #ffffff;
  --border: #e7e5e4;
  --text: #1c1917;
  --text-muted: #57534e;
  --text-subtle: #78716c;
  --accent: #059669;
  --accent-hover: #047857;
  --accent-soft: #ecfdf5;
  --accent-tint: #d1fae5;
  --shadow: 0 10px 40px rgba(0,0,0,.08);
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1080px;
  --pad: clamp(1.25rem, 5vw, 2.5rem);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --t: 200ms ease;
}
[data-theme="dark"] {
  --bg: #0c0a09;
  --bg-alt: #1c1917;
  --surface: #161311;
  --border: #292524;
  --text: #e7e5e4;
  --text-muted: #a8a29e;
  --text-subtle: #78716c;
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-soft: rgba(16,185,129,.12);
  --accent-tint: rgba(16,185,129,.20);
  --shadow: 0 10px 40px rgba(0,0,0,.5);
}

/* ===== Base ===== */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t), color var(--t);
}
h1, h2, h3 { line-height: 1.1; letter-spacing: -0.02em; font-weight: 800; }
.container { max-width: var(--maxw); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section-alt { background: var(--bg-alt); }
.section-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: 2rem; }
.section-num { color: var(--accent); font-weight: 700; font-size: .85rem; letter-spacing: .1em; }
.section-head h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-size: .8rem; font-weight: 600; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* ===== Nav ===== */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.brand span { color: var(--accent); }
.nav-menu { display: flex; align-items: center; gap: 1.4rem; }
.nav-menu > a { font-size: .9rem; color: var(--text-muted); transition: color var(--t); }
.nav-menu > a:hover { color: var(--accent); }
.lang-switch { display: flex; gap: .15rem; border: 1px solid var(--border); border-radius: 999px; padding: .15rem; }
.lang-switch button { font-size: .72rem; font-weight: 600; padding: .25rem .55rem; border-radius: 999px; color: var(--text-subtle); transition: var(--t); }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.theme-toggle { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); transition: var(--t); }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.nav-toggle { display: none; flex-direction: column; gap: 5px; width: 40px; height: 40px; align-items: center; justify-content: center; }
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: var(--t); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 820px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: fixed; inset: 64px 0 auto 0;
    flex-direction: column; align-items: flex-start; gap: 1rem;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 1.5rem var(--pad); transform: translateY(-120%);
    transition: transform 250ms ease; box-shadow: var(--shadow);
  }
  .nav-menu.open { transform: translateY(0); }
  .lang-switch { margin-top: .5rem; }
}

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; font-weight: 600; padding: .7rem 1.3rem; border-radius: var(--radius-sm); transition: var(--t); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Hero ===== */
.hero { padding: clamp(3rem, 9vw, 6.5rem) 0; }
.hero-inner { display: grid; grid-template-columns: 1fr auto; gap: clamp(2rem, 6vw, 4rem); align-items: center; }
.hero-name { font-size: clamp(2.4rem, 7vw, 4rem); margin: .6rem 0 .3rem; }
.hero-name::after { content: ""; display: block; width: 48px; height: 4px; background: var(--accent); border-radius: 2px; margin-top: 1rem; }
.hero-title { font-size: clamp(1.05rem, 2.6vw, 1.4rem); font-weight: 600; color: var(--text); margin-bottom: .5rem; }
.hero-tech { color: var(--text-subtle); font-size: .95rem; margin-bottom: .9rem; }
.hero-loc { display: inline-flex; align-items: center; gap: .35rem; color: var(--text-muted); font-size: .9rem; margin-bottom: 1.6rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.hero-photo img { width: clamp(160px, 28vw, 240px); height: clamp(160px, 28vw, 240px); border-radius: 50%; object-fit: cover; border: 4px solid var(--accent); box-shadow: var(--shadow); }

/* résumé dropdown */
.resume-menu { position: relative; }
.resume-list { position: absolute; top: calc(100% + .4rem); left: 0; min-width: 160px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .35rem; z-index: 20; }
.resume-list a { display: block; padding: .55rem .8rem; border-radius: 6px; font-size: .9rem; }
.resume-list a:hover { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; text-align: left; }
  .hero-photo { order: -1; }
  .hero-name::after { margin-left: 0; }
}

/* ===== About ===== */
.about-body { max-width: 70ch; font-size: 1.08rem; color: var(--text-muted); }
.about-langs { margin-top: 1.2rem; color: var(--text-muted); font-size: .95rem; }
.about-langs strong { color: var(--text); }

/* ===== Section sub ===== */
.section-sub { color: var(--text-muted); margin: -1.2rem 0 2rem; }

/* ===== Work ===== */
.work-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.work-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: transform var(--t), box-shadow var(--t), border-color var(--t); }
.work-card:hover, .work-card:focus-visible { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.work-thumb { aspect-ratio: 16/10; overflow: hidden; }
.work-thumb img { width: 100%; height: 100%; object-fit: cover; }
.work-body { padding: 1.1rem 1.3rem 1.4rem; }
.work-body h3 { font-size: 1.2rem; margin-bottom: .25rem; }
.work-body p { color: var(--text-muted); font-size: .9rem; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags span { font-size: .72rem; background: var(--accent-soft); color: var(--accent); border-radius: 5px; padding: .2rem .55rem; }

/* ===== Lightbox ===== */
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--pad); }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(2px); }
.lightbox-panel { position: relative; z-index: 1; background: var(--surface); border-radius: var(--radius); max-width: 720px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.lightbox-close { position: absolute; top: .6rem; right: .6rem; z-index: 2; width: 34px; height: 34px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 1.3rem; line-height: 1; display: grid; place-items: center; }
.lightbox-stage { aspect-ratio: 16/10; background: var(--bg-alt); }
.lightbox-stage img { width: 100%; height: 100%; object-fit: cover; }
.lightbox-thumbs { display: flex; gap: .5rem; padding: .7rem; }
.lightbox-thumbs img { width: 64px; height: 42px; object-fit: cover; border-radius: 5px; cursor: pointer; opacity: .6; border: 2px solid transparent; }
.lightbox-thumbs img.active, .lightbox-thumbs img:hover { opacity: 1; border-color: var(--accent); }
.lightbox-info { padding: 0 1.4rem 1.6rem; }
.lightbox-info h3 { font-size: 1.4rem; }
.lightbox-tagline { color: var(--accent); font-weight: 600; font-size: .9rem; margin: .2rem 0 .8rem; }
.lightbox-info .tags { margin-bottom: 1rem; }
.lightbox-desc { color: var(--text-muted); margin-bottom: 1.2rem; }
.lightbox-internal { color: var(--text-subtle); font-size: .85rem; font-style: italic; }
body.lb-open { overflow: hidden; }

/* ===== Press ===== */
.press { background: var(--accent-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: clamp(3rem, 7vw, 4.5rem) 0; text-align: center; }
.press-inner { max-width: 760px; }
.press-eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .75rem; font-weight: 600; color: var(--text-muted); }
.press-pub { margin: .6rem 0 1.2rem; }
.press-logo {
  display: inline-block;
  width: min(280px, 72vw);
  height: 42px;
  background-color: var(--text);
  -webkit-mask: url(/assets/press/conde-nast-traveler.svg) center / contain no-repeat;
  mask: url(/assets/press/conde-nast-traveler.svg) center / contain no-repeat;
}
.press-quote { font-size: clamp(1.05rem, 2.4vw, 1.35rem); line-height: 1.5; font-weight: 500; color: var(--text); font-style: italic; }
.press-quote::before { content: "\201C"; display: block; font-family: Georgia, serif; font-size: 3rem; line-height: .5; color: var(--accent); opacity: .55; margin-bottom: .4rem; font-style: normal; }
.press-cite { color: var(--text-subtle); font-size: .85rem; margin-top: 1rem; }
.press-link { display: inline-block; margin-top: 1.1rem; color: var(--accent); font-weight: 600; }
.press-link:hover { text-decoration: underline; }

/* ===== Open Source ===== */
.repos { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.repo-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.1rem 1.2rem; transition: var(--t); }
.repo-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.repo-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.repo-head h3 { font-size: 1rem; }
.lang-dot { font-size: .72rem; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: .15rem .6rem; }
.repo-card p { color: var(--text-muted); font-size: .88rem; }
.more-link { display: inline-block; margin-top: 1.5rem; color: var(--accent); font-weight: 600; }
.more-link:hover { text-decoration: underline; }

/* ===== 42 Projects ===== */
.edu-stats { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.8rem; }
.edu-stat { font-size: .85rem; color: var(--text-muted); background: var(--accent-soft); border: 1px solid var(--border); border-radius: 999px; padding: .4rem .9rem; }
.edu-stat strong { color: var(--accent); font-weight: 700; }
.edu-stat--soft { color: var(--text-subtle); background: transparent; }
.edu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.edu-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem; transition: var(--t); }
.edu-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.edu-card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .15rem; }
.edu-card-head h3 { font-size: 1.05rem; }
.edu-badge { flex-shrink: 0; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-radius: 999px; padding: .25rem .6rem; border: 1px solid var(--border); color: var(--text-subtle); }
.edu-badge--bonus { background: var(--accent); color: #fff; border-color: var(--accent); }
.edu-meta { font-size: .78rem; color: var(--text-subtle); margin-bottom: .6rem; }
.edu-desc { font-size: .9rem; color: var(--text-muted); }

/* ===== Skills ===== */
.skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.6rem; }
.skill-group h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin-bottom: .8rem; }
.pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.pills li { font-size: .85rem; border: 1px solid var(--border); border-radius: 999px; padding: .4rem .9rem; color: var(--text-muted); transition: var(--t); }
.pills li:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Timeline ===== */
.timeline { position: relative; border-left: 2px solid var(--border); margin-left: .5rem; padding-left: 1.6rem; display: flex; flex-direction: column; gap: 2rem; }
.timeline-item { position: relative; }
.timeline-item::before { content: ""; position: absolute; left: calc(-1.6rem - 6px); top: .45rem; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-alt); }
.timeline-date { font-size: .8rem; font-weight: 600; color: var(--accent); }
.timeline-item h3 { font-size: 1.1rem; margin: .25rem 0 .15rem; }
.timeline-org { color: var(--text-muted); font-size: .92rem; font-weight: 500; }
.timeline-desc { color: var(--text-muted); font-size: .92rem; margin-top: .35rem; max-width: 65ch; }

/* ===== Contact ===== */
.contact { text-align: center; }
.contact-inner { max-width: 640px; }
.contact .section-num { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; }
.contact-cta { font-size: clamp(1.8rem, 5vw, 2.6rem); margin-bottom: .8rem; }
.contact-body { color: var(--text-muted); margin-bottom: 1.6rem; }
.contact-actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; }

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

/* ===== Scroll reveal ===== */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
