/* ---------- Fonts (self-hosted, from Google Fonts, SIL OFL 1.1) ---------- */
/* Nunito Sans latin-ext */
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 300;
  font-stretch: 100%;
  font-display: swap;
  src: url(/assets/fonts/nunito-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Nunito Sans latin */
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 300;
  font-stretch: 100%;
  font-display: swap;
  src: url(/assets/fonts/nunito-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Nunito Sans latin-ext */
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url(/assets/fonts/nunito-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Nunito Sans latin */
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url(/assets/fonts/nunito-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Nunito Sans latin-ext */
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url(/assets/fonts/nunito-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Nunito Sans latin */
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url(/assets/fonts/nunito-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Work Sans latin-ext */
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/work-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Work Sans latin */
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/work-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Work Sans latin-ext */
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/work-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Work Sans latin */
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/work-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #f2f2f2;
  --surface: #ffffff;
  --fg: #0a0a0a;
  --muted: #4a4a4a;
  --rule: #d4d4d4;
  --accent: #e8a92a;
  --accent-ink: #9a7425;
  --focus: #9a7425;

  --font-head: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1120px;
  --gutter: 24px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131313;
    --surface: #1c1c1c;
    --fg: #f2f2f2;
    --muted: #b4b4b4;
    --rule: #333333;
    --accent: #e8a92a;
    --accent-ink: #f0bf5c;
    --focus: #f0bf5c;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #131313;
  --surface: #1c1c1c;
  --fg: #f2f2f2;
  --muted: #b4b4b4;
  --rule: #333333;
  --accent: #e8a92a;
  --accent-ink: #f0bf5c;
  --focus: #f0bf5c;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; }

a { color: inherit; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

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

ul { margin: 0; padding-left: 1.15em; }
li + li { margin-top: 0.3em; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--fg);
  color: var(--bg);
  padding: 8px 14px;
  z-index: 10;
}
.skip-link:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-top: 22px;
  padding-bottom: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.25rem;
}

.brand-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-nav ul {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-nav li { margin: 0; }
.site-nav li + li { border-left: 1px solid var(--fg); }

.site-nav a {
  display: block;
  padding: 2px 18px;
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.15s ease;
}
.site-nav li:last-child a { padding-right: 0; }

.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--accent-ink); }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
}
.theme-toggle:hover { border-color: var(--fg); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ---------- Home ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 48px;
  min-height: calc(100vh - 260px);
  padding-top: 48px;
  padding-bottom: 72px;
}

.hero-portrait {
  justify-self: center;
  width: min(100%, 440px);
}

.hero h1 {
  font-size: clamp(3rem, 8vw, 6.25rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

.hero .role {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 18px;
}

.hero .lede { max-width: 34em; color: var(--muted); }

.hero h2 {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0;
  margin: 18px 0 6px;
}

.hero ul { color: var(--muted); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--fg);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}
.btn-primary:hover { background: #d99a1c; border-color: #d99a1c; }
.btn-ghost:hover { background: var(--fg); color: var(--bg); }

/* ---------- Page header ---------- */
.page-head {
  padding-top: 56px;
  padding-bottom: 40px;
}
.page-head h1 { font-size: clamp(2.25rem, 5vw, 3rem); }
.page-head p { margin-top: 14px; max-width: 40em; color: var(--muted); }

/* ---------- Sections (About / Projects) ---------- */
.section {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px;
  padding: 56px 0;
  border-top: 1px solid var(--rule);
}

.section > h2 { font-size: 1.6rem; }

.skills {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.skills li {
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 0.92rem;
}

.timeline { display: grid; gap: 32px; }

.entry {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
}

.entry time,
.entry .when {
  font-size: 0.92rem;
  color: var(--muted);
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}

.entry h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.entry p { margin: 0; color: var(--muted); }

.plain-list li { font-weight: 400; }

/* Projects */
.products {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.products li { margin: 0; display: flex; }

.product {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.product:hover { border-color: var(--fg); transform: translateY(-1px); }

.product-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.product-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.product strong {
  display: block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.3;
}

.product-tagline { display: block; font-weight: 600; font-size: 0.92rem; line-height: 1.35; }
.product-desc { font-size: 0.92rem; color: var(--muted); }

.product-link {
  margin-top: auto;
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--accent-ink);
}

.pubs {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 22px;
}
.pubs li { margin: 0; }
.pubs .title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.35;
  text-decoration: none;
}
.pubs a.title:hover { color: var(--accent-ink); }
.pubs .authors,
.pubs .venue {
  display: block;
  font-size: 0.92rem;
  color: var(--muted);
}
.pubs .authors b { font-weight: 600; color: var(--fg); }
.pubs .venue { font-style: italic; }

.more-link {
  display: inline-block;
  margin-top: 26px;
  font-weight: 400;
  color: var(--accent-ink);
  text-underline-offset: 3px;
}

/* ---------- Contact ---------- */
.contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  padding-top: 56px;
  padding-bottom: 88px;
  align-items: start;
}

.contact h1 { font-size: clamp(2.25rem, 5vw, 3rem); margin-bottom: 18px; }
.contact .intro p { color: var(--muted); max-width: 30em; }

.channels {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}
.channels li { margin: 0; }

.channel {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.channel:hover { border-color: var(--fg); transform: translateY(-1px); }
.channel.primary { border-color: var(--accent); }

.channel-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg);
}
.channel.primary .channel-icon { background: var(--accent); color: #111; }
.channel-icon svg { width: 18px; height: 18px; }

.channel strong {
  display: block;
  font-family: var(--font-head);
  font-weight: 600;
}
.channel span { font-size: 0.92rem; color: var(--muted); word-break: break-word; }
.channel .arrow { color: var(--muted); font-size: 1.1rem; }

/* ---------- Footer ---------- */
.site-footer .wrap { padding-bottom: 28px; }

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  border-top: 1px solid var(--rule);
  padding: 32px 40px 24px;
}

.footer-grid h2 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.footer-grid a { font-size: 0.95rem; text-decoration: none; }
.footer-grid a:hover { color: var(--accent-ink); }

.social {
  display: flex;
  gap: 14px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.social li { margin: 0; }
.social a {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: background 0.15s ease;
}
.social a:hover { background: var(--surface); }
.social svg { width: 18px; height: 18px; }

.copyright {
  padding: 0 40px;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

/* ---------- 404 ---------- */
.not-found {
  padding-top: 96px;
  padding-bottom: 120px;
}
.not-found h1 { font-size: clamp(3rem, 8vw, 5rem); margin-bottom: 16px; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: rise 0.6s ease-out both; }
  .reveal-2 { animation-delay: 0.08s; }
  .reveal-3 { animation-delay: 0.16s; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    min-height: 0;
    padding-top: 24px;
  }
  .hero-portrait { width: min(80%, 320px); }

  .section { grid-template-columns: 1fr; gap: 24px; padding: 44px 0; }
  .contact { grid-template-columns: 1fr; gap: 36px; }
  .footer-grid { padding: 28px 0 20px; }
  .copyright { padding: 0; }
}

@media (max-width: 560px) {
  :root { --gutter: 16px; }
  .site-header .wrap { padding-top: 16px; padding-bottom: 16px; }
  .header-right { width: 100%; justify-content: space-between; }
  .site-nav a { padding: 2px 14px; }
  .site-nav li:first-child a { padding-left: 0; }
  .entry { grid-template-columns: 1fr; gap: 4px; }
  .products { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}
