*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ================= Theme tokens ================= */
:root, [data-theme="dark"] {
  --bg: #0C0C0C; --bg2: #14091c; --fg: #D7E2EA; --muted: rgba(215,226,234,.62); --line: rgba(215,226,234,.16);
  --grad-h: linear-gradient(180deg, #646973 0%, #BBCCD7 100%);
  --hero-bg: radial-gradient(ellipse at 50% 92%, rgba(118,33,176,.24), transparent 60%), radial-gradient(ellipse at 12% 8%, rgba(182,0,168,.10), transparent 45%), #0C0C0C;
  --section-glow: radial-gradient(ellipse at 50% 40%, rgba(118,33,176,.16), transparent 62%);
  --svc-bg: radial-gradient(ellipse at 20% 0%, rgba(182,0,168,.18), transparent 55%), radial-gradient(ellipse at 90% 100%, rgba(118,33,176,.20), transparent 55%), #150a1e;
  --svc-card: rgba(255,255,255,.04); --svc-line: rgba(182,0,168,.32); --svc-title: var(--grad-h);
  --glass: rgba(20,20,26,.58); --glass-line: rgba(215,226,234,.14);
  --card: rgba(255,255,255,.045); --shadow: 0 22px 50px rgba(0,0,0,.5);
  --tk: #c792ea; --ts: #f78c6c; --tf: #82aaff; --tc: #7d8a9a;
  --tile-bg: linear-gradient(145deg, #17121f, #0f0d14); --live-hover: rgba(215,226,234,.1);
}
[data-theme="light"] {
  --bg: #FFF2FA; --bg2: #F6E3FF; --fg: #2B0A3D; --muted: rgba(43,10,61,.68); --line: rgba(118,33,176,.22);
  --grad-h: linear-gradient(180deg, #7621B0 0%, #E0529C 100%);
  --hero-bg: radial-gradient(ellipse at 50% 92%, rgba(224,82,156,.30), transparent 60%), radial-gradient(ellipse at 12% 8%, rgba(118,33,176,.16), transparent 50%), radial-gradient(ellipse at 90% 20%, rgba(255,160,215,.28), transparent 50%), #FFF2FA;
  --section-glow: radial-gradient(ellipse at 50% 40%, rgba(224,82,156,.20), transparent 62%);
  --svc-bg: radial-gradient(ellipse at 15% 0%, rgba(255,150,210,.55), transparent 55%), radial-gradient(ellipse at 90% 100%, rgba(170,110,255,.35), transparent 55%), #FBE6F7;
  --svc-card: rgba(255,255,255,.78); --svc-line: rgba(182,0,168,.25); --svc-title: linear-gradient(180deg, #7621B0, #C93A93);
  --glass: rgba(255,255,255,.66); --glass-line: rgba(118,33,176,.25);
  --card: rgba(255,255,255,.72); --shadow: 0 22px 50px rgba(150,40,160,.22);
  --tk: #7621B0; --ts: #c2410c; --tf: #1d4ed8; --tc: #8a7a99;
  --tile-bg: linear-gradient(145deg, #ffffff, #f8e8ff); --live-hover: rgba(118,33,176,.10);
}

html { scroll-behavior: smooth; background: var(--bg); }
body, #root, #app { background: var(--bg); color: var(--fg); transition: background-color .4s ease, color .4s ease; }
body { font-family: 'Kanit', 'Vazirmatn', sans-serif; }
html[lang="fa"] body, html[lang="fa"] button, html[lang="fa"] input, html[lang="fa"] textarea { font-family: 'Vazirmatn', 'Kanit', sans-serif; }
html[lang="fa"] * { letter-spacing: normal !important; }      /* tracking breaks joined Persian letters */
html[lang="fa"] .uppercase { text-transform: none; }

/* language switching */
html[lang="en"] .l-fa, html[lang="fa"] .l-en { display: none !important; }

.c-fg { color: var(--fg); } .c-muted { color: var(--muted); } .bg-page { background: var(--bg); }
.hero-heading, .svc-title {
  background: var(--grad-h); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.svc-title { background-image: var(--svc-title); }
.js [data-fade] { opacity: 0; }
a:focus-visible, button:focus-visible { outline: 2px solid #B600A8; outline-offset: 3px; }

/* ================= Buttons ================= */
.contact-btn {
  background: linear-gradient(123deg, #18011F 7%, #B600A8 37%, #7621B0 72%, #BE4C00 100%);
  box-shadow: 0px 4px 4px rgba(181,1,167,.25), 4px 4px 12px #7721B1 inset;
  outline: 2px solid #fff; outline-offset: -3px; color: #fff; cursor: pointer; border: 0;
  transition: transform .25s ease, filter .25s ease;
}
.contact-btn:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.15); }
.live-btn { border-color: var(--fg); color: var(--fg); } .live-btn:hover { background: var(--live-hover); }

.tbtn {
  display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 .6rem; border-radius: 999px; cursor: pointer;
  font: 600 12px/1 'Vazirmatn','Kanit',sans-serif; color: var(--fg); background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: transform .2s ease, background-color .2s ease;
}
.tbtn:hover { transform: translateY(-1px) scale(1.06); }
.tbtn.big { width: 46px; height: 46px; font-size: 24px; padding: 0; }
[data-theme="dark"] .i-sun, [data-theme="light"] .i-moon { display: block; }
[data-theme="dark"] .i-moon, [data-theme="light"] .i-sun { display: none; }

/* ================= Hero ================= */
#hero { background: var(--hero-bg); transition: background .4s ease; }
.portrait-wrap { perspective: 1200px; }
.portrait-scene { position: relative; width: clamp(200px, 30vh, 330px); aspect-ratio: 3/4; }
@media (min-width: 640px) { .portrait-scene { width: clamp(280px, 49.5vh, 520px); } }
.portrait-glow { position: absolute; inset: -12% -18% 0; z-index: -2; filter: blur(46px); opacity: .7; border-radius: 50%;
  background: conic-gradient(from 0deg, #B600A8, #7621B0, #BE4C00, #B600A8); animation: glow-spin 14s linear infinite; }
[data-theme="light"] .portrait-glow { opacity: .55; background: conic-gradient(from 0deg, #ff7ac6, #a96bff, #ffb36b, #ff7ac6); }
.portrait-ring { position: absolute; inset: -6% -14%; z-index: -1; border-radius: 50%; border: 1px dashed var(--line); transform: rotateX(72deg); animation: ring-spin 18s linear infinite; }
#code-canvas { position: absolute; z-index: -3; top: -4%; left: -88%; width: 276%; height: 100%;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 38%, transparent 72%); mask-image: radial-gradient(ellipse at center, #000 38%, transparent 72%); }
.portrait-tilt { transform-style: preserve-3d; transition: transform .25s ease-out; will-change: transform; width: 100%; height: 100%; }
.portrait-img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; border-radius: 36px 36px 0 0;
  border: 1px solid var(--line); border-bottom: 0; filter: saturate(1.05) contrast(1.04);
  -webkit-mask-image: linear-gradient(to bottom, #000 76%, transparent 100%); mask-image: linear-gradient(to bottom, #000 76%, transparent 100%); }
@keyframes glow-spin { to { transform: rotate(360deg); } }
@keyframes ring-spin { from { transform: rotateX(72deg) rotateZ(0); } to { transform: rotateX(72deg) rotateZ(360deg); } }
html[lang="fa"] #hero h1 { font-size: clamp(2.2rem, 9.4vw, 9.5rem) !important; font-weight: 900; line-height: 1.25; }

.glass { background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow); color: var(--fg); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.float-card { will-change: transform; transition: transform .2s ease-out; }
#terminal::after { content: "▍"; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* syntax colours */
.code .k { color: var(--tk); } .code .s { color: var(--ts); } .code .f { color: var(--tf); } .code .c { color: var(--tc); font-style: italic; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; direction: ltr; text-align: left; }

/* ================= Skills marquee ================= */
.skill-tile { display: flex; align-items: center; gap: 12px; width: 250px; height: 76px; padding: 0 16px; border-radius: 18px;
  background: var(--tile-bg); border: 1px solid var(--line); color: var(--fg); }
.skill-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: #fff; flex: none; box-shadow: 0 4px 14px rgba(118,33,176,.25); }
.skill-ico img { width: 26px; height: 26px; object-fit: contain; }
.skill-ico b { font: 800 15px/1 'Kanit', sans-serif; color: #7621B0; place-items: center; }
.skill-txt { display: flex; flex-direction: column; min-width: 0; }
.skill-txt strong { font-weight: 700; font-size: 1rem; line-height: 1.1; }
.skill-txt code { font: 400 11px/1.4 ui-monospace, Menlo, monospace; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ================= About ================= */
.about-glow { position: absolute; inset: 0; background: var(--section-glow); pointer-events: none; }
.cube-stage { width: var(--s); height: var(--s); perspective: 700px; }
.cube { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.cube .f { position: absolute; inset: 0; display: grid; place-items: center; font: 800 calc(var(--s) * .24)/1 'Kanit', sans-serif; color: #fff;
  background: linear-gradient(135deg, rgba(118,33,176,.62), rgba(224,82,156,.42)); border: 1px solid rgba(255,255,255,.4); box-shadow: inset 0 0 28px rgba(182,0,168,.4); }
.f1 { transform: rotateY(0deg) translateZ(calc(var(--s) / 2)); } .f2 { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.f3 { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); } .f4 { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.f5 { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); } .f6 { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.spin-a { animation: spin 16s linear infinite; } .spin-b { animation: spin 21s linear infinite reverse; }
.spin-c { animation: spin 18s linear infinite; } .spin-d { animation: spin 24s linear infinite reverse; } .spin-e { animation: spin 14s linear infinite; }
@keyframes spin { from { transform: rotateX(-20deg) rotateY(0); } to { transform: rotateX(340deg) rotateY(360deg); } }

.trait { padding: .45rem 1rem; border-radius: 999px; font-size: .85rem; font-weight: 500; color: var(--fg); background: var(--card);
  border: 1px solid var(--line); animation: floaty 4.5s ease-in-out infinite; animation-delay: calc(var(--d) * -.7s); }
@keyframes floaty { 50% { transform: translateY(-6px); } }

/* dark editor window (used in About + Experience) */
.win { --fg: #D7E2EA; --muted: rgba(215,226,234,.6); --tk: #c792ea; --ts: #f78c6c; --tf: #82aaff; --tc: #7d8a9a;
  color: #D7E2EA; background: #0f0b16; border: 1px solid rgba(182,0,168,.35); border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 70px rgba(80,20,120,.45), 0 0 0 1px rgba(255,255,255,.03) inset; transition: transform .1s ease-out; will-change: transform; }
.win-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: #1a1124; font: 500 12px 'Kanit', sans-serif; }
.win-bar span { margin-inline-start: 10px; opacity: .75; } .win-bar em { margin-inline-start: auto; font-style: normal; font-size: 11px; color: #B600A8; }
.win-body { display: flex; gap: 14px; padding: 16px 14px 18px; min-height: 340px; overflow-x: auto; }
.ln { font: 400 clamp(11px,1.5vw,14px)/1.7 ui-monospace, Menlo, monospace; color: rgba(215,226,234,.28); text-align: right; user-select: none; }
#about-code { font-size: clamp(11px, 1.5vw, 14px); line-height: 1.7; }
.caret { display: inline-block; width: 8px; height: 1.1em; vertical-align: text-bottom; background: #B600A8; animation: blink 1s steps(2) infinite; }
.win-out { padding: 0 18px 0; max-height: 0; overflow: hidden; opacity: 0; font: 400 13px/1.8 ui-monospace, Menlo, monospace; border-top: 1px dashed transparent; transition: max-height .6s ease, opacity .6s ease, padding .6s ease; }
.win-out.show { max-height: 220px; opacity: 1; padding: 12px 18px 16px; border-top-color: rgba(215,226,234,.15); }
.win-out .ok { color: #7ee787; opacity: 0; transform: translateX(-10px); } .win-out .ok span { font-family: 'Vazirmatn', sans-serif; }
.win-out.show .ok { animation: line-in .5s ease forwards; animation-delay: calc(var(--i) * .35s + .3s); }
.win-out .k { color: #c792ea; } .win-out .s { color: #f78c6c; }
@keyframes line-in { to { opacity: 1; transform: none; } }

/* ================= Services ================= */
.svc-section { background: var(--svc-bg); transition: background .4s ease; }
.svc-card { border-radius: 22px; overflow: hidden; background: var(--svc-card); border: 1px solid var(--svc-line); box-shadow: var(--shadow); backdrop-filter: blur(6px); transition: transform .1s ease-out, box-shadow .3s; will-change: transform; }
.svc-img { aspect-ratio: 16/9.6; overflow: hidden; } .svc-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s ease; }
.svc-card:hover .svc-img img { transform: scale(1.06); }
.svc-body { padding: 16px 18px 20px; position: relative; }
.svc-num { position: absolute; inset-inline-end: 16px; top: 8px; font: 900 2.2rem/1 'Kanit', sans-serif; color: var(--fg); opacity: .12; }
.svc-body h3 { font-weight: 600; font-size: clamp(.95rem, 1.5vw, 1.2rem); line-height: 1.3; color: var(--fg); padding-inline-end: 2.4rem; }
.svc-body p { margin-top: .5rem; font-weight: 300; font-size: clamp(.8rem, 1.1vw, .95rem); line-height: 1.7; color: var(--muted); }

/* ================= Projects ================= */
#projects { --top-base: 5rem; }
@media (min-width: 768px) { #projects { --top-base: 6rem; } }
.stack-card { position: sticky; margin-bottom: 45vh; transform-origin: top center; will-change: transform;
  border-radius: 40px; border: 2px solid var(--fg); background: var(--bg); padding: 1rem; transition: background-color .4s ease; }
.stack-card:last-child { margin-bottom: 30vh; }
@media (min-width: 640px) { .stack-card { border-radius: 50px; padding: 1.5rem; } }
@media (min-width: 768px) { .stack-card { border-radius: 60px; padding: 2rem; } }
[data-theme="light"] .stack-card { background: #fff; border-color: #B600A8; box-shadow: 0 30px 60px rgba(182,0,168,.18); }
.panel { --tk: #c792ea; --ts: #f78c6c; --tf: #82aaff; --tc: #7d8a9a; --fg: #D7E2EA; position: relative; overflow: hidden; background: #110c19; border: 1px solid rgba(215,226,234,.12); color: #D7E2EA; }
.panel canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.panel .code { position: absolute; inset: 0; padding: clamp(14px, 2.4vw, 34px); overflow: hidden; font-size: clamp(8px, 1vw, 14px); line-height: 1.6; }
.bg-net { position: absolute; inset: 0; border: 0; background: transparent; opacity: .4; border-radius: 0; }

/* ================= Reviews (3D ring) ================= */
.rev-section { background: linear-gradient(180deg, var(--bg), var(--bg2) 50%, var(--bg)); }
.rev-glow { position: absolute; inset: 0; background: var(--section-glow); pointer-events: none; }
.carousel { --cw: 300px; --ch: 390px; position: relative; perspective: 1300px; height: calc(var(--ch) + 40px); touch-action: pan-y; cursor: grab; user-select: none; }
@media (min-width: 640px) { .carousel { --cw: 380px; --ch: 370px; } }
.carousel:active { cursor: grabbing; }
.ring { position: relative; width: var(--cw); height: var(--ch); margin: 20px auto 0; transform-style: preserve-3d; will-change: transform; }
.rcard { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: 26px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--fg); }
html[dir="rtl"] .rcard { direction: rtl; text-align: right; }
.rcard-top { display: flex; align-items: center; gap: 12px; } .rcard-top img { width: 58px; height: 58px; border-radius: 50%; box-shadow: 0 0 0 2px #B600A8; }
.rcard figcaption { font-weight: 700; font-size: 1.05rem; line-height: 1.2; } .rcard small { font-size: .8rem; color: var(--muted); }
.rcard-co { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-size: .8rem; font-weight: 600; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line); }
.rcard-co b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, #7621B0, #BE4C00); color: #fff; font-size: .72rem; }
.rcard blockquote { font-weight: 400; font-size: .95rem; line-height: 1.75; color: var(--fg); flex: 1; } .stars { color: #ffb347; letter-spacing: 2px; font-size: .95rem; }

/* ================= Experience (neural timeline) ================= */
.spine { position: absolute; top: 0; bottom: 0; inset-inline-start: 1.25rem; width: 2px; margin-inline-start: -1px; background: var(--line); border-radius: 2px; }
@media (min-width: 768px) { .spine { inset-inline-start: 50%; } }
.spine-fill { width: 100%; height: 0; background: linear-gradient(180deg, #7621B0, #B600A8, #BE4C00); box-shadow: 0 0 14px #B600A8; border-radius: 2px; position: relative; }
.spine-fill::after { content: ""; position: absolute; inset-inline-start: 50%; bottom: 0; width: 10px; height: 10px; margin-inline-start: -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 16px 4px #B600A8; }
.neuron { position: relative; z-index: 2; display: grid; place-items: center; width: 40px; height: 40px; margin-inline: auto; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd1ec, #B600A8 55%, #4a0f7a); color: #fff; font: 800 15px 'Kanit', sans-serif; filter: grayscale(1) brightness(.55); transform: scale(.82); transition: filter .6s ease, transform .6s ease, box-shadow .6s ease; }
.neuron::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 1px dashed rgba(182,0,168,.7); animation: ring2 8s linear infinite; }
@keyframes ring2 { to { transform: rotate(360deg); } }
.exp-item.on .neuron { filter: none; transform: scale(1.08); box-shadow: 0 0 0 6px rgba(182,0,168,.18), 0 0 30px 6px rgba(182,0,168,.6); animation: fire 2.8s ease-in-out infinite; }
@keyframes fire { 50% { box-shadow: 0 0 0 10px rgba(182,0,168,.10), 0 0 44px 12px rgba(190,76,0,.55); } }
.exp-card { transition: transform .1s ease-out, box-shadow .4s; } .exp-item.on .exp-card { box-shadow: 0 30px 70px rgba(182,0,168,.35); }
.exp-body { padding: 16px 20px 20px; text-align: start; } html[dir="rtl"] .exp-body { direction: rtl; }
.exp-period { font: 500 .75rem ui-monospace, Menlo, monospace; color: #B600A8; }
.exp-body h3 { margin-top: .25rem; font-weight: 700; font-size: clamp(1.05rem, 2vw, 1.4rem); line-height: 1.25; }
.exp-co { font-size: .85rem; color: #82aaff; margin-top: .1rem; } .exp-desc { margin-top: .6rem; font-size: .9rem; line-height: 1.7; color: rgba(215,226,234,.78); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: .8rem; }
.chips span { font: 500 .72rem ui-monospace, Menlo, monospace; padding: 3px 10px; border-radius: 999px; background: rgba(118,33,176,.28); border: 1px solid rgba(182,0,168,.4); }
.act { height: 4px; margin-top: 1rem; border-radius: 4px; background: rgba(215,226,234,.12); overflow: hidden; }
.act span { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #7621B0, #BE4C00); transition: width 1.4s cubic-bezier(.25,.1,.25,1) .3s; }
.exp-item.on .act span { width: var(--w); }

/* ================= Contact ================= */
.contact-glow { position: absolute; inset: 0; background: var(--section-glow); pointer-events: none; }
.contact-scene { position: relative; display: grid; place-items: center; width: calc(var(--s) * 2.3); height: calc(var(--s) * 2.3); perspective: 900px; transform-style: preserve-3d; }
.orbit { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed var(--line); transform-style: preserve-3d; }
.orbit i { position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #B600A8; box-shadow: 0 0 14px 3px #B600A8; }
.o1 { --t: rotateX(70deg); animation: orb 9s linear infinite; }
.o2 { --t: rotateX(70deg) rotateY(50deg); inset: 8%; animation: orb 12s linear infinite reverse; }
.o3 { --t: rotateX(70deg) rotateY(-45deg); inset: -8%; animation: orb 16s linear infinite; }
.o2 i { background: #BE4C00; box-shadow: 0 0 14px 3px #BE4C00; }
@keyframes orb { from { transform: var(--t) rotateZ(0deg); } to { transform: var(--t) rotateZ(360deg); } }
.contact-card { padding: clamp(1.2rem, 3vw, 2rem); border-radius: 28px; background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: transform .1s ease-out; will-change: transform; }
.field { width: 100%; border-radius: 18px; padding: .85rem 1.15rem; color: var(--fg); background: var(--card); border: 1px solid var(--line); font: inherit; transition: border-color .2s, box-shadow .2s; }
.field::placeholder { color: var(--muted); }
.field:focus { outline: none; border-color: #B600A8; box-shadow: 0 0 0 4px rgba(182,0,168,.18), 0 8px 24px rgba(182,0,168,.2); }
.notice { padding: .8rem 1.1rem; border-radius: 16px; border: 1px solid rgba(39,201,63,.55); color: var(--fg); background: rgba(39,201,63,.1); }
.err { color: #e5484d; font-size: .8rem; }

@media (prefers-reduced-motion: reduce) {
  .cube, .portrait-glow, .portrait-ring, .trait, .orbit, .neuron::before { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ================= Neural backgrounds (all sections) ================= */
.nn-sec { position: relative; isolation: isolate; }
.neural-bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; border-radius: inherit; }

/* ================= Reviews v2 ================= */
.rev-chip { display: flex; flex-direction: column; align-items: center; min-width: 140px; padding: .8rem 1.4rem; border-radius: 20px;
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.rev-chip b { font: 800 1.6rem/1.1 'Kanit', sans-serif; background: linear-gradient(135deg, #7621B0, #E0529C, #BE4C00); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.rev-chip b i { font-style: normal; -webkit-text-fill-color: #ffb347; }
.rev-chip span { font-size: .78rem; color: var(--muted); }
.rev-stage { padding-block: 10px 30px; }
.rev-floor { position: absolute; left: 50%; bottom: 0; width: min(780px, 92vw); height: 190px; transform: translateX(-50%) rotateX(72deg); pointer-events: none; z-index: 0; }
.rev-floor i { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(182,0,168,.45); box-shadow: 0 0 40px rgba(182,0,168,.25) inset; animation: floor-pulse 4.5s ease-out infinite; }
.rev-floor i:nth-child(2) { animation-delay: 1.5s; } .rev-floor i:nth-child(3) { animation-delay: 3s; }
@keyframes floor-pulse { from { transform: scale(.35); opacity: .95; } to { transform: scale(1.05); opacity: 0; } }
.carousel { z-index: 1; }
.rcard { transition: border-color .4s, box-shadow .4s; overflow: hidden; }
.rcard.front { border-color: #B600A8; box-shadow: 0 0 0 1px #B600A8, 0 30px 80px rgba(182,0,168,.38), 0 0 60px rgba(118,33,176,.35) inset; }
.rcard::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 85% 0%, rgba(182,0,168,.22), transparent 55%); pointer-events: none; }
.qmark { position: absolute; top: -6px; inset-inline-end: 16px; font: 900 5.5rem/1 Georgia, serif; color: #B600A8; opacity: .22; }
.rcard-top img { width: 62px; height: 62px; }
.rcard blockquote { font-size: 1rem; }
.rev-thumbs { display: flex; gap: 8px; padding: 6px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.rev-thumbs button { width: 40px; height: 40px; padding: 0; border: 2px solid transparent; border-radius: 50%; overflow: hidden; cursor: pointer; background: none; opacity: .5; transform: scale(.88); transition: all .3s ease; }
.rev-thumbs button img { width: 100%; height: 100%; display: block; }
.rev-thumbs button:hover { opacity: .85; }
.rev-thumbs button.on { opacity: 1; transform: scale(1.12); border-color: #B600A8; box-shadow: 0 0 14px #B600A8; }

/* ================= v3 additions ================= */
.toggles { display: flex; gap: .5rem; z-index: 40; }
.logo { display: inline-flex; align-items: center; gap: .6rem; color: var(--fg); text-decoration: none; transition: transform .25s ease; }
.logo:hover { transform: translateY(-1px) scale(1.03); }
.logo img { width: 44px; height: 44px; filter: drop-shadow(0 4px 14px rgba(182,0,168,.55)); }
.logo span { display: flex; flex-direction: column; line-height: 1.05; }
.logo b { font: 900 1.3rem/1 'Kanit', sans-serif; letter-spacing: .02em; }
.logo small { font-size: .62rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin-top: 3px; }
@media (max-width: 400px) { .logo small { display: none; } }

/* portrait: new transparent cut-out, a bit larger */
.portrait-scene { height: clamp(250px, 40vh, 420px); width: auto; aspect-ratio: 674 / 700; }
@media (min-width: 640px) { .portrait-scene { height: clamp(340px, 73vh, 800px); width: auto; } }
.portrait-img { object-fit: contain; object-position: bottom; border: 0; border-radius: 0;
  filter: drop-shadow(0 18px 40px rgba(182,0,168,.38)) saturate(1.04);
  -webkit-mask-image: linear-gradient(to bottom, #000 92%, transparent 100%); mask-image: linear-gradient(to bottom, #000 92%, transparent 100%); }
#code-canvas { left: -60%; width: 220%; }

/* About: big editor */
.win.big .win-body { min-height: 440px; padding: 22px 20px 24px; }
.win.big .ln, .win.big #about-code { font-size: clamp(11.5px, 1.65vw, 16px); line-height: 1.75; }

/* Services: 3D pop-out cards */
.svc-card { overflow: visible; background: none; border: 0; box-shadow: none; backdrop-filter: none; border-radius: 24px; position: relative; transform-style: preserve-3d; }
.svc-card::before { content: ""; position: absolute; inset: 40px 0 0; border-radius: 24px; background: var(--svc-card); border: 1px solid var(--svc-line); box-shadow: var(--shadow); }
.svc-img { position: relative; margin: 0 16px; aspect-ratio: 16 / 10; border-radius: 20px; overflow: hidden; transform: translateZ(60px);
  box-shadow: 0 26px 44px rgba(60,0,90,.5), 0 0 0 1px rgba(255,255,255,.14); }
.svc-img img { animation: float-img 7s ease-in-out infinite; transform-origin: center; }
@keyframes float-img { 50% { transform: scale(1.07) translateY(-3px); } }
.svc-body { transform: translateZ(34px); padding: 18px 22px 24px; }
.svc-card:hover .svc-img { box-shadow: 0 34px 60px rgba(182,0,168,.5), 0 0 0 1px rgba(255,255,255,.3); }

/* Projects: real images + description */
.proj-desc { font-size: clamp(.78rem, 1.1vw, .95rem); line-height: 1.65; max-width: 78ch; margin-bottom: .6rem; }
.stack-card .chips { margin-top: 0; } .stack-card .chips span { color: var(--fg); }
[data-theme="light"] .stack-card .chips span { background: rgba(182,0,168,.1); border-color: rgba(182,0,168,.35); }
.pimg { position: relative; overflow: hidden; background: #110c19; border: 1px solid rgba(215,226,234,.14); }
.pimg img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .9s ease; }
.stack-card:hover .pimg img { transform: scale(1.05); }

/* Reviews: full width, bigger */
.carousel { --cw: 280px; --ch: 410px; width: 100%; height: calc(var(--ch) + 50px); }
@media (min-width: 640px) { .carousel { --cw: 360px; --ch: 400px; } }
@media (min-width: 1024px) { .carousel { --cw: 430px; --ch: 410px; } }
.rcard { padding: 26px; gap: 16px; }
.rcard-top img { width: 70px; height: 70px; } .rcard figcaption { font-size: 1.2rem; } .rcard small { font-size: .88rem; }
.rcard blockquote { font-size: clamp(.95rem, 1.2vw, 1.1rem); line-height: 1.8; }
.rev-floor { width: min(1100px, 96vw); height: 230px; }

/* Gallery: 3D coverflow */
.gal-section { background: linear-gradient(180deg, var(--bg), var(--bg2) 50%, var(--bg)); }
.gal-wrap { position: relative; perspective: 1500px; padding: 24px 0 36px; }
.gal-track { display: flex; gap: 30px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; cursor: grab; padding-block: 24px 30px; transform-style: preserve-3d; }
.gal-track::-webkit-scrollbar { display: none; } .gal-track.drag { cursor: grabbing; scroll-snap-type: none; }
.gal-card { flex: none; width: clamp(240px, 30vw, 400px); scroll-snap-align: center; position: relative; transform-style: preserve-3d; will-change: transform, opacity; }
.gal-pic { border-radius: 24px; overflow: hidden; aspect-ratio: 4 / 3; border: 1px solid var(--glass-line); box-shadow: 0 34px 60px rgba(0,0,0,.45), 0 0 40px rgba(182,0,168,.18); background: #1a1027; }
.gal-pic img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.gal-card figcaption { margin-top: 16px; text-align: center; font-weight: 600; font-size: clamp(.9rem, 1.3vw, 1.1rem); color: var(--fg); }
.gal-card::after { content: ""; position: absolute; left: 8%; right: 8%; bottom: -26px; height: 24px; background: radial-gradient(ellipse at center, rgba(182,0,168,.45), transparent 70%); filter: blur(8px); z-index: -1; }

/* Contact form: select + photo upload */
.lbl { font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: -.5rem; }
select.field { appearance: none; -webkit-appearance: none; cursor: pointer; padding-inline-end: 2.6rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23B600A8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 1.1rem center; }
html[dir="rtl"] select.field { background-position: left 1.1rem center; }
select.field option { background: var(--bg); color: var(--fg); }
.review-extra { display: flex; flex-direction: column; gap: .8rem; } .review-extra[hidden] { display: none; }
.review-extra:not([hidden]) { animation: pop-in .45s ease; } @keyframes pop-in { from { opacity: 0; transform: translateY(-8px); } }
.upload { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1.5px dashed var(--line); border-radius: 18px; cursor: pointer; transition: border-color .2s, background .2s; }
.upload:hover { border-color: #B600A8; background: var(--card); }
.upload-prev { flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem; color: #B600A8; background: var(--card) center / cover no-repeat; border: 1px solid var(--line); }
.upload-txt { display: flex; flex-direction: column; min-width: 0; } .upload-txt b { font-weight: 600; color: var(--fg); }
.upload-txt small { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
