:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #efeee8;
  --ink: #15181c;
  --muted: #5d636b;
  --line: #e0ded6;
  --accent: #0f766e;
  --accent-rgb: 15, 118, 110;
  --accent-soft: #dcefeb;
  --on-accent: #ffffff;
  --code-bg: #15181c;
  --code-ink: #e7e9ec;
  --shadow: 0 1px 2px rgba(20, 22, 26, .05), 0 12px 32px -18px rgba(20, 22, 26, .22);
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;
  --radius: 14px;
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0c0f12;
  --surface: #14181d;
  --surface-2: #1b2026;
  --ink: #eef0f2;
  --muted: #9aa3ad;
  --line: #262c33;
  --accent: #2dd4bf;
  --accent-rgb: 45, 212, 191;
  --accent-soft: #123430;
  --on-accent: #06211e;
  --code-bg: #0a0d10;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; letter-spacing: -.015em; margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .8125rem; }
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.is-stuck { border-bottom-color: var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.125rem; text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 8px; }
#site-nav ul { display: flex; gap: 4px; }
#site-nav a {
  display: block; padding: 6px 12px; border-radius: 8px;
  text-decoration: none; font-size: .9375rem; color: var(--muted);
  transition: color .15s, background-color .15s;
}
#site-nav a:hover { color: var(--ink); }
#site-nav a.is-active, #site-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
#theme-toggle .fa-sun { display: none; }
#theme-toggle .fa-moon { display: inline-block; }
[data-theme="dark"] #theme-toggle .fa-sun { display: inline-block; }
[data-theme="dark"] #theme-toggle .fa-moon { display: none; }
#nav-toggle { display: none; }

@media (max-width: 760px) {
  #nav-toggle { display: inline-grid; }
  #site-nav {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 16px;
  }
  #site-nav.is-open { display: block; }
  #site-nav ul { flex-direction: column; }
  #site-nav a { padding: 10px 12px; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); text-decoration: none; font-weight: 600; font-size: .9375rem;
  transition: transform .15s, border-color .15s, color .15s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { color: var(--on-accent); }

/* Hero */
.hero { position: relative; overflow: hidden; }
#net {
  position: absolute; inset: 0;
  -webkit-mask-image: linear-gradient(100deg, transparent 15%, #000 75%);
  mask-image: linear-gradient(100deg, transparent 15%, #000 75%);
  pointer-events: none;
}
.hero-grid {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 72px); align-items: center;
  padding-block: clamp(56px, 10vw, 112px) clamp(48px, 7vw, 80px);
}
.eyebrow {
  font-family: var(--mono); font-size: .8125rem; color: var(--accent);
  letter-spacing: .02em; margin-bottom: 18px;
}
.hero h1 { font-size: clamp(2.75rem, 7.4vw, 5rem); font-weight: 700; line-height: 1.02; }
.hero-lede { font-size: clamp(1.25rem, 2.5vw, 1.625rem); font-family: var(--display); margin-top: 20px; line-height: 1.3; }
#rotator { display: inline-block; color: var(--accent); transition: opacity .3s, transform .3s; }
#rotator.is-out { opacity: 0; transform: translateY(8px); }
.hero-summary { color: var(--muted); max-width: 56ch; margin-top: 18px; font-size: 1.0625rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.socials a {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 10px; color: var(--muted); text-decoration: none;
  transition: color .15s, background-color .15s;
}
.socials a:hover { color: var(--accent); background: var(--surface-2); }
.portrait { justify-self: end; max-width: 340px; width: 100%; position: relative; }
.portrait img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 24px; box-shadow: var(--shadow);
}
.portrait::before {
  content: ""; position: absolute; inset: 14px -14px -14px 14px;
  border: 1.5px solid var(--accent); border-radius: 24px; z-index: -1;
}
.hero-media { position: relative; z-index: 0; }

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
  .portrait { justify-self: start; max-width: 168px; }
  .portrait::before { inset: 8px -8px -8px 8px; }
}

/* Stats */
.stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-block: 1px solid var(--line); margin: 0;
}
.stat { padding: 24px 0; display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; }
.stat + .stat { padding-left: clamp(12px, 4vw, 40px); margin-left: clamp(0px, 1vw, 8px); border-left: 1px solid var(--line); }
.stat dd { margin: 0; font-family: var(--display); font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 700; line-height: 1.1; }
.stat dt { color: var(--muted); font-size: .875rem; line-height: 1.35; }

/* Sections */
.section { padding-block: clamp(56px, 8vw, 96px); }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 32px; margin-bottom: 36px; }
.section-head h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.text-link { color: var(--accent); font-weight: 600; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(40px, 7vw, 80px); }
.subhead { font-size: 1.25rem; margin-bottom: 18px; }
.subhead:not(:first-child) { margin-top: 44px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* Experience */
.timeline { border-left: 1.5px solid var(--line); margin-left: 5px; }
.job { position: relative; padding: 0 0 30px 28px; }
.job:last-child { padding-bottom: 0; }
.job::before {
  content: ""; position: absolute; left: -6.5px; top: 8px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--muted);
}
.job.is-current::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 20px; }
.job h3 { font-size: 1.1875rem; }
.job-company { color: var(--muted); }
.job-period { font-family: var(--mono); font-size: .8125rem; color: var(--muted); padding-top: 4px; }
.job ul { list-style: disc; padding-left: 18px; margin-top: 10px; color: var(--muted); }
.job li + li { margin-top: 4px; }

.work-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.work {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; gap: 10px;
}
.work-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 20px; }
.work h3 { font-size: 1.1875rem; }
.work-client { font-family: var(--mono); font-size: .8125rem; color: var(--accent); }
.work p:not(.work-client):not(.job-period) { color: var(--muted); font-size: .9375rem; }
.work .pills { margin-top: auto; padding-top: 6px; }

.edu-list li + li { margin-top: 20px; }
.edu-note { font-size: .875rem; margin-top: 6px; line-height: 1.5; }
.edu-list h3 { font-size: 1.0625rem; }
.edu-list p { color: var(--muted); font-size: .9375rem; }
.lang-list { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 28px 40px; }
.skill-group h3 { font-size: 1.0625rem; margin-bottom: 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills li {
  background: var(--surface); border: 1px solid var(--line);
  padding: 4px 11px; border-radius: 8px; font-size: .875rem;
}

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.project, .article-card, .repo {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; transition: border-color .18s, box-shadow .18s, translate .18s;
}
.project:hover, .article-card:hover, .repo:hover { border-color: var(--accent); box-shadow: var(--shadow); translate: 0 -2px; }
.project-top { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.project-thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--surface-2); }
.tag {
  font-family: var(--mono); font-size: .75rem; color: var(--accent);
  background: var(--accent-soft); padding: 3px 9px; border-radius: 6px; white-space: nowrap;
}
.project h3, .article-card h3, .repo h3 { font-size: 1.1875rem; margin-bottom: 6px; }
.project p, .article-card p, .repo p { color: var(--muted); font-size: .9375rem; }
.project-links { display: flex; gap: 18px; margin-top: auto; padding-top: 16px; }
.project-links a { display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; font-weight: 600; text-decoration: none; }
.project-links a:hover { color: var(--accent); }
.project-links .is-live { color: var(--accent); }
.article-card, .repo { text-decoration: none; }
.article-card .tag { align-self: start; margin-bottom: 14px; }
.read-more { color: var(--accent); font-weight: 600; font-size: .9rem; margin-top: auto; padding-top: 16px; }
.repo .repo-meta { margin-top: auto; padding-top: 14px; font-size: .75rem; }
.repo h3 { text-transform: capitalize; }

/* Certificates */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.cert {
  display: flex; flex-direction: column; padding: 0; text-align: left; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .18s, box-shadow .18s, translate .18s;
}
.cert:hover { border-color: var(--accent); box-shadow: var(--shadow); translate: 0 -2px; }
.cert img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; background: var(--surface-2); }
.cert-body { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; }
.cert-title { font-weight: 600; font-size: .9375rem; line-height: 1.35; }
.cert-issuer { color: var(--muted); font-size: .8125rem; }

#lightbox {
  border: 0; padding: 0; background: transparent; color: #fff;
  max-width: min(960px, calc(100vw - 32px)); width: 100%;
}
#lightbox::backdrop { background: rgba(6, 8, 10, .86); }
#lightbox figure { margin: 0; }
#lightbox img { width: 100%; max-height: 76vh; object-fit: contain; border-radius: 10px; }
#lightbox figcaption { margin-top: 10px; text-align: center; font-size: .9375rem; }
.lb-bar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.lb-bar button { width: 40px; height: 40px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .14); color: #fff; }
.lb-bar button:hover { background: rgba(255, 255, 255, .26); }

/* Contact */
.contact-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: clamp(28px, 5vw, 56px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px 56px; align-items: center;
}
.contact-panel h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.contact-panel > div > p { color: var(--muted); margin-top: 12px; max-width: 42ch; }
.contact-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.contact-list li:last-child { border-bottom: 0; }
.contact-list i { color: var(--accent); width: 18px; text-align: center; }
.contact-list a { text-decoration: none; overflow-wrap: anywhere; }
.contact-list a:hover { color: var(--accent); }
.copy-btn {
  margin-left: auto; border: 1px solid var(--line); background: transparent;
  padding: 2px 10px; border-radius: 7px; font-size: .75rem; color: var(--muted);
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 760px) { .contact-panel { grid-template-columns: 1fr; } }

/* Listing pages */
.page-head { padding-block: clamp(48px, 7vw, 80px) 24px; }
.page-head h1 { font-size: clamp(2.25rem, 6vw, 3.5rem); }
.page-head p { color: var(--muted); margin-top: 12px; max-width: 60ch; font-size: 1.0625rem; }
.toolbar { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.search { position: relative; max-width: 400px; }
.search i { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--muted); font-size: .875rem; }
.search input {
  width: 100%; padding: 10px 14px 10px 38px; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; font-size: .875rem; transition: border-color .15s, color .15s;
}
.chip span { color: var(--muted); font-size: .75rem; margin-left: 2px; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip[aria-pressed="true"] span { color: inherit; opacity: .8; }
.result-count { color: var(--muted); font-size: .875rem; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }
.page-body { padding-bottom: clamp(56px, 8vw, 96px); }

/* Article */
#read-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
}
.article-shell { max-width: 720px; margin-inline: auto; padding: clamp(40px, 6vw, 72px) var(--gutter) clamp(56px, 8vw, 96px); }
.back-link { color: var(--muted); text-decoration: none; font-size: .9375rem; display: inline-flex; gap: 8px; align-items: center; }
.back-link:hover { color: var(--accent); }
.article-shell h1 { font-size: clamp(2rem, 5.2vw, 3rem); margin-top: 22px; }
.article-meta { font-family: var(--mono); font-size: .8125rem; color: var(--muted); margin-top: 14px; }
.prose { margin-top: 32px; font-size: 1.0625rem; line-height: 1.75; }
.prose p { margin: 0 0 1.15em; }
.prose h2 { font-size: 1.5rem; margin: 1.9em 0 .55em; }
.prose h3 { font-size: 1.1875rem; margin: 1.6em 0 .45em; }
.prose ul { list-style: disc; padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li + li { margin-top: .35em; }
.prose code { font-family: var(--mono); font-size: .875em; background: var(--surface-2); padding: .12em .4em; border-radius: 5px; }
.prose pre {
  position: relative; background: var(--code-bg); color: var(--code-ink);
  padding: 18px 20px; border-radius: 12px; overflow-x: auto; margin: 0 0 1.4em;
  line-height: 1.6;
}
.prose pre code { background: none; padding: 0; font-size: .84rem; color: inherit; }
.copy-code {
  position: absolute; top: 8px; right: 8px; padding: 2px 10px; border-radius: 7px;
  font-size: .75rem; color: #c8ced6; background: rgba(255, 255, 255, .1); border: 0;
}
.copy-code:hover { background: rgba(255, 255, 255, .2); }
.prose .closing { border-left: 3px solid var(--accent); padding-left: 18px; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 26px; color: var(--muted); font-size: .875rem; }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.site-footer .socials { margin: 0; }

/* Reveal */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease, border-color .18s, box-shadow .18s, translate .18s; }
.js .reveal.is-in { opacity: 1; transform: none; }

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