:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --accent: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #ffffff;
  --ok: #15803d;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --glow: radial-gradient(60rem 28rem at 70% -10%, rgba(67, 56, 202, 0.12), transparent 60%);
  --space: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020;
    --surface: #111833;
    --text: #f1f5f9;
    --muted: #a5b0c5;
    --line: #232b4a;
    --accent: #a5b4fc;
    --accent-soft: #1b2250;
    --accent-text: #0b1020;
    --ok: #4ade80;
    --code-bg: #060a16;
    --code-text: #cbd5e1;
    --glow: radial-gradient(60rem 28rem at 70% -10%, rgba(129, 140, 248, 0.2), transparent 60%);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #111833;
  --text: #f1f5f9;
  --muted: #a5b0c5;
  --line: #232b4a;
  --accent: #a5b4fc;
  --accent-soft: #1b2250;
  --accent-text: #0b1020;
  --ok: #4ade80;
  --code-bg: #060a16;
  --code-text: #cbd5e1;
  --glow: radial-gradient(60rem 28rem at 70% -10%, rgba(129, 140, 248, 0.2), transparent 60%);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
body {
  margin: 0;
  background: var(--bg) var(--glow) no-repeat;
  color: var(--text);
  font: 16px/1.65 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:focus-visible, summary:focus-visible, .btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
code, .mono { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace; }
code { font-size: 0.9em; background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 calc(var(--space) * 3); }

header.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 calc(var(--space) * 3); }
.brand { display: inline-flex; align-items: center; gap: var(--space); min-height: 56px; font-weight: 700; color: var(--text); text-decoration: none; }
.logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-text); font: 700 13px/1 ui-monospace, monospace; }
nav { display: flex; flex-wrap: wrap; gap: 0 calc(var(--space) * 2); }
nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; font-size: 0.9375rem; }
nav a:hover { color: var(--text); }

.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: calc(var(--space) * 6); align-items: center; padding: calc(var(--space) * 11) 0 calc(var(--space) * 8); }
.status { display: inline-flex; align-items: center; gap: var(--space); padding: 4px 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font-size: 0.875rem; color: var(--muted); margin: 0 0 calc(var(--space) * 3); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
h1 { font-size: 3.25rem; line-height: 1.08; margin: 0 0 calc(var(--space) * 2); letter-spacing: -0.03em; }
h1 span { color: var(--accent); }
h2 { font-size: 1.75rem; margin: 0 0 var(--space); letter-spacing: -0.02em; }
h3 { font-size: 1.125rem; margin: 0; }
.eyebrow { font: 600 0.8125rem/1 ui-monospace, monospace; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 var(--space); }
.lead { font-size: 1.1875rem; color: var(--muted); margin: 0 0 calc(var(--space) * 4); max-width: 54ch; }
.actions { display: flex; flex-wrap: wrap; gap: calc(var(--space) * 1.5); }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 calc(var(--space) * 3); border-radius: 10px; background: var(--accent); color: var(--accent-text); font-weight: 600; text-decoration: none; border: 1px solid var(--accent); transition: transform 0.2s ease, filter 0.2s ease; }
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn.alt { background: transparent; color: var(--text); border-color: var(--line); }


.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin-bottom: calc(var(--space) * 10); }
.stats div { padding: calc(var(--space) * 3); border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats strong { display: block; font-size: 1.75rem; letter-spacing: -0.02em; }
.stats span { color: var(--muted); font-size: 0.875rem; }

section { padding: calc(var(--space) * 8) 0; }
.sub { color: var(--muted); max-width: 62ch; margin: 0 0 calc(var(--space) * 4); }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: calc(var(--space) * 3); }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: calc(var(--space) * 3); transition: transform 0.2s ease, border-color 0.2s ease; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .kind { font: 600 0.75rem/1 ui-monospace, monospace; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--space); }
.card p { margin: var(--space) 0 0; color: var(--muted); }
.card .more { margin-top: auto; padding-top: calc(var(--space) * 2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: calc(var(--space) * 2) 0 0; list-style: none; }
.chips li { padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.8125rem; font-weight: 500; }
details { margin-top: calc(var(--space) * 2); border-top: 1px solid var(--line); }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; font-size: 0.9375rem; }
details p { margin-top: 0; }



footer { border-top: 1px solid var(--line); padding: calc(var(--space) * 4) 0; color: var(--muted); font-size: 0.875rem; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: calc(var(--space) * 7); }
  h1 { font-size: 2.5rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(2) { border-right: 0; }
  .stats div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .grid { grid-template-columns: 1fr; }
}

.herobg { background: linear-gradient(rgba(8, 12, 24, 0.8), rgba(8, 12, 24, 0.9)), url("workspace.jpg") center / cover no-repeat #0b1020; color: #f1f5f9; margin-bottom: calc(var(--space) * 6); }
.herobg .lead { color: #cbd5e1; }
.herobg h1 span, .herobg a:not(.btn) { color: #a5b4fc; }
.herobg .status { background: rgba(15, 23, 42, 0.7); border-color: rgba(148, 163, 184, 0.35); color: #cbd5e1; }
.herobg .btn { background: #a5b4fc; border-color: #a5b4fc; color: #0b1020; }
.herobg .btn.alt { background: transparent; border-color: rgba(203, 213, 225, 0.5); color: #f1f5f9; }
.hero { padding-bottom: calc(var(--space) * 10); }
.photo { justify-self: center; width: min(100%, 360px); height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 24px; border: 1px solid rgba(203, 213, 225, 0.35); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6); }

.shot { display: block; width: 100%; height: auto; margin: calc(var(--space) * 2) 0 0; border: 1px solid var(--line); border-radius: 10px; }


.card.wide { grid-column: 1 / -1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card .more .btn { color: var(--accent); }

.card .user { margin: 0 0 var(--space); padding: 6px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 0.9375rem; font-weight: 600; }

dialog#gallery { width: min(1500px, 96vw); height: 94vh; max-width: none; max-height: none; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--text); overflow: hidden; }
dialog#gallery::backdrop { background: rgba(2, 6, 16, 0.78); }
dialog#gallery iframe { display: block; width: 100%; height: 100%; border: 0; }
dialog#gallery .x { position: absolute; top: 10px; right: 12px; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
dialog#gallery .x:hover { background: var(--accent-soft); }
@media (max-width: 700px) { dialog#gallery { width: 100vw; height: 100vh; border-radius: 0; } }

.hdr-right { display: flex; align-items: center; gap: calc(var(--space) * 1.5); }
.theme { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.theme:hover { color: var(--text); background: var(--accent-soft); }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme .sun { display: none; } :root:not([data-theme="light"]) .theme .moon { display: block; } }
.card .kind { margin-bottom: calc(var(--space) * 1.5); }
.card .user { margin-bottom: calc(var(--space) * 2); }
.card h3 { margin-bottom: 0; }
.card p { margin-top: calc(var(--space) * 1.5); }
.card .chips { margin-top: calc(var(--space) * 2.5); }
.card .more { padding-top: calc(var(--space) * 3); }

.ico { flex: none; color: var(--accent); }
.skillgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(var(--space) * 3); }
.skill { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: calc(var(--space) * 3); }
.skill .head { display: flex; align-items: center; gap: calc(var(--space) * 1.5); }
.skill h3 { font-size: 1.0625rem; }
.skill .chips { margin-top: calc(var(--space) * 2); }
.skill .used { margin: calc(var(--space) * 2) 0 0; color: var(--muted); font-size: 0.875rem; }
.points { display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(var(--space) * 4) calc(var(--space) * 4); margin: 0; padding: 0; list-style: none; }
.points li { display: flex; gap: calc(var(--space) * 2); color: var(--muted); }
.points li .ico { margin-top: 2px; }
.points b { display: block; margin-bottom: 4px; color: var(--text); }
.contact { display: grid; grid-template-columns: 1.4fr 1fr; gap: calc(var(--space) * 5); align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: calc(var(--space) * 6); background-image: var(--glow); }
.contact .sub { margin-bottom: calc(var(--space) * 3); }
.contact .btn .ico { color: inherit; vertical-align: -5px; }
.copied { min-height: 1.5em; margin: calc(var(--space) * 1.5) 0 0; color: var(--muted); font-size: 0.875rem; }
.fit { padding-left: calc(var(--space) * 4); border-left: 1px solid var(--line); }
.fit h3 { font-size: 0.9375rem; color: var(--muted); font-weight: 600; margin-bottom: calc(var(--space) * 1.5); }
.fit ul { margin: 0; padding-left: 1.1rem; }
.fit li { margin-bottom: var(--space); }
@media (max-width: 960px) { .skillgrid, .points { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .skillgrid, .points { grid-template-columns: 1fr; } .contact { grid-template-columns: 1fr; padding: calc(var(--space) * 3); } .fit { padding: calc(var(--space) * 3) 0 0; border-left: 0; border-top: 1px solid var(--line); } }
.btn { font: inherit; font-weight: 600; cursor: pointer; }
.contact { grid-template-columns: 1.7fr 1fr; }
.contact .actions { gap: var(--space); }

.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(var(--space) * 2); margin: 0; padding: 0; list-style: none; }
.tools li { display: flex; align-items: flex-start; gap: calc(var(--space) * 2); padding: calc(var(--space) * 2) calc(var(--space) * 2.5); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 0.9375rem; transition: border-color 0.2s ease, transform 0.2s ease; }
.tools li:hover { border-color: var(--accent); transform: translateY(-1px); }
.tools b { display: block; color: var(--text); font-size: 1rem; margin-bottom: 2px; }
.mono-badge { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font: 700 0.8125rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
@media (max-width: 960px) { .tools { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tools { grid-template-columns: 1fr; } }

.logo { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.logo img { display: block; width: 24px; height: 24px; object-fit: contain; }

.tools { display: flex; flex-wrap: wrap; justify-content: center; }
.tools li { flex: 0 1 calc((100% - calc(var(--space) * 4)) / 3); }
@media (max-width: 960px) { .tools li { flex-basis: calc((100% - calc(var(--space) * 2)) / 2); } }
@media (max-width: 560px) { .tools li { flex-basis: 100%; } }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; justify-content: normal; }
.tools li { flex: none; }
@media (max-width: 960px) { .tools { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tools { grid-template-columns: 1fr; } }

.chips li { display: inline-flex; align-items: center; gap: 6px; }
.chips li .ci { flex: none; box-sizing: content-box; width: 14px; height: 14px; padding: 2px; margin-left: -4px; border-radius: 5px; background: #fff; object-fit: contain; }

.brand .mark { display: block; width: 30px; height: 30px; border-radius: 8px; }
.card .more { display: flex; flex-wrap: wrap; gap: var(--space); }
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

.langsel { position: relative; }
.langbtn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.langbtn:hover, .langbtn[aria-expanded="true"] { background: var(--accent-soft); color: var(--text); }
.flag { flex: none; width: 20px; height: 15px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18); }
.chev { opacity: 0.7; }
.langlist { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 190px; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px -16px rgba(15, 23, 42, 0.45); }
.langlist[hidden] { display: none; }
.langlist li { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 8px; color: var(--text); font-size: 0.9375rem; cursor: pointer; }
.langlist li:hover, .langlist li:focus { background: var(--accent-soft); outline: none; }
.langlist li:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.langlist li[aria-selected="true"] { font-weight: 700; }
.langlist li[aria-selected="true"]::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
h1 span { white-space: nowrap; }

/* Responsive pass */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
img, svg, video { max-width: 100%; }
h1, h2, h3, .lead, .sub { overflow-wrap: break-word; hyphens: auto; }
.grid > *, .skillgrid > *, .tools > *, .points > *, .contact > *, .hero > * { min-width: 0; }
h1 { font-size: clamp(1.875rem, 1.1rem + 3.6vw, 3.25rem); }
h2 { font-size: clamp(1.375rem, 1rem + 1.4vw, 1.75rem); }
.lead { font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.1875rem); }
.btn { height: auto; min-height: 44px; padding-top: 8px; padding-bottom: 8px; text-align: center; justify-content: center; }
.contact .btn { overflow-wrap: anywhere; }
.stats strong { font-size: clamp(1.375rem, 1rem + 1.2vw, 1.75rem); }

@media (min-width: 1500px) {
  html { font-size: 17px; }
  .wrap { max-width: 1200px; }
}
@media (min-width: 2000px) {
  html { font-size: 19px; }
  .wrap { max-width: 1400px; }
}

@media (max-width: 960px) {
  section { padding: calc(var(--space) * 6) 0; }
  .hero { padding: calc(var(--space) * 8) 0 calc(var(--space) * 6); gap: calc(var(--space) * 4); }
  .photo { width: min(100%, 320px); justify-self: start; }
}

@media (max-width: 900px) {
  header.top .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: 4px; }
  .hdr-right { display: contents; }
  .brand { grid-column: 1; grid-row: 1; min-height: 52px; min-width: 0; }
  .langsel { grid-column: 2; grid-row: 1; }
  .theme { grid-column: 3; grid-row: 1; }
  nav { grid-column: 1 / -1; grid-row: 2; min-width: 0; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; gap: 0 4px; margin: 0 -20px; padding: 0 20px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  nav::-webkit-scrollbar { display: none; }
  nav a { flex: none; padding: 0 10px; }
}
@media (max-width: 760px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  .hero { padding: calc(var(--space) * 5) 0 calc(var(--space) * 5); }
  .stats > div { padding: calc(var(--space) * 2); }
  .card { padding: calc(var(--space) * 2.5); }
  .skill { padding: calc(var(--space) * 2.5); }
  .contact { padding: calc(var(--space) * 3); }
  .actions .btn, .card .more .btn, .contact .actions .btn { flex: 1 1 100%; }
  .hero .actions .btn { flex: 1 1 auto; }
  .langlist { right: 0; max-width: calc(100vw - 32px); }
  section { padding: calc(var(--space) * 5) 0; }
}

@media (max-width: 400px) {
  .langbtn span { display: none; }
  .hero .actions .btn { flex: 1 1 100%; }
}
@media (max-width: 330px) {
  .stats { grid-template-columns: 1fr; }
  .stats > div { border-right: 0 !important; border-bottom: 1px solid var(--line); }
  .stats > div:last-child { border-bottom: 0; }
}

@media (hover: none) {
  .card:hover, .tools li:hover { transform: none; }
}

@media (max-height: 520px) and (orientation: landscape) {
  header.top { position: static; }
  dialog#gallery { width: 100vw; height: 100vh; border-radius: 0; }
}
@media (max-width: 760px) {
  .contact { grid-template-columns: minmax(0, 1fr); gap: calc(var(--space) * 3); }
  .fit { padding: calc(var(--space) * 3) 0 0; border-left: 0; border-top: 1px solid var(--line); }
}

@media (min-width: 701px) and (max-width: 960px) {
  h1 { font-size: clamp(1.75rem, 3.3vw, 2.4rem); }
  .hero { grid-template-columns: 1.25fr 1fr; align-items: center; }
  .photo { justify-self: center; width: min(100%, 300px); }
}

nav a { border-radius: 8px; transition: background-color 0.2s ease, color 0.2s ease; }
nav a[aria-current="true"] { color: var(--text); background: var(--accent-soft); background: color-mix(in srgb, var(--accent) 14%, transparent); }
@media (min-width: 901px) { nav { gap: 0 4px; } nav a { padding: 0 12px; } }
@media (max-width: 700px) {
  .photo { width: 100%; max-width: 420px; justify-self: center; }
}
