/* =========================================================================
   Personal Site - public stylesheet (Persian / RTL)
   Light, warm editorial look: cream ground, serif display headings,
   orange / green / ink accents, capsule-sliced imagery, pill buttons.
   ========================================================================= */

/* ---- Fonts (self-hosted, no external CDN) ---------------------------- */
@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/vazirmatn-arabic.woff2") format("woff2");
    font-weight: 100 900; font-style: normal; font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/vazirmatn-latin.woff2") format("woff2");
    font-weight: 100 900; font-style: normal; font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* ---- Tokens ------------------------------------------------------------ */
:root {
    --bg: #f8f7f3;
    --surface: #ffffff;
    --surface-2: #f1eee7;
    --ink: #16161a;
    --ink-2: #3f3f46;
    --muted: #6b6b73;
    --line: #e6e1d6;
    --beige: #eee6d8;
    --orange: #f6a11a;
    --orange-ink: #a85a00;
    --orange-soft: #fdecd0;
    --green: #177a57;
    --green-soft: #dcefe6;
    --coral: #f0643c;
    --blue: #3ba3e6;
    --lime: #8cc152;
    --danger: #b91c1c;

    --font-body: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
    --font-display: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;

    --radius-sm: 12px;
    --radius: 20px;
    --radius-lg: 28px;
    --radius-xl: 40px;
    --shadow-sm: 0 1px 2px rgba(22, 22, 26, .05), 0 8px 24px -16px rgba(22, 22, 26, .18);
    --shadow: 0 18px 40px -22px rgba(22, 22, 26, .30);
    --shadow-lg: 0 34px 70px -30px rgba(22, 22, 26, .38);
    --ease: cubic-bezier(.2, .7, .2, 1);
    --container: 1200px;
    --header-h: 84px;
}

/* ---- Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); }
body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.9;
    color: var(--ink-2);
    background: var(--bg);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
img, svg { max-width: 100%; }
img { height: auto; display: block; }
a { color: var(--green); }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); font-weight: 800; line-height: 1.5; margin: 0 0 .6em; text-wrap: balance; }
p { margin: 0 0 1em; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--orange-soft); color: var(--ink); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
main:focus { outline: none; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: middle; }
.container { width: min(var(--container), 100% - 2.5rem); margin-inline: auto; }
.narrow { max-width: 820px; }
.text-center { text-align: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -100px; right: 1rem; z-index: 200; background: var(--ink); color: #fff; padding: .75rem 1.25rem; border-radius: 0 0 12px 12px; text-decoration: none; font-weight: 700; }
.skip-link:focus { top: 0; }

/* ---- Buttons --------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .7rem;
    min-height: 50px; padding: .55rem 1.5rem .55rem .6rem;
    border: 1.5px solid transparent; border-radius: 999px;
    font-weight: 700; font-size: .95rem; line-height: 1.4;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .2s, color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-icon { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; flex: none; transition: transform .3s var(--ease); }
.btn-icon .icon { width: 1rem; height: 1rem; }
.btn:hover .btn-icon { transform: rotate(-12deg) scale(1.06); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark .btn-icon { background: rgba(255, 255, 255, .14); color: var(--orange); }
.btn-orange { background: var(--orange); color: var(--ink); }
.btn-orange .btn-icon { background: rgba(22, 22, 26, .1); }
.btn-green { background: var(--green); color: #fff; }
.btn-green .btn-icon { background: rgba(255, 255, 255, .16); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-outline .btn-icon { background: var(--surface-2); }
.btn-outline:hover { border-color: var(--ink); }
.btn-sm { min-height: 44px; font-size: .88rem; padding-inline-end: 1.15rem; gap: .55rem; }
.btn-sm .btn-icon { width: 1.8rem; height: 1.8rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .7; cursor: progress; transform: none; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2rem; }
.btn-row-center { justify-content: center; }
.icon-button {
    display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
    transition: background-color .2s, color .2s, border-color .2s;
}
.icon-button:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.link-arrow {
    display: inline-flex; align-items: center; gap: .45rem; min-height: 44px;
    color: var(--ink); font-weight: 700; text-decoration: none;
}
.link-arrow .icon { width: 1.1rem; height: 1.1rem; color: var(--orange-ink); transition: transform .25s var(--ease); }
.link-arrow:hover .icon { transform: translateX(-5px); }
.link-arrow:hover span { text-decoration: underline; text-underline-offset: 6px; text-decoration-color: var(--orange); }
.link-arrow-lg { font-size: 1.05rem; margin-top: .5rem; }

/* ---- Section scaffolding --------------------------------------------------- */
.section { position: relative; padding-block: clamp(2rem, 1.3rem + 2.25vw, 3.75rem); }
.section-head { text-align: center; max-width: 46rem; margin: 0 auto clamp(1.5rem, 1rem + 1.5vw, 2.5rem); }
.section-title { font-size: clamp(1.7rem, 1.25rem + 1.6vw, 2.5rem); line-height: 1.5; margin-bottom: .4em; }
.section-sub { color: var(--muted); font-size: 1.05rem; margin: 0; }
.section-foot { display: flex; justify-content: center; margin-top: clamp(2rem, 1.5rem + 2vw, 3rem); }
.eyebrow {
    display: inline-flex; align-items: center; gap: .5rem;
    color: var(--orange-ink); font-weight: 800; font-size: .85rem; margin: 0 0 .9rem;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--orange); }
.text-center .eyebrow, .section-head .eyebrow { justify-content: center; }
.lead { font-size: 1.1rem; color: var(--muted); line-height: 2.05; }
.lead p:last-child { margin-bottom: 0; }

/* Decorative dots used across sections */
.deco-dot { position: absolute; border-radius: 50%; pointer-events: none; animation: float 7s ease-in-out infinite; }
.dot-green { width: 14px; height: 14px; background: var(--lime); top: 4%; right: 20%; }
.dot-coral { width: 18px; height: 18px; background: var(--coral); bottom: 24%; left: 0; animation-delay: -2s; }
.dot-blue { width: 16px; height: 16px; background: var(--blue); bottom: 4%; right: 34%; animation-delay: -4s; }
.dot-orange { width: 18px; height: 18px; background: var(--orange); }
.dot-orange-lg { width: 26px; height: 26px; background: var(--orange); top: 18%; right: 3%; }
.dot-green-sm { width: 12px; height: 12px; background: var(--green); }
.deco-ring { position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--blue); pointer-events: none; }
.media-placeholder { display: grid; place-items: center; width: 100%; height: 100%; min-height: 180px; background: var(--beige); color: var(--muted); }
.media-placeholder .icon { width: 42px; height: 42px; opacity: .6; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Scroll reveal (only when JS is available) */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---- Header ----------------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(248, 247, 243, .86);
    -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
    transition: box-shadow .3s, background-color .3s;
}
.site-header.is-scrolled { box-shadow: 0 10px 30px -18px rgba(22, 22, 26, .35); background: rgba(248, 247, 243, .95); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: .7rem; min-height: 44px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-mark { width: 42px; height: 42px; flex: none; transition: transform .6s var(--ease); }
.brand:hover .brand-mark { transform: rotate(90deg); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; line-height: 1.4; color: var(--ink); white-space: nowrap; }
.brand-tagline { font-size: .72rem; color: var(--muted); line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-logo { max-height: 50px; width: auto; }
.main-nav { display: none; }
.nav-list { display: flex; gap: .15rem; list-style: none; margin: 0; padding: 0; }
.nav-link {
    position: relative; display: inline-flex; align-items: center; min-height: 44px;
    padding: .4rem .85rem; color: var(--ink); font-weight: 600; font-size: .95rem; text-decoration: none; border-radius: 999px;
    transition: color .2s, background-color .2s;
}
.nav-link::after {
    content: ""; position: absolute; bottom: 4px; left: 50%; width: 6px; height: 6px; margin-left: -3px;
    border-radius: 50%; background: var(--orange); transform: scale(0); transition: transform .3s var(--ease);
}
.nav-link:hover { background: rgba(22, 22, 26, .05); }
.nav-link.is-active::after { transform: scale(1); }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.header-phone { display: none; align-items: center; gap: .6rem; color: var(--ink); font-weight: 700; text-decoration: none; font-size: .95rem; }
.header-phone-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--orange-soft); color: var(--orange-ink); }
.header-phone-icon .icon { width: 18px; height: 18px; }
.header-cta { display: none; }
.nav-toggle {
    display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}

/* Mobile drawer */
.drawer { position: fixed; inset: 0; z-index: 100; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(22, 22, 26, .5); opacity: 0; transition: opacity .35s; }
.drawer-panel {
    position: absolute; top: 0; bottom: 0; right: 0; width: min(360px, 88vw);
    display: flex; flex-direction: column; gap: 1.25rem; padding: 1.25rem;
    background: var(--bg); overflow-y: auto; box-shadow: var(--shadow-lg);
    transform: translateX(100%); transition: transform .38s var(--ease);
}
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer.is-open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.drawer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.drawer-list .nav-link { display: flex; min-height: 52px; padding: .75rem 1rem; border-radius: 14px; font-size: 1.05rem; }
.drawer-list .nav-link::after { left: auto; right: .35rem; top: 50%; bottom: auto; margin: -3px 0 0; }
.drawer-list .nav-link.is-active { background: var(--surface); }
.drawer-foot { margin-top: auto; display: grid; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.drawer-phone { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 700; text-decoration: none; min-height: 44px; }

/* ---- Hero slider ------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(1rem, .5rem + 1.5vw, 2rem) clamp(1.75rem, 1rem + 2vw, 3rem); }
.hero-bg { position: absolute; inset: 0; z-index: -1; }
.hero-blobs { width: 100%; height: 100%; }
.hero-blobs path { fill: var(--beige); opacity: .6; }
.hero-grid { display: grid; gap: 2.5rem; align-items: center; }
/* Grid children may shrink below their content width (e.g. the scrollable tab row) instead of widening the page. */
.hero-grid > *, .about-grid > *, .skills-grid > *, .contact-grid > *, .footer-grid > * { min-width: 0; }
.hero-copy { position: relative; z-index: 2; }
.hero-texts { display: grid; }
.hero-text {
    grid-area: 1 / 1; opacity: 0; visibility: hidden; transform: translateY(18px);
    transition: opacity .7s var(--ease), transform .7s var(--ease), visibility 0s linear .7s;
}
.hero-text.is-active { opacity: 1; visibility: visible; transform: none; transition-delay: .1s, .1s, 0s; }
.hero-title { font-size: clamp(2.1rem, 1.3rem + 2.9vw, 3.9rem); line-height: 1.45; margin: 0 0 1rem; letter-spacing: 0; }
.hero-sub { max-width: 34rem; font-size: 1.08rem; color: var(--muted); margin: 0 0 2rem; line-height: 2; }
.hero-controls { display: flex; align-items: center; gap: .6rem; margin-top: clamp(2rem, 1.5rem + 2vw, 3rem); }
.slider-btn {
    display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
    transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}
.slider-btn .icon { width: 20px; height: 20px; }
.slider-btn:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.slider-btn:active { transform: scale(.94); }
.hero-counter { display: inline-flex; align-items: center; gap: .7rem; padding-inline: .5rem; font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--ink); }
.hero-total { color: var(--muted); }
.hero-progress { position: relative; width: 72px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.hero-progress > span { position: absolute; inset: 0; background: var(--orange); transform: scaleX(0); transform-origin: right center; }
.hero-progress > span.is-running { animation: progress linear forwards; }
.hero.is-paused .hero-progress > span { animation-play-state: paused; }
@keyframes progress { to { transform: scaleX(1); } }
.slider-toggle .when-paused { display: none; }
.hero.is-paused .slider-toggle .when-playing { display: none; }
.hero.is-paused .slider-toggle .when-paused { display: inline-flex; }
.slider-toggle span { display: inline-flex; }

.hero-visual { position: relative; width: 100%; max-width: 440px; margin-inline: auto; }
.hero-shape { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 30px 40px rgba(22, 22, 26, .12)); }
.hero-shape-bg { fill: var(--beige); }
.hero-img { opacity: 0; transition: opacity 1s ease; }
.hero-img.is-active { opacity: 1; }
.hero-capsule {
    position: absolute; left: -80px; top: 12%; width: 150px; height: 230px; border-radius: 999px;
    background: var(--orange); transform: rotate(35deg); opacity: .95; pointer-events: none; display: none;
}

/* ---- Welcome ---------------------------------------------------------------- */
.welcome { padding-top: clamp(1rem, .5rem + 1.5vw, 2rem); }
.welcome::before, .welcome::after {
    content: ""; position: absolute; z-index: -1; width: 280px; height: 280px; border-radius: 50%;
    background-image: radial-gradient(circle, rgba(22, 22, 26, .14) 1.5px, transparent 1.8px);
    background-size: 16px 16px; -webkit-mask-image: radial-gradient(circle, #000 35%, transparent 70%); mask-image: radial-gradient(circle, #000 35%, transparent 70%);
}
.welcome::before { top: 10%; right: 2%; }
.welcome::after { bottom: 0; left: 4%; }
.welcome .section-title { max-width: 16em; margin-inline: auto; }

/* ---- About ------------------------------------------------------------------- */
.about-grid { display: grid; gap: 3rem; align-items: center; }
.about-visual { position: relative; width: 100%; max-width: 520px; margin-inline: auto; aspect-ratio: 1 / 1; }
.about-dots {
    position: absolute; inset: 2% -2% 6% 10%; border-radius: 50%;
    background-image: radial-gradient(circle, rgba(22, 22, 26, .2) 1.6px, transparent 1.9px); background-size: 15px 15px;
    -webkit-mask-image: radial-gradient(circle at 55% 45%, #000 30%, transparent 70%); mask-image: radial-gradient(circle at 55% 45%, #000 30%, transparent 70%);
}
.about-circle { position: absolute; margin: 0; border-radius: 50%; overflow: hidden; background: var(--beige); box-shadow: var(--shadow); border: 6px solid var(--bg); }
.about-circle img { width: 100%; height: 100%; object-fit: cover; }
.about-circle-main { width: 70%; aspect-ratio: 1; top: 13%; right: 9%; }
.about-circle-2 { width: 28%; aspect-ratio: 1; top: 7%; left: 5%; }
.about-circle-3 { width: 23%; aspect-ratio: 1; bottom: 4%; right: 0; }
.about-visual .dot-orange { top: 2%; right: 12%; }
.about-visual .deco-ring { bottom: 20%; left: 12%; }
.about-visual .dot-green-sm { bottom: 9%; left: 36%; }
.about-badge {
    position: absolute; left: 3%; bottom: 12%; z-index: 2;
    display: flex; flex-direction: column; align-items: center; gap: .1rem;
    padding: 1rem 1.25rem; min-width: 120px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.about-badge strong { font-family: var(--font-display); font-weight: 800; font-size: 1.75rem; line-height: 1.3; color: var(--orange-ink); }
.about-badge span { font-size: .8rem; font-weight: 600; color: var(--ink-2); text-align: center; }
.about-highlight {
    font-weight: 700; color: var(--ink); font-size: 1.1rem; line-height: 1.9;
    border-inline-start: 3px solid var(--orange); padding-inline-start: 1rem; margin-bottom: 1.25rem;
}
.stats {
    list-style: none; margin: clamp(2rem, 1.5rem + 2vw, 3rem) 0 0; padding: clamp(1.25rem, 1rem + 1vw, 2rem);
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem 0;
    background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.stat { text-align: center; padding: .5rem 1rem; }
.stat-value { display: block; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.8rem, 1.4rem + 1.4vw, 2.5rem); line-height: 1.35; color: var(--ink); }
.stat-label { color: var(--muted); font-size: .93rem; font-weight: 500; }

/* ---- Skills (tabs) --------------------------------------------------------------- */
.skills-grid { display: grid; gap: 2rem; align-items: center; }
.skills-media { position: relative; order: 2; border-radius: var(--radius-xl); overflow: hidden; aspect-ratio: 4 / 5; max-height: 560px; width: 100%; background: var(--beige); }
.skill-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.04); transition: opacity .7s ease, transform 1.2s var(--ease); }
.skill-img.is-active { opacity: 1; transform: none; }
.skills-media .dot-orange { top: 1.25rem; left: 1.25rem; z-index: 2; }
.skills-panel { position: relative; z-index: 2; background: var(--surface); border-radius: var(--radius-xl); padding: clamp(1.5rem, 1rem + 2.2vw, 3rem); box-shadow: var(--shadow); }
.tabs { display: flex; gap: .35rem; margin: 1.75rem 0 1.5rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; gap: .45rem; min-width: 96px; min-height: 44px;
    padding: .8rem .75rem 1rem; margin-bottom: -1px; background: none; border: 0; border-bottom: 2px solid transparent;
    color: var(--muted); font-weight: 600; font-size: .88rem; line-height: 1.5; cursor: pointer; transition: color .2s, border-color .2s;
}
.tab-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); transition: background-color .25s, color .25s; }
.tab-icon .icon { width: 24px; height: 24px; stroke-width: 1.7; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--orange); }
.tab[aria-selected="true"] .tab-icon { background: var(--orange); color: var(--ink); }
.tab-panel { animation: fade-up .45s var(--ease); }
.tab-panel:focus-visible { outline-offset: 6px; border-radius: 8px; }
.tab-panel-title { font-size: 1.3rem; margin-bottom: .5rem; }
.meter { margin-top: 1.5rem; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .9rem; font-weight: 600; color: var(--ink); margin-bottom: .5rem; }
.meter-head strong { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--orange-ink); }
.meter-track { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.meter-track span { display: block; height: 100%; width: var(--value); border-radius: inherit; background: linear-gradient(270deg, var(--orange), var(--coral)); animation: meter-grow 1.2s var(--ease); }
@keyframes meter-grow { from { width: 0; } }

/* ---- Prose (rich text) ------------------------------------------------------------ */
.prose { color: var(--ink-2); line-height: 2; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 1.1em; }
.prose h2 { font-size: 1.4rem; margin: 1.8em 0 .55em; }
.prose h3 { font-size: 1.2rem; margin: 1.6em 0 .5em; }
.prose h4 { font-size: 1.05rem; margin: 1.4em 0 .5em; }
.prose ul, .prose ol { padding-inline-start: 1.4rem; margin: 0 0 1.2em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--orange-ink); }
.prose a { color: var(--green); text-underline-offset: 4px; }
.prose strong { color: var(--ink); }
.prose blockquote {
    margin: 2rem 0; padding: 1.25rem 1.5rem; border-inline-start: 4px solid var(--orange);
    background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; line-height: 1.9; color: var(--ink);
}
.prose img { border-radius: var(--radius); margin: 1.5rem 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.prose code { background: var(--surface-2); padding: .1rem .4rem; border-radius: 6px; font-size: .9em; }
.prose-lg { font-size: 1.1rem; line-height: 2.1; }

/* ---- Projects --------------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 0 0 2.5rem; }
.filter {
    display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .45rem 1.25rem;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2);
    font-weight: 600; font-size: .92rem; text-decoration: none; cursor: pointer; transition: background-color .2s, color .2s, border-color .2s;
}
.filter:hover { border-color: var(--ink); color: var(--ink); }
.filter.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-count { font-size: .78rem; opacity: .7; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1.75rem; }
.project-card {
    display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-sm); transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.js .project-card.is-extra { display: none; }
.js .project-grid.show-all .project-card.is-extra { display: flex; }
.project-card.is-entering { animation: fade-up .5s var(--ease) both; }
.project-media { position: relative; aspect-ratio: 10 / 7; overflow: hidden; border-radius: var(--radius-lg) var(--radius-lg) 0 0; cursor: pointer; background: var(--beige); }
.project-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.project-card:hover .project-media img { transform: scale(1.06); }
.chip {
    position: absolute; top: 1rem; right: 1rem; padding: .25rem .8rem; border-radius: 999px;
    background: rgba(255, 255, 255, .92); color: var(--ink); font-size: .78rem; font-weight: 700;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.project-body { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 1.6rem 1.5rem 1.8rem; text-align: center; }
.project-title { font-size: 1.2rem; margin: 0; }
.project-summary { flex: 1; margin: 0 0 .6rem; color: var(--muted); font-size: .95rem; line-height: 1.95; }

/* Project dialog */
.modal { width: min(960px, 100% - 2rem); max-width: none; max-height: calc(100dvh - 2rem); padding: 0; border: 0; background: transparent; color: inherit; overflow: visible; }
.modal::backdrop { background: rgba(22, 22, 26, .62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal[open] .modal-card { animation: fade-up .4s var(--ease); }
.modal-card { position: relative; max-height: calc(100dvh - 2rem); overflow: auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-close { position: absolute; top: 1rem; left: 1rem; z-index: 3; }
.modal-content { display: grid; }
.modal-media { background: var(--beige); }
.modal-media img { width: 100%; height: 100%; min-height: 240px; object-fit: cover; }
.modal-body { padding: clamp(1.5rem, 1rem + 2vw, 2.5rem); }
.modal-title { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.8rem); }
.project-facts { display: flex; flex-wrap: wrap; gap: .75rem 2rem; margin: 1rem 0 1.5rem; padding: 1rem 0; border-block: 1px solid var(--line); }
.project-facts dt { font-size: .8rem; color: var(--muted); }
.project-facts dd { margin: 0; font-weight: 700; color: var(--ink); }
.modal-body .btn { margin-top: 1.5rem; }

/* ---- Blog cards ------------------------------------------------------------------------ */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1.75rem; }
.post-card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .4s var(--ease), box-shadow .4s var(--ease); }
.post-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.post-media { display: block; aspect-ratio: 25 / 16; overflow: hidden; background: var(--beige); }
.post-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.post-card:hover .post-media img { transform: scale(1.06); }
.post-body { flex: 1; display: flex; flex-direction: column; gap: .55rem; padding: 1.4rem 1.5rem 1.5rem; }
.post-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.date-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .75rem; border-radius: 999px; background: var(--orange-soft); color: #7a4300; font-size: .8rem; font-weight: 700; }
.date-badge .icon { width: 14px; height: 14px; }
.post-cat { font-size: .82rem; font-weight: 700; color: var(--green); }
.post-title { font-size: 1.15rem; line-height: 1.7; margin: 0; }
.post-title a { color: inherit; text-decoration: none; background: linear-gradient(var(--orange), var(--orange)) right bottom / 0 2px no-repeat; transition: background-size .4s var(--ease); }
.post-title a:hover { background-size: 100% 2px; }
.post-excerpt { flex: 1; margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.95; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- Contact ------------------------------------------------------------------------------- */
.contact-grid { display: grid; gap: 1.75rem; }
.contact-info {
    position: relative; overflow: hidden; padding: clamp(1.75rem, 1.2rem + 2vw, 2.75rem);
    border-radius: var(--radius-lg); background: var(--ink); color: #d4d4d8;
}
.contact-info-title { color: #fff; font-size: 1.45rem; margin-bottom: .4rem; }
.contact-info-text { color: #a1a1aa; margin-bottom: 0; }
.contact-list { list-style: none; margin: 2rem 0; padding: 0; display: grid; gap: 1.4rem; position: relative; z-index: 1; }
.contact-list li { display: flex; align-items: flex-start; gap: 1rem; }
.contact-icon { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%; background: rgba(246, 161, 26, .14); color: var(--orange); }
.contact-icon .icon { width: 20px; height: 20px; }
.contact-text { display: flex; flex-direction: column; min-width: 0; }
.contact-label { font-size: .8rem; color: #a1a1aa; }
.contact-value { color: #fff; font-weight: 600; line-height: 1.8; overflow-wrap: anywhere; }
.contact-value a { display: inline-block; padding-block: .35rem; color: inherit; text-decoration: none; }
.contact-value a:hover { color: var(--orange); }
.contact-value .sep { margin-inline: .5rem; color: #52525b; }
.contact-info-deco { position: absolute; left: -90px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%; border: 40px solid rgba(246, 161, 26, .1); pointer-events: none; }
.social-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; position: relative; z-index: 1; }
.social-list a {
    display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid var(--line); color: var(--ink); transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}
.social-list a .icon { width: 18px; height: 18px; }
.social-list a:hover { background: var(--orange); border-color: var(--orange); color: var(--ink); transform: translateY(-2px); }
.social-list-light a { border-color: rgba(255, 255, 255, .18); color: #fff; }

.contact-form { position: relative; padding: clamp(1.5rem, 1rem + 2vw, 2.5rem); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.form-grid { display: grid; gap: 1.1rem 1.25rem; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: .4rem; font-weight: 600; font-size: .92rem; color: var(--ink); }
.req { color: #c2410c; }
.input {
    width: 100%; min-height: 52px; padding: .75rem 1rem; border: 1.5px solid var(--line); border-radius: 14px;
    background: #fcfbf8; color: var(--ink); line-height: 1.7; transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.input::placeholder { color: #9a9aa2; }
.input:hover { border-color: #d6cfc0; }
.input:focus { outline: none; border-color: var(--orange); background: #fff; box-shadow: 0 0 0 4px rgba(246, 161, 26, .22); }
textarea.input { min-height: 150px; resize: vertical; }
.field.is-invalid .input { border-color: #dc2626; background: #fffafa; }
.field.is-invalid .input:focus { box-shadow: 0 0 0 4px rgba(220, 38, 38, .15); }
.field-error { margin: .35rem 0 0; color: var(--danger); font-size: .85rem; font-weight: 600; }
.field-error:empty { display: none; }
.form-hint { margin: 1rem 0 1.25rem; font-size: .85rem; color: var(--muted); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.form-status { font-weight: 700; font-size: .95rem; }
.form-status.is-success { color: var(--green); }
.form-status.is-error { color: var(--danger); }
.form-alert { margin-bottom: 1.25rem; padding: .9rem 1.1rem; border-radius: 14px; font-weight: 600; }
.form-alert-success { background: var(--green-soft); color: #0f5132; }
.form-alert-error { background: #fee2e2; color: #991b1b; }
.btn .spinner { display: none; width: 18px; height: 18px; border: 2px solid currentColor; border-left-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-icon { display: none; }
/* Honeypot: invisible without pushing content off-canvas (a large negative offset creates horizontal scroll in RTL). */
.hp-field { position: absolute !important; top: 0; right: 0; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }
.map-frame { margin-top: 1.75rem; border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 21 / 8; min-height: 280px; box-shadow: var(--shadow-sm); background: var(--beige); }
.map-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---- Footer ---------------------------------------------------------------------------------- */
.site-footer { position: relative; overflow: hidden; margin-top: clamp(1rem, .5rem + 1.5vw, 2rem); padding-top: clamp(2.5rem, 2rem + 2vw, 4rem); background: var(--ink); color: #a1a1aa; }
.site-footer::before { content: ""; position: absolute; top: -140px; left: -120px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(246, 161, 26, .16), transparent 70%); pointer-events: none; }
.footer-grid { display: grid; gap: 2.5rem; position: relative; }
.brand-light .brand-name { color: #fff; }
.brand-light .brand-mark { color: #fff; }
.brand-light .brand-tagline { color: #a1a1aa; }
.footer-about { margin: 1.25rem 0 1.5rem; line-height: 2; font-size: .95rem; }
.footer-title { color: #fff; font-size: 1.1rem; margin-bottom: 1.1rem; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.footer-links .nav-link { padding: .25rem 0; min-height: 40px; color: #d4d4d8; font-weight: 500; }
.footer-links .nav-link::after { display: none; }
.footer-links .nav-link:hover { background: none; color: var(--orange); }
.footer-contact { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; font-size: .93rem; }
.footer-contact li { display: flex; gap: .65rem; align-items: flex-start; line-height: 1.9; }
.footer-contact .icon { color: var(--orange); width: 18px; height: 18px; margin-top: .35rem; }
.footer-contact a { display: inline-block; padding-block: .4rem; color: #d4d4d8; text-decoration: none; }
.footer-contact a:hover { color: var(--orange); }
.footer-cta p { font-size: .95rem; line-height: 2; margin-bottom: 1.25rem; }
.footer-bottom {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem;
    margin-top: clamp(2.5rem, 2rem + 2vw, 4rem); padding-block: 1.5rem; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .88rem;
}
.footer-bottom p { margin: 0; }
.footer-bottom a { display: inline-block; padding-block: .6rem; color: #d4d4d8; text-decoration: none; }
.footer-bottom a:hover { color: var(--orange); }
.to-top {
    position: fixed; left: 1.25rem; bottom: 1.25rem; z-index: 40; display: grid; place-items: center;
    width: 50px; height: 50px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; box-shadow: var(--shadow);
    opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .3s, transform .3s var(--ease), background-color .2s;
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--orange); color: var(--ink); }

/* ---- Inner pages (blog, post, 404) ------------------------------------------------------------ */
.page-hero { position: relative; overflow: hidden; padding-block: clamp(1.5rem, 1rem + 1.5vw, 2.5rem) clamp(1rem, .75rem + 1vw, 1.5rem); }
.page-hero-deco { position: absolute; inset: 0; z-index: -1; }
.page-hero-deco::before { content: ""; position: absolute; top: -80px; left: 6%; width: 260px; height: 260px; border-radius: 50%; background: var(--beige); opacity: .7; }
.page-hero-deco::after { content: ""; position: absolute; top: 30%; right: 4%; width: 22px; height: 22px; border-radius: 50%; background: var(--orange); }
.page-title { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.9rem); line-height: 1.5; margin: .2rem 0 1rem; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.25rem; padding: 0; font-size: .88rem; color: var(--muted); }
.breadcrumb li + li::before { content: "/"; margin-inline-end: .4rem; color: #c4bdb0; }
.breadcrumb a { color: var(--ink-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--orange-ink); }
.breadcrumb-center ol { justify-content: center; }
.post-meta { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: 0; padding: 0; color: var(--muted); font-size: .92rem; }
.post-meta li { display: inline-flex; align-items: center; gap: .4rem; }
.post-meta .icon { width: 17px; height: 17px; color: var(--orange-ink); }
.post-meta a { color: inherit; text-decoration: none; }
.post-meta a:hover { color: var(--orange-ink); }
.post-layout { padding-bottom: 2rem; }
.post-cover { margin: 0 0 2.5rem; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.post-cover img { width: 100%; }
.post-share { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 2.5rem 0 1.25rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.post-share-label { font-weight: 700; color: var(--ink); margin-inline-end: .5rem; }
.share-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; transition: background-color .2s, color .2s; }
.share-btn .icon { width: 18px; height: 18px; }
.share-btn:hover { background: var(--ink); color: #fff; }
.copy-status { font-size: .85rem; font-weight: 600; color: var(--green); }
.back-link .icon { transform: none; }
.back-link:hover .icon { transform: translateX(5px); }
.related { padding-top: 1rem; }
.blog-archive { padding-top: 1rem; }
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: 3rem; }
.pager-btn { display: inline-grid; place-items: center; min-width: 46px; height: 46px; padding: 0 .75rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; text-decoration: none; }
.pager-btn:hover { border-color: var(--ink); }
.pager-btn.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pager-btn .icon { width: 18px; height: 18px; }
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.empty-state .icon { width: 48px; height: 48px; margin-bottom: 1rem; opacity: .6; }
.not-found { min-height: 60vh; display: grid; align-items: center; }
.not-found-code { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(6rem, 3rem + 12vw, 11rem); line-height: 1; color: var(--orange); }

/* ---- Responsive ---------------------------------------------------------------------------------- */
@media (min-width: 640px) {
    .header-cta { display: inline-flex; }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .field-full { grid-column: 1 / -1; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
    .hero-grid { grid-template-columns: 1fr 1.02fr; gap: 3rem; }
    .hero-visual { max-width: 600px; }
    .hero-capsule { display: block; }
    .about-grid { grid-template-columns: 1fr 1fr; gap: 4rem; }
    .stats { grid-template-columns: repeat(4, 1fr); }
    .stat + .stat { border-inline-start: 1px solid var(--line); }
    .skills-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 0; }
    .skills-panel { margin-inline-end: -4.5rem; }
    .skills-media { max-height: 640px; }
    .contact-grid { grid-template-columns: .85fr 1.15fr; }
    .modal-content { grid-template-columns: 1fr 1.1fr; }
    .modal-media img { min-height: 100%; }
}
@media (min-width: 1100px) {
    .main-nav { display: block; }
    .nav-toggle { display: none; }
    .footer-grid { grid-template-columns: 1.35fr .9fr 1.2fr 1.1fr; gap: 3rem; }
}
@media (min-width: 1240px) {
    .header-phone { display: inline-flex; }
}
@media (max-width: 899px) {
    .dot-orange-lg { display: none; }
    .stat:nth-child(odd) { border-inline-end: 1px solid var(--line); }
    .hero-controls { justify-content: flex-start; }
}
@media (max-width: 480px) {
    :root { --header-h: 72px; }
    .brand-mark { width: 36px; height: 36px; }
    .brand-name { font-size: 1.1rem; }
    .brand-tagline { display: none; }
    .btn { padding-inline-end: 1.2rem; }
    .btn-row .btn { flex: 1 1 100%; }
    .about-badge { padding: .7rem .9rem; min-width: 96px; }
    .about-badge strong { font-size: 1.8rem; }
    .tab { min-width: 84px; }
    .hero-counter { padding-inline: .15rem; gap: .5rem; }
    .hero-progress { width: 44px; }
}

/* ---- Motion preferences ------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .js .reveal { opacity: 1; transform: none; }
}
