/* ==========================================================
   Anelia D. Yordanova — portfolio
   Light, cool off-white base; midnight-blue and plum panels;
   a blue → violet → pink gradient used only for data lines.
   ========================================================== */

:root {
  --paper: #f6f5fb;
  --surface: #ffffff;
  --line: #e3e0f0;
  --ink: #17183b;
  --ink-soft: #565879;
  --midnight: #17195a;
  --plum: #2b1b5f;
  --on-dark: #eeedff;
  --on-dark-soft: #b9b6e6;
  --blue: #4c5bff;
  --violet: #8b5cf6;
  --pink: #ec5fab;
  --lav: #ece9ff;
  --blush: #ffe3f1;
  --grad: linear-gradient(90deg, #4c5bff 0%, #8b5cf6 50%, #ec5fab 100%);

  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, monospace;

  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 8px;
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

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

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

/* ---------- Type scale ---------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0;
}
h1 { font-size: clamp(2.3rem, 6vw, 4.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.2rem; line-height: 1.25; }

p { margin: 0 0 1em; }
.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 36em; }
.muted { color: var(--ink-soft); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
}
.mark-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--midnight);
  color: var(--on-dark);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  position: relative;
  overflow: hidden;
}
.mark-badge::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--grad);
}
.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.97rem;
}
.nav a:hover { color: var(--ink); background: var(--lav); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--lav); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 16px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  font-size: 0.98rem;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--midnight); color: var(--on-dark); }
.btn-primary:hover { background: var(--plum); }
.btn-ghost { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn-ghost:hover { border-color: var(--violet); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 9vw, 104px) 0 0; }
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.section-head p { margin: 8px 0 0; color: var(--ink-soft); max-width: 34em; }
.text-link {
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid var(--pink);
  padding-bottom: 2px;
}
.text-link:hover { color: var(--violet); }

/* ---------- Hero ---------- */
.hero { padding: clamp(40px, 7vw, 88px) 0 0; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
}
.hero h1 { margin-bottom: 20px; }
.hero h1 .surname { display: block; color: var(--ink-soft); font-weight: 300; }
.hero .lede { margin-bottom: 28px; }

.frontier {
  background: var(--midnight);
  border-radius: var(--r-lg);
  padding: 22px 22px 16px;
  color: var(--on-dark);
  position: relative;
  overflow: hidden;
  margin: 0;
}
.frontier::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 10%, rgba(236, 95, 171, 0.22), transparent 45%),
    radial-gradient(circle at 10% 100%, rgba(76, 91, 255, 0.28), transparent 50%);
  pointer-events: none;
}
.frontier-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--on-dark-soft);
}
.frontier-head strong { color: var(--on-dark); font-weight: 600; display: block; font-size: 1rem; }
.frontier svg { position: relative; width: 100%; height: auto; margin-top: 6px; }
.frontier .axis { stroke: rgba(238, 237, 255, 0.25); stroke-width: 1; }
.frontier .grid { stroke: rgba(238, 237, 255, 0.07); stroke-width: 1; }
.frontier .axis-label { fill: var(--on-dark-soft); font-size: 13px; font-family: var(--font-body); }
.frontier .curve {
  fill: none;
  stroke: url(#frontierGrad);
  stroke-width: 3;
  stroke-linecap: round;
}
.frontier .curve.draw {
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
  animation: draw 1.6s cubic-bezier(.6,.05,.2,1) .2s forwards;
}
.frontier .pt circle.dot { fill: var(--on-dark); }
.frontier .pt circle.halo { fill: none; stroke: rgba(238,237,255,.35); }
.frontier .pt text { fill: var(--on-dark); font-size: 15px; font-family: var(--font-body); font-weight: 600; }
.frontier .pt text.sub { fill: var(--on-dark-soft); font-weight: 400; font-size: 13px; }
.frontier .pt { opacity: 0; animation: fadein .5s ease forwards; }
.frontier .pt:nth-of-type(1) { animation-delay: 1.2s; }
.frontier .pt:nth-of-type(2) { animation-delay: 1.4s; }
.frontier .pt:nth-of-type(3) { animation-delay: 1.6s; }
.frontier .pt:nth-of-type(4) { animation-delay: 1.8s; }
.frontier .pt a { text-decoration: none; }
.frontier .pt a:hover text { fill: var(--blush); }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .frontier .curve.draw { animation: none; stroke-dashoffset: 0; }
  .frontier .pt { animation: none; opacity: 1; }
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
}

/* ---------- Work grid ---------- */
.work-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 16px;
}
.work {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  padding: 24px;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  min-height: 190px;
}
.work:hover { border-color: var(--violet); }
.work h3 { margin: 10px 0 10px; }
.work p { color: var(--ink-soft); margin: 0; font-size: 0.98rem; }
.work .tags { margin-top: auto; padding-top: 18px; }

.work-feature {
  grid-row: span 3;
  background: var(--midnight);
  color: var(--on-dark);
  border: none;
  border-radius: var(--r-lg);
  padding: clamp(24px, 3.5vw, 40px);
  position: relative;
  overflow: hidden;
}
.work-feature:hover { background: #1c1f6b; }
.work-feature h3 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin-top: 14px; }
.work-feature p { color: var(--on-dark-soft); font-size: 1.05rem; max-width: 30em; }
.work-feature .chunks {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 5px;
  margin: 28px 0 8px;
}
.work-feature .chunks span {
  height: 34px;
  border-radius: 5px;
  background: rgba(238, 237, 255, 0.08);
}
.work-feature .chunks span.hit { background: var(--pink); }
.work-feature .chunks span.hit:nth-child(odd) { background: var(--blue); }
.work-feature .chunks span.hit:nth-child(3n) { background: var(--violet); }
.work-feature .chunks-caption { font-size: 0.88rem; color: var(--on-dark-soft); }

.work-plum { background: var(--plum); color: var(--on-dark); border: none; }
.work-plum:hover { background: #331f70; }
.work-plum p { color: var(--on-dark-soft); }

.kind { font-size: 0.88rem; font-weight: 600; color: var(--violet); }
.work-feature .kind, .work-plum .kind { color: #f9a8d4; }

@media (max-width: 860px) {
  .work-grid { grid-template-columns: 1fr; }
  .work-feature { grid-row: auto; }
}

/* ---------- Tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.tags li {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--lav);
  color: var(--ink);
}
.work-feature .tags li, .work-plum .tags li { background: rgba(238, 237, 255, 0.12); color: var(--on-dark); }

/* ---------- Post list ---------- */
.post-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.post-list li { border-bottom: 1px solid var(--line); }
.post-list a {
  display: grid;
  grid-template-columns: 8.5em 1fr auto;
  gap: 20px;
  align-items: baseline;
  padding: 20px 4px;
  text-decoration: none;
}
.post-list a:hover h3 { color: var(--violet); }
.post-list time { color: var(--ink-soft); font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.post-list p { margin: 6px 0 0; color: var(--ink-soft); font-size: 0.97rem; max-width: 48em; }
.post-list .tag {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--blush);
  white-space: nowrap;
}
.post-empty { padding: 24px 0; color: var(--ink-soft); }
@media (max-width: 640px) {
  .post-list a { grid-template-columns: 1fr; gap: 6px; }
  .post-list .tag { justify-self: start; }
}

/* ---------- Lab teaser / calculators ---------- */
.panel-dark {
  background: var(--plum);
  color: var(--on-dark);
  border-radius: var(--r-lg);
  padding: clamp(24px, 4vw, 44px);
}
.panel-dark p { color: var(--on-dark-soft); }
.lab-teaser {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
}
@media (max-width: 860px) { .lab-teaser { grid-template-columns: 1fr; } }

.calc {
  background: rgba(238, 237, 255, 0.06);
  border: 1px solid rgba(238, 237, 255, 0.14);
  border-radius: var(--r-md);
  padding: 20px;
}
.calc-light {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(20px, 3vw, 32px);
}
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.92rem; font-weight: 500; display: flex; justify-content: space-between; gap: 8px; }
.field output { font-variant-numeric: tabular-nums; font-weight: 600; }
.field input[type="range"] { width: 100%; accent-color: var(--pink); }
.field input[type="number"] {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }

.result {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(238, 237, 255, 0.14);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.result-value {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-variant-numeric: tabular-nums;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.calc-light .result { border-top-color: var(--line); }

.lab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .lab-grid { grid-template-columns: 1fr; } }
.lab-grid h2 { font-size: 1.4rem; margin-bottom: 6px; }
.lab-note { font-size: 0.92rem; color: var(--ink-soft); margin-top: 14px; }

.bars { margin-top: 18px; }
.bars svg { width: 100%; height: auto; }

/* ---------- Skills ---------- */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 960px) { .skills { grid-template-columns: 1fr; } }
.skill {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.skill h3 { display: flex; align-items: center; gap: 10px; }
.skill h3 .swatch { width: 12px; height: 12px; border-radius: 4px; }
.skill > p { color: var(--ink-soft); font-size: 0.97rem; margin: 10px 0 16px; }

pre.code {
  margin: auto 0 0;
  background: var(--midnight);
  color: #dcdaff;
  border-radius: var(--r-sm);
  padding: 16px;
  font-family: var(--font-code);
  font-size: 0.8rem;
  line-height: 1.6;
  overflow-x: auto;
}
pre.code .k { color: #f9a8d4; }
pre.code .s { color: #a5f3d0; }
pre.code .c { color: #8c89c4; font-style: italic; }
pre.code .f { color: #a5b4fc; }

/* ---------- About / contact ---------- */
.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
}
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.contact-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-decoration: none;
  font-weight: 600;
}
.contact-list a span { font-weight: 400; color: var(--ink-soft); font-size: 0.95rem; overflow-wrap: anywhere; text-align: right; }
.contact-list a:hover { border-color: var(--pink); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: clamp(64px, 10vw, 120px);
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--ink-soft); }

/* ---------- Page header (inner pages) ---------- */
.page-head { padding: clamp(40px, 7vw, 80px) 0 8px; }
.page-head h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 16px; }
.back { display: inline-block; margin-bottom: 20px; text-decoration: none; color: var(--ink-soft); font-weight: 500; }
.back:hover { color: var(--violet); }

/* ---------- Case study ---------- */
.case {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: clamp(24px, 5vw, 64px);
  margin-top: 32px;
}
.case > * { min-width: 0; }
@media (max-width: 860px) { .case { grid-template-columns: 1fr; } }
.facts {
  background: var(--midnight);
  color: var(--on-dark);
  border-radius: var(--r-md);
  padding: 20px;
  align-self: start;
  position: sticky;
  top: 88px;
}
@media (max-width: 860px) { .facts { position: static; } }
.facts dl { margin: 0; display: grid; gap: 14px; }
.facts dt { font-size: 0.82rem; color: var(--on-dark-soft); }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.facts .status {
  display: inline-block;
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(236, 95, 171, 0.2);
  color: #fbcfe8;
}
.prose { max-width: 40em; }
.prose h2 { font-size: 1.35rem; margin: 2em 0 0.6em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.6em 0 0.5em; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; }
.prose a { color: var(--blue); }
.prose blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--pink);
  color: var(--ink-soft);
}
.prose code {
  font-family: var(--font-code);
  font-size: 0.88em;
  background: var(--lav);
  padding: 2px 6px;
  border-radius: 5px;
}
.prose pre {
  background: var(--midnight);
  color: #dcdaff;
  padding: 16px;
  border-radius: var(--r-sm);
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.95rem; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.prose img { border-radius: var(--r-md); margin: 1em 0; }

.callout {
  background: var(--blush);
  border-radius: var(--r-md);
  padding: 16px 20px;
  margin: 1.4em 0;
}
.callout p:last-child { margin: 0; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 1.4em 0; }
@media (max-width: 640px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; }
.stat b { display: block; font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.85rem; color: var(--ink-soft); }

/* ---------- Blog post ---------- */
.post-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; color: var(--ink-soft); font-size: 0.95rem; }
.post-body { margin-top: 32px; }
.post-body.prose { font-size: 1.08rem; }

.filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 24px; }
.filter button {
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.filter button[aria-pressed="true"] { background: var(--midnight); color: var(--on-dark); border-color: var(--midnight); }

/* ---------- Button motion ---------- */
@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition:
    transform .25s cubic-bezier(.2,.8,.2,1),
    box-shadow .25s ease,
    background-color .25s ease,
    border-color .25s ease,
    color .25s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); transition-duration: .08s; }

/* Light sweep that crosses the button on hover (moves the gradient, not the box, so it stays inside the pill) */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 40%, rgba(255,255,255,.3) 50%, transparent 60%) no-repeat;
  background-size: 250% 100%;
  background-position: 130% 0;
  pointer-events: none;
}
.btn:hover::after { background-position: -30% 0; transition: background-position .7s ease; }

.btn-primary:hover { box-shadow: 0 10px 24px -10px rgba(76, 91, 255, .7), 0 4px 14px -6px rgba(236, 95, 171, .5); }
.btn-ghost::after { background-image: linear-gradient(110deg, transparent 40%, rgba(139, 92, 246, .16) 50%, transparent 60%); }
.btn-ghost:hover { border-color: var(--violet); box-shadow: 0 8px 20px -12px rgba(139, 92, 246, .6); }

/* Shine outline: a gradient border that keeps circling the button */
.btn-shine {
  overflow: visible;
  border: none;
  padding: 13px 23px;
}
.btn-shine::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -2;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--angle), #4c5bff, #8b5cf6, #ec5fab, #ffd6ec, #4c5bff);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: spin-border 3.5s linear infinite;
  filter: drop-shadow(0 0 6px rgba(236, 95, 171, .45));
}
.btn-shine:hover::before { animation-duration: 1.4s; filter: drop-shadow(0 0 10px rgba(139, 92, 246, .7)); }

@keyframes spin-border { to { --angle: 360deg; } }

/* Small hover lift for other clickable pills */
.filter button { transition: transform .2s ease, background-color .2s ease, border-color .2s ease; }
.filter button:hover { transform: translateY(-1px); border-color: var(--violet); }
.nav a { transition: background-color .2s ease, color .2s ease; }

@media (prefers-reduced-motion: reduce) {
  .btn, .btn:hover, .btn:active, .filter button:hover { transform: none; }
  .btn:hover::after { transition: none; background-position: 130% 0; }
  .btn-shine::before { animation: none; }
}

/* ---------- Kretz: integration map ---------- */
.integrations {
  background: var(--midnight);
  color: var(--on-dark);
  border-radius: var(--r-lg);
  padding: clamp(20px, 3vw, 28px);
  margin: 1.4em 0;
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0 28px;
  align-items: center;
}
.int-hub {
  position: relative;
  background: rgba(238, 237, 255, 0.08);
  border: 1px solid rgba(238, 237, 255, 0.18);
  border-radius: var(--r-md);
  padding: 16px;
}
.int-hub::before {
  content: "";
  position: absolute;
  left: 16px; right: 16px; bottom: -1px;
  height: 3px;
  border-radius: 3px;
  background: var(--grad);
}
.int-hub::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -29px;
  width: 28px;
  height: 2px;
  background: rgba(238, 237, 255, 0.35);
}
.int-hub-name { display: block; font-family: var(--font-display); font-size: 1.3rem; }
.int-hub-sub { display: block; font-size: 0.85rem; color: var(--on-dark-soft); margin-top: 4px; line-height: 1.35; }

.int-groups {
  border-left: 2px solid rgba(238, 237, 255, 0.35);
  padding-left: 20px;
  display: grid;
  gap: 14px;
}
.int-group-title { margin: 0 0 6px; font-size: 0.85rem; color: var(--on-dark-soft); }
.int-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.int-group li {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: rgba(238, 237, 255, 0.06);
  font-weight: 500;
  margin: 0;
}
.int-group li::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 50%;
  width: 21px;
  height: 2px;
  background: rgba(238, 237, 255, 0.35);
}
.pill { font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill-now { background: var(--pink); color: #fff; }
.pill-next { border: 1px solid rgba(238, 237, 255, 0.4); color: var(--on-dark-soft); }

@media (max-width: 640px) {
  .integrations { grid-template-columns: 1fr; gap: 24px; }
  .int-hub::after { top: auto; bottom: -25px; right: auto; left: 24px; width: 2px; height: 24px; }
  .int-groups { margin-left: 24px; }
}

.stat-row.stat-row-2 { grid-template-columns: repeat(2, 1fr); max-width: 26rem; }

.prose blockquote.quote {
  border-left: none;
  padding: 20px 24px;
  background: var(--lav);
  border-radius: var(--r-md);
  color: var(--ink);
}
.prose blockquote.quote p { font-family: var(--font-display); font-weight: 300; font-size: 1.25rem; line-height: 1.4; margin: 0 0 10px; }
.prose blockquote.quote footer { font-size: 0.9rem; color: var(--ink-soft); }

.progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 1.2em 0; }
@media (max-width: 640px) { .progress { grid-template-columns: 1fr; } }
.progress-col { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); padding: 16px; }
.progress-col.progress-now { background: var(--plum); color: var(--on-dark); border-color: var(--plum); }
.progress-title { font-weight: 600; margin: 0 0 8px; }
.progress-now .progress-title { color: #f9a8d4; }
.prose .progress ul { padding-left: 1.1em; margin: 0; font-size: 0.95rem; }

/* ---------- Screenshot gallery ---------- */
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 1.2em 0 0.4em; }
.shot { margin: 0; min-width: 0; }
.shot-wide { grid-column: 1 / -1; }
.shot a { display: block; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.shot a:hover { border-color: var(--violet); }
.prose .shot img { margin: 0; border-radius: 0; width: 100%; height: auto; }
.shot figcaption { font-size: 0.88rem; color: var(--ink-soft); margin-top: 8px; }
@media (max-width: 640px) { .shots { grid-template-columns: 1fr; } }
.prose h3 + .shots { margin-top: 0.6em; }
.shot-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.shot-side figcaption { margin: 0; font-size: 0.98rem; }
.shot-side figcaption strong { display: block; font-family: var(--font-display); font-weight: 500; color: var(--ink); font-size: 1.1rem; margin-bottom: 6px; }
@media (max-width: 640px) { .shot-side { grid-template-columns: 1fr; } }

/* ---------- Screenshot gallery dialog ---------- */
.btn-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(238, 237, 255, 0.16);
  font-size: 0.8rem;
}
.gallery {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
  border: none;
  background: #101014;
  color: #f2f2f5;
  display: none;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}
.gallery[open] { display: grid; }
.gallery::backdrop { background: rgba(16, 16, 20, 0.9); }
.g-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.g-meta { margin: 0; display: flex; gap: 14px; font-size: 0.92rem; color: #a9a9b3; }
.g-meta #g-group { color: #f2f2f5; font-weight: 600; }
.g-close, .g-nav {
  font: inherit;
  color: #f2f2f5;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .2s ease, transform .2s ease;
}
.g-close { padding: 8px 16px; font-size: 0.92rem; }
.g-close:hover, .g-nav:hover { background: rgba(255, 255, 255, 0.16); }
.g-stage { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 0; }
.g-nav { width: 48px; height: 48px; font-size: 1.8rem; line-height: 1; display: grid; place-items: center; }
.g-nav:hover { transform: scale(1.06); }
.g-figure { margin: 0; height: 100%; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; justify-items: center; }
.g-figure img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; align-self: center; }
.g-figure figcaption { max-width: 46em; text-align: center; color: #d6d6de; font-size: 0.98rem; }
.g-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; justify-content: safe center; }
.g-thumb {
  flex: 0 0 auto;
  width: 96px;
  height: 60px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #1c1c22;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity .2s ease, border-color .2s ease;
}
.g-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.g-thumb:hover { opacity: 0.85; }
.g-thumb[aria-current="true"] { opacity: 1; border-color: #f2f2f5; }
@media (max-width: 640px) {
  .g-stage { grid-template-columns: minmax(0, 1fr); }
  .g-nav { display: none; }
  .g-thumb { width: 72px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) { .g-nav:hover { transform: none; } }

/* ---------- Finance lab: advanced tools ---------- */
.tool-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tool-nav a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color .2s ease, transform .2s ease;
}
.tool-nav a:hover { border-color: var(--violet); transform: translateY(-1px); }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
section[id], h2[id] { scroll-margin-top: 84px; }

.tool {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.tool-head { padding: clamp(20px, 3vw, 32px) clamp(20px, 3vw, 32px) 0; max-width: 52em; }
.tool-head h2 { font-size: 1.4rem; margin-bottom: 8px; }
.tool-head p { margin: 0; }
.tool-body {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 32px);
  padding: clamp(20px, 3vw, 32px);
  align-items: start;
}
@media (max-width: 900px) { .tool-body { grid-template-columns: minmax(0, 1fr); } }
.tool-controls { min-width: 0; }
.tool-controls .btn { margin-top: 4px; }
.tool-output { min-width: 0; }

fieldset.asset { border: none; margin: 0 0 16px; padding: 0; min-width: 0; }
fieldset.asset legend { font-weight: 600; font-size: 0.95rem; padding: 0; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
fieldset.asset legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
fieldset.asset .field { margin-bottom: 8px; }

.field select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpis-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--paper); border-radius: var(--r-md); padding: 12px 14px; min-width: 0; }
.kpi span { display: block; font-size: 0.82rem; color: var(--ink-soft); }
.kpi b { display: block; font-family: var(--font-display); font-weight: 500; font-size: 1.15rem; font-variant-numeric: tabular-nums; margin-top: 2px; overflow-wrap: anywhere; }
.kpi-main { background: var(--midnight); color: var(--on-dark); }
.kpi-main span { color: var(--on-dark-soft); }

svg.chart { width: 100%; height: auto; display: block; }

.weights { display: grid; gap: 8px; margin-top: 12px; }
.wrow { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 0.92rem; }
.wtitle { font-weight: 600; min-width: 7.5em; }
.wcell { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); }
.wcell i { width: 9px; height: 9px; border-radius: 50%; }
.wcell b { color: var(--ink); font-variant-numeric: tabular-nums; }

.seg { display: inline-flex; padding: 4px; background: var(--paper); border-radius: 999px; margin-bottom: 16px; border: 1px solid var(--line); }
.seg button {
  font: inherit; font-weight: 600; font-size: 0.92rem;
  padding: 7px 20px; border: none; border-radius: 999px;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.seg button[aria-pressed="true"] { background: var(--midnight); color: var(--on-dark); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.88rem; color: var(--ink-soft); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend .ln { width: 22px; height: 0; border-top: 3px solid var(--violet); display: inline-block; }
.legend .ln-dash { border-top: 2px dashed var(--midnight); }
.legend .ln-dot { border-top: 2px dotted var(--pink); }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend .dot-pink { background: var(--pink); }

.bd-status { margin: -4px 0 6px; font-size: 0.92rem; color: var(--ink-soft); }

.heat-title { font-size: 1rem; margin: 22px 0 10px; }
.heat-wrap { overflow-x: auto; }
table.heat { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
table.heat th { font-weight: 600; color: var(--ink-soft); padding: 6px 4px; text-align: center; white-space: nowrap; }
table.heat thead th:first-child span { font-weight: 400; font-size: 0.78rem; }
table.heat td { text-align: center; padding: 8px 4px; border-radius: 6px; color: var(--ink); }
table.heat td.base { outline: 2px solid var(--midnight); outline-offset: -2px; font-weight: 700; }
table.heat td.na { color: var(--ink-soft); background: var(--paper); }

/* Tools grid: three code skills on top, Excel and Power BI below */
.skills { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.skills .skill { grid-column: span 2; }
.skills .skill-wide { grid-column: span 3; }
@media (max-width: 960px) { .skills { grid-template-columns: minmax(0, 1fr); } .skills .skill, .skills .skill-wide { grid-column: auto; } }

/* ---------- Floating navigation bubble ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  background: none;
  backdrop-filter: none;
  border-bottom: none;
  pointer-events: none;
}
.site-header .nav,
.site-header .nav.open {
  pointer-events: auto;
  position: static;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  box-shadow: 0 10px 30px -12px rgba(23, 25, 90, 0.28), 0 2px 6px -2px rgba(23, 25, 90, 0.08);
  max-width: 100%;
}
.site-header .nav a {
  padding: 9px 18px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease;
}
.site-header .nav a[aria-current="page"] { background: var(--midnight); color: var(--on-dark); }
.site-header .nav a[aria-current="page"]:hover { background: var(--plum); color: var(--on-dark); }
.nav-toggle { display: none !important; }
@media (max-width: 720px) {
  .site-header .nav a { padding: 8px 12px; font-size: 0.92rem; }
}
@media (max-width: 360px) {
  .site-header .nav a { padding: 8px 9px; font-size: 0.88rem; }
}

/* LinkedIn bubble, top right */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.site-header .nav { grid-column: 2; }
.social {
  grid-column: 3;
  justify-self: end;
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: var(--midnight);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  box-shadow: 0 10px 30px -12px rgba(23, 25, 90, 0.28), 0 2px 6px -2px rgba(23, 25, 90, 0.08);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), color .2s ease, background-color .2s ease;
}
.social:hover { transform: translateY(-2px); color: #0a66c2; background: var(--surface); }
@media (min-width: 1160px) {
  .site-header { padding-right: max(16px, calc((100vw - var(--wrap)) / 2 + var(--gutter))); padding-left: max(16px, calc((100vw - var(--wrap)) / 2 + var(--gutter))); }
}
@media (max-width: 560px) {
  .site-header { grid-template-columns: auto auto; justify-content: center; gap: 6px; }
  .site-header .nav, .social { grid-column: auto; }
  .site-header .nav a { padding: 8px 9px; font-size: 0.88rem; }
  .social { width: 40px; height: 40px; }
  .social svg { width: 17px; height: 17px; }
}
@media (max-width: 380px) {
  .site-header { gap: 4px; padding-left: 8px; padding-right: 8px; }
  .site-header .nav { padding: 3px; gap: 0; }
  .site-header .nav a { padding: 7px 7px; font-size: 0.8rem; }
  .social { width: 36px; height: 36px; }
  .social svg { width: 15px; height: 15px; }
}
@media (prefers-reduced-motion: reduce) { .social:hover { transform: none; } }

/* Let lab cards shrink on very narrow phones */
.lab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lab-grid > * { min-width: 0; }
@media (max-width: 900px) { .lab-grid { grid-template-columns: minmax(0, 1fr); } }

/* Blog title + name byline in the hero */
.hero h1 { margin-bottom: 14px; }
.hero .byline {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
}
.hero .byline::before {
  content: "";
  width: 32px;
  height: 3px;
  border-radius: 3px;
  background: var(--grad);
}

/* ---------- Portfolio banner ---------- */
.banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  aspect-ratio: 1040 / 360;
  min-height: 190px;
  max-width: 100%;
  background-color: var(--midnight);
  background-image:
    linear-gradient(180deg, rgba(23, 25, 90, 0.10) 0%, rgba(23, 25, 90, 0.55) 55%, rgba(23, 25, 90, 0.96) 100%),
    linear-gradient(90deg, rgba(43, 27, 95, 0.55), rgba(76, 91, 255, 0.10) 50%, rgba(236, 95, 171, 0.28)),
    url("../img/hero-ai-finance.webp");
  background-size: cover;
  background-position: center 38%;
  margin-bottom: clamp(32px, 5vw, 56px);
  box-shadow: 0 30px 60px -36px rgba(23, 25, 90, 0.6);
}
.banner::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: var(--grad);
}
.banner { container-type: inline-size; }
.banner-title {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  margin: 0;
  padding: 0 clamp(14px, 2.4vw, 26px);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 0.78;
  text-transform: uppercase;
  white-space: nowrap;
}
.banner-title span {
  display: inline-block;
  font-size: 13cqw;
  color: #ffffff;
  background: linear-gradient(90deg, #ffffff 0%, #eeedff 68%, #f9a8d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-bottom: 0.07em;
}
.hero .byline { margin-top: 4px; }
