/* ---- Tokens: monochrome, one accent; dark mode follows the system ------- */
:root {
  --bg: #ffffff;
  --text: #0c0c0d;
  --muted: #6b6b70;
  --faint: #a1a1a6;
  --line: #e7e7e9;
  --hover: #f6f6f7;
  --accent: #2b5cff;
  --header-bg: rgba(255, 255, 255, .82);
  --live: #15803d;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0d;
    --text: #ededee;
    --muted: #9a9aa0;
    --faint: #5f5f66;
    --line: #232326;
    --hover: #151517;
    --accent: #7c9bff;
    --header-bg: rgba(12, 12, 13, .82);
    --live: #4ade80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.65 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
.wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: clamp(16px, 5vw, 48px); }

.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 8px 14px; border-radius: 6px; background: var(--text); color: var(--bg); }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.label { color: var(--muted); font-size: .82rem; font-weight: 500; }
.meta { color: var(--faint); font-size: .82rem; }

/* ---- Header ----------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }
.brand { font-weight: 600; letter-spacing: -.01em; }
.site-header nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); font-size: .9rem; color: var(--muted); }
.site-header nav a:not(.btn):hover, .site-header nav a[aria-current] { color: var(--text); }
.site-header nav a[aria-current] { box-shadow: 0 2px 0 var(--text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border: 1px solid var(--text); border-radius: 999px; font-weight: 500; font-size: .95rem; line-height: 1.2; transition: background .2s ease, color .2s ease, transform .2s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--hover); }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
@media (prefers-reduced-motion: reduce) { .btn, .btn:hover { transition: none; transform: none; } }

/* ---- Hero ------------------------------------------------------------------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: center; gap: clamp(32px, 7vw, 96px);
  padding-block: clamp(48px, 10vw, 120px) clamp(56px, 9vw, 104px);
}
.hero h1 { margin: 14px 0 22px; font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.06; letter-spacing: -.035em; max-width: 17ch; }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 54ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-proof { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 28px; font-size: .86rem; color: var(--muted); }
.hero-proof span { color: var(--faint); display: inline-flex; align-items: center; gap: 8px; }
.hero-proof span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); }
.hero-proof a { border-bottom: 1px solid var(--line); }
.hero-proof a:hover { color: var(--text); border-color: var(--text); }

/* The single 3D element: portrait card, a floating outline frame behind it,
   and a light reflection, all tilting together with the pointer. */
.portrait-scene { --rx: 0deg; --ry: 0deg; --lx: 30%; --ly: 20%; perspective: 1100px; }
.portrait {
  position: relative; aspect-ratio: 450 / 550;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}
.portrait::before {
  content: ""; position: absolute; inset: 0; border: 1px solid var(--text); border-radius: 6px; opacity: .35;
  transform: translate3d(22px, 22px, -70px);
}
.portrait img {
  position: relative; width: 100%; height: 100%; object-fit: cover; border-radius: 6px;
  filter: grayscale(.15) contrast(1.02);
  box-shadow: 0 40px 70px -30px rgba(0, 0, 0, .45);
  transform: translateZ(30px);
}
.portrait::after {
  content: ""; position: absolute; inset: 0; border-radius: 6px; pointer-events: none;
  background: radial-gradient(500px circle at var(--lx) var(--ly), rgba(255, 255, 255, .22), transparent 40%);
  transform: translateZ(31px); mix-blend-mode: soft-light;
}
@media (prefers-reduced-motion: reduce) { .portrait { transition: none; } }

/* ---- Stats ---------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.stat { padding: 26px 20px 0 0; }
.stat strong { display: block; font-size: 2rem; font-weight: 600; letter-spacing: -.03em; }
.stat span { color: var(--muted); font-size: .86rem; }

/* ---- Blocks: label column + content --------------------------------------- */
.block { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; padding-block: clamp(56px, 9vw, 104px) 0; }
.block-title { font-size: .82rem; font-weight: 500; color: var(--muted); letter-spacing: 0; padding-top: 4px; }
.block-body > * + * { margin-top: 24px; }
.body-lead, .note { color: var(--muted); max-width: 60ch; }
.note { font-size: .92rem; }
.about-copy > * + * { margin-top: 14px; }
.experience dd strong { display: block; color: var(--text); font-weight: 600; }
.exp-co { display: block; color: var(--faint); font-size: .85rem; margin-bottom: 6px; }
.experience > * + * { margin-top: 0; }
.dialog-link { border-bottom: 1px solid var(--line); }
.dialog-link:hover { border-color: var(--text); }
.shots { display: flex; gap: 12px; margin-top: 24px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.shot { position: relative; flex: 0 0 auto; height: 260px; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; scroll-snap-align: start; background: var(--hover); cursor: zoom-in; transition: border-color .2s ease; }
.shot:hover { border-color: var(--muted); }
.shot img { height: 100%; width: auto; object-fit: cover; object-position: top; }
.shot-phone { width: 130px; }
.shot-tag { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .72); color: #fff; font-size: .72rem; font-weight: 500; }
.shot-phone img { width: 100%; }
.process-shot { margin: 0; }
.shot-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.process-shot img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.process-shot figcaption { margin-top: 8px; color: var(--faint); font-size: .8rem; }
.shot-caption { margin-top: 8px; color: var(--muted); font-size: .8rem; }
@media (max-width: 640px) { .shot { height: 200px; } .shot-phone { width: 100px; } }

.stats, .block { opacity: 0; translate: 0 16px; transition: opacity .8s ease, translate .8s ease; }
.is-visible { opacity: 1; translate: 0 0; }
@media (prefers-reduced-motion: reduce) { .stats, .block { opacity: 1; translate: none; transition: none; } }

/* Capabilities */
.capabilities { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.capabilities > * + * { margin-top: 0; }
.capability h3 { font-size: 1rem; margin-bottom: 8px; }
.capability p:not(.meta) { color: var(--muted); font-size: .93rem; margin-bottom: 10px; }

/* Work list: hairline rows that lift slightly in 3D on hover */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; font-size: .85rem; color: var(--muted); cursor: pointer; transition: border-color .2s ease, color .2s ease, background .2s ease; }
.chip span { color: var(--faint); font-variant-numeric: tabular-nums; }
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip[aria-pressed="true"] span { color: inherit; opacity: .7; }
.work-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); perspective: 1200px; }
.work-row {
  width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr) 168px 20px; align-items: center; gap: 24px;
  padding: 22px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer;
  transition: background .25s ease, transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease;
  transform-origin: 50% 100%;
}
.work-row:hover { background: var(--hover); transform: translateZ(18px) rotateX(4deg); box-shadow: 0 18px 30px -24px rgba(0, 0, 0, .35); position: relative; z-index: 1; }
.work-no { align-self: start; padding-top: 2px; color: var(--faint); font-size: .85rem; font-variant-numeric: tabular-nums; }
.work-main { display: grid; gap: 4px; }
.work-meta { color: var(--muted); font-size: .8rem; }
.work-meta strong { color: var(--text); font-weight: 500; }
.work-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge { padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .74rem; }
.badge-live { color: var(--live); border-color: currentColor; }
.work-thumb { display: block; aspect-ratio: 16 / 10; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--hover); }
.work-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .4s ease; }
.work-row:hover .work-thumb img { transform: scale(1.04); }
.work-title { font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; }
.work-summary { color: var(--muted); font-size: .9rem; max-width: 62ch; }
.arrow { color: var(--faint); transition: transform .25s ease, color .25s ease; }
.work-row:hover .arrow { color: var(--accent); transform: translateX(4px); }
@media (prefers-reduced-motion: reduce) { .work-row, .work-row:hover { transform: none; transition: background .2s ease; } }

/* AI diagram */
.ai-diagram { display: grid; justify-items: center; gap: 0; padding: 32px 0 8px; }
.ai-core { display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; border: 1px solid var(--text); border-radius: 999px; font-weight: 500; font-size: .92rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }
.ai-users { position: relative; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 36px; }
.ai-users::before { content: ""; position: absolute; left: 16.6%; right: 16.6%; top: -20px; height: 20px; border: 1px solid var(--line); border-bottom: 0; }
.ai-users::after { content: ""; position: absolute; left: 50%; top: -36px; height: 16px; border-left: 1px solid var(--line); }
.ai-user { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.ai-user strong { font-weight: 600; font-size: .92rem; }
.ai-user span { color: var(--muted); font-size: .82rem; }

.points, .toolbox { display: grid; margin: 0; border-top: 1px solid var(--line); }
.points > div, .toolbox > div { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.points dt, .toolbox dt { font-weight: 600; font-size: .95rem; }
.points dd, .toolbox dd { margin: 0; color: var(--muted); font-size: .93rem; }
.toolbox > * + * { margin-top: 0; }

/* Process */
.process { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.process li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.step-no { color: var(--faint); font-size: .85rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.process h3 { font-size: 1rem; margin-bottom: 4px; }
.process p:not(.meta) { color: var(--muted); font-size: .93rem; margin-bottom: 6px; max-width: 64ch; }

/* Contact */
.contact { padding-bottom: clamp(72px, 10vw, 120px); }
.contact-lead { font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 600; letter-spacing: -.03em; line-height: 1.15; max-width: 20ch; }
.contact-list { border-top: 1px solid var(--line); }
.contact-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 20px; gap: 16px; align-items: baseline; padding: 18px 12px; border-bottom: 1px solid var(--line); transition: background .2s ease; }
.contact-row:hover { background: var(--hover); }
.contact-row:hover .arrow { color: var(--accent); }
.contact-row span:first-child { color: var(--muted); font-size: .86rem; }
.contact-row strong { font-weight: 500; overflow-wrap: anywhere; }

.site-footer { display: flex; justify-content: space-between; gap: 12px; padding-block: 28px 40px; border-top: 1px solid var(--line); color: var(--faint); font-size: .82rem; }

/* ---- Dialog -------------------------------------------------------------- */
.project-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .5); }
.project-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog-body { position: relative; padding: clamp(24px, 5vw, 48px); }
.dialog-body h2 { margin: 8px 40px 12px 0; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.03em; line-height: 1.15; }
.dialog-lead { color: var(--muted); margin-bottom: 28px; }
.dialog-facts { margin: 0; border-top: 1px solid var(--line); }
.dialog-facts > div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.dialog-facts dt { color: var(--muted); font-size: .86rem; }
.dialog-facts dd { margin: 0; font-size: .94rem; }
.dialog-facts ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.model { display: grid; gap: 6px; }
.model-row { font-size: .9rem; }
.model-row .arrow { color: var(--accent); }
.dialog-close { position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.dialog-close:hover { background: var(--hover); }
.dialog-actions { margin: -12px 0 4px; }
.dialog-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }
.dialog-nav button { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: transparent; text-align: left; font-weight: 500; font-size: .9rem; cursor: pointer; transition: background .2s ease; }
.dialog-nav button:last-child { text-align: right; }
.dialog-nav button span { color: var(--faint); font-size: .78rem; font-weight: 400; }
.dialog-nav button:hover { background: var(--hover); }

/* ---- Screenshot viewer ------------------------------------------------------ */
.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 8, 9, .94); color: #f2f2f3; }
.lightbox[open] { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; }
.lightbox::backdrop { background: transparent; }
.lb-figure { margin: 0; display: grid; justify-items: center; gap: 12px; max-height: 100vh; padding: 56px 0 24px; }
.lb-figure img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; border-radius: 6px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6); }
.lb-figure figcaption { font-size: .86rem; color: #b4b4ba; text-align: center; }
.lb-btn { width: 44px; height: 44px; justify-self: center; border: 1px solid rgba(255, 255, 255, .25); border-radius: 50%; background: transparent; color: inherit; font-size: 1.1rem; cursor: pointer; }
.lb-btn:hover { background: rgba(255, 255, 255, .1); }
.lb-close { position: absolute; top: 14px; right: 14px; }

/* ---- Responsive ------------------------------------------------------------- */
@media (max-width: 900px) {
  .block { grid-template-columns: 1fr; gap: 16px; }
  .capabilities { grid-template-columns: 1fr; gap: 24px; }
  .work-row { grid-template-columns: 36px minmax(0, 1fr) 120px; gap: 16px; }
  .work-row .arrow { display: none; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 24px; }
  .portrait-scene { width: min(260px, 70vw); justify-self: start; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding-bottom: 8px; }
  .ai-users { grid-template-columns: 1fr; margin-top: 24px; }
  .ai-users::before, .ai-users::after { display: none; }
  .points > div, .toolbox > div, .dialog-facts > div { grid-template-columns: 1fr; gap: 4px; }
  .contact-row { grid-template-columns: 90px minmax(0, 1fr) 16px; padding-inline: 4px; }
  .site-header nav a:not(.btn) { display: none; }
  .work-row { grid-template-columns: 28px minmax(0, 1fr); }
  .work-thumb { grid-column: 2; max-width: 280px; }
  .dialog-nav { grid-template-columns: 1fr; }
  .dialog-nav button:last-child { text-align: left; }
  .lightbox[open] { grid-template-columns: 0 minmax(0, 1fr) 0; }
  .lb-prev, .lb-next { position: absolute; bottom: 18px; }
  .lb-prev { left: calc(50% - 56px); }
  .lb-next { left: calc(50% + 12px); }
  .lb-figure { padding: 56px 8px 80px; }
}
