/* ==========================================================================
   David Yuskovich — Portfolio · v3
   One stylesheet, one system. Sections, top to bottom:
     1. Tokens        2. Base          3. Header        4. Layout & type
     5. Home          6. Case studies  7. Components    8. About / AI / Art
     9. Chat         10. Responsive
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  /* Text: three greys and one accent, nothing else */
  --ink: #18181b;          /* headings, titles, numbers, emphasis */
  --text: #52525b;         /* body text */
  --text-muted: #6e6e78;   /* labels, captions, secondary lines */
  --accent: #6d4aff;
  --accent-soft: #f2efff;

  --bg: #ffffff;
  --surface: #f5f5f7;      /* cards, panels */
  --line: #e7e7ec;         /* hairlines, borders */

  /* Spacing scale */
  --s-xs: 8px; --s-sm: 12px; --s-md: 24px; --s-lg: 40px; --s-xl: 64px; --s-2xl: 112px;

  --radius: 14px;
  --radius-lg: 20px;
  --header-h: 64px;
  --wide: 1120px;          /* page width */
  --measure: 720px;        /* comfortable line length for reading */
  --gutter: 24px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);

  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body { margin: 0; min-height: 100vh; background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, video, iframe, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
p, ul, ol, h1, h2, h3, h4, figure, blockquote { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
h1, h2, h3, h4 { color: var(--ink); font-weight: 600; letter-spacing: -0.015em; }
strong, b { color: var(--ink); font-weight: 600; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

[hidden] { display: none !important; }
main { padding-top: var(--header-h); }

.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* 3. Header ---------------------------------------------------------------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header .bar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  max-width: calc(var(--wide) + 2 * var(--gutter)); height: 100%;
  margin: 0 auto; padding: 0 var(--gutter);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 28px; height: 22px; }
.brand-name { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.brand-role { font-size: 13px; color: var(--text-muted); }
.nav-panel { display: flex; align-items: center; gap: 28px; }
.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav a { font-size: 15px; font-weight: 500; color: var(--text); transition: color 0.2s; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.header-cta {
  display: inline-flex; align-items: center; height: 36px; padding: 0 16px;
  border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500;
  transition: background 0.2s;
}
.header-cta:hover { background: #3f3f46; }
.menu-toggle { display: none; width: 36px; height: 36px; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; }
.menu-toggle svg { width: 24px; height: 24px; margin: auto; }
.menu-toggle .icon-close { display: none; }

/* 4. Layout & type --------------------------------------------------------- */
.wrap { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.lead { font-size: 21px; line-height: 1.55; color: var(--text); max-width: var(--measure); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: 999px;
  font: inherit; font-size: 15px; font-weight: 500;
  color: #fff; background: var(--ink); border: 0; cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.btn:hover { background: #3f3f46; transform: translateY(-1px); }
.btn.dark { background: var(--ink); }
.btn.ghost, .btn.secondary { color: var(--ink); background: var(--surface); }
.btn.ghost:hover, .btn.secondary:hover { background: #ececf0; }
.btn img { width: 18px; height: 18px; }
.link-arrow { font-size: 15px; font-weight: 500; color: var(--ink); }
.link-arrow::after { content: " →"; display: inline-block; transition: transform 0.2s; }
.link-arrow:hover::after { transform: translateX(3px); }

/* 5. Home ------------------------------------------------------------------ */
.hero { padding: var(--s-2xl) 0 var(--s-xl); }
.hero .eyebrow { margin-bottom: var(--s-md); }
.hero h1 { max-width: 900px; font-size: 64px; line-height: 1.04; letter-spacing: -0.035em; font-weight: 600; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lead { margin-top: var(--s-md); }
.hero .now { display: flex; align-items: center; gap: 10px; margin-top: var(--s-md); font-size: 15px; color: var(--text); }
.hero .now::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px #dcfce7; }
.hero .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; margin-top: var(--s-lg); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.metrics li { padding: 22px 20px; border-radius: var(--radius); background: var(--surface); }
.metrics span { display: block; margin-bottom: 18px; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.metrics b { display: block; font-size: 40px; line-height: 1; letter-spacing: -0.03em; }
.metrics p { margin-top: 10px; font-size: 14px; line-height: 1.45; }

.block { padding: var(--s-2xl) 0 0; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; margin-bottom: var(--s-lg); }
.block-head h2 { font-size: 36px; line-height: 1.15; letter-spacing: -0.025em; }
.block-head p { max-width: 460px; font-size: 15px; color: var(--text-muted); }

.works { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-xl) var(--s-md); }
.work { display: block; }
.work-media { aspect-ratio: 16 / 10; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.work-media img, .work-media svg { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.work-media:has(svg) { display: flex; align-items: center; background: linear-gradient(135deg, #f6f2ff, #eef6ff); }
.work-media svg { height: auto; }
.work:hover .work-media img, .work:hover .work-media svg { transform: scale(1.025); }
.works:not(.small) .work:first-child { grid-column: 1 / -1; }
.works:not(.small) .work:first-child .work-media { aspect-ratio: 21 / 9; }
.work-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-top: 16px; }
.work-meta h3 { font-size: 19px; }
.work-meta small { display: block; margin-top: 2px; font-size: 14px; color: var(--text-muted); }
.work-meta em { flex-shrink: 0; font-style: normal; font-size: 14px; font-weight: 500; color: var(--ink); }
.works.small { grid-template-columns: repeat(3, 1fr); gap: var(--s-lg) var(--s-md); }
.works.small .work-media { border-radius: var(--radius); }
.works.small .work-meta h3 { font-size: 16px; }

.works-group { margin: var(--s-2xl) 0 var(--s-md); padding-top: var(--s-lg); border-top: 1px solid var(--line); }
.works-group h2 { font-size: 28px; letter-spacing: -0.02em; }
.works-group small { display: block; max-width: var(--measure); margin-top: var(--s-xs); font-size: 16px; line-height: 1.55; color: var(--text); }
.works-more { margin: 0 0 var(--s-lg); }
.works-more summary { display: inline-flex; gap: 6px; font-size: 15px; font-weight: 500; color: var(--ink); cursor: pointer; list-style: none; }
.works-more summary::-webkit-details-marker { display: none; }
.works-more summary::after { content: "↓"; transition: transform 0.2s; }
.works-more[open] summary::after { transform: rotate(180deg); }
.works-more .prose { max-width: var(--measure); margin-top: var(--s-sm); }
.tailored { display: flex; align-items: center; gap: 14px; margin-bottom: var(--s-lg); padding: 16px 20px; border: 1px solid #e4ddff; border-radius: var(--radius); background: linear-gradient(90deg, var(--accent-soft), #faf9ff); color: var(--ink); font-size: 16px; line-height: 1.45; }
.tailored strong { color: var(--accent); font-weight: 600; }
.tailored-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: #fff; color: var(--accent); box-shadow: 0 1px 2px rgba(109, 74, 255, 0.12); }
.tailored-icon svg { width: 20px; height: 20px; }
.tailored-icon img { width: 26px; height: 26px; border-radius: 6px; }

.ai-band { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-md); }
.ai-card { padding: 32px; border-radius: var(--radius-lg); background: var(--surface); display: flex; flex-direction: column; gap: var(--s-sm); }
.ai-card h3 { font-size: 24px; letter-spacing: -0.02em; }
.ai-card ul { margin: 0; padding-left: 18px; }
.ai-card li + li { margin-top: 6px; }
.ai-card .link-arrow { margin-top: auto; padding-top: var(--s-sm); }

/* Contact block (end of every page) */
.contact-cta { max-width: var(--measure); margin: var(--s-2xl) auto 0; padding: 0 var(--gutter) var(--s-lg); text-align: center; }
.contact-cta h2 { font-size: 36px; letter-spacing: -0.025em; margin-bottom: var(--s-xs); }
.contact-cta p { margin-bottom: var(--s-md); }
.contact-cta .refs { margin: calc(-1 * var(--s-sm)) 0 var(--s-md); font-size: 14px; color: var(--text-muted); }
.contact-cta .actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 24px; }
.contact-cta .btn.ghost { height: auto; padding: 0; background: none; color: var(--ink); }
.contact-cta .btn.ghost::after { content: "→"; transition: transform 0.2s; }
.contact-cta .btn.ghost:hover { transform: none; }
.contact-cta .btn.ghost:hover::after { transform: translateX(3px); }
.to-top { display: grid; place-items: center; width: 40px; height: 40px; margin: var(--s-lg) auto var(--s-xl); border-radius: 50%; color: var(--text-muted); transition: background 0.2s, color 0.2s; }
.to-top:hover { background: var(--surface); color: var(--ink); }
.to-top svg { width: 20px; height: 20px; }
.site-footer { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: var(--s-md) var(--gutter) var(--s-lg); display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-muted); }
.site-footer a:hover { color: var(--ink); }

/* 6. Case studies ---------------------------------------------------------- */
.project { max-width: 1040px; margin: 0 auto; padding: var(--s-xl) var(--gutter) 0; }
.crumbs { margin-bottom: var(--s-lg); font-size: 14px; }
.crumbs a { color: var(--text-muted); transition: color 0.2s; }
.crumbs a:hover { color: var(--ink); }
.project-title { margin-bottom: var(--s-lg); font-size: 22px; font-weight: 400; color: var(--text); letter-spacing: -0.01em; line-height: 1.35; }
.project-title .name { display: block; margin-bottom: 6px; font-size: 56px; line-height: 1.05; font-weight: 600; letter-spacing: -0.035em; color: var(--ink); }
.project-cover { width: 100%; margin-bottom: var(--s-lg); border-radius: var(--radius-lg); }
/* Studio cover: the artwork ends in a thin white strip on the right */
.project-cover.trim-right { aspect-ratio: 2352 / 1077; object-fit: cover; object-position: left; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-md); margin: 0 0 var(--s-xl); padding: 28px; border-radius: var(--radius-lg); background: var(--surface); }
.summary dt { margin-bottom: 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.summary dd { margin: 0; font-size: 16px; line-height: 1.55; }
.summary div:not(.wide) dd { color: var(--ink); font-weight: 500; }
.summary .wide { grid-column: 1 / -1; }
.summary .wide dd { max-width: var(--measure); }
.summary div:not(.wide) + .wide { padding-top: var(--s-md); border-top: 1px solid var(--line); }
.summary .outcome dd { color: var(--ink); font-weight: 500; }

.section { max-width: var(--measure); margin: 0 auto var(--s-xl); }
.section h2 { margin-bottom: var(--s-sm); font-size: 32px; line-height: 1.2; letter-spacing: -0.025em; }
.section h3 { margin-bottom: var(--s-xs); font-size: 20px; line-height: 1.35; }
.section h2 + h3, .section > .prose + h3, .section > p.prose + h3 { margin-top: var(--s-md); }
.prose { font-size: 17px; line-height: 1.65; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li::marker { color: var(--text-muted); }
.prose em { font-style: italic; }
.prose p + p, .prose p + ul, .prose p + ol, .prose ul + p, .prose ol + p,
p.prose + p.prose, p.prose + ul.prose, ul.prose + p.prose { margin-top: var(--s-sm); }
.prose li + li { margin-top: var(--s-xs); }
.prose.loose li + li, .prose .loose li + li { margin-top: 4px; }
.prose table { width: 100%; margin-top: var(--s-md); border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.highlight { color: var(--ink); font-weight: 600; }
.quote { font-size: 26px; line-height: 1.3; font-weight: 500; letter-spacing: -0.015em; color: var(--ink); }
.hook { display: grid; gap: var(--s-sm); }
.section:has(+ .media), .section:has(+ .flow), .section:has(+ .feature-grid),
.section:has(+ .steps), .section:has(+ .ai-grid), .section:has(+ .stat-row),
.section:has(+ .split), .section:has(+ .panel), .section:has(+ .gallery), .section:has(+ .collage) { margin-bottom: var(--s-md); }

.media { margin: 0 0 var(--s-xl); }
.media img, .media video { width: 100%; }
.media img.rounded, .media.rounded img, .rounded { border-radius: var(--radius); }
.media.stack { display: grid; gap: 0; }
.media.stack.gap { gap: var(--s-md); }
.media:has(+ .section > h3:first-child) { margin-bottom: var(--s-lg); }
img.framed { border: 1px solid var(--line); }
img.zoomable, [data-lightbox] img { cursor: zoom-in; }
.caption { margin-top: var(--s-xs); font-size: 14px; color: var(--text-muted); text-align: center; }

.panel { display: grid; gap: var(--s-md); margin: 0 0 var(--s-lg); padding: 24px; border-radius: var(--radius-lg); background: var(--surface); }
.panel h3 { font-size: 20px; }
.panel .split, .panel .media { margin: 0; }
.split { display: grid; grid-template-columns: 340px 1fr; gap: var(--s-md); align-items: start; margin: 0 0 var(--s-lg); }
.split.wide { grid-template-columns: 1fr 320px; }
.split.half { grid-template-columns: 1fr 1fr; }
.split.card { padding: 20px; border-radius: var(--radius); background: var(--surface); }
.split img { width: 100%; }
.split img.photo { border-radius: var(--radius); }
/* Persona sketches: show the drawing only, the handwriting beside it is cut off in the artwork */
.split img.persona-sketch { width: auto; height: 320px; margin: 0 auto; object-fit: cover; object-position: left; border-radius: var(--radius); }
.stack { display: grid; gap: var(--s-sm); align-content: start; }
.panel:has(> img.tuck) { isolation: isolate; }
.panel img.tuck { position: relative; z-index: -1; margin-top: -17%; }

.collage { display: grid; margin-bottom: var(--s-xl); border-radius: var(--radius-lg); overflow: hidden; }
.collage > img { width: 100%; }
.collage-row { display: grid; }
.collage-row img { width: 100%; height: 100%; object-fit: cover; }
.collage-row.contain { background: #fff; align-items: center; }
.collage-row.contain img { height: auto; object-fit: contain; }
.app-icon { position: relative; z-index: 1; width: 123px; margin: -6px auto -66px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.15)); }
.gallery { display: grid; gap: var(--s-md); grid-template-columns: repeat(var(--cols, 2), 1fr); margin-bottom: var(--s-xl); }
.gallery img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }
.phone-demo { display: grid; place-items: center; padding: 24px 0; border-radius: var(--radius); background: linear-gradient(135deg, #a77be0, #7b62d6); }
.phone-demo .phone { width: 232px; padding: 7px; border-radius: 30px; background: linear-gradient(160deg, rgba(255,255,255,.9), rgba(255,255,255,.5)); box-shadow: 0 20px 40px rgba(60,30,120,.25); }
.phone-demo .phone img { width: 100%; border-radius: 24px; }

.logo-marquee { overflow: hidden; margin: 0 calc(50% - 50vw) var(--s-lg); padding: var(--s-sm) 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.logo-track { display: flex; align-items: center; gap: 48px; width: max-content; animation: marquee 45s linear infinite; }
.logo-track img { height: auto; flex: none; opacity: 0.85; }
@keyframes marquee { to { transform: translateX(calc(-50% - 24px)); } }
@media (prefers-reduced-motion: reduce) { .logo-track { animation: none; } }

.impact { max-width: var(--measure); margin: 0 auto var(--s-xl); padding: 32px; border-radius: var(--radius-lg); background: var(--surface); }
.impact h2 { margin-bottom: var(--s-sm); font-size: 28px; letter-spacing: -0.02em; }
.impact h2:not(:first-child) { margin-top: var(--s-lg); }
.impact .prose li { margin-top: var(--s-xs); }

.next-project { display: flex; justify-content: space-between; align-items: center; gap: 16px; max-width: var(--measure); margin: var(--s-xl) auto 0; padding: 24px 28px; border-radius: var(--radius-lg); border: 1px solid var(--line); transition: border-color 0.2s, background 0.2s; }
.next-project:hover { border-color: #d4d4dc; background: #fafafb; }
.next-project small { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.next-project strong { font-size: 20px; }
.next-project span[aria-hidden] { font-size: 22px; color: var(--ink); }

.cta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--s-sm); margin: 0 0 var(--s-xl); text-align: center; }
.cta p { width: 100%; margin-bottom: var(--s-xs); font-weight: 500; color: var(--ink); }

.embed { max-width: var(--wide); margin: 0 auto; padding: var(--s-lg) var(--gutter) var(--s-xl); }
.embed .frame { position: relative; aspect-ratio: 1110 / 740; border-radius: var(--radius-lg); overflow: hidden; background: #000; }
.embed iframe, .embed video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Full design process behind a toggle */
details.process { margin: 0 0 var(--s-xl); }
details.process > summary { display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: var(--measure); margin: 0 auto; padding: 20px; border-radius: var(--radius-lg); border: 1px solid var(--line); font-size: 16px; font-weight: 600; color: var(--ink); text-align: center; cursor: pointer; list-style: none; transition: background 0.2s; }
details.process > summary:hover { background: #fafafb; }
details.process > summary::-webkit-details-marker { display: none; }
details.process > summary::after { content: "+"; font-size: 20px; font-weight: 400; color: var(--text-muted); }
details.process[open] > summary::after { content: "–"; }
details.process > summary span { font-size: 14px; font-weight: 400; color: var(--text-muted); }
details.process[open] > summary { margin-bottom: var(--s-lg); }

/* 7. Components ------------------------------------------------------------ */
.ai-block { margin: 0 0 var(--s-xl); padding: 32px; border-radius: var(--radius-lg); background: linear-gradient(135deg, #f6f3ff, #f0f6ff); }
.ai-block h2 { margin-bottom: var(--s-sm); font-size: 28px; line-height: 1.25; letter-spacing: -0.02em; }
.ai-block h2 span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.ai-block > .prose { max-width: var(--measure); }
.ai-block > p + .ai-grid, .ai-block > .prose + .ai-grid, .ai-block h2 + .ai-grid { margin-top: var(--s-md); }
.ai-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-sm); }
.ai-grid article { padding: 18px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.8); }
.ai-grid h3 { margin-bottom: var(--s-xs); font-size: 16px; }
.ai-grid p { font-size: 15px; line-height: 1.5; }
.ai-shot { width: 100%; margin-top: var(--s-md); border-radius: var(--radius); }
.ai-sub { margin: var(--s-md) 0 var(--s-xs); font-size: 18px; }

.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-sm); margin: 0 0 var(--s-xl); }
.steps article { padding: 24px; border-radius: var(--radius-lg); background: var(--surface); }
.steps .full { grid-column: 1 / -1; }
.steps h3 { margin-bottom: var(--s-xs); font-size: 18px; }
.steps p, .steps li { font-size: 15px; line-height: 1.55; }
.steps ul { margin: var(--s-sm) 0 0; padding-left: 20px; }
.steps li + li { margin-top: var(--s-xs); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-sm); margin: 0 0 var(--s-xl); }
.stat { padding: 22px 20px; border-radius: var(--radius); background: var(--surface); }
.stat b { display: block; font-size: 34px; line-height: 1.1; letter-spacing: -0.03em; }
.stat span { display: block; margin-top: 6px; font-size: 14px; line-height: 1.45; }

.flow { display: grid; grid-template-columns: 300px 1fr; gap: var(--s-md); align-items: start; margin: 0 0 var(--s-xl); }
.flow-steps { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.flow-steps button { display: grid; grid-template-columns: 30px 1fr; gap: 10px; width: 100%; padding: 12px 14px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background 0.2s, border-color 0.2s; }
.flow-steps button:hover { background: var(--surface); }
.flow-steps button[aria-selected="true"] { background: var(--accent-soft); border-color: #ddd4ff; }
.flow-steps .num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #ebe6ff; color: var(--accent); font-size: 13px; font-weight: 600; }
.flow-steps button[aria-selected="true"] .num { background: var(--accent); color: #fff; }
.flow-steps strong { display: block; font-size: 15px; }
.flow-steps span.txt { display: block; margin-top: 2px; font-size: 14px; line-height: 1.5; }
.flow-steps button:not([aria-selected="true"]) span.txt { display: none; }
.flow-stage { position: relative; aspect-ratio: 1792 / 984; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.flow-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform-origin: var(--o, 50% 50%); transition: opacity 0.45s var(--ease), transform 1.2s var(--ease); }
.flow-stage img.on { opacity: 1; transform: scale(var(--z, 1)); }
.flow-nav { display: none; align-items: center; justify-content: space-between; gap: 12px; }
.flow-nav button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 18px; cursor: pointer; }
.flow-nav button:disabled { opacity: 0.35; cursor: default; }
.flow-dots { display: flex; gap: 6px; }
.flow-dots i { width: 7px; height: 7px; border-radius: 50%; background: #ddd4ff; transition: width 0.2s, background 0.2s; }
.flow-dots i.on { width: 20px; border-radius: 4px; background: var(--accent); }

.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-md); margin: 0 0 var(--s-xl); }
.feature-grid.three { grid-template-columns: repeat(3, 1fr); }
.feature-grid img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: var(--radius); border: 1px solid var(--line); cursor: zoom-in; transition: transform 0.3s var(--ease), box-shadow 0.3s; }
.feature-grid img:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(24, 24, 27, 0.08); }
.feature-grid figcaption { margin-top: var(--s-xs); font-size: 14px; line-height: 1.5; }

.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; overflow-y: auto; overscroll-behavior: contain; padding: 24px; background: rgba(15, 15, 20, 0.86); cursor: zoom-out; }
.lightbox img { margin: auto; max-width: min(1600px, 100%); max-height: calc(100vh - 48px); border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4); }
.lightbox img.tall { max-height: none; }
.lightbox-close { position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); }
.lightbox-close svg { width: 24px; height: 24px; }
.lightbox-close .icon-close { display: block; }

.org-wrap { border-radius: var(--radius-lg); overflow: hidden; }
.prose + .org-wrap, p + .org-wrap { margin-top: var(--s-md); }
.org-chart { width: 100%; height: auto; }

/* 8. About / AI / Art ------------------------------------------------------ */
.about { display: grid; grid-template-columns: 300px 1fr; gap: var(--s-xl); align-items: center; padding: var(--s-2xl) 0 var(--s-xl); }
.about .portrait { width: 300px; height: 300px; border-radius: 50%; object-fit: cover; }
.about .bio { font-size: 24px; line-height: 1.5; color: var(--ink); letter-spacing: -0.01em; }
.about-more { padding-bottom: var(--s-md); }
.about-more h2 { margin: var(--s-xl) 0 var(--s-md); font-size: 32px; letter-spacing: -0.025em; }
.about-more > h2:first-child { margin-top: 0; }
.principles { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-sm); }
.principles article { padding: 24px; border-radius: var(--radius-lg); background: var(--surface); }
.principles article:last-child:nth-child(odd) { grid-column: 1 / -1; }
.principles h3 { margin-bottom: var(--s-xs); font-size: 18px; }
.principles p { font-size: 15px; line-height: 1.55; }
.xp { width: 100%; border-collapse: collapse; font-size: 16px; }
.xp th, .xp td { padding: 14px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.xp th { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.xp td:nth-child(2) { color: var(--ink); font-weight: 500; }

.art-quote { max-width: 900px; margin: 0 auto; padding: var(--s-xl) var(--gutter) var(--s-lg); text-align: center; }
.art-quote blockquote { font-size: 36px; line-height: 1.25; font-weight: 300; font-style: italic; color: var(--ink); }
.art-quote blockquote strong { font-weight: 500; }
.art-quote cite { display: block; margin-top: var(--s-md); font-size: 17px; color: var(--text-muted); }
.art-section { max-width: 1040px; margin: 0 auto var(--s-xl); padding: 0 var(--gutter); }
.art-section h2 { margin: var(--s-lg) 0; font-size: 28px; text-align: center; }
.art-rows { display: grid; gap: 16px; }
.art-row { display: flex; gap: 20px; }
.art-row.narrow { width: 66.6%; margin: 0 auto; }
.art-row figure, .art-grid figure { flex: var(--w, 1) 1 0; min-width: 0; padding: 4px; border-radius: 12px; background: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.08); overflow: hidden; }
.art-row img, .art-grid img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; }
.art-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; }
.art-grid figure { aspect-ratio: 221 / 332; }
.art-grid .crop-eye img { object-position: 50% 40%; transform: scale(3); transform-origin: 50% 42%; }
.more { display: grid; place-items: center; height: 110px; margin-top: var(--s-md); border-radius: var(--radius); background: var(--surface); color: var(--text-muted); }

/* Leftovers kept for hidden (data-archived) material */
.ph { padding: 0 4px; border-radius: 4px; background: #fff3b0; color: #7a5b00; }
.glow, .sparkles, .cursors, .project-glow { display: none; }

/* 9. Ask my portfolio ------------------------------------------------------ */
.chat { display: flex; flex-direction: column; gap: var(--s-sm); padding: 32px; border-radius: var(--radius-lg); background: var(--ink); color: #d4d4d8; }
.chat h3 { color: #fff; font-size: 24px; letter-spacing: -0.02em; }
.chat .chat-sub { font-size: 15px; color: #a1a1aa; }
.chat-log { display: grid; gap: 10px; max-height: 320px; overflow-y: auto; }
.chat-log:empty { display: none; }
.chat-msg { max-width: 92%; padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.55; }
.chat-msg.user { justify-self: end; background: var(--accent); color: #fff; }
.chat-msg.bot { justify-self: start; background: #27272a; color: #e4e4e7; }
.chat-msg.bot.thinking { color: #a1a1aa; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-suggest button { padding: 7px 12px; border-radius: 999px; border: 1px solid #3f3f46; background: transparent; color: #e4e4e7; font: inherit; font-size: 13px; cursor: pointer; transition: background 0.2s; }
.chat-suggest button:hover { background: #27272a; }
.chat-form { display: flex; gap: 8px; margin-top: auto; }
.chat-form input { flex: 1; min-width: 0; height: 46px; padding: 0 16px; border-radius: 999px; border: 1px solid #3f3f46; background: #18181b; color: #fff; font: inherit; font-size: 15px; }
.chat-form input::placeholder { color: #71717a; }
.chat-form input:focus { outline: none; border-color: var(--accent); }
.chat-form button { height: 46px; padding: 0 18px; border-radius: 999px; border: 0; background: #fff; color: var(--ink); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; }
.chat-form button:disabled { opacity: 0.5; cursor: default; }
.chat-note { font-size: 12px; color: #71717a; }

/* 10. Responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
  .hero h1 { font-size: 52px; }
  .ai-grid { grid-template-columns: 1fr 1fr; }
  .summary { grid-template-columns: 1fr 1fr; }
  .flow { grid-template-columns: 1fr; gap: 14px; }
  .flow-stage { order: -1; touch-action: pan-y; }
  .flow-steps li { display: none; }
  .flow-steps li:has(button[aria-selected="true"]) { display: block; }
  .flow-steps button { cursor: default; padding: 4px 2px; border: 0; background: none !important; }
  .flow-steps button span.txt { display: block; }
  .flow-nav { display: flex; }
  .about { grid-template-columns: 220px 1fr; gap: var(--s-lg); }
  .about .portrait { width: 220px; height: 220px; }
}

@media (max-width: 767px) {
  :root { --gutter: 20px; --header-h: 56px; font-size: 16px; }
  .brand-role { display: none; }
  .menu-toggle { display: block; }
  .nav-panel {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: var(--s-md);
    padding: var(--s-md) var(--gutter) var(--s-lg);
    background: #fff; border-bottom: 1px solid var(--line);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  }
  .site-nav { flex-direction: column; align-items: flex-start; gap: var(--s-md); }
  .site-nav a { font-size: 20px; color: var(--ink); }
  .header-cta { align-self: flex-start; height: 44px; padding: 0 20px; font-size: 15px; }
  .site-header.is-open { background: #fff; }
  .site-header.is-open .nav-panel { opacity: 1; visibility: visible; transform: none; }
  .site-header.is-open .icon-open { display: none; }
  .site-header.is-open .icon-close { display: block; }

  .hero { padding: var(--s-xl) 0 var(--s-lg); }
  .hero h1 { font-size: 38px; line-height: 1.08; }
  .lead { font-size: 18px; }
  .hero .actions { gap: 20px; margin-top: var(--s-md); }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metrics li { padding: 16px 14px; }
  .metrics span { margin-bottom: 12px; }
  .metrics b { font-size: 30px; }
  .metrics p { font-size: 13px; }

  .block { padding-top: var(--s-xl); }
  .block-head { flex-direction: column; gap: var(--s-xs); margin-bottom: var(--s-md); }
  .block-head h2 { font-size: 28px; }
  .works { grid-template-columns: 1fr; gap: var(--s-lg); }
  .works:not(.small) .work:first-child .work-media { aspect-ratio: 21 / 9; }
  .work-meta { flex-direction: column; gap: 4px; }
  .works.small { grid-template-columns: 1fr 1fr; gap: var(--s-md) 12px; }
  .works-group { margin-top: var(--s-xl); padding-top: var(--s-md); }
  .ai-band { grid-template-columns: 1fr; }
  .ai-card, .chat { padding: 24px; }

  .project { padding-top: var(--s-lg); }
  .project-title { font-size: 18px; }
  .project-title .name { font-size: 38px; }
  .summary { grid-template-columns: 1fr 1fr; padding: 20px; gap: var(--s-md) var(--s-sm); }
  .section h2 { font-size: 26px; }
  .quote { font-size: 22px; }
  .split, .split.wide, .split.half { grid-template-columns: 1fr; gap: var(--s-sm); }
  .panel { padding: 18px; }
  .gallery { grid-template-columns: 1fr; }
  .ai-block, .impact { padding: 22px; }
  .ai-grid, .steps, .principles, .feature-grid { grid-template-columns: 1fr; }
  .feature-grid.three { grid-template-columns: 1fr 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .next-project { padding: 20px; }
  .contact-cta h2 { font-size: 28px; }
  .site-footer { flex-direction: column; }

  .about { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: var(--s-md); padding-top: var(--s-xl); }
  .about .portrait { width: 180px; height: 180px; }
  .about .bio { font-size: 19px; }
  .org-wrap { overflow-x: auto; }
  .org-chart { width: 720px; max-width: none; }
  .xp { font-size: 14px; }
  .xp th, .xp td { padding: 12px 4px; }
  .xp th:first-child { width: 64px; }
  .about-more h2 { font-size: 26px; }

  .art-quote blockquote { font-size: 24px; }
  .art-row { flex-direction: column; aspect-ratio: auto !important; }
  .art-row.narrow { width: 100%; }
  .art-row figure { flex: none; }
  .art-row img { height: auto; }
  .art-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}
.media > .prose { max-width: var(--measure); margin: 0 auto var(--s-md); }
.about, .about-more { max-width: calc(var(--wide) + 2 * var(--gutter)); margin-left: auto; margin-right: auto; padding-left: var(--gutter); padding-right: var(--gutter); }
/* One left edge: text blocks keep a reading measure but align with titles, cards and images */
.section, .impact, .next-project, details.process > summary, .media > .prose { margin-left: 0; margin-right: auto; }
.lead { margin-bottom: var(--s-xl); }
/* Hero: tighter top and a closer "Currently" line */
.hero { padding-top: var(--s-lg); }
.hero .now { margin-top: var(--s-sm); }
.brand img { width: 32px; height: 25px; }
@media (max-width: 767px) { .hero { padding-top: var(--s-md); } }
.hero .lead { margin-bottom: 0; }
.link-arrow::after { content: "→"; margin-left: 6px; }

/* AI band v3.1 — quiet text on the left, a light chat on the right */
.ai-band { grid-template-columns: 1fr 1.15fr; gap: var(--s-xl); align-items: start; }
.ai-intro { display: flex; flex-direction: column; gap: var(--s-sm); padding-top: 4px; }
.ai-intro h3 { font-size: 24px; line-height: 1.3; letter-spacing: -0.02em; }
.ai-intro ul { margin: 0; padding: 0; list-style: none; }
.ai-intro li { position: relative; padding-left: 20px; font-size: 16px; }
.ai-intro li::before { content: ""; position: absolute; left: 2px; top: 0.65em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.ai-intro li + li { margin-top: var(--s-xs); }
.ai-intro .link-arrow { margin-top: var(--s-xs); }

.chat { gap: var(--s-md); padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(24, 24, 27, 0.04), 0 12px 32px rgba(24, 24, 27, 0.05); }
.chat-head { display: flex; align-items: center; gap: 12px; }
.chat-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.chat-icon svg { width: 20px; height: 20px; }
.chat h3 { color: var(--ink); font-size: 16px; letter-spacing: -0.01em; }
.chat .chat-sub { font-size: 13px; color: var(--text-muted); }
.chat-log { gap: 12px; max-height: 300px; }
.chat-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 15px; }
.chat-msg.user { background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.chat-msg.bot { background: var(--surface); color: var(--ink); border-bottom-left-radius: 6px; }
.chat-msg.bot.thinking { color: var(--text-muted); }
.chat-suggest { gap: 8px; }
.chat-suggest button { padding: 8px 12px; border: 0; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; }
.chat-suggest button:hover { background: #ececf0; color: var(--ink); }
.chat-form { position: relative; gap: 0; margin-top: 0; }
.chat-form input { height: 48px; padding: 0 56px 0 18px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.chat-form input::placeholder { color: var(--text-muted); }
.chat-form input:focus { border-color: #c9c2ff; box-shadow: 0 0 0 4px var(--accent-soft); }
.chat-form button { position: absolute; right: 6px; top: 6px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 50%; background: var(--ink); color: #fff; }
.chat-form button svg { width: 18px; height: 18px; }
.chat-suggest .fit-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.chat-suggest .fit-chip svg { width: 16px; height: 16px; flex: none; }
.chat-suggest .fit-chip:hover { background: #e9e3ff; color: var(--accent); }
.chat-fit { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-sm); }
.chat-fit[hidden] { display: none; }
.chat-fit textarea { width: 100%; padding: 12px 16px; border: 1px solid var(--line); border-radius: 16px; font: inherit; font-size: 15px; color: var(--ink); resize: vertical; }
.chat-fit textarea:focus { outline: none; border-color: #c9c2ff; box-shadow: 0 0 0 4px var(--accent-soft); }
.chat-log:has(.fit) { max-height: 560px; }
.chat-msg.fit { display: flex; flex-direction: column; gap: 12px; max-width: 100%; }
.fit-row { display: flex; flex-direction: column; gap: 2px; padding-left: 12px; border-left: 2px solid var(--accent); font-size: 14px; }
.fit-row b { font-weight: 600; color: var(--ink); }
.fit-row span { color: var(--text); }
.fit-row a { align-self: flex-start; color: var(--accent); font-weight: 500; }
.fit-row a::after { content: " →"; }
.fit-row.gap { border-left-color: var(--line); }
.fit-row.gap span { color: var(--text-muted); }
.fit-cv { align-self: flex-start; margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.chat-note { margin-top: calc(var(--s-sm) - var(--s-md)); font-size: 12px; color: var(--text-muted); }
.chat-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.chat-note a:hover { color: var(--ink); }
/* Linked sections (e.g. /ai/#this-site) land with room above the heading */
section[id] { scroll-margin-top: var(--s-lg); }
/* Hero link to the chat, beside the button, with the chat's sparkle */
.link-ask { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 500; color: var(--ink); }
.link-ask::before { content: "✦"; color: var(--accent); }
.link-ask:hover { color: var(--accent); }
@media (max-width: 767px) { .ai-band { grid-template-columns: 1fr; gap: var(--s-lg); } .chat { padding: 20px; } }
/* "Now" status as a small pill above the name, one line on every screen */
.hero .now { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 var(--s-md); padding: 6px 14px 6px 12px; border-radius: 999px; background: var(--surface); font-size: 13px; line-height: 1.3; color: var(--ink); white-space: nowrap; }
.hero .now::before { width: 7px; height: 7px; box-shadow: 0 0 0 3px #dcfce7; flex: none; }
.hero .now + .eyebrow { margin-top: 0; }
.hero .actions + .now { margin: var(--s-lg) 0 0; }
/* Cards span the full content width like every other card; the text inside keeps the reading measure */
.impact, .next-project { max-width: none; }
.impact > * { max-width: var(--measure); }
/* Mobile: every project card has the same shape */
@media (max-width: 767px) { .works:not(.small) .work:first-child .work-media { aspect-ratio: 16 / 10; } }
.work-media picture { display: contents; }

/* Engageli card: separate layers on desktop. On hover the card tilts toward the cursor, each piece moves
   at its own depth, the classroom zooms in and the pieces around it drift out with a gentle rotation.
   Mobile and touch screens show the flat image instead. Layers are rebuilt with scripts/collage/. */
.layers { display: none; }
@media (min-width: 768px) and (hover: hover) {
  .work-media.layered { position: relative; perspective: 1400px; }
  .work-media.layered > picture { display: none; }
  .layers { display: block; position: absolute; inset: 0; transform: rotateX(calc(var(--my, 0) * -7deg)) rotateY(calc(var(--mx, 0) * 9deg)) scale(1.08); transform-style: preserve-3d; transition: transform 0.25s ease-out; }
  .work .layers img, .work:hover .layers img {
    --d: 0;
    position: absolute; left: var(--l); top: var(--t); width: var(--w); height: auto; object-fit: initial; will-change: transform;
    transform: translate(calc(var(--mx, 0) * var(--d) * 1px + var(--hx, 0%)), calc(var(--my, 0) * var(--d) * 1px + var(--hy, 0%))) rotate(calc(var(--hr, 0deg) + var(--mx, 0) * var(--rr, 0deg))) scale(var(--s, 1));
    transition: transform 0.35s ease-out;
  }
  .layers .l-bg { --d: -14; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .layers .l-screen { --d: 24; }
  .layers .l-report { --d: 50; }
  .layers .l-table { --d: 72; }
  .layers .l-ai { --d: 86; }
  .work:hover .layers .l-screen { --s: 1.16; }
  .work:hover .layers .l-table { --hx: -12%; --hy: -6%; --hr: -5deg; --rr: -2deg; }
  .work:hover .layers .l-report { --hx: 7%; --hy: 6%; --hr: 1.5deg; --rr: 1deg; --s: 1.04; }
  .work:hover .layers .l-ai { --hx: 8%; --hy: -14%; --hr: 3deg; --rr: 2deg; --s: 1.06; }
  .work-media.layered.is-resting .layers, .work-media.layered.is-resting .layers img { transition-duration: 1s; }
}
@media (prefers-reduced-motion: reduce) { .layers, .work .layers img, .work:hover .layers img { transition: none; transform: none; } }

/* Case-study top: tighter rhythm from the header down to the cover */
.project { padding-top: var(--s-lg); }
.crumbs { margin-bottom: var(--s-md); }
.project-title { margin-bottom: var(--s-md); }
.logo-marquee { margin-bottom: var(--s-md); padding: 0; }
.logo-track { zoom: 0.85; }
@media (max-width: 767px) {
  .project { padding-top: var(--s-md); }
  .crumbs { margin-bottom: var(--s-sm); }
  .logo-track { zoom: 0.65; }
}
.chat-msg { white-space: pre-line; }
