/* Gray-Jan Tupas portfolio: "dark workflow canvas".
   Shared by every page. One dark theme, one emerald accent, Geist + Geist Mono.
   Radius rule: nodes, panels and media 12px; buttons, tags and status pills full pill. */

/* ============ FONTS: self-hosted, latin subset ============ */
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/geist.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(fonts/geist-mono.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ============ TOKENS ============ */
:root {
  --bg: #0D110F;
  --panel: #151B18;
  --panel-2: #1B2320;
  --edge: #28332D;
  --text: #E6ECE8;      /* 15.9:1 on bg */
  --text-2: #A7B4AC;    /* 8.9:1 on bg, 8.1:1 on panel */
  --muted: #8C9A92;     /* 6.5:1 on bg, 6.0:1 on panel */
  --accent: #3FCF8E;    /* 9.5:1 on bg; dark ink on it is 9:1 */
  --accent-ink: #0B1A12;
  --r: 12px;
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'Courier New', monospace;
  color-scheme: dark;
}

/* ============ BASE ============ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.in { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
section { padding: clamp(56px, 8vw, 104px) 0; border-top: 1px solid var(--edge); }
section > .in > h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
.sub { color: var(--text-2); max-width: 64ch; margin-top: 12px; }
.eyebrow { font: 500 .82rem/1.4 var(--mono); color: var(--muted); margin-bottom: 22px; }
/* faint grain over everything, so the dark surfaces are not flat; fixed so it never repaints on scroll */
body::after { content: ""; position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: .05; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E"); }
.skip { position: absolute; left: -999px; top: 12px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 12px 16px; border-radius: 8px; font-weight: 600; }
.skip:focus { left: 12px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ============ BUTTONS ============ */
.btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 24px; border-radius: 999px; font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap; transition: transform .2s cubic-bezier(.16, 1, .3, 1), background-color .2s ease, box-shadow .2s ease; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #5BDCA2; }
.btn.ghost { box-shadow: inset 0 0 0 1px var(--edge); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--text-2); }

/* ============ NODES: the one building block ============ */
.node { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r); }
.node > header { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--edge); font: 500 .76rem/1 var(--mono); color: var(--muted); }
.node > header .on, .live { color: var(--accent); }

/* ============ NAV ============ */
.nav { position: sticky; top: 0; z-index: 10; background: rgba(13, 17, 15, .94); border-bottom: 1px solid var(--edge); }
.nav .in { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; min-height: 44px; font: 500 .95rem var(--mono); text-decoration: none; white-space: nowrap; }
.nav nav { margin-left: auto; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav nav::-webkit-scrollbar { display: none; }
.nav nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-size: .92rem; text-decoration: none; color: var(--text-2); white-space: nowrap; }
.nav nav a:hover { color: var(--text); }
.nav nav a.active, .nav nav a[aria-current] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

/* ============ HOME: HERO ============ */
.hero { border-top: 0; padding-top: clamp(48px, 7vw, 88px); }
.hero .in { display: grid; gap: 48px; align-items: center; }
@media (min-width: 860px) { .hero .in { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 56px; } }
.hero h1 { font-size: clamp(2.8rem, 6.4vw, 5rem); letter-spacing: -0.035em; line-height: 1; }
.hero h1 span { display: block; margin-top: 14px; font-size: clamp(1.1rem, 2.2vw, 1.5rem); font-weight: 400; letter-spacing: -0.01em; color: var(--accent); }
.hero .lede { max-width: 44ch; margin-top: 22px; font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--text-2); }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* the portrait as a node, wired to the three rules */
.hero-flow { position: relative; display: grid; gap: 20px; }
@media (min-width: 860px) { .hero-flow { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 44px; align-items: center; } }
.me { margin: 0; overflow: hidden; max-width: 300px; }
.me img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 14%; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: step; }
.step { position: relative; padding: 12px 14px 12px 44px; font-size: .92rem; counter-increment: step; }
.step::before { content: counter(step); position: absolute; left: 14px; top: 12px; font: 500 .8rem/1.6 var(--mono); color: var(--accent); }

/* wires, drawn by site.js from the layout; none on phones, where the nodes stack */
.wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.wires path { fill: none; stroke: var(--accent); stroke-opacity: .5; stroke-width: 1.5; }
.wires circle { fill: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .copy > * { animation: rise .8s cubic-bezier(.16, 1, .3, 1) both; }
  .copy > :nth-child(2) { animation-delay: .08s; } .copy > :nth-child(3) { animation-delay: .16s; } .copy > :nth-child(4) { animation-delay: .24s; }
  .hero-flow .node { animation: rise .8s cubic-bezier(.16, 1, .3, 1) both; }
  .hero-flow .step:nth-child(1) { animation-delay: .2s; } .hero-flow .step:nth-child(2) { animation-delay: .3s; } .hero-flow .step:nth-child(3) { animation-delay: .4s; }
  /* the live workflow shows data moving along its wires, as n8n does while it runs */
  .wf .wires path { stroke-dasharray: 6 8; animation: flow 1.2s linear infinite; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } }
  @keyframes flow { to { stroke-dashoffset: -28; } }
}

/* ============ HOME: FACTS ============ */
.facts { padding: 36px 0; }
.facts .in { display: grid; gap: 28px; }
@media (min-width: 860px) { .facts .in { grid-template-columns: 1.3fr 1fr; align-items: center; } }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 32px; margin: 0; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, auto); justify-content: start; } }
.stats div { display: flex; flex-direction: column; }
.stats dd { order: -1; margin: 0; font: 500 2rem/1 var(--mono); letter-spacing: -0.02em; }
.stats dt { margin-top: 8px; font-size: .85rem; color: var(--muted); }
.now h2 { font-size: .95rem; letter-spacing: 0; }
.now ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: .95rem; }
.now li::marker { color: var(--accent); }

/* ============ HOME: FEATURED LIVE WORKFLOW ============ */
.flag { display: flex; align-items: center; gap: 12px; font: 500 .8rem/1 var(--mono); color: var(--muted); margin-bottom: 16px; }
.flag .live { padding: 5px 11px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--accent); }
.featured h2 { font-size: clamp(2rem, 4.4vw, 3.2rem); max-width: 20ch; }
.featured .lede { max-width: 62ch; margin-top: 16px; font-size: 1.1rem; color: var(--text-2); }
.wf { position: relative; display: grid; gap: 14px; margin-top: 48px; }
@media (min-width: 860px) { .wf { grid-template-columns: 170px 170px minmax(0, 1fr) 190px; gap: 56px; align-items: center; } }
.wf .col { display: grid; gap: 10px; }
.wf .node { padding: 12px 14px; }
.wf .node b { display: block; font-size: .95rem; }
.wf .node span { display: block; font-size: .85rem; color: var(--text-2); }
.wf .node .k { font: 500 .72rem/1.4 var(--mono); color: var(--accent); }
.wf .route { padding: 10px 14px; }
.wf .route.human { border-style: dashed; border-color: var(--text-2); }
.wf .alert { box-shadow: inset 0 0 0 1px var(--accent); }
.story { display: grid; gap: 32px; margin-top: 56px; }
@media (min-width: 960px) { .story { grid-template-columns: 1fr 1fr 1.2fr; gap: 40px; align-items: start; } }
.story h3 { font-size: 1.05rem; margin-bottom: 10px; }
.story p { color: var(--text-2); }
.canvas { display: block; padding: 10px; background: #111; border: 1px solid var(--edge); border-radius: var(--r); text-decoration: none; transition: border-color .2s ease; }
.canvas:hover { border-color: var(--accent); }
.canvas span { display: block; margin-top: 8px; font: .76rem var(--mono); color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 14px 0 0; padding: 0; }
.tags li { padding: 3px 11px; border-radius: 999px; background: var(--panel-2); font: .76rem/1.6 var(--mono); color: var(--text-2); }

/* ============ HOME: OTHER BUILDS (seven cells, no gaps) ============ */
.grid { display: grid; gap: 16px; margin-top: 36px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(2, 1fr); } .grid > :last-child { grid-column: 1 / -1; } }
@media (min-width: 1020px) { .grid { grid-template-columns: repeat(3, 1fr); } .grid > :first-child, .grid > :last-child { grid-column: span 2; } }
.card { display: flex; flex-direction: column; overflow: hidden; transition: border-color .2s ease, transform .3s cubic-bezier(.16, 1, .3, 1); }
.card:hover { border-color: #3A4840; transform: translateY(-2px); }
.thumb { display: block; aspect-ratio: 16 / 9; background: #111; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.card .body { display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 18px; flex: 1; }
.card h3 { font-size: 1.12rem; }
.card .body > p { color: var(--text-2); font-size: .95rem; }
details { margin-top: auto; padding-top: 4px; }
summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; font-size: .92rem; list-style: none; color: var(--accent); }
summary::-webkit-details-marker { display: none; }
summary:hover { text-decoration: underline; text-underline-offset: 3px; }
summary::after { content: "+"; margin-left: 8px; font-weight: 400; }
details[open] summary::after { content: "\2212"; }
details p, details li, details .dv { color: var(--text-2); font-size: .92rem; margin-top: 8px; }
details .dl { margin-top: 12px; font-weight: 600; font-size: .88rem; color: var(--text); }
details ul { margin: 6px 0 0; padding-left: 18px; }

/* ============ HOME: CASE-STUDY PANELS ============ */
.pair { display: grid; gap: 16px; margin-top: 36px; }
@media (min-width: 860px) { .pair { grid-template-columns: 1.2fr 1fr; } }
.case { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; transition: border-color .2s ease; }
.case:hover { border-color: var(--accent); }
.case .pic { aspect-ratio: 16 / 9; overflow: hidden; }
.case .pic img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.case .body { display: flex; flex-direction: column; gap: 10px; padding: 22px; flex: 1; }
.case h3 { font-size: 1.3rem; }
.case p { color: var(--text-2); }
.more { margin-top: auto; padding-top: 12px; font-weight: 600; color: var(--accent); }
.more::after { content: " \2192"; }

/* ============ HOME: SYSTEMS BENTO ============ */
.bento { display: grid; gap: 16px; margin-top: 36px; }
@media (min-width: 860px) { .bento { grid-template-columns: 1.25fr 1fr; } .c1 { grid-row: span 2; } .c4 { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; align-items: center; } }
.cell { display: flex; flex-direction: column; overflow: hidden; }
.cell .shot { display: block; background: #111; }
.cell .shot img { width: 100%; max-height: 300px; object-fit: cover; object-position: top; }
.c1 .shot { flex: 1; } .c1 .shot img { max-height: none; height: 100%; }
.cell .body { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.cell h3 { font-size: 1.08rem; }
.cell p { color: var(--text-2); font-size: .95rem; }
.boundary { font-size: .88rem !important; padding-left: 12px; box-shadow: inset 2px 0 0 var(--accent); }

/* ============ HOME: APPROACH, STACK, EXPERIENCE, CONTACT ============ */
.approach .in { display: grid; gap: 32px; }
@media (min-width: 860px) { .approach .in { grid-template-columns: 1fr 2fr; gap: 64px; } .approach h2 { position: sticky; top: 100px; align-self: start; } }
.approach ol { list-style: none; margin: 0; padding: 0; counter-reset: rule; display: grid; gap: 32px; }
.approach li { counter-increment: rule; display: grid; grid-template-columns: 48px 1fr; gap: 4px 16px; }
.approach li::before { content: counter(rule); grid-row: span 2; font: 500 1.6rem/1.2 var(--mono); color: var(--accent); }
.approach h3 { font-size: 1.2rem; }
.approach p { color: var(--text-2); max-width: 58ch; }

.logos { display: flex; flex-wrap: wrap; gap: 28px 36px; list-style: none; margin: 36px 0 28px; padding: 0; }
.logos img { width: 34px; height: 34px; opacity: .8; transition: opacity .2s ease; }
.logos img:hover { opacity: 1; }

.xp ol { list-style: none; margin: 36px 0 0; padding: 0; }
.xp ol > li { display: grid; gap: 6px 32px; padding: 28px 0; border-top: 1px solid var(--edge); }
@media (min-width: 760px) { .xp ol > li { grid-template-columns: 180px 1fr; } }
.when { font: .85rem var(--mono); color: var(--muted); padding-top: 4px; }
.xp h3 { font-size: 1.2rem; }
.note { font-weight: 400; color: var(--muted); }
.org { margin-top: 2px; font-weight: 500; color: var(--accent); }
.xp ul { margin: 10px 0 0; padding-left: 18px; color: var(--text-2); }
.xp ul li { margin-bottom: 6px; }

.contact { background: var(--panel); }
.contact h2 { font-size: clamp(2rem, 4.4vw, 3.2rem); max-width: 18ch; }
.contact p { max-width: 56ch; margin: 18px 0 28px; color: var(--text-2); }
.clist { display: flex; flex-wrap: wrap; gap: 0 28px; list-style: none; margin: 32px 0 0; padding: 0; }
.clist a, .clist .static { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; text-decoration: none; }
.clist a:hover .cv { color: var(--accent); }
.clist .ck { font: .76rem var(--mono); color: var(--muted); }
.foot { border-top: 1px solid var(--edge); color: var(--muted); padding: 24px 0; font-size: .85rem; }

/* ============ CASE-STUDY PAGES (/work/*) ============ */
.cs-hero { padding: clamp(48px, 7vw, 88px) 0 clamp(36px, 5vw, 56px); }
.cs-hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); max-width: 20ch; letter-spacing: -0.03em; }
.status-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.status { padding: 4px 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--accent); font: 500 .78rem/1.4 var(--mono); color: var(--accent); }
.hero-desc { max-width: 62ch; margin-top: 20px; font-size: 1.1rem; color: var(--text-2); }
.cs-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 36px 0 0; }
.cs-meta > div { padding: 14px 16px; background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r); }
.cs-meta dt { font: 500 .74rem var(--mono); color: var(--muted); }
.cs-meta dd { margin: 4px 0 0; }
.cs { padding-bottom: 72px; }
.cs > section { max-width: 720px; padding: clamp(32px, 5vw, 48px) 0; }
.cs h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); margin-bottom: 14px; }
.cs p { color: var(--text-2); margin-bottom: 14px; }
.cs p, .cs section > ul { max-width: 65ch; }
.cs section > ul { margin: 0 0 14px; padding-left: 20px; color: var(--text-2); }
.cs section > ul li { margin-bottom: 8px; }
.cs section > ul li::marker { color: var(--accent); }
.cs strong { color: var(--text); }
.cs a { color: var(--accent); text-underline-offset: 3px; }
.cs li > a { display: inline-block; padding: 12px 0; } /* 44px touch target */
.process { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 18px; }
.process li { position: relative; padding: 12px 16px 14px; background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r); color: var(--text-2); }
.process li:not(:last-child)::after { content: ""; position: absolute; left: 28px; top: 100%; height: 18px; border-left: 1.5px solid var(--accent); opacity: .6; }
.process b { display: block; color: var(--text); font-size: 1.05rem; }
.cs .shot { margin: 18px 0 0; }
.cs .shot img { width: 100%; border: 1px solid var(--edge); border-radius: var(--r); }
.cs .shot figcaption { margin-top: 8px; font: .78rem var(--mono); color: var(--muted); }
.cs-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.ps { padding: 16px; background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r); }
.ps h3 { font: 500 .8rem var(--mono); letter-spacing: 0; color: var(--accent); margin-bottom: 8px; }
.ps ul { margin: 0; padding-left: 18px; color: var(--text-2); }
.ps li { margin-bottom: 6px; font-size: .95rem; }
.ps li::marker { color: var(--accent); }

/* AI workspace diagram (inline SVG) */
.dg { display: block; width: 100%; max-width: 440px; height: auto; margin: 20px 0; }
.dg .n { fill: var(--panel); stroke: var(--edge); }
.dg .g { fill: var(--accent); }
.dg .a { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dg .k { font: 500 10.5px var(--mono); letter-spacing: .12em; fill: var(--muted); }
.dg .h { font: 600 16px var(--sans); fill: var(--text); }
.dg .p { font: 13px var(--sans); fill: var(--text-2); }
.dg .m { font: 11.5px var(--mono); fill: var(--text); }
.dg .on { fill: var(--accent-ink); }
.dg .on2 { fill: var(--accent-ink); opacity: .75; }

/* ============ HOME: INTRO (built by site.js, once per session, never with reduced motion) ============ */
.intro-layer { position: fixed; inset: 0; z-index: 30; overflow: hidden; }
.intro-layer::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 45% at 50% 50%, #142019, var(--bg) 70%); transition: opacity .6s ease; }
.intro-layer.leaving { pointer-events: none; }
/* on hand-over everything fades except the photo, which stays solid while it glides into the hero */
.intro-layer.leaving::before, .intro-layer.leaving .intro-flow > :not(.i-me), .intro-layer.leaving .i-log, .intro-layer.leaving .i-progress, .intro-layer.leaving .intro-skip { opacity: 0; transition: opacity .4s ease; }
.intro-layer.leaving.fade .i-me { opacity: 0; transition: opacity .4s ease; }
/* progress of the execution, along the top edge */
.i-progress { position: absolute; left: 0; top: 0; width: 100%; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .4s ease; }
/* the track holds the whole workflow; the "camera" is the track sliding so the newest node sits mid-screen */
.intro-flow { position: absolute; left: 0; top: 50%; display: flex; align-items: center; transform: translate(var(--x, 0px), -50%); transition: transform .6s cubic-bezier(.65, 0, .35, 1); }
.intro-flow.no-anim { transition: none; }
/* nodes: pop up, pulse while running, light up when done. Waiting text stays readable (muted, not faded). */
.i-node { flex: none; width: 200px; padding-bottom: 12px; color: var(--muted); opacity: 0; transform: scale(.6) translateY(8px); transition: opacity .2s ease, transform .5s cubic-bezier(.34, 1.56, .64, 1), color .3s ease, border-color .3s ease, box-shadow .3s ease; }
.i-node.show { opacity: 1; transform: none; }
.i-node b { display: block; padding: 10px 14px 0; font-size: .95rem; line-height: 1.3; }
.i-node header span { white-space: nowrap; }
.i-node header em { margin-left: auto; font-style: normal; color: var(--accent); }
.i-node.run { color: var(--text); border-color: var(--accent); animation: i-pulse .7s ease-in-out infinite; }
.i-node.on { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), 0 0 32px rgba(63, 207, 142, .18); }
@keyframes i-pulse { 50% { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 6px rgba(63, 207, 142, .14); } }
/* wires: draw, then a packet runs along them, with n8n's item count above */
.i-link { position: relative; display: block; flex: none; width: 88px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .3s ease; }
.i-link.on { transform: scaleX(1); }
.i-link::after { content: ""; position: absolute; left: 0; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--text); opacity: 0; }
.i-link.on::after { animation: i-packet .45s ease-in .1s both; }
@keyframes i-packet { 0% { opacity: 1; transform: translateX(0); } 90% { opacity: 1; } 100% { opacity: 0; transform: translateX(80px); } }
.i-link span { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font: 500 .7rem/1 var(--mono); color: var(--muted); white-space: nowrap; opacity: 0; transition: opacity .3s ease .2s; }
.i-link.on span { opacity: 1; }
.i-me { margin: 0; padding: 0; overflow: hidden; }
.i-me img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 14%; opacity: .35; filter: grayscale(1); transition: opacity .4s ease, filter .6s ease; }
.i-me.on img { opacity: 1; filter: none; }
.intro-layer.leaving .i-me { transform-origin: 0 0; transition: transform .8s cubic-bezier(.16, 1, .3, 1); }
/* execution log, bottom left */
.i-log { position: absolute; left: 20px; bottom: 20px; margin: 0; padding: 0; list-style: none; font: .78rem/1.7 var(--mono); color: var(--muted); }
.i-log li { animation: i-line .25s ease both; }
.i-log .ok::before { content: "\2713  "; color: var(--accent); }
@keyframes i-line { from { opacity: 0; transform: translateY(6px); } }
.intro-skip { position: absolute; right: 20px; bottom: 20px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: none; box-shadow: inset 0 0 0 1px var(--edge); color: var(--text-2); font: 500 .85rem var(--sans); cursor: pointer; }
.intro-skip:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--text-2); }
@media (max-width: 559px) { .i-node { width: 184px; } .i-link { width: 56px; } @keyframes i-packet { 0% { opacity: 1; transform: translateX(0); } 90% { opacity: 1; } 100% { opacity: 0; transform: translateX(48px); } } .i-log { bottom: 76px; } }
/* hold the hero's own entrance until the intro hands over; the photo arrives by gliding instead */
html.intro .copy > *, html.intro .hero-flow .node { animation: none; }
html.intro-moving .copy, html.intro-moving .me, html.intro-moving .hero-flow .steps, html.intro-moving .hero-flow .wires { visibility: hidden; }
.from-intro .copy > *, .from-intro .hero-flow .node { animation: none; }
@media (prefers-reduced-motion: no-preference) {
  /* after the photo lands, the hero copy wipes in left to right (clip only, no fade, so contrast holds) */
  .intro-landed .copy > * { animation: wipe .7s cubic-bezier(.16, 1, .3, 1) backwards; }
  .intro-landed .copy > :nth-child(2) { animation-delay: .08s; } .intro-landed .copy > :nth-child(3) { animation-delay: .22s; } .intro-landed .copy > :nth-child(4) { animation-delay: .34s; }
  @keyframes wipe { from { clip-path: inset(-20% 100% -20% -5%); transform: translateX(-12px); } to { clip-path: inset(-20% -5% -20% -5%); transform: none; } }
  .intro-landed .hero-flow .wires path { stroke-dasharray: 1; animation: i-draw .5s ease both; }
  .intro-landed .hero-flow .wires circle { animation: i-fade .3s ease .4s both; }
  .intro-landed .hero-flow .step { animation: rise .6s cubic-bezier(.16, 1, .3, 1) both; }
  .intro-landed .hero-flow .step:nth-child(1) { animation-delay: .3s; }
  .intro-landed .hero-flow .step:nth-child(2) { animation-delay: .42s; }
  .intro-landed .hero-flow .step:nth-child(3) { animation-delay: .54s; }
  @keyframes i-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
  @keyframes i-fade { from { opacity: 0; } }
}

/* ============ HOME: HERO LOOP (site.js; off under reduced motion) ============ */
.wires .pkt { fill: var(--text); opacity: 0; transition: opacity .15s ease; }
.wires .pkt.go { opacity: 1; }
.me > header em { margin-left: auto; font-style: normal; color: var(--accent); }
.step { transition: border-color .3s ease, box-shadow .3s ease; }
/* always moving: data flows along the hero wires, the role line has a terminal cursor, "Open to work" pings */
@media (prefers-reduced-motion: no-preference) {
  .hero-flow .wires path { stroke-dasharray: .035 .04; animation: flow-1 1.4s linear infinite; }
  @keyframes flow-1 { to { stroke-dashoffset: -.075; } }
  .hero h1 span::after { content: ""; display: inline-block; width: .45em; height: .9em; margin-left: 6px; vertical-align: -.08em; background: var(--accent); animation: caret 1.1s steps(1) infinite; }
  @keyframes caret { 50% { opacity: 0; } }
  .hero .eyebrow::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 10px; vertical-align: 1px; border-radius: 50%; background: var(--accent); animation: ping 2s ease-out infinite; }
  @keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(63, 207, 142, .55); } 70%, 100% { box-shadow: 0 0 0 8px rgba(63, 207, 142, 0); } }
  .hero-flow .me.run { border-color: var(--accent); animation: i-pulse .7s ease-in-out infinite; }
}
.me { transition: border-color .3s ease; }
.step.hit { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), 0 0 28px rgba(63, 207, 142, .16); }

/* ============ SCREENSHOT VIEWER (site.js, native <dialog>) ============ */
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 72px clamp(12px, 3vw, 40px) 24px; border: 0; background: rgba(9, 12, 10, .96); color: var(--text); cursor: zoom-out; }
.viewer[open] { display: grid; place-items: center; animation: v-in .25s ease; }
.viewer::backdrop { background: transparent; }
.viewer figure { margin: 0; display: grid; gap: 12px; justify-items: center; max-width: 100%; }
.viewer img { width: auto; max-width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; border: 1px solid var(--edge); border-radius: var(--r); background: #111; cursor: default; }
.viewer figcaption { font: .82rem var(--mono); color: var(--muted); text-align: center; }
.viewer-close { position: fixed; top: 14px; right: 14px; min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--edge); color: var(--text); font: 600 .9rem var(--sans); cursor: pointer; }
.viewer-close:hover { box-shadow: inset 0 0 0 1px var(--accent); }
html:has(.viewer[open]) { overflow: hidden; }
@keyframes v-in { from { opacity: 0; } }
