/* Shared mechanics for the demos. Each page sets its own tokens:
   --accent, --ink, --surface, --radius-lb, --font-display. */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; overflow-x: clip; }
body { margin: 0; overflow-x: clip; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { max-width: 100%; }
a { transition: color .2s ease; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 200; padding: 10px 16px; background: var(--ink); color: #fff; border-radius: 8px; text-decoration: none; transition: top .2s; }
.skip:focus { top: 12px; }

/* Scroll progress */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 120; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }

/* Sticky header */
.site-header { position: sticky; top: 0; z-index: 100; transition: transform .45s cubic-bezier(.2,.8,.2,1), background-color .3s, box-shadow .3s, backdrop-filter .3s; }
.site-header.is-hidden { transform: translateY(-110%); }
.menu-btn { display: none; width: 44px; height: 44px; border: 0; background: transparent; color: inherit; border-radius: 10px; cursor: pointer; position: relative; }
.menu-btn span { position: absolute; left: 11px; right: 11px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .3s, opacity .2s; }
.menu-btn span:nth-child(1) { top: 15px; }
.menu-btn span:nth-child(2) { top: 21px; }
.menu-btn span:nth-child(3) { top: 27px; }
.menu-open .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-open .menu-btn span:nth-child(2) { opacity: 0; }
.menu-open .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .site-header .header-in { column-gap: 12px; }
  .js [data-reveal="left"], .js [data-reveal="right"] { transform: translateY(32px); }
  .site-header[data-header] nav { display: none; width: 100%; flex-direction: column; align-items: stretch !important; padding: 8px 0 16px; }
  .site-header[data-header] nav a { margin-left: 0 !important; }
  .site-header[data-header].menu-open nav { display: flex; animation: menuIn .35s cubic-bezier(.2,.8,.2,1); }
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Reveal on scroll */
.js [data-reveal] { opacity: 0; transition: opacity .8s cubic-bezier(.2,.8,.2,1), transform .9s cubic-bezier(.2,.8,.2,1), filter .8s; transition-delay: var(--delay, 0ms); will-change: transform, opacity; }
.js [data-reveal="up"] { transform: translateY(32px); }
.js [data-reveal="left"] { transform: translateX(-40px); }
.js [data-reveal="right"] { transform: translateX(40px); }
.js [data-reveal="zoom"] { transform: scale(.92); }
.js [data-reveal="blur"] { filter: blur(10px); transform: translateY(16px); }
.js [data-reveal="pop"] { transform: translateY(24px) scale(.9) rotate(-2deg); transition-timing-function: cubic-bezier(.34,1.56,.64,1); }
.js [data-reveal].is-in { opacity: 1; transform: none; filter: none; }

/* Split-word headline */
[data-split] .word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
[data-split] .word > span { display: inline-block; transform: translateY(105%); transition: transform 1s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--i) * 70ms + 150ms); }
[data-split].is-split .word > span { transform: none; }

/* Fade-in for hero pieces (CSS only, runs on load) */
.intro { animation: introUp .9s cubic-bezier(.2,.8,.2,1) both; animation-delay: var(--d, 0ms); }
@keyframes introUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* Self-drawing SVG strokes */
.draw path, .draw rect { stroke-dasharray: 900; stroke-dashoffset: 900; }
.is-in .draw path, .is-in .draw rect, .draw.is-in path, .draw.is-in rect { animation: drawStroke 2.2s cubic-bezier(.6,0,.2,1) forwards; animation-delay: var(--sd, 0ms); }
@keyframes drawStroke { to { stroke-dashoffset: 0; } }

/* Gallery items */
.g-item { cursor: zoom-in; transition: transform .5s cubic-bezier(.2,.8,.2,1), box-shadow .5s, opacity .4s; }
.g-item .g-img { overflow: hidden; position: relative; }
.g-item img { transition: transform .9s cubic-bezier(.2,.8,.2,1), filter .5s; }
.g-item:hover img, .g-item:focus-visible img { transform: scale(1.08); }
.g-item.is-filtered { display: none; }
.g-item.pop { animation: popIn .55s cubic-bezier(.34,1.56,.64,1) both; animation-delay: var(--delay, 0ms); }
@keyframes popIn { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
.g-zoom { position: absolute; right: 10px; bottom: 10px; width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; background: rgba(255,255,255,.92); color: #111; opacity: 0; transform: translateY(8px) scale(.8); transition: .35s cubic-bezier(.2,.8,.2,1); }
.g-item:hover .g-zoom, .g-item:focus-visible .g-zoom { opacity: 1; transform: none; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button { font: inherit; cursor: pointer; transition: background-color .25s, color .25s, border-color .25s, transform .2s; }
.filters button:active { transform: scale(.95); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 300; display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; justify-items: center; padding: 24px; background: rgba(8,10,14,.82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
.lightbox.is-open { opacity: 1; visibility: visible; }
.lb-figure { margin: 0; max-width: min(960px, 100%); width: 100%; background: var(--surface, #fff); border-radius: var(--radius-lb, 16px); padding: 12px; box-shadow: 0 40px 80px rgba(0,0,0,.4); transform: scale(.92); transition: transform .45s cubic-bezier(.2,.8,.2,1); }
.lightbox.is-open .lb-figure { transform: none; }
.lb-figure.swap { animation: lbSwap .45s cubic-bezier(.2,.8,.2,1); }
@keyframes lbSwap { from { opacity: .2; transform: scale(.97); } to { opacity: 1; transform: none; } }
.lb-figure img { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; border-radius: calc(var(--radius-lb, 16px) - 6px); background: #ddd; }
.lb-figure figcaption { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 14px 6px 4px; color: var(--ink); font-family: var(--font-display, inherit); }
.lb-tag { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.lb-title { grid-column: 1; font-weight: 700; font-size: 18px; }
.lb-count { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 13px; opacity: .6; font-variant-numeric: tabular-nums; }
.lb-nav, .lb-close { border: 0; cursor: pointer; color: #fff; background: rgba(255,255,255,.12); border-radius: 999px; width: 52px; height: 52px; font-size: 30px; line-height: 1; transition: background .2s, transform .2s; }
.lb-nav:hover, .lb-close:hover { background: rgba(255,255,255,.24); transform: scale(1.08); }
.lb-close { position: absolute; top: 18px; right: 18px; font-size: 28px; }
@media (max-width: 600px) { .lightbox { grid-template-columns: 1fr; } .lb-nav { display: none; } }

/* Career timeline (from LinkedIn) */
.journey { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: 4px; }
.journey::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--j-line, rgba(0,0,0,.1)); }
.journey li { position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 2px 16px; padding: 10px 0 10px 30px; }
.journey li::before { content: ""; position: absolute; left: 0; top: 15px; width: 16px; height: 16px; border-radius: 99px; background: var(--j-dot-bg, #fff); border: 2px solid var(--accent); transform: scale(0); transition: transform .5s cubic-bezier(.34,1.56,.64,1); transition-delay: var(--delay, 0ms); }
.journey li.is-in::before { transform: none; }
.journey .yr { font-size: 13px; font-weight: 700; color: var(--accent); padding-top: 2px; font-variant-numeric: tabular-nums; }
.journey b { display: block; font-family: var(--font-display); font-size: 17px; line-height: 1.3; }
.journey small { display: block; font-size: 14px; opacity: .75; }
.journey li > span:last-child { grid-column: 2; }
@media (max-width: 480px) { .journey li { grid-template-columns: 1fr; } .journey li > span:last-child { grid-column: 1; } }

/* Carousel */
.carousel-track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, calc((100% - 40px) / 3)); gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 6px 2px 14px; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track > * { scroll-snap-align: start; }
@media (max-width: 720px) { .carousel-track { grid-auto-columns: 86%; } }
.carousel-ctrl { display: flex; align-items: center; gap: 10px; }
.carousel-ctrl button[data-prev], .carousel-ctrl button[data-next] { width: 44px; height: 44px; border-radius: 999px; cursor: pointer; display: grid; place-items: center; transition: transform .2s, opacity .2s, background .2s; }
.carousel-ctrl button:disabled { opacity: .35; cursor: default; }
.carousel-ctrl button:not(:disabled):hover { transform: scale(1.08); }
.dots { display: flex; gap: 6px; margin-right: auto; }
.dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px; background: currentColor; opacity: .25; cursor: pointer; transition: width .35s, opacity .35s; }
.dots button.is-on { width: 26px; opacity: 1; }

/* Star fill animation */
.stars svg { transform: scale(0) rotate(-40deg); }
.is-in .stars svg, .stars.is-in svg { animation: starPop .5s cubic-bezier(.34,1.56,.64,1) forwards; }
.stars svg:nth-child(2) { animation-delay: .08s !important; }
.stars svg:nth-child(3) { animation-delay: .16s !important; }
.stars svg:nth-child(4) { animation-delay: .24s !important; }
.stars svg:nth-child(5) { animation-delay: .32s !important; }
@keyframes starPop { to { transform: none; } }

/* Open status pill */
.status { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.status .dot { width: 10px; height: 10px; border-radius: 99px; background: #E0605A; position: relative; }
.status.is-open .dot { background: #34C77B; }
.status.is-open .dot::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: inherit; animation: ping 1.6s cubic-bezier(0,0,.2,1) infinite; }
@keyframes ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 400; transform: translate(-50%, 20px); opacity: 0; padding: 12px 20px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.25); transition: .35s cubic-bezier(.2,.8,.2,1); pointer-events: none; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Back to top */
.to-top { position: fixed; right: 22px; bottom: 22px; z-index: 90; width: 50px; height: 50px; border-radius: 999px; border: 0; cursor: pointer; display: grid; place-items: center; background: var(--ink); color: #fff; box-shadow: 0 10px 24px rgba(0,0,0,.2); opacity: 0; transform: translateY(16px) scale(.8); pointer-events: none; transition: .4s cubic-bezier(.2,.8,.2,1); }
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { transform: translateY(-3px); }

/* Mobile call bar */
.call-fab { display: none; }
@media (max-width: 700px) {
  .call-fab { position: fixed; left: 16px; right: 84px; bottom: 18px; z-index: 90; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; border-radius: 999px; background: var(--accent); color: #fff !important; font-weight: 700; text-decoration: none; box-shadow: 0 12px 28px rgba(0,0,0,.25); animation: introUp .6s 1s both; }
  .to-top { bottom: 19px; }
}

/* Inside the index-page preview frames, hide floating controls */
.in-frame .back-demos, .in-frame .to-top, .in-frame .call-fab, .in-frame .progress { display: none !important; }

/* Marquee */
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: flex; width: max-content; animation: marquee var(--marquee-speed, 38s) linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  [data-split] .word > span { transform: none; }
  .draw path, .draw rect { stroke-dashoffset: 0; }
  .stars svg { transform: none; }
}
