:root {
  color-scheme: light;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-soft: #edf2f5;
  --surface-strong: #e3eaee;
  --text: #17212b;
  --text-muted: #5f6e7a;
  --border: #d5dee4;
  --accent: #2f6f9f;
  --accent-strong: #20557d;
  --accent-soft: #dcecf7;
  --secondary: #31867b;
  --todo: #8b6215;
  --todo-bg: #fff6dc;
  --todo-border: #e9ca7a;
  --shadow: 0 20px 60px rgba(26, 45, 60, .09);
  --shadow-small: 0 10px 28px rgba(26, 45, 60, .08);
  --radius: 22px;
  --radius-small: 14px;
  --container: 1180px;
  --header-height: 76px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d151c;
  --surface: #131e27;
  --surface-soft: #172630;
  --surface-strong: #20323f;
  --text: #edf4f7;
  --text-muted: #a8bac5;
  --border: #2a3d49;
  --accent: #70b5e3;
  --accent-strong: #9bcef0;
  --accent-soft: #17374c;
  --secondary: #70c9bb;
  --todo: #f0c86d;
  --todo-bg: #2e291b;
  --todo-border: #665727;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
  --shadow-small: 0 12px 32px rgba(0, 0, 0, .28);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 20px); }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  transition: background-color .2s ease, color .2s ease;
}
img { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: .08em; }
a:hover { color: var(--accent-strong); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
::selection { background: var(--accent); color: #fff; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 1rem; top: -8rem; z-index: 1000;
  background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: 8px;
}
.skip-link:focus { top: 1rem; }
.container { width: min(calc(100% - 40px), var(--container)); margin-inline: auto; }

.site-header {
  position: sticky; top: 0; z-index: 100;
  min-height: var(--header-height);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}
.nav-shell { min-height: var(--header-height); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; min-width: max-content; }
.brand__mark {
  display: block; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px;
  box-shadow: var(--shadow-small);
}
.brand__text { display: grid; line-height: 1.2; }
.brand__text strong { font-size: .96rem; }
.brand__text small { color: var(--text-muted); font-size: .73rem; margin-top: 3px; }
.main-nav { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.main-nav > a {
  color: var(--text-muted); text-decoration: none; font-size: .88rem; font-weight: 650;
  padding: .58rem .7rem; border-radius: 9px;
}
.main-nav > a:hover, .main-nav > a:focus-visible { color: var(--text); background: var(--surface-soft); }
.nav-toggle { display: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: .45rem .65rem; }
.theme-toggle {
  display: inline-grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 2px;
  width: 58px; height: 34px; padding: 3px; border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-muted); background: var(--surface); cursor: pointer;
}
.theme-toggle span { display: grid; place-items: center; height: 26px; border-radius: 50%; font-size: .9rem; }
:root[data-theme="light"] .theme-toggle__sun,
:root[data-theme="dark"] .theme-toggle__moon { color: var(--text); background: var(--surface-strong); }

.hero { position: relative; overflow: clip; padding: clamp(76px, 10vw, 145px) 0 clamp(84px, 10vw, 145px); }
.hero::after {
  content: ""; position: absolute; inset: auto 0 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.hero__glow { position: absolute; border-radius: 50%; filter: blur(10px); opacity: .55; pointer-events: none; }
.hero__glow--one { width: 440px; height: 440px; right: -150px; top: -170px; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 28%, transparent), transparent 70%); }
.hero__glow--two { width: 380px; height: 380px; left: -190px; bottom: -220px; background: radial-gradient(circle, color-mix(in srgb, var(--secondary) 22%, transparent), transparent 70%); }
.hero__grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); align-items: center; gap: clamp(54px, 8vw, 110px); }
.eyebrow { margin: 0 0 16px; color: var(--secondary); font-size: .76rem; font-weight: 800; letter-spacing: .15em; line-height: 1.4; text-transform: uppercase; }
.hero h1 { margin: 0; max-width: 840px; font-size: clamp(3.3rem, 8vw, 7.4rem); line-height: .9; letter-spacing: -.065em; }
.hero__headline { margin: 25px 0 0; color: var(--accent); font-size: clamp(1.25rem, 2.8vw, 2rem); font-weight: 750; letter-spacing: -.025em; }
.hero__summary { max-width: 720px; margin: 24px 0 0; color: var(--text-muted); font-size: clamp(1.04rem, 1.5vw, 1.2rem); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .72rem 1.05rem; border: 1px solid transparent; border-radius: 12px;
  font-weight: 760; text-decoration: none; transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-2px); }
.button--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-small); }
.button--primary:hover { color: #fff; background: var(--accent-strong); }
.button--secondary { border-color: var(--border); color: var(--text); background: var(--surface); }
.button--secondary:hover { color: var(--text); border-color: var(--accent); }
.button--large { min-height: 54px; padding-inline: 1.35rem; }
.hero__links { display: flex; flex-wrap: wrap; gap: 18px; margin: 27px 0 0; padding: 0; list-style: none; }
.hero__links a { color: var(--text-muted); font-size: .9rem; font-weight: 650; }
.hero__portrait-wrap { justify-self: end; width: min(100%, 360px); }
.hero__portrait-frame { position: relative; padding: 12px; border: 1px solid var(--border); border-radius: 36px; background: var(--surface); box-shadow: var(--shadow); transform: rotate(2deg); }
.hero__portrait-frame::before { content: ""; position: absolute; inset: -18px 28px 28px -18px; z-index: -1; border-radius: 36px; background: linear-gradient(145deg, var(--accent-soft), color-mix(in srgb, var(--secondary) 20%, transparent)); }
.hero__portrait { display: block; width: 100%; height: auto; aspect-ratio: 1 / 2; object-fit: cover; border-radius: 26px; }

.section { padding: clamp(82px, 9vw, 132px) 0; }
.section--muted { background: var(--surface-soft); border-block: 1px solid var(--border); }
.section-grid { display: grid; grid-template-columns: minmax(190px, .36fr) minmax(0, 1fr); gap: clamp(48px, 8vw, 110px); align-items: start; }
.section-heading { position: sticky; top: calc(var(--header-height) + 30px); }
.section-heading--wide { position: static; max-width: 780px; margin-bottom: 58px; }
.section-heading h2 { margin: 0; font-size: clamp(2.4rem, 4vw, 4.15rem); line-height: .96; letter-spacing: -.05em; }
.section-heading p:not(.eyebrow) { margin: 20px 0 0; color: var(--text-muted); }
.prose { min-width: 0; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose li { color: var(--text-muted); }
.prose strong { color: var(--text); }
.prose h3 { margin: 2rem 0 .85rem; color: var(--text); font-size: 1.24rem; letter-spacing: -.02em; }
.prose h4 { margin: 0 0 .45rem; color: var(--text); font-size: 1rem; }
.prose ul { padding-left: 1.25rem; }
.prose li + li { margin-top: .45rem; }
.prose code {
  display: inline-block; margin: .2rem .24rem .2rem 0; padding: .32rem .58rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text); font-family: inherit; font-size: .82rem; font-weight: 700;
}
.prose--large { font-size: clamp(1.05rem, 1.55vw, 1.24rem); }
.prose--large p { max-width: 850px; }
.fact-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 38px 0 0; }
.fact-card { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface); }
.fact-card dt { color: var(--text-muted); font-size: .75rem; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.fact-card dd { margin: 8px 0 0; color: var(--text); font-size: .98rem; font-weight: 750; line-height: 1.35; }

.skills-content > h3:first-child { margin-top: 0; }
.skills-content h3 { display: flex; align-items: center; gap: 10px; }
.skills-content h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.todo-card {
  margin: 26px 0 0; padding: 19px 20px; border: 1px dashed var(--todo-border); border-radius: var(--radius-small);
  background: var(--todo-bg); color: var(--text);
}
.todo-card__label { margin: 0 0 8px !important; color: var(--todo) !important; font-size: .68rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.todo-card h4 { margin: 0 0 7px; }
.todo-card p:last-child { margin-bottom: 0; }
.todo-card p { color: color-mix(in srgb, var(--text) 78%, var(--todo)); }

.timeline { position: relative; }
.timeline::before { content: ""; position: absolute; left: 221px; top: 7px; bottom: 7px; width: 1px; background: var(--border); }
.timeline-entry { position: relative; display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 60px; padding-bottom: 40px; }
.timeline-entry:last-child { padding-bottom: 0; }
.timeline-entry__marker { position: absolute; left: 215px; top: 25px; z-index: 2; width: 13px; height: 13px; border: 3px solid var(--bg); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.section--muted .timeline-entry__marker { border-color: var(--surface-soft); }
.timeline-entry__meta { padding-top: 16px; text-align: right; }
.timeline-entry__period { margin: 0; color: var(--text); font-size: .88rem; font-weight: 760; line-height: 1.4; }
.timeline-entry__location { margin: 8px 0 0; color: var(--text-muted); font-size: .8rem; line-height: 1.4; }
.timeline-entry__card { padding: clamp(24px, 3vw, 36px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-small); }
.timeline-entry__head h3 { margin: 0; font-size: clamp(1.25rem, 2vw, 1.65rem); letter-spacing: -.025em; }
.timeline-entry__company { margin: 4px 0 0; font-weight: 700; }
.timeline-entry__company a { color: var(--accent); }
.timeline-entry__projects { color: var(--text-muted); font-weight: 600; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0 22px; }
.tag-list span { padding: .3rem .58rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text-muted); background: var(--surface-soft); font-size: .72rem; font-weight: 700; }

.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.project-card { min-width: 0; padding: clamp(24px, 3vw, 34px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-small); }
.project-card:first-child { grid-column: 1 / -1; }
.project-card__period { margin: 0 0 7px; color: var(--secondary); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.project-card h3 { margin: 0; font-size: clamp(1.35rem, 2.3vw, 1.85rem); letter-spacing: -.03em; }
.project-card__role { margin: 8px 0 0; color: var(--text-muted); }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 26px 0 0; }
.gallery > p { display: contents; }
.gallery img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border: 1px solid var(--border); border-radius: 11px; cursor: zoom-in; transition: transform .18s ease, box-shadow .18s ease; }
.gallery img:hover, .gallery img:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-small); outline: 2px solid var(--accent); outline-offset: 2px; }

.card { padding: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-small); }
.card--flat { box-shadow: none; }
.optional-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.optional-grid .todo-card { margin: 0; }
.contact { padding-top: clamp(70px, 8vw, 110px); }
.contact__card { display: flex; align-items: center; justify-content: space-between; gap: 40px; padding: clamp(30px, 5vw, 56px); border: 1px solid var(--border); border-radius: 30px; background: linear-gradient(135deg, var(--surface), var(--accent-soft)); box-shadow: var(--shadow); }
.contact__card h2 { margin: 0; font-size: clamp(2.2rem, 4vw, 4rem); line-height: 1; letter-spacing: -.05em; }
.contact__card .prose { margin-top: 18px; }

.site-footer { padding: 30px 0 42px; color: var(--text-muted); font-size: .78rem; }
.site-footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--border); padding-top: 24px; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--text-muted); }
.site-footer span { margin-inline: .4rem; }
.standalone { min-height: 70vh; padding-top: 100px; }
.standalone .container { max-width: 840px; }
.card-grid { display: grid; gap: 20px; margin-top: 40px; }

.lightbox { width: min(92vw, 1200px); max-width: none; padding: 44px 18px 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.lightbox::backdrop { background: rgba(4, 9, 13, .82); backdrop-filter: blur(4px); }
.lightbox__image { max-width: 100%; max-height: 78vh; margin: 0 auto; border-radius: 10px; }
.lightbox__caption { margin: 12px 0 0; color: var(--text-muted); text-align: center; }
.lightbox__close { position: absolute; right: 10px; top: 7px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surface-soft); color: var(--text); cursor: pointer; font-size: 1.5rem; line-height: 1; }

@media (max-width: 980px) {
  .main-nav > a { padding-inline: .48rem; font-size: .8rem; }
  .hero__grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 48px; }
  .fact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-grid { grid-template-columns: 1fr; gap: 40px; }
  .section-heading { position: static; max-width: 720px; }
  .timeline::before { left: 161px; }
  .timeline-entry { grid-template-columns: 135px minmax(0, 1fr); gap: 52px; }
  .timeline-entry__marker { left: 155px; }
}

@media (max-width: 760px) {
  :root { --header-height: 66px; }
  .container { width: min(calc(100% - 28px), var(--container)); }
  .brand__text small { display: none; }
  .nav-toggle { display: inline-flex; }
  .main-nav {
    display: none; position: absolute; left: 14px; right: 14px; top: calc(100% + 8px); flex-direction: column; align-items: stretch;
    padding: 12px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow);
  }
  .main-nav--open { display: flex; }
  .main-nav > a { padding: .72rem .8rem; font-size: .92rem; }
  .theme-toggle { margin: 5px 0 2px 7px; }
  .hero { padding-top: 60px; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__portrait-wrap { justify-self: start; width: min(72vw, 300px); order: -1; }
  .hero h1 { font-size: clamp(3.2rem, 17vw, 5.6rem); }
  .timeline::before { left: 6px; }
  .timeline-entry { grid-template-columns: 1fr; gap: 12px; padding-left: 30px; }
  .timeline-entry__marker { left: 0; top: 8px; }
  .timeline-entry__meta { padding-top: 0; text-align: left; }
  .timeline-entry__period, .timeline-entry__location { display: inline; }
  .timeline-entry__location::before { content: " · "; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card:first-child { grid-column: auto; }
  .gallery { grid-template-columns: 1fr; }
  .optional-grid { grid-template-columns: 1fr; }
  .contact__card { align-items: flex-start; flex-direction: column; }
  .site-footer__inner { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .fact-grid { grid-template-columns: 1fr; }
  .hero__actions .button { width: 100%; }
  .timeline-entry__card, .project-card { padding: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-soft: #fff; --surface-strong: #f3f3f3;
    --text: #111; --text-muted: #333; --border: #bbb; --accent: #174c70; --secondary: #245d55;
    --todo-bg: #fff; --todo-border: #999; --shadow: none; --shadow-small: none;
  }
  body { font-size: 10pt; }
  .site-header, .hero__actions, .hero__links, .optional-grid, #optional, .lightbox, .hero__glow { display: none !important; }
  .hero, .section { padding: 22px 0; }
  .hero__grid { grid-template-columns: 1fr 120px; gap: 24px; }
  .hero h1 { font-size: 34pt; }
  .hero__portrait-frame { box-shadow: none; transform: none; padding: 4px; border-radius: 12px; }
  .hero__portrait { border-radius: 9px; }
  .section-grid { grid-template-columns: 155px 1fr; gap: 28px; }
  .section-heading { position: static; }
  .timeline::before, .timeline-entry__marker { display: none; }
  .timeline-entry { grid-template-columns: 130px 1fr; gap: 18px; padding-bottom: 16px; break-inside: avoid; }
  .timeline-entry__card, .project-card, .card { padding: 14px; box-shadow: none; break-inside: avoid; }
  .project-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .gallery { display: none; }
  .todo-card { display: none; }
  .contact__card { padding: 18px; box-shadow: none; }
  a { color: inherit; text-decoration: none; }
  .site-footer { padding: 15px 0 0; }
}
