/* ── motion layer (GSAP + Lenis); everything here degrades to the static site ── */
:root { --clawd: #d97757; --green: #19c15f; --red: #ff4d5e; }
.gs .reveal { opacity: 1; transform: none; transition: none; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

/* Clawd — the orange Claude robot, drawn as pixels */
.clawd-svg { display: block; width: 100%; height: auto; overflow: visible; shape-rendering: crispEdges; }
.clawd-svg .body { fill: var(--clawd); }
.clawd-svg .eye { fill: #141414; transform-box: fill-box; transform-origin: center; animation: clawd-blink 4.2s infinite; }
.clawd-svg .leg { fill: var(--clawd); }
.walking .clawd-svg .legA { animation: clawd-step .32s steps(2) infinite; }
.walking .clawd-svg .legB { animation: clawd-step .32s steps(2) infinite reverse; }
.clawd-svg .arm-r { transform-box: fill-box; transform-origin: 0% 50%; }
.waving .clawd-svg .arm-r { animation: clawd-wave 1.1s ease-in-out infinite; }
@keyframes clawd-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes clawd-step { 0% { transform: translateY(0); } 100% { transform: translateY(-1px); } }
@keyframes clawd-wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-38deg); } }

/* loader */
.loader { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; pointer-events: none; }
.loader .ld-panel { position: absolute; left: 0; right: 0; height: 50.5%; background: #050608; z-index: 0; }
.loader .ld-panel.a { top: 0; } .loader .ld-panel.b { bottom: 0; }
.loader .ld-in { position: relative; z-index: 1; display: grid; justify-items: center; gap: 18px; }
.loader .ld-candles { width: 260px; height: 120px; overflow: visible; }
.loader .ld-row { display: flex; align-items: center; gap: 14px; }
.loader .ld-row [data-clawd] { width: 44px; }
.loader .ld-pct { font-family: var(--display); font-size: 46px; color: var(--blue); min-width: 3.2ch; font-weight: 400; direction: ltr; }
.loader .ld-name { font-family: var(--display); letter-spacing: .4em; font-size: 13px; color: var(--ink-2); direction: ltr; }
html:not(.gs) .loader, .no-loader .loader { display: none; }

/* custom cursor (fine pointers only) */
.cursor { position: fixed; top: 0; left: 0; z-index: 90; pointer-events: none; display: none; }
.cursor i { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 1px solid rgba(53, 143, 253, .7); transition: width .25s, height .25s, margin .25s, background .25s, border-color .25s; }
.cursor b { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--blue); }
.cursor.hot i { width: 70px; height: 70px; margin: -35px 0 0 -35px; background: rgba(53, 143, 253, .12); border-color: rgba(53, 143, 253, .9); }
@media (pointer: fine) { .gs .cursor { display: block; } }

/* scroll progress + Clawd walking on it */
.progress { position: fixed; left: 0; right: 0; bottom: 0; height: 3px; z-index: 80; pointer-events: none; }
.progress .bar { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; background: linear-gradient(90deg, var(--blue-d), var(--blue)); box-shadow: 0 0 12px rgba(53, 143, 253, .8); }
:root[dir="rtl"] .progress .bar { background: linear-gradient(270deg, var(--blue-d), var(--blue)); }
.progress .pet { position: absolute; bottom: 3px; width: 38px; margin-inline-start: -19px; inset-inline-start: 0; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; transform-origin: 50% 100%; }
:root[dir="rtl"] .progress .pet .clawd-svg { transform: scaleX(-1); }
.progress .pet.back .clawd-svg { transform: scaleX(-1); }
:root[dir="rtl"] .progress .pet.back .clawd-svg { transform: none; }
.progress .pet:hover { filter: drop-shadow(0 0 8px rgba(217, 119, 87, .8)); }
html:not(.gs) .progress { display: none; }

/* hero: live candlestick chart behind the big word */
.hero-candles { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .9;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 35%, transparent 80%); mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 35%, transparent 80%); }
.hero-word { z-index: 0; }
.made { margin-top: 18px; display: inline-flex; align-items: center; gap: 12px; padding: 8px 16px 8px 10px; border: 1px solid rgba(217, 119, 87, .45); border-radius: 999px; background: rgba(217, 119, 87, .08); font-size: 12px; color: var(--ink); transition: border-color .3s, background .3s; }
:root[dir="rtl"] .made { padding: 8px 10px 8px 16px; }
.made:hover { border-color: var(--clawd); background: rgba(217, 119, 87, .16); }
.made [data-clawd] { width: 28px; flex: none; }
.made b { color: var(--clawd); font-weight: 700; }

/* marquee strip */
.marquee { overflow: hidden; border-bottom: 1px solid var(--line); padding: 14px 0; background: linear-gradient(90deg, rgba(53, 143, 253, .06), transparent 40%, transparent 60%, rgba(53, 143, 253, .06)); }
.mq-track { display: flex; width: max-content; direction: ltr; }
.mq-set { display: flex; align-items: center; gap: 28px; padding-inline-end: 28px; }
.mq-set span { font-family: var(--display); font-size: clamp(22px, 3vw, 36px); letter-spacing: .04em; line-height: 1; text-transform: uppercase; white-space: nowrap; color: transparent; -webkit-text-stroke: 1px rgba(241, 244, 248, .28); }
.mq-set span.fill { color: rgba(241, 244, 248, .7); -webkit-text-stroke: 0; }
:root[lang="fa"] .mq-set span.fa { font-family: var(--sans); font-weight: 900; font-size: clamp(20px, 2.6vw, 32px); direction: rtl; }
.mq-set svg { width: 10px; height: 18px; flex: none; opacity: .55; }

/* section heads: rule becomes a candle sparkline */
.head .rule { height: 1px; background: var(--line-2); }
.head .rule svg { position: relative; width: 100%; height: 22px; overflow: visible; opacity: .5; }
.gs .head h2 .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; }
.gs .head h2 .w > span { display: inline-block; }

/* project cards: 3D tilt + glare */
.proj .shot { transform-style: preserve-3d; will-change: transform; }
.proj .shot::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .18), transparent 45%); }
.proj .shot:hover::after { opacity: 0; }
.gs .proj .shot img { transform: scale(1.12); transition: none; }
.gs .proj:hover .shot img { transform: scale(1.12); }
.this-site { display: flex; align-items: center; gap: 18px; margin: -6px 0 26px; padding: 0 0 18px; border: 0; border-bottom: 1px solid var(--line); background: none; font-size: 13px; color: var(--ink-2); }
.this-site .n { font-family: var(--display); font-size: 30px; color: var(--clawd); line-height: 1; }
:root[lang="fa"] .this-site .n { font-family: var(--sans); font-weight: 800; font-size: 26px; }
.this-site b { color: var(--ink); }
.this-site [data-clawd] { width: 34px; margin-inline-start: auto; flex: none; }

.group { position: relative; border-top: 0 !important; }
.group::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 1px; background: linear-gradient(90deg, var(--blue), var(--line) 40%); transform: scaleX(var(--gl, 1)); transform-origin: 0 50%; }
:root[dir="rtl"] .group::before { transform-origin: 100% 50%; }

/* process line that draws itself */
.steps .line { position: absolute; inset-inline-start: calc(34px + 14px + 22px); top: 46px; bottom: 66px; width: 2px; margin-inline-start: -.5px; background: linear-gradient(var(--blue), rgba(53, 143, 253, .2)); transform-origin: 50% 0; box-shadow: 0 0 10px rgba(53, 143, 253, .6); }
html:not(.gs) .steps .line { display: none; }

/* contact Clawd waving */
.contact .hi { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.contact .hi [data-clawd] { width: 52px; }
.contact .hi span.say { font-size: 12px; color: var(--clawd); border: 1px solid rgba(217, 119, 87, .5); border-radius: 12px 12px 12px 2px; padding: 4px 10px; margin-bottom: 18px; }
:root[dir="rtl"] .contact .hi span.say { border-radius: 12px 12px 2px 12px; }

@media (max-width: 820px) {
  .progress .pet { width: 30px; margin-inline-start: -15px; }
  .this-site { flex-wrap: wrap; }
  .marquee { padding: 14px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .loader, .cursor { display: none !important; }
  .clawd-svg .eye, .walking .clawd-svg .leg, .waving .clawd-svg .arm-r { animation: none !important; }
}

:root[dir="rtl"] .group::before { background: linear-gradient(270deg, var(--blue), var(--line) 40%); transform-origin: 100% 50%; }
.laptop img { translate: 0 var(--bob, 0px); }
.cursor { opacity: 0; transition: opacity .3s; } .cursor.on { opacity: 1; }
@media (max-width: 820px) { .hero-candles { height: 46%; opacity: .45; } }

/* Clawd only where Claude is named */
.clawd-inline { display: inline-block; width: 22px; vertical-align: -3px; margin-inline-end: 6px; }
.sk-claude { display: flex; align-items: center; justify-content: center; gap: 2px; border-color: rgba(217, 119, 87, .45) !important; color: var(--ink) !important; }
.sk-claude .clawd-inline { width: 16px; vertical-align: 0; margin-inline-end: 4px; }
.this-site b + .clawd-inline, .this-site .clawd-inline { margin-inline-start: 2px; }
.skills span.sk-claude { display: flex; align-items: center; justify-content: center; gap: 4px; }
.skills span.clawd-inline { padding: 0; border: 0; width: 16px; flex: none; }
.this-site span.clawd-inline { width: 20px; margin-inline: 2px 6px; vertical-align: -3px; }

/* inline Clawd is alive: steps in place, hops, waves, looks around (CSS only) */
.clawd-inline .clawd-svg { animation: clawd-hop 2.8s ease-in-out infinite; transform-origin: 50% 100%; }
.clawd-inline .clawd-svg .legA { animation: clawd-step .36s steps(2) infinite; }
.clawd-inline .clawd-svg .legB { animation: clawd-step .36s steps(2) infinite reverse; }
.clawd-inline .clawd-svg .arm-r { animation: clawd-wave-sometimes 4.2s ease-in-out infinite; }
.clawd-inline .clawd-svg .eye { animation: clawd-blink 4.2s infinite, clawd-look 5.6s ease-in-out infinite; }
.clawd-inline:hover .clawd-svg { animation-duration: .7s; }
.sk-claude .clawd-inline .clawd-svg { animation-delay: -1.3s; }
.sk-claude .clawd-inline .clawd-svg .arm-r { animation-delay: -2s; }
@keyframes clawd-hop {
  0%, 55%, 100% { transform: translateY(0) scale(1, 1); }
  60% { transform: translateY(0) scale(1.08, .9); }
  70% { transform: translateY(-28%) scale(.96, 1.06); }
  80% { transform: translateY(0) scale(1.06, .94); }
  86% { transform: translateY(-8%) scale(1, 1); }
  92% { transform: translateY(0) scale(1, 1); }
}
@keyframes clawd-wave-sometimes { 0%, 18%, 100% { transform: rotate(0); } 4%, 12% { transform: rotate(-40deg); } 8%, 16% { transform: rotate(-10deg); } }
@keyframes clawd-look { 0%, 30%, 100% { translate: 0 0; } 38%, 55% { translate: .6px 0; } 63%, 80% { translate: -.6px 0; } }
@media (prefers-reduced-motion: reduce) { .clawd-inline .clawd-svg, .clawd-inline .clawd-svg * { animation: none !important; } }
.nw { white-space: nowrap; }
.marquee { direction: ltr; }
.trio .edu-h { margin-top: 26px; }
.exp.edu { margin-bottom: 0; }
