:root {
  color-scheme: light;
  --color-paper: #eef1ec;
  --color-mist: #e1e6df;
  --color-surface: #fbfcfa;
  --color-accent: #27272a;
  --color-accent-hover: #3f3f42;
  --color-signal: #c2703d;
  --color-ink: #1c1917;
  --color-slate-500: #78716c;
  --color-slate-600: #57534e;
  --color-slate-700: #44403c;
  --color-border: #d7ddd4;
  --shadow-premium: 0 18px 44px -30px rgba(28, 25, 23, 0.24);
  --shadow-premium-hover: 0 24px 56px -28px rgba(28, 25, 23, 0.22);
  --header-bg: rgba(238, 241, 236, 0.7);
  --header-bg-scrolled: rgba(238, 241, 236, 0.92);
  --header-height: 72px;
  --shell: 74rem;
  --font-serif: "Newsreader", Georgia, serif;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-paper: #14171d;
    --color-mist: #1a1e25;
    --color-surface: #1e232b;
    --color-accent: #5b86b3;
    --color-accent-hover: #6f97c2;
    --color-signal: #6fcf97;
    --color-ink: #f2f0ea;
    --color-slate-500: #8b94a3;
    --color-slate-600: #a7afbc;
    --color-slate-700: #c7ccd4;
    --color-border: #2a2f38;
    --shadow-premium: 0 18px 44px -30px rgba(0, 0, 0, 0.6);
    --shadow-premium-hover: 0 24px 56px -28px rgba(0, 0, 0, 0.55);
    --header-bg: rgba(20, 23, 29, 0.7);
    --header-bg-scrolled: rgba(20, 23, 29, 0.92);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-paper: #14171d;
  --color-mist: #1a1e25;
  --color-surface: #1e232b;
  --color-accent: #5b86b3;
  --color-accent-hover: #6f97c2;
  --color-signal: #6fcf97;
  --color-ink: #f2f0ea;
  --color-slate-500: #8b94a3;
  --color-slate-600: #a7afbc;
  --color-slate-700: #c7ccd4;
  --color-border: #2a2f38;
  --shadow-premium: 0 18px 44px -30px rgba(0, 0, 0, 0.6);
  --shadow-premium-hover: 0 24px 56px -28px rgba(0, 0, 0, 0.55);
  --header-bg: rgba(20, 23, 29, 0.7);
  --header-bg-scrolled: rgba(20, 23, 29, 0.92);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body.no-scroll {
  overflow: hidden;
}

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

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

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

h1, h2, h3 {
  font-family: var(--font-serif);
  color: var(--color-ink);
  margin: 0;
  font-weight: 600;
}

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--shadow-premium);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-premium-hover);
}
.btn-ghost {
  background: transparent;
  color: var(--color-accent);
  border-color: var(--color-border);
}
.btn-ghost:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  transition: box-shadow 0.3s ease, background 0.3s ease;
}
.site-header.is-scrolled {
  background: var(--header-bg-scrolled);
  box-shadow: 0 1px 0 var(--color-border);
}
.site-header-inner {
  max-width: var(--shell);
  margin: 0 auto;
  width: 100%;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.main-nav {
  display: none;
  gap: 1.75rem;
}
.main-nav a {
  font-size: 0.92rem;
  color: var(--color-slate-600);
  position: relative;
  padding: 0.25rem 0;
}
.main-nav a:hover {
  color: var(--color-ink);
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  transition: width 0.2s ease;
}
.main-nav a:hover::after {
  width: 100%;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.lang-switch {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-ink);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
}
.lang-switch:hover {
  border-color: var(--color-accent);
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-ink);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
}
.theme-toggle:hover {
  border-color: var(--color-accent);
}
.theme-toggle svg {
  width: 17px;
  height: 17px;
}
.mobile-menu-button {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
}
.mobile-menu-button span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-ink);
}

@media (min-width: 768px) {
  .main-nav {
    display: flex;
  }
  .mobile-menu-button {
    display: none;
  }
}

/* ---------- Mobile drawer ---------- */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(78vw, 320px);
  background: var(--color-surface);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: calc(var(--header-height) + 1rem) 2rem 2rem;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -20px 0 40px -20px rgba(17, 24, 39, 0.3);
}
.mobile-drawer.is-open {
  transform: translateX(0);
}
.mobile-drawer a {
  font-size: 1.05rem;
  color: var(--color-slate-700);
}
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.35);
  z-index: 50;
}

/* ---------- Hero ---------- */
.hero {
  padding: 3rem 0 4rem;
}
.hero-grid {
  display: grid;
  gap: 3rem;
  align-items: center;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-signal);
  margin-bottom: 1rem;
}
.hero-copy h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.hero-role {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--color-slate-500);
}
.hero-headline {
  font-size: 1.2rem;
  font-weight: 500;
  margin: 1.25rem 0 0.75rem;
  color: var(--color-ink);
}
.hero-subtitle {
  color: var(--color-slate-600);
  font-size: 1rem;
  max-width: 42rem;
}
.hero-proof {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.5rem;
}
.hero-proof li {
  position: relative;
  padding-left: 1.4rem;
  color: var(--color-slate-600);
  font-size: 0.92rem;
}
.hero-proof li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-signal);
}

.hero-visual {
  display: grid;
  gap: 1.25rem;
}
.hero-card {
  background: var(--color-surface);
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-premium);
  display: flex;
  gap: 1.25rem;
  align-items: center;
}
.hero-photo {
  width: 84px;
  height: 84px;
  border-radius: 1rem;
  object-fit: cover;
  flex-shrink: 0;
}
.hero-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.88rem;
}
.hero-card-info strong {
  font-size: 1rem;
}
.hero-card-info .muted {
  color: var(--color-slate-500);
}
.stats-row {
  margin-top: 3rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, 1fr);
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  text-align: center;
}
.stat-value {
  display: block;
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--color-accent);
}
.stat-label {
  display: block;
  font-size: 0.82rem;
  color: var(--color-slate-500);
  margin-top: 0.25rem;
}

@media (min-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

/* ---------- Sections ---------- */
.section {
  padding: 5rem 0;
}
.section-alt {
  background: var(--color-mist);
}
.section-header {
  max-width: 42rem;
  margin-bottom: 3rem;
}
.section-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-signal);
  margin-bottom: 0.75rem;
}
.section-header h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
}
.section-subtitle {
  margin-top: 0.85rem;
  color: var(--color-slate-600);
  max-width: 40rem;
}

/* ---------- Timeline (Experience) ---------- */
.timeline {
  position: relative;
  display: grid;
  gap: 2rem;
  padding-left: 1.6rem;
  border-left: 2px solid var(--color-border);
}
.timeline-item {
  position: relative;
}
.timeline-marker {
  position: absolute;
  left: -1.98rem;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-paper);
}
.timeline-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
}
.timeline-heading h3 {
  font-size: 1.2rem;
}
.timeline-period {
  font-size: 0.82rem;
  color: var(--color-slate-500);
}
.timeline-company {
  font-weight: 600;
  color: var(--color-accent);
  margin: 0.2rem 0 0.6rem;
}
.timeline-desc {
  color: var(--color-slate-600);
  margin: 0 0 0.85rem;
  max-width: 46rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tag-list li {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  color: var(--color-slate-700);
}
.section-alt .tag-list li {
  background: var(--color-paper);
}

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  gap: 1.5rem;
}
.project-card {
  background: var(--color-surface);
  border-radius: 1.1rem;
  padding: 1.75rem;
  box-shadow: var(--shadow-premium);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-premium-hover);
}
.project-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.project-card-head h3 {
  font-size: 1.2rem;
}
.project-scale {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-signal);
  white-space: nowrap;
}
.project-card p {
  color: var(--color-slate-600);
  font-size: 0.92rem;
  margin: 0 0 1rem;
}

@media (min-width: 768px) {
  .project-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Skills ---------- */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.skill-pill {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-slate-700);
}

/* ---------- Education ---------- */
.education-list {
  display: grid;
  gap: 1.25rem;
}
.education-card {
  background: var(--color-surface);
  border-radius: 1.1rem;
  padding: 1.75rem;
  box-shadow: var(--shadow-premium);
}
.education-card h3 {
  font-size: 1.15rem;
  display: inline;
}
.education-period {
  float: right;
  font-size: 0.82rem;
  color: var(--color-slate-500);
}
.education-degree {
  font-weight: 600;
  color: var(--color-accent);
  margin: 0.5rem 0 0.5rem;
  clear: both;
}
.education-card p:last-child {
  color: var(--color-slate-600);
  font-size: 0.92rem;
  margin: 0;
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  gap: 2rem;
  align-items: start;
}
.contact-links {
  display: grid;
  gap: 1.25rem;
  background: var(--color-surface);
  border-radius: 1.1rem;
  padding: 1.75rem;
  box-shadow: var(--shadow-premium);
}
.contact-item {
  display: grid;
  gap: 0.2rem;
}
.contact-item-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-slate-500);
}
.contact-item a {
  color: var(--color-accent);
  font-weight: 500;
  word-break: break-word;
}
.contact-item a:hover {
  text-decoration: underline;
}
.social-icons {
  display: flex;
  gap: 0.75rem;
}
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  background: var(--color-mist);
  color: var(--color-accent);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.icon-link svg {
  width: 1.2rem;
  height: 1.2rem;
}
.icon-link:hover {
  background: var(--color-accent);
  color: var(--color-surface);
  transform: translateY(-2px);
  text-decoration: none;
}
/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--color-slate-500);
}
.footer-inner a:hover {
  color: var(--color-accent);
}

@media (max-width: 767px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
  .hero-card {
    flex-direction: column;
    text-align: center;
  }
}
