:root {
  --bg: #f2f5f5;
  --surface: #ffffff;
  --surface-2: #e8eeee;
  --ink: #13222a;
  --body: #3b4a52;
  --muted: #6c7b81;
  --line: #d6dfe0;
  --accent: #0d6b6e;
  --accent-soft: #d8eae9;
  --signal: #d9862f;
  --shadow: 0 1px 0 rgba(19,34,42,.04), 0 12px 32px -18px rgba(19,34,42,.25);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c181b; --surface: #122327; --surface-2: #172d32;
    --ink: #e6eff0; --body: #b6c6c9; --muted: #7f9498; --line: #22393e;
    --accent: #4bb5ae; --accent-soft: #163b3c; --signal: #f0a457;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 16px 40px -20px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c181b; --surface: #122327; --surface-2: #172d32;
  --ink: #e6eff0; --body: #b6c6c9; --muted: #7f9498; --line: #22393e;
  --accent: #4bb5ae; --accent-soft: #163b3c; --signal: #f0a457;
  --shadow: 0 1px 0 rgba(0,0,0,.2), 0 16px 40px -20px rgba(0,0,0,.7);
  color-scheme: dark;
}

:root { box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 72px); scroll-behavior: smooth; }
*, *::before, *::after { box-sizing: inherit; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--body);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
a { color: inherit; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(1120px, 100% - 48px); margin-inline: auto; }

/* ---------- nav ---------- */
nav.top {
  position: sticky; top: env(safe-area-inset-top, 0px); 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 transparent; transition: border-color .3s;
}
nav.top.scrolled { border-bottom-color: var(--line); }
nav.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { white-space: nowrap; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
nav.top ul { list-style: none; display: flex; gap: 4px; align-items: center; }
nav.top ul a { text-decoration: none; font-size: 15px; color: var(--muted); padding: 6px 10px; border-radius: 8px; transition: color .2s, background .2s; }
nav.top ul a:hover { color: var(--ink); background: var(--surface-2); }
.theme-btn { background: none; border: 1px solid var(--line); color: var(--ink); width: 36px; height: 36px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; margin-left: 6px; }
.theme-btn svg { width: 17px; height: 17px; }
@media (max-width: 640px) { nav.top ul li.hide-sm { display: none; } nav.top ul a { padding: 6px 7px; } }
@media (max-width: 380px) { .brand .brand-name { display: none; } }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero .wrap { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; min-height: min(640px, 78vh); gap: 24px; padding-block: 40px 56px; }
.hero-text { position: relative; z-index: 2; }
.hero h1 {
  font-size: clamp(52px, 8.4vw, 104px); line-height: .92; letter-spacing: -.045em;
  color: var(--ink); font-weight: 700;
}
.hero h1 span { display: block; }
.hero .role { margin-top: 22px; font-size: clamp(18px, 2vw, 21px); color: var(--ink); font-weight: 500; max-width: 30ch; line-height: 1.4; }
.hero .lede { margin-top: 12px; max-width: 44ch; color: var(--body); }
.hero-links { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none;
  font-size: 15px; font-weight: 500; padding: 10px 16px; border-radius: 11px;
  border: 1px solid var(--line); color: var(--ink); background: var(--surface);
  transition: border-color .2s, transform .2s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn svg { width: 17px; height: 17px; fill: currentColor; }

.graph-box { position: relative; height: 100%; min-height: 440px; }
#graph { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.graph-caption { position: absolute; right: 0; bottom: 0; font-size: 13px; color: var(--muted); }
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; min-height: auto; padding-top: 28px; }
  .graph-box { min-height: 320px; order: 2; }
}

/* ---------- sections ---------- */
section.block { padding-block: 72px; }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; flex-wrap: wrap; }
.sec-head h2 { font-size: clamp(30px, 4vw, 44px); line-height: 1.05; letter-spacing: -.03em; color: var(--ink); font-weight: 700; }
.sec-head p { color: var(--muted); max-width: 46ch; font-size: 16px; }

/* ---------- projects ---------- */
.projects { border-top: 1px solid var(--line); }
.proj { border-bottom: 1px solid var(--line); }
.proj-head {
  width: 100%; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) auto 32px; gap: 20px; align-items: center;
  padding: 24px 6px;
}
.proj-head:hover .proj-name { color: var(--accent); }
.proj-name { font-size: clamp(21px, 2.4vw, 26px); font-weight: 600; letter-spacing: -.02em; color: var(--ink); line-height: 1.15; transition: color .2s; }
.proj-name .he { font-family: "Heebo", sans-serif; font-weight: 700; color: var(--muted); font-size: .8em; margin-left: 8px; }
.proj-one { color: var(--body); font-size: 16px; }
.status { font-size: 13px; font-weight: 500; padding: 4px 10px; border-radius: 99px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2); color: var(--ink); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status.live::before { background: var(--signal); box-shadow: 0 0 0 0 var(--signal); animation: ping 2.4s infinite; }
.status.build::before { background: var(--accent); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 60%, transparent);} 70%,100% { box-shadow: 0 0 0 7px transparent; } }
.chev { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; transition: transform .35s cubic-bezier(.2,.8,.2,1), background .2s, border-color .2s; }
.chev svg { width: 14px; height: 14px; stroke: var(--ink); fill: none; stroke-width: 2.2; }
.proj.open .chev { transform: rotate(45deg); background: var(--accent); border-color: var(--accent); }
.proj.open .chev svg { stroke: var(--bg); }

.proj-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s cubic-bezier(.2,.8,.2,1); }
.proj.open .proj-body { grid-template-rows: 1fr; }
.proj-body > .inner { overflow: hidden; }
.proj-content {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 36px;
  padding: 4px 6px 34px; opacity: 0; transform: translateY(-6px); transition: opacity .35s, transform .45s;
}
.proj.open .proj-content { opacity: 1; transform: none; transition-delay: .12s; }
.proj-content p + p { margin-top: 12px; }
.proj-content h4 { font-size: 14px; font-weight: 600; color: var(--ink); margin: 22px 0 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; padding: 4px 9px; border-radius: 7px; background: var(--accent-soft); color: var(--ink); }
.visual {
  border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  min-height: 300px; position: relative; overflow: hidden; display: grid; place-items: center; padding: 26px;
}
@media (max-width: 860px) {
  .proj-head { grid-template-columns: minmax(0,1fr) auto 32px; row-gap: 6px; }
  .proj-one { grid-column: 1 / -1; grid-row: 2; }
  .proj-content { grid-template-columns: 1fr; gap: 24px; }
}

/* --- visual: Picshare phone --- */
.phone { width: 176px; height: 344px; border-radius: 30px; background: #0f0d13; padding: 9px; box-shadow: 0 20px 40px -18px rgba(15,13,19,.6); position: relative; }
.phone .screen { width: 100%; height: 100%; border-radius: 22px; overflow: hidden; display: flex; flex-direction: column; background: #0f0d13; }
.vf { flex: 1; position: relative; background: radial-gradient(120% 90% at 30% 20%, #e7b9a8 0%, #b98bd0 45%, #7257e8 100%); }
.vf::before, .vf::after { content: ""; position: absolute; inset: 14px; border: 1.5px solid rgba(246,241,233,.7); border-radius: 6px; clip-path: polygon(0 0, 22% 0, 22% 2px, 2px 2px, 2px 22%, 0 22%, 0 78%, 2px 78%, 2px calc(100% - 2px), 22% calc(100% - 2px), 22% 100%, 78% 100%, 78% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 78%, 100% 78%, 100% 22%, calc(100% - 2px) 22%, calc(100% - 2px) 2px, 78% 2px, 78% 0, 100% 0, 100% 0); }
.vf .count { position: absolute; top: 12px; right: 12px; font-family: "Heebo"; font-size: 11px; color: #f6f1e9; background: rgba(15,13,19,.35); padding: 2px 8px; border-radius: 99px; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; }
.proj.open .flash { animation: flash 4s 1s infinite; }
@keyframes flash { 0%, 90%, 100% { opacity: 0; } 92% { opacity: .85; } }
.filters { display: flex; justify-content: center; gap: 7px; padding: 10px 0 6px; }
.filters i { width: 18px; height: 18px; border-radius: 50%; display: block; border: 1.5px solid transparent; }
.filters i:nth-child(1) { background: #f6f1e9; } .filters i:nth-child(2) { background: #e7b9a8; border-color: #f6f1e9; } .filters i:nth-child(3) { background: #7257e8; } .filters i:nth-child(4) { background: #3d3a44; }
.shutter { width: 46px; height: 46px; border-radius: 50%; border: 3px solid #f6f1e9; margin: 4px auto 12px; display: grid; place-items: center; }
.shutter::after { content: ""; width: 34px; height: 34px; border-radius: 50%; background: #f6f1e9; }
.qr { position: absolute; left: calc(50% - 160px); bottom: 36px; width: 78px; height: 78px; background: #f6f1e9; border-radius: 10px; padding: 8px; box-shadow: var(--shadow); transform: rotate(-8deg);
  background-image: conic-gradient(#17151b 25%, transparent 0 50%, #17151b 0 75%, transparent 0); background-size: 12px 12px; background-origin: content-box; background-clip: content-box; }
.qr::before { content: ""; position: absolute; inset: 8px; background: linear-gradient(90deg,#f6f1e9 1px,transparent 1px) 0 0/6px 6px; }

/* --- visual: Rega player --- */
.player { width: min(320px, 100%); background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 18px; direction: rtl; font-family: "Heebo", sans-serif; }
.player .t { font-weight: 700; color: var(--ink); font-size: 17px; }
.player .s { font-size: 13px; color: var(--muted); }
.hosts { display: flex; gap: 8px; margin: 14px 0; }
.host { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink); background: var(--surface-2); padding: 4px 10px 4px 4px; border-radius: 99px; }
.host b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; }
.host:nth-child(1) b { background: var(--accent); } .host:nth-child(2) b { background: var(--signal); }
.wave { display: flex; align-items: center; gap: 3px; height: 54px; direction: ltr; }
.wave i { flex: 1; border-radius: 2px; background: var(--accent); opacity: .85; height: var(--h); transform-origin: center; }
.wave i.b { background: var(--signal); }
.proj.open .wave i { animation: talk 1.1s ease-in-out infinite alternate; animation-delay: var(--d); }
@keyframes talk { to { transform: scaleY(.35); } }
.player .bar { height: 4px; background: var(--surface-2); border-radius: 4px; margin-top: 14px; overflow: hidden; direction: ltr; }
.player .bar i { display: block; height: 100%; width: 38%; background: var(--ink); border-radius: 4px; }
.proj.open .player .bar i { animation: prog 14s linear infinite; }
@keyframes prog { from { width: 4%; } to { width: 100%; } }
.player .time { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; direction: ltr; font-family: "IBM Plex Mono", monospace; }

/* --- visual: chart (market gym / hmm) --- */
.chart-card { width: 100%; }
.chart-card svg { width: 100%; height: auto; display: block; }
.chart-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 14px; color: var(--ink); gap: 10px; flex-wrap: wrap; }
.xp { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.xp .track { width: 110px; height: 7px; border-radius: 7px; background: var(--surface-2); overflow: hidden; }
.xp .track i { display: block; height: 100%; width: 0; background: var(--signal); border-radius: 7px; transition: width 1.4s cubic-bezier(.2,.8,.2,1) .3s; }
.proj.open .xp .track i { width: 68%; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.draw path.line { stroke-dasharray: 1200; stroke-dashoffset: 1200; }
.proj.open .draw path.line { animation: draw 2.2s cubic-bezier(.4,.1,.2,1) .25s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* --- visual: agents --- */
.flow { width: 100%; display: grid; gap: 12px; }
.flow-row { display: grid; grid-template-columns: 1fr auto 1.2fr auto 1fr; align-items: center; gap: 8px; }
.node { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; color: var(--ink); text-align: center; line-height: 1.3; }
.node small { display: block; color: var(--muted); font-size: 12px; }
.node.core { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.link { width: 26px; height: 2px; background: var(--line); position: relative; overflow: hidden; }
.link::after { content: ""; position: absolute; top: 0; left: -40%; width: 40%; height: 100%; background: var(--signal); }
.proj.open .link::after { animation: pkt 1.6s linear infinite; }
.proj.open .link.rev::after { animation-direction: reverse; animation-delay: .8s; }
@keyframes pkt { to { left: 100%; } }
.log { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-family: "IBM Plex Mono", monospace; font-size: 12.5px; color: var(--body); display: grid; gap: 5px; }
.log div { display: flex; gap: 8px; align-items: center; opacity: 0; transform: translateX(-4px); transition: opacity .3s, transform .3s; }
.proj.open .log div { opacity: 1; transform: none; }
.proj.open .log div:nth-child(2) { transition-delay: .5s; } .proj.open .log div:nth-child(3) { transition-delay: 1s; } .proj.open .log div:nth-child(4) { transition-delay: 1.5s; }
.log i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.log i.w { background: var(--signal); }

/* ---------- stack ---------- */
.stack { display: grid; gap: 0; border-top: 1px solid var(--line); }
.stack-row { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line); align-items: center; }
.stack-row h3 { font-size: 16px; font-weight: 600; color: var(--ink); }
.tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.tile {
  --c: var(--ink);
  display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px 9px 10px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  font-size: 14.5px; color: var(--ink); transition: border-color .25s, transform .25s, box-shadow .25s;
  opacity: 0; transform: translateY(8px);
}
.stack.in .tile { opacity: 1; transform: none; transition: opacity .5s, transform .5s, border-color .25s, box-shadow .25s; transition-delay: calc(var(--i) * 28ms), calc(var(--i) * 28ms), 0s, 0s; }
.tile svg { width: 22px; height: 22px; fill: var(--muted); transition: fill .25s, transform .35s cubic-bezier(.3,1.6,.5,1); }
.tile:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); box-shadow: 0 8px 22px -14px var(--c); }
.tile:hover svg { fill: var(--c); transform: scale(1.18) rotate(-6deg); }
.tile.text-only { padding-left: 14px; }
.tile.text-only::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@media (max-width: 720px) { .stack-row { grid-template-columns: 1fr; gap: 12px; } }

/* ---------- path ---------- */
.path { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.path h3 { font-size: 15px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
.tl { list-style: none; position: relative; }
.tl::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl li { position: relative; padding: 0 0 24px 34px; }
.tl li::before { content: ""; position: absolute; left: 1px; top: 7px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.tl li.now::before { background: var(--accent); }
.tl .when { font-family: "IBM Plex Mono", monospace; font-size: 13px; color: var(--muted); }
.tl .what { font-weight: 600; color: var(--ink); font-size: 17.5px; line-height: 1.3; margin-top: 2px; }
.tl .where { color: var(--accent); font-weight: 500; font-size: 15.5px; }
.tl p { font-size: 15.5px; margin-top: 6px; max-width: 52ch; }
@media (max-width: 820px) { .path { grid-template-columns: 1fr; gap: 24px; } }

/* ---------- contact ---------- */
.contact-band { border-top: 1px solid var(--line); padding-block: 72px 56px; }
.contact-band h2 { font-size: clamp(34px, 5.4vw, 64px); line-height: 1; letter-spacing: -.04em; color: var(--ink); font-weight: 700; max-width: 16ch; }
.contact-band .hero-links { margin-top: 28px; }
footer { padding-block: 26px 34px; font-size: 14px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .draw path.line { stroke-dashoffset: 0; }
}
