/* ---------- Tokens ---------- */
:root {
  --bg: #f7f7fb;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --text: #16172b;
  --muted: #5d6078;
  --line: #e3e4ee;
  --accent: #6a4dff;
  --accent-2: #0fb5d4;
  --accent-soft: rgba(106, 77, 255, 0.1);
  --shadow: 0 1px 2px rgba(20, 20, 50, 0.05), 0 8px 24px rgba(20, 20, 50, 0.07);
  --radius: 16px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0d18; --bg-2: #11132a; --surface: #151731; --text: #ecedf7; --muted: #9a9dbb;
    --line: #262947; --accent: #9b87ff; --accent-2: #3dd9f0; --accent-soft: rgba(155, 135, 255, 0.14);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0d18; --bg-2: #11132a; --surface: #151731; --text: #ecedf7; --muted: #9a9dbb;
  --line: #262947; --accent: #9b87ff; --accent-2: #3dd9f0; --accent-soft: rgba(155, 135, 255, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.65;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.mono { font-family: var(--mono); }
.accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { font-weight: 800; font-size: 18px; text-decoration: none; letter-spacing: -0.01em; }
.brand::after { content: "."; color: var(--accent); }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 500; font-size: 15px; }
.nav a:hover { color: var(--text); }
.tools { display: flex; gap: 8px; align-items: center; }
.lang {
  display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px;
  background: var(--surface); cursor: pointer; font: 600 12px var(--mono); color: var(--muted);
}
.lang span { padding: 4px 9px; border-radius: 999px; }
.lang span.on { background: var(--accent); color: #fff; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font-size: 15px;
}
.icon-btn:hover, .lang:hover { border-color: var(--accent); }

/* ---------- Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-weight: 600; font-size: 15px;
  transition: transform .15s, border-color .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn svg { width: 18px; height: 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font: 500 12px var(--mono); padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: center; padding: 88px 0 72px; }
.eyebrow { color: var(--muted); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 14px; }
.eyebrow::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; margin-right: 10px; box-shadow: 0 0 0 4px rgba(34,197,94,.18); vertical-align: 1px; }
.hero__title { font-size: clamp(34px, 6vw, 60px); font-weight: 800; letter-spacing: -0.03em; }
.hero__role { font-size: clamp(18px, 2.4vw, 22px); font-weight: 600; margin: 14px 0 10px; color: var(--muted); }
.hero__tagline { font-size: 17px; max-width: 56ch; margin: 0 0 28px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.hero__avatar { justify-self: center; position: relative; }
.hero__avatar::before {
  content: ""; position: absolute; inset: -14px; border-radius: 36% 64% 58% 42% / 44% 40% 60% 56%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); opacity: .25; filter: blur(2px);
}
.hero__avatar img {
  position: relative; width: min(300px, 70vw); height: auto; aspect-ratio: 1; object-fit: cover;
  border-radius: 36% 64% 58% 42% / 44% 40% 60% 56%; border: 4px solid var(--surface); box-shadow: var(--shadow);
}
.socials { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 0; }
.socials--center { justify-content: center; }
.socials a {
  height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); transition: .15s;
  text-decoration: none; font-weight: 500; font-size: 14px;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.socials svg { width: 18px; height: 18px; }
.ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Sections ---------- */
.section { padding: 72px 0; border-top: 1px solid var(--line); }
.section__title { font-size: clamp(26px, 3.4vw, 34px); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 32px; display: flex; align-items: baseline; gap: 14px; }
.num { font-size: 14px; color: var(--accent); }

.about { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; }
.about__text p { margin: 0 0 16px; font-size: 17px; }
.about__skills { display: grid; gap: 20px; }
.skill-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; font-weight: 600; }
.skill-group .tags { gap: 8px; }
.skill-group .tag { font-size: 13px; padding: 5px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--line); }

/* ---------- Projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
  padding: 7px 14px; border-radius: 999px; font: 500 14px var(--font); transition: .15s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.card {
  display: flex; flex-direction: column; text-align: left; width: 100%; padding: 0; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  color: inherit; font: inherit; box-shadow: var(--shadow); transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); }
.card__img { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-2); }
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card__img img { transform: scale(1.04); }
.badge {
  position: absolute; top: 12px; left: 12px; font: 600 11px var(--mono); padding: 4px 9px; border-radius: 999px;
  background: rgba(0,0,0,.6); color: #fff; backdrop-filter: blur(6px); text-transform: uppercase; letter-spacing: .05em;
}
.badge--video { left: auto; right: 12px; }
.card__body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card__top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card__title { font-size: 19px; font-weight: 700; }
.card__year { font: 500 13px var(--mono); color: var(--muted); }
.card__summary { color: var(--muted); margin: 0; font-size: 15px; }
.card__foot { margin-top: auto; padding-top: 6px; }
.empty { color: var(--muted); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.timeline li { display: grid; grid-template-columns: 80px 170px minmax(0, 1fr); grid-template-areas: "logo . company" "logo period role" "logo . description"; gap: 6px 24px; padding: 20px 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.tl__logo-slot { grid-area: logo; align-self: center; }
.tl__heading { grid-area: company; font-size: 20px; overflow-wrap: anywhere; }
.tl__period { grid-area: period; font: 500 14px var(--mono); color: var(--muted); padding-top: 3px; }
.tl__role { grid-area: role; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.tl__company { color: var(--accent); font-weight: 600; }
.tl__logo { display: block; width: 80px; height: 80px; object-fit: contain; border-radius: 8px; }
a.tl__company { text-decoration: underline; text-underline-offset: 3px; }
a.tl__company:hover, a.tl__company:focus-visible { text-decoration-thickness: 2px; }
.tl__desc { grid-area: description; margin: 0; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- Contact / footer ---------- */
.contact { text-align: center; }
.contact .section__title { justify-content: center; }
.contact__lead { font-size: 18px; color: var(--muted); margin: -12px 0 18px; }
.contact__mail {
  display: inline-block; font-size: clamp(22px, 4vw, 36px); font-weight: 800; text-decoration: none; margin-bottom: 28px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
  word-break: break-all;
}
.footer { display: flex; justify-content: space-between; padding: 28px 0 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ---------- Modal ---------- */
.modal {
  width: min(980px, 100% - 24px); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 20px;
  background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.4); overflow: hidden;
}
.modal::backdrop { background: rgba(8, 8, 20, .7); backdrop-filter: blur(4px); }
.modal[open] { animation: pop .22s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal__box { position: relative; max-height: calc(100dvh - 24px); overflow-y: auto; }
.modal__close { position: absolute; top: 12px; right: 12px; z-index: 3; background: rgba(0,0,0,.55); color: #fff; border-color: transparent; }
.viewer { position: relative; aspect-ratio: 16 / 9; background: #000; }
.viewer img, .viewer video, .viewer iframe { width: 100%; height: 100%; object-fit: contain; border: 0; }
.viewer figcaption {
  position: absolute; left: 12px; bottom: 12px; font-size: 13px; padding: 4px 10px; border-radius: 8px; background: rgba(0,0,0,.6); color: #fff;
}
.nav-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 20px; cursor: pointer; z-index: 2;
}
.nav-arrow:hover { background: rgba(0,0,0,.75); }
.nav-arrow--prev { left: 12px; } .nav-arrow--next { right: 12px; }
.yt { position: absolute; inset: 0; cursor: pointer; border: 0; padding: 0; background: #000; }
.yt img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.yt::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 72px; height: 50px; transform: translate(-50%, -50%);
  border-radius: 14px; background: #ff0033 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z' fill='white'/%3E%3C/svg%3E") center / 28px no-repeat;
}
.thumbs { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.thumbs:empty { display: none; }
.thumb {
  flex: 0 0 auto; width: 96px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; padding: 0; cursor: pointer;
  border: 2px solid transparent; background: #000; position: relative; opacity: .6; transition: .15s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb[aria-current="true"] { border-color: var(--accent); opacity: 1; }
.thumb:hover { opacity: 1; }
.thumb .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 18px; text-shadow: 0 1px 4px #000; }
.modal__body { padding: 24px 28px 28px; }
.modal__head { margin-bottom: 18px; }
.modal__head h3 { font-size: clamp(24px, 3.4vw, 30px); font-weight: 800; letter-spacing: -0.02em; }
.meta { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.modal__cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 32px; }
.prose p { margin: 0 0 14px; }
.modal__side h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.modal__side h4:not(:first-child) { margin-top: 20px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 15px; }
.checks li { padding-left: 26px; position: relative; }
.checks li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--accent); font-weight: 700; }
.modal__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.modal__links:empty { display: none; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s, transform .6s; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav { display: none; }
  .tools { margin-left: auto; }
  .hero { grid-template-columns: 1fr; padding: 48px 0 56px; gap: 32px; }
  .hero__avatar { order: -1; justify-self: start; }
  .hero__avatar img { width: 140px; }
  .about, .modal__cols { grid-template-columns: 1fr; gap: 28px; }
  .timeline li { grid-template-columns: 56px minmax(0, 1fr); grid-template-areas: "logo company" "logo period" "logo role" "logo description"; gap: 6px 16px; }
  .tl__logo { width: 56px; height: 56px; }
  .section { padding: 56px 0; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
  .modal__body { padding: 20px 18px 24px; }
  .footer { flex-direction: column; gap: 8px; }
}
