/* Ameer Saleh — "live system" theme. Logical properties keep RTL and LTR equal. */

:root {
    color-scheme: dark;
    --bg: #07080d;
    --bg-2: #0b0d15;
    --surface: #10131e;
    --surface-2: #161a28;
    --line: rgba(148, 163, 214, .14);
    --line-2: rgba(148, 163, 214, .28);
    --text: #eef1fb;
    --muted: #9aa3bd;
    --brand: #7c85ff;
    --cyan: #3fe0c9;
    --amber: #ffb866;
    --grad: linear-gradient(105deg, var(--brand), var(--cyan));
    --radius: 22px;
    --shell: min(1180px, 100% - 40px);
    --display: "Space Grotesk", "IBM Plex Sans Arabic", system-ui, sans-serif;
    --body: "Inter", "IBM Plex Sans Arabic", system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
    --ease: cubic-bezier(.2, .7, .15, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--text); font: 400 16px/1.75 var(--body); overflow-x: clip; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); line-height: 1.2; letter-spacing: -.02em; text-wrap: balance; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4 { letter-spacing: 0; line-height: 1.4; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--brand); color: #fff; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }

.shell { width: var(--shell); margin-inline: auto; }
.mono { font-family: var(--mono); }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; inset-block-start: 12px; inset-inline-start: 12px; z-index: 200; padding: 10px 16px; border-radius: 10px; background: var(--cyan); color: #04201b; font-weight: 700; translate: 0 -200%; }
.skip-link:focus { translate: 0 0; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .icon--dir { scale: -1 1; }

/* Background */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.backdrop::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 64px 64px; opacity: .35; mask-image: radial-gradient(ellipse 80% 60% at 50% 0, #000, transparent 75%); }
.backdrop i { position: absolute; width: 52vmax; height: 52vmax; border-radius: 50%; opacity: .17; background: radial-gradient(circle, var(--brand), transparent 62%); inset-block-start: -22vmax; inset-inline-start: -12vmax; animation: drift 18s ease-in-out infinite alternate; }
.backdrop i + i { background: radial-gradient(circle, var(--cyan), transparent 62%); inset-block-start: 22vh; inset-inline-start: auto; inset-inline-end: -24vmax; opacity: .12; animation-duration: 24s; animation-delay: -8s; }
@keyframes drift { to { transform: translate3d(8vmax, 6vmax, 0) scale(1.15); } }

.progress { position: fixed; inset-block-start: 0; inset-inline: 0; height: 2px; z-index: 110; background: var(--grad); transform: scaleX(0); transform-origin: 0 50%; }
[dir="rtl"] .progress { transform-origin: 100% 50%; }

/* Navigation */
.nav { position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 100; padding-block: 18px; transition: padding .35s var(--ease); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 12px; border: 1px solid transparent; border-radius: 18px; transition: background .35s, border-color .35s, box-shadow .35s; }
.nav.is-scrolled { padding-block: 10px; }
.nav.is-scrolled .nav__inner, .menu-open .nav__inner { background: rgba(11, 13, 21, .82); border-color: var(--line); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 11px; font: 700 1.02rem var(--display); }
.brand__mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--grad); color: #06070c; font: 700 .85rem var(--mono); transition: rotate .4s var(--ease); }
.brand:hover .brand__mark { rotate: -8deg; }
.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links a { padding: 8px 13px; border-radius: 10px; color: var(--muted); font-size: .92rem; font-weight: 500; transition: color .25s, background .25s; }
.nav__links a:hover, .nav__links a[aria-current="page"] { color: var(--text); background: rgba(124, 133, 255, .12); }
.nav__actions { display: flex; align-items: center; gap: 8px; }
.chip-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 42px; height: 40px; padding-inline: 13px; border: 1px solid var(--line-2); border-radius: 11px; font: 600 .83rem var(--mono); transition: border-color .25s, background .25s; }
.chip-btn:hover { border-color: var(--cyan); background: rgba(63, 224, 201, .08); }
.menu-toggle { display: none; width: 42px; height: 40px; padding: 0; border: 1px solid var(--line-2); border-radius: 11px; background: none; cursor: pointer; }
.menu-toggle span { display: block; width: 18px; height: 2px; margin: 4px auto; background: currentColor; border-radius: 2px; transition: transform .3s var(--ease); }
.menu-open .menu-toggle span:first-child { transform: translateY(3px) rotate(45deg); }
.menu-open .menu-toggle span:last-child { transform: translateY(-3px) rotate(-45deg); }

/* Buttons */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px; border: 1px solid var(--line-2); border-radius: 14px; background: rgba(255, 255, 255, .02); font-weight: 600; cursor: pointer; overflow: hidden; transition: translate .25s var(--ease), border-color .25s, box-shadow .3s; }
.btn:hover { border-color: var(--brand); }
.btn--solid { border-color: transparent; background: var(--grad); color: #060712; }
.btn--solid::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%); translate: -120% 0; transition: translate .7s var(--ease); }
.btn--solid:hover { box-shadow: 0 14px 40px rgba(101, 160, 240, .35); }
.btn--solid:hover::after { translate: 120% 0; }
.btn.is-busy { opacity: .65; cursor: progress; }

/* Sections */
.section { padding-block: clamp(84px, 11vw, 150px); position: relative; overflow-x: clip; }
.section--alt { background: linear-gradient(180deg, transparent, var(--bg-2) 18%, var(--bg-2) 82%, transparent); }
.head { display: grid; gap: 16px; max-width: 720px; margin-block-end: clamp(40px, 6vw, 68px); }
.head--split { max-width: none; grid-template-columns: 1.3fr 1fr; align-items: end; column-gap: 48px; }
.head--split .eyebrow { grid-column: 1 / -1; }
.eyebrow { display: inline-flex; align-items: center; gap: 12px; color: var(--cyan); font: 600 .78rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
[dir="rtl"] .eyebrow { letter-spacing: 0; font-family: var(--body); font-size: .9rem; }
.eyebrow::before { content: ""; width: 34px; height: 1px; background: currentColor; }
.title { font-size: clamp(2rem, 4.6vw, 3.5rem); }
.lead { color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.13rem); }

/* Hero */
.hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding-block: 130px 56px; }
.hero__grid { display: grid; grid-template-columns: 1.02fr .98fr; align-items: center; gap: clamp(32px, 5vw, 72px); }
.status { display: inline-flex; align-items: center; gap: 11px; padding: 7px 15px; border: 1px solid var(--line-2); border-radius: 99px; background: rgba(16, 19, 30, .7); font-size: .85rem; }
.pulse { position: relative; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--cyan); }
.pulse::after { content: ""; position: absolute; inset: -5px; border: 1px solid var(--cyan); border-radius: 50%; animation: ping 2s ease-out infinite; }
@keyframes ping { 0% { scale: .5; opacity: 1; } 100% { scale: 1.8; opacity: 0; } }
.hero__name { margin-block: 26px 14px; font-size: clamp(3.4rem, 9.2vw, 7.2rem); line-height: .96; letter-spacing: -.045em; }
[dir="rtl"] .hero__name { line-height: 1.18; letter-spacing: 0; }
.hero__name span { display: block; }
.hero__name .grad { background-size: 200% 100%; animation: shimmer 7s ease-in-out infinite alternate; padding-block-end: .08em; }
@keyframes shimmer { to { background-position: 100% 0; } }
.hero__role { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-block-end: 18px; color: var(--muted); font: 500 .92rem var(--mono); }
.hero__role [data-rotate] { display: inline-block; color: var(--amber); transition: opacity .3s, translate .3s var(--ease); }
.hero__role [data-rotate].is-leaving { opacity: 0; translate: 0 -10px; }
.hero__statement { max-width: 560px; font: 500 clamp(1.2rem, 2.2vw, 1.55rem)/1.55 var(--display); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 34px; }
.hero__social { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-block-start: 30px; color: var(--muted); font-size: .88rem; }
.hero__social a { display: inline-flex; align-items: center; gap: 8px; transition: color .25s; }
.hero__social a:hover { color: var(--cyan); }
.hero__grid > * { min-width: 0; }

/* Entrance of the hero, independent of scrolling */
.js .enter { animation: enter .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms); }
@keyframes enter { from { opacity: 0; transform: translateY(28px); filter: blur(8px); } }

/* Live system diagram (always laid out left to right) */
.system { position: relative; border: 1px solid var(--line-2); border-radius: 26px; background: linear-gradient(160deg, rgba(22, 26, 40, .94), rgba(9, 11, 18, .94)); box-shadow: 0 40px 100px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .05); direction: ltr; overflow: hidden; }
.system::before { content: ""; position: absolute; inset-block-start: 0; left: -40%; width: 40%; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); animation: sweep 5s linear infinite; }
@keyframes sweep { to { left: 100%; } }
.system__bar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-block-end: 1px solid var(--line); font: 500 .74rem var(--mono); color: var(--muted); }
.system__dots { display: flex; gap: 6px; }
.system__dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-2); }
.system__live { display: inline-flex; align-items: center; gap: 9px; margin-left: auto; color: var(--cyan); }
.system svg { width: 100%; height: auto; padding: 10px 8px 2px; }
.wire { fill: none; stroke: var(--line-2); stroke-width: 1.4; stroke-dasharray: 4 6; animation: dash 1.2s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -20; } }
.packet { fill: var(--cyan); filter: drop-shadow(0 0 6px var(--cyan)); }
.packet--amber { fill: var(--amber); filter: drop-shadow(0 0 6px var(--amber)); }
.packet--brand { fill: var(--brand); filter: drop-shadow(0 0 6px var(--brand)); }
.node rect { fill: #121624; stroke: var(--line-2); stroke-width: 1.2; transition: stroke .35s, fill .35s; }
.node text { fill: var(--text); font: 600 13px var(--mono); text-anchor: middle; }
.node text + text { fill: var(--muted); font-weight: 400; font-size: 10px; }
.node.is-active rect { stroke: var(--cyan); fill: #12252c; filter: drop-shadow(0 0 12px rgba(63, 224, 201, .45)); }
.system__log { display: grid; align-content: end; gap: 3px; height: 96px; padding: 10px 18px 14px; border-block-start: 1px solid var(--line); font: 400 .74rem/1.7 var(--mono); color: var(--muted); overflow: hidden; }
.system__log li { display: flex; gap: 12px; white-space: nowrap; overflow: hidden; animation: log-in .4s var(--ease) both; }
.system__log b { min-width: 74px; color: var(--brand); font-weight: 600; }
.system__log span { overflow: hidden; text-overflow: ellipsis; }
@keyframes log-in { from { opacity: 0; transform: translateX(-10px); } }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-block-start: clamp(44px, 7vw, 84px); border: 1px solid var(--line); border-radius: var(--radius); background: rgba(16, 19, 30, .55); }
.stat { padding: 24px 26px; border-inline-start: 1px solid var(--line); }
.stat:first-child { border-inline-start: 0; }
.stat strong { display: block; font: 700 clamp(1.9rem, 3.6vw, 2.9rem)/1.15 var(--display); font-variant-numeric: tabular-nums; direction: ltr; text-align: end; width: max-content; }
.stat strong em { font-style: normal; color: var(--cyan); }
.stat span:last-child { color: var(--muted); font-size: .88rem; }

/* Marquee */
.marquee { direction: ltr; overflow: hidden; border-block: 1px solid var(--line); background: var(--bg-2); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.marquee__track { display: flex; width: max-content; animation: marquee 46s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__track ul { display: flex; }
.marquee__track li { display: flex; align-items: center; gap: 38px; padding: 20px 19px; font: 600 1.05rem var(--display); color: var(--muted); white-space: nowrap; }
.marquee__track li::after { content: "✦"; color: var(--brand); font-size: .75rem; margin-inline-start: 19px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* About */
.about { display: grid; grid-template-columns: .78fr 1.22fr; gap: clamp(34px, 6vw, 84px); align-items: center; }
.portrait { width: 100%; max-width: 440px; margin: 0; }
.portrait__stage { position: relative; transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .3s var(--ease); }
.portrait__stage img { position: relative; width: 100%; height: auto; aspect-ratio: 1; }
.portrait__ring { position: absolute; inset: 4%; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 40%, var(--brand), var(--cyan), transparent 94%); mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px)); animation: spin 8s linear infinite; }
.portrait__ring--outer { inset: -3%; opacity: .45; animation-duration: 15s; animation-direction: reverse; }
.portrait__stage::before { content: ""; position: absolute; inset: 12%; border-radius: 50%; background: var(--brand); opacity: .35; filter: blur(70px); }
@keyframes spin { to { rotate: 1turn; } }
.portrait__badge { position: absolute; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: rgba(11, 13, 21, .88); box-shadow: 0 14px 34px rgba(0, 0, 0, .4); font: 600 .76rem var(--mono); animation: bob 4.5s ease-in-out infinite alternate; }
.portrait__badge--a { left: -2%; top: 34%; color: var(--cyan); }
.portrait__badge--b { right: -2%; bottom: 20%; color: var(--amber); animation-delay: -2.2s; }
@keyframes bob { to { translate: 0 -12px; } }
.portrait__caption { display: flex; justify-content: center; gap: 22px; padding-block-start: 22px; font: 500 .78rem var(--mono); color: var(--muted); }
.about__summary { font-size: clamp(1.05rem, 1.7vw, 1.24rem); line-height: 2; }
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-block-start: 34px; }
.principles li { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); font-weight: 500; font-size: .94rem; }
.principles b { display: block; margin-block-end: 8px; color: var(--brand); font: 600 .8rem var(--mono); }

/* Spotlight cards */
.card { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; transition: border-color .35s; }
.card::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(420px circle at var(--x, 50%) var(--y, 0), rgba(124, 133, 255, .17), transparent 60%); transition: opacity .35s; }
.card:hover { border-color: var(--line-2); }
.card:hover::before { opacity: 1; }

/* Skills */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.skill { grid-column: span 2; padding: 28px; }
.skill--backend { grid-column: span 4; }
.skill--frontend { grid-column: span 2; grid-row: span 2; }
.skill--devops { grid-column: span 4; }
.skill header { display: flex; align-items: center; gap: 14px; margin-block-end: 20px; }
.skill__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; border: 1px solid var(--line-2); color: var(--cyan); font-size: 1.15rem; }
.skill h3 { font-size: 1.25rem; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; direction: ltr; }
[dir="rtl"] .tags { justify-content: flex-end; }
.tags li { padding: 5px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, .025); font: 500 .78rem/1.8 var(--mono); color: #c9d0e8; transition: border-color .25s, color .25s, translate .25s var(--ease); }
.tags li:hover { border-color: var(--cyan); color: var(--cyan); translate: 0 -2px; }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.project { display: flex; flex-direction: column; transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .3s var(--ease), border-color .35s; }
.projects > .project--wide { grid-column: 1 / -1; display: grid; grid-template-columns: 1.15fr 1fr; }
.project__media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-2); border-block-end: 1px solid var(--line); }
.project--wide .project__media { aspect-ratio: auto; min-height: 340px; border-block-end: 0; border-inline-end: 1px solid var(--line); }
.project__media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: scale .8s var(--ease); }
.project:hover .project__media > img, .project:hover .art { scale: 1.05; }
.project__body { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; flex: 1; padding: clamp(22px, 3vw, 34px); }
.project--wide .project__body { justify-content: center; }
.project__meta { color: var(--cyan); font: 600 .74rem var(--mono); }
[dir="rtl"] .project__meta { font-family: var(--body); font-size: .84rem; }
.project h2, .project h3 { font-size: clamp(1.3rem, 2.2vw, 1.75rem); }
.project__body > p { color: var(--muted); font-size: .96rem; }
.project .tags li { font-size: .72rem; }
.project__link { display: inline-flex; align-items: center; gap: 9px; margin-block-start: auto; padding-block-start: 8px; font-weight: 600; }
.project__link .icon { transition: translate .3s var(--ease); }
.project:hover .project__link { color: var(--cyan); }
.project:hover .project__link .icon { translate: 5px 0; }
[dir="rtl"] .project:hover .project__link .icon { translate: -5px 0; }
.project__hit { position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.project__hit:focus-visible { outline-offset: -4px; border-radius: var(--radius); }

/* Generated artwork for projects without a picture */
.art { position: absolute; inset: 0; width: 100%; height: 100%; direction: ltr; transition: scale .8s var(--ease); --tone: var(--brand); }
.art--1 { --tone: var(--cyan); }
.art--2 { --tone: var(--amber); }
.art--3 { --tone: #c58bff; }
.art .grid-line { stroke: var(--line); stroke-width: 1; fill: none; }
.art .shape { fill: none; stroke: var(--tone); stroke-width: 1.6; opacity: .75; }
.art .block { fill: var(--tone); opacity: .13; }
.art .dot { fill: var(--tone); }
.art .flow { fill: none; stroke: var(--tone); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 10 14; animation: dash-long 2.4s linear infinite; }
@keyframes dash-long { to { stroke-dashoffset: -48; } }
.art .float { animation: float 5s ease-in-out infinite alternate; }
.art .float:nth-of-type(even) { animation-delay: -2.5s; }
@keyframes float { to { translate: 0 -9px; } }

.section__more { display: flex; justify-content: center; margin-block-start: 46px; }

/* Experience */
.experience { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(34px, 6vw, 84px); align-items: start; }
.experience > .head { position: sticky; top: 120px; margin: 0; }
.timeline { position: relative; display: grid; gap: 26px; padding-inline-start: 34px; --fill: 0; }
.timeline::before, .timeline::after { content: ""; position: absolute; inset-block: 8px; inset-inline-start: 6px; width: 2px; background: var(--line); }
.timeline::after { background: linear-gradient(var(--brand), var(--cyan)); transform: scaleY(var(--fill)); transform-origin: top; }
html:not(.js) .timeline { --fill: 1; }
.job { position: relative; padding: clamp(22px, 3vw, 34px); overflow: visible; }
.job::after { content: ""; position: absolute; inset-block-start: 38px; inset-inline-start: -34px; width: 14px; height: 14px; z-index: 1; border-radius: 50%; border: 3px solid var(--cyan); background: var(--bg); box-shadow: 0 0 0 6px rgba(63, 224, 201, .12); }
.job__date { display: inline-block; padding: 4px 13px; border-radius: 99px; background: rgba(63, 224, 201, .1); color: var(--cyan); font: 600 .76rem var(--mono); }
[dir="rtl"] .job__date { font-family: var(--body); }
.job h3 { margin-block: 14px 4px; font-size: 1.5rem; }
.job__company { color: var(--amber); font-weight: 600; }
.job__desc { margin-block-start: 12px; color: var(--muted); }
.job__list { display: grid; gap: 11px; margin-block-start: 20px; }
.job__list li { position: relative; padding-inline-start: 24px; color: #c9d0e8; font-size: .94rem; }
.job__list li::before { content: ""; position: absolute; inset-inline-start: 2px; inset-block-start: .72em; width: 8px; height: 8px; border-radius: 3px; background: var(--grad); rotate: 45deg; }

/* Education and languages */
.edu { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.edu > .card { padding: clamp(26px, 4vw, 40px); }
.edu h3 { font-size: 1.45rem; margin-block: 14px 8px; }
.edu p { color: var(--muted); }
.lang-row { display: grid; gap: 9px; margin-block-start: 22px; }
.lang-row div { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.lang-row div span:last-child { color: var(--muted); font-weight: 400; font-size: .9rem; }
.meter { display: block; height: 6px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; width: var(--level); height: 100%; border-radius: inherit; background: var(--grad); transition: width 1.4s var(--ease) .2s; }
.js [data-reveal]:not(.is-in) .meter i { width: 0; }

/* Contact */
.contact { display: grid; grid-template-columns: .95fr 1.05fr; gap: clamp(30px, 6vw, 80px); align-items: start; }
.contact__list { display: grid; gap: 12px; margin-block-start: 8px; }
.contact__item { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: border-color .3s, translate .3s var(--ease); }
a.contact__item:hover { border-color: var(--cyan); translate: 0 -3px; }
.contact__item .icon { width: 22px; height: 22px; color: var(--cyan); }
.contact__item small { display: block; color: var(--muted); font-size: .78rem; }
.contact__item span { overflow-wrap: anywhere; font-weight: 600; }
.copy { justify-self: start; padding: 6px 0; border: 0; background: none; color: var(--muted); font-size: .85rem; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.copy:hover { color: var(--cyan); }
.form { display: grid; gap: 18px; padding: clamp(22px, 4vw, 40px); }
.form > * { position: relative; z-index: 1; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 7px; font-size: .86rem; font-weight: 600; }
.field input, .field textarea { width: 100%; padding: 13px 15px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-2); font-weight: 400; font-size: 1rem; transition: border-color .25s, box-shadow .25s; }
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(124, 133, 255, .17); }
.field small { color: #ff8f9c; font-weight: 500; }
.field [aria-invalid="true"] { border-color: #ff6b7d; }
.honeypot { position: absolute !important; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { padding: 13px 16px; border-radius: 12px; border: 1px solid; font-size: .93rem; }
.alert--ok { border-color: rgba(63, 224, 201, .45); background: rgba(63, 224, 201, .1); color: #a6f5e8; }
.alert--bad { border-color: rgba(255, 107, 125, .45); background: rgba(255, 107, 125, .1); color: #ffc2c9; }
.form__note { color: var(--muted); font-size: .8rem; text-align: center; }

/* Footer */
.footer { padding-block: 70px 30px; border-block-start: 1px solid var(--line); background: var(--bg-2); }
.footer__top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 30px; padding-block-end: 44px; }
.footer__statement { max-width: 620px; font: 600 clamp(1.7rem, 3.8vw, 2.8rem)/1.35 var(--display); }
.footer__nav { display: flex; flex-wrap: wrap; gap: 10px 26px; padding-block: 26px; border-block: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.footer__nav a:hover { color: var(--cyan); }
.footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-block-start: 26px; color: var(--muted); font-size: .82rem; }
.footer__bottom a:hover { color: var(--text); }

/* Inner pages */
.page-head { padding-block: 168px 54px; }
.page-head .title { font-size: clamp(2.5rem, 6.5vw, 5rem); margin-block: 18px; max-width: 900px; }
.page-head .lead { max-width: 620px; }
.page-body { padding-block-end: clamp(80px, 10vw, 130px); }
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-block-end: 36px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter { padding: 8px 18px; border: 1px solid var(--line-2); border-radius: 99px; font-size: .87rem; font-weight: 500; transition: background .25s, border-color .25s; }
.filter:hover { border-color: var(--brand); }
.filter.is-active { border-color: transparent; background: var(--grad); color: #060712; font-weight: 700; }
.search { display: flex; align-items: center; gap: 6px; min-width: min(340px, 100%); padding: 5px; padding-inline-start: 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); }
.search:focus-within { border-color: var(--brand); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; }
.search button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 18px; padding: 70px 24px; border: 1px dashed var(--line-2); border-radius: var(--radius); text-align: center; color: var(--muted); }

.back { display: inline-flex; align-items: center; gap: 9px; margin-block-end: 28px; color: var(--muted); font-size: .9rem; }
.back:hover { color: var(--cyan); }
.back .icon { scale: -1 1; }
[dir="rtl"] .back .icon { scale: 1 1; }
.case__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 28px; }
.case__cover { position: relative; aspect-ratio: 21 / 9; margin: 0 0 54px; border: 1px solid var(--line-2); border-radius: 28px; overflow: hidden; background: var(--bg-2); }
.case__cover img { width: 100%; height: 100%; object-fit: cover; }
.case { display: grid; grid-template-columns: 1.5fr .8fr; gap: clamp(28px, 5vw, 64px); align-items: start; }
.case__story { display: grid; gap: 18px; }
.case__block { padding: clamp(22px, 3vw, 34px); }
.case__block h2 { margin-block-end: 14px; color: var(--cyan); font-size: 1.05rem; }
.case__block p { white-space: pre-line; font-size: 1.05rem; }
.case__aside { position: sticky; top: 110px; display: grid; gap: 18px; }
.case__aside > .card { padding: 24px; }
.case__aside h2 { margin-block-end: 16px; font-size: 1rem; }
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-block-start: 54px; }
.gallery img { width: 100%; border-radius: 18px; border: 1px solid var(--line); }

.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 20px; }
.post { display: flex; flex-direction: column; }
.post img, .post__blank { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.post__blank { background: linear-gradient(135deg, rgba(124, 133, 255, .35), rgba(63, 224, 201, .12)); }
.post__body { display: grid; gap: 10px; padding: 24px; }
.post__body h2 { font-size: 1.3rem; }
.post__body p { color: var(--muted); font-size: .93rem; }
.meta { color: var(--muted); font: 500 .78rem var(--mono); }
.pager { margin-block-start: 44px; display: flex; justify-content: center; gap: 12px; }
.article { max-width: 780px; margin-inline: auto; font-size: 1.12rem; line-height: 2.05; color: #d3d8ea; overflow-wrap: anywhere; }
.article > * + * { margin-block-start: 1.3em; }
.article h2, .article h3 { color: var(--text); margin-block-start: 2.2em; }
.article a { color: var(--cyan); text-decoration: underline; text-underline-offset: 4px; }
.article img { border-radius: 18px; }
.article ul, .article ol { padding-inline-start: 1.4em; list-style: revert; }
.article pre { overflow-x: auto; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); direction: ltr; text-align: left; font: .85rem/1.8 var(--mono); }
.article blockquote { margin-inline: 0; padding: 8px 24px; border-inline-start: 3px solid var(--brand); color: var(--text); }
.article-cover { width: 100%; max-height: 520px; object-fit: cover; border-radius: 28px; margin-block-end: 54px; }

/* Scroll reveal */
.js [data-reveal] { opacity: 0; translate: 0 36px; transition: opacity .8s var(--ease), translate .8s var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
.js [data-reveal].is-in { opacity: 1; translate: 0 0; }
.js .project[data-reveal] { transition: opacity .8s var(--ease), translate .8s var(--ease), transform .3s var(--ease), border-color .35s; }

/* Responsive */
@media (max-width: 1060px) {
    .hero__grid { grid-template-columns: 1fr; }
    .system { width: 100%; max-width: 640px; }
    .bento { grid-template-columns: repeat(2, 1fr); }
    .skill, .skill--backend, .skill--devops { grid-column: span 2; }
    .skill--frontend { grid-row: auto; }
}

@media (max-width: 920px) {
    .menu-toggle { display: block; }
    .nav__links { position: absolute; inset-block-start: calc(100% - 4px); inset-inline: 20px; display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line-2); border-radius: 18px; background: rgba(11, 13, 21, .97); box-shadow: 0 30px 60px rgba(0, 0, 0, .5); opacity: 0; visibility: hidden; translate: 0 -10px; transition: opacity .25s, translate .25s var(--ease), visibility .25s; }
    .menu-open .nav__links { opacity: 1; visibility: visible; translate: 0 0; }
    .nav__links a { padding: 12px 14px; font-size: 1rem; }
    html:not(.js) .nav__links { position: static; display: flex; flex-wrap: wrap; opacity: 1; visibility: visible; translate: 0 0; }
    html:not(.js) .menu-toggle { display: none; }
    html:not(.js) .nav { position: absolute; }
    html:not(.js) .nav__inner { flex-wrap: wrap; }
    .head--split, .about, .experience, .contact, .case, .edu, .projects > .project--wide { grid-template-columns: 1fr; }
    .experience > .head, .case__aside { position: static; }
    .projects > .project--wide .project__media { min-height: 0; aspect-ratio: 16 / 9; border-inline-end: 0; border-block-end: 1px solid var(--line); }
    .portrait { margin-inline: auto; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stat:nth-child(3) { border-inline-start: 0; }
    .stat:nth-child(n+3) { border-block-start: 1px solid var(--line); }
}

@media (max-width: 640px) {
    :root { --shell: calc(100% - 28px); }
    .projects, .principles, .form__row, .bento, .gallery { grid-template-columns: 1fr; }
    .skill, .skill--backend, .skill--frontend, .skill--devops { grid-column: auto; }
    .hero { padding-block-start: 112px; }
    .hero__actions .btn { flex: 1 1 100%; }
    .stat { padding: 18px; }
    .brand__name { display: none; }
    .hero__role span[aria-hidden] { display: none; }
    .hero__role { flex-direction: column; align-items: flex-start; }
    .system__log { font-size: .68rem; }
    .case__cover { aspect-ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js [data-reveal] { opacity: 1; translate: 0 0; }
    .packet { display: none; }
    .timeline { --fill: 1 !important; }
}

@media print {
    .nav, .backdrop, .progress, .form, .marquee { display: none; }
    .js [data-reveal] { opacity: 1; translate: 0 0; }
}
