/* ================================================
   Ahmed Balleh Portfolio — style.css v3 Clean
   ================================================ */

/* ── Reset & Base ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* ألوان ديناميكية — تُعيَّن من PHP */
    --accent:        #4ab4e6;
    --bg-dark:       #1f2229;
    --bg-card:       #2a2d35;
    --text-color:    #ffffff;

    /* ألوان مشتقة */
    --accent-dim:    rgba(74,180,230,.15);
    --bg-section:    color-mix(in srgb, var(--bg-card) 95%, white);
    --text-gray:     rgba(255,255,255,.72);
    --text-muted:    rgba(255,255,255,.46);
    --border:        rgba(255,255,255,.1);

    /* Spacing & shape */
    --r:   8px;
    --r-lg: 14px;
    --shadow:    0 4px 20px rgba(0,0,0,.28);
    --shadow-lg: 0 16px 50px rgba(0,0,0,.45);
    --transition: all .28s cubic-bezier(.4,0,.2,1);
}

/* Light theme overrides */
body[data-theme="light"] {
    --bg-dark:    #f4f6f8;
    --bg-card:    #ffffff;
    --bg-section: #e8ecf0;
    --text-color: #1a1d24;
    --text-gray:  rgba(0,0,0,.7);
    --text-muted: rgba(0,0,0,.46);
    --border:     rgba(0,0,0,.09);
    --shadow:    0 4px 20px rgba(0,0,0,.08);
    --shadow-lg: 0 16px 50px rgba(0,0,0,.12);
}

body {
    font-family: 'Inter', 'Open Sans', sans-serif;
    background: var(--bg-dark);
    color: var(--text-color);
    line-height: 1.65;
    padding: 20px;
    min-height: 100vh;
    transition: background .4s, color .4s;
}

body[data-theme="dark"] { background: linear-gradient(160deg,#0f111a,#1a1d25); }
body[data-theme="light"] { background: linear-gradient(160deg,#edf0f4,#f4f6f8); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

/* ── Reading Progress ──────────────────────────── */
.reading-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999;
}
.progress-fill {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb,var(--accent) 70%,white));
    box-shadow: 0 0 8px var(--accent);
    transition: width .1s linear;
}

/* ── Theme Toggle ──────────────────────────────── */
.theme-toggle {
    position: fixed; top: 18px; left: 18px; z-index: 999;
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--bg-card); border: 2px solid var(--border);
    color: var(--text-color); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow); transition: var(--transition);
}
.theme-toggle:hover { transform: scale(1.1) rotate(12deg); border-color: var(--accent); }
.theme-toggle svg { width: 20px; height: 20px; }

body[data-theme="dark"] .icon-sun  { display: block; }
body[data-theme="dark"] .icon-moon { display: none; }
body[data-theme="light"] .icon-sun  { display: none; }
body[data-theme="light"] .icon-moon { display: block; }

/* ── Back to Top ───────────────────────────────── */
.back-to-top {
    position: fixed; bottom: 22px; left: 22px; z-index: 999;
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--accent); border: none; color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0; transform: translateY(20px);
    transition: var(--transition);
    box-shadow: 0 4px 18px rgba(74,180,230,.4);
}
.back-to-top svg { width: 20px; height: 20px; }
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { transform: translateY(-4px); }

/* ── Fade-in Animation ─────────────────────────── */
.fade-in { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.fade-in.visible { opacity: 1; transform: none; }

/* ── Main Container ────────────────────────────── */
.cv-wrap {
    max-width: 1100px; margin: 0 auto;
    background: var(--bg-dark);
    padding: 40px 50px;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
}

body[data-theme="dark"] .cv-wrap::before {
    content: '';
    position: absolute; inset: 0; pointer-events: none; border-radius: var(--r-lg);
    background: radial-gradient(circle at 20% 10%, rgba(74,180,230,.07), transparent 55%);
}

/* ── Section Header ────────────────────────────── */
.section-head {
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-section);
    padding: 11px 20px;
    border-radius: 4px;
    border-right: 4px solid var(--accent);
    margin-bottom: 20px; margin-top: 14px;
}
.sec-icon { font-size: 20px; }
.section-head h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 20px; font-weight: 700;
    color: var(--accent); letter-spacing: 3px;
}

/* ══════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════ */
.cv-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 28px; align-items: center;
    padding-bottom: 24px;
}

/* Photo */
.header-photo {
    width: 130px; height: 130px; border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--text-color);
    box-shadow: 0 0 0 6px var(--accent-dim);
    animation: photoPulse 3s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes photoPulse {
    0%,100% { box-shadow: 0 0 0 6px var(--accent-dim); }
    50%      { box-shadow: 0 0 0 14px transparent; }
}
.header-photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-initials {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Montserrat', sans-serif; font-size: 56px; font-weight: 900;
    color: var(--accent); background: var(--bg-card);
}

/* Name */
.header-name { text-align: center; }
.header-name h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 60px; font-weight: 900; letter-spacing: 2px; line-height: 1;
    color: var(--text-color);
    animation: slideLeft .8s ease-out both;
}
.header-name h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 38px; font-weight: 300; letter-spacing: 8px;
    color: var(--text-gray); margin: 6px 0 12px;
    animation: slideRight .8s ease-out both;
}
.job-badge {
    display: inline-block;
    background: var(--accent); color: #fff;
    padding: 6px 24px;
    font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 700;
    letter-spacing: 2px; border-radius: 3px;
    animation: fadeUp .9s ease-out both;
}
@keyframes slideLeft  { from { opacity:0; transform:translateX(-40px); } }
@keyframes slideRight { from { opacity:0; transform:translateX(40px);  } }
@keyframes fadeUp     { from { opacity:0; transform:translateY(16px);  } }

/* Right side */
.header-right { text-align: right; }
.logo-circle {
    width: 58px; height: 58px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    margin-left: auto; margin-bottom: 10px;
    font-family: 'Montserrat', sans-serif; font-size: 20px; font-weight: 900;
    transition: var(--transition);
}
.logo-circle:hover { transform: rotate(360deg); }

.header-contact { display: flex; flex-direction: column; gap: 5px; font-style: normal; }
.header-contact a {
    display: flex; align-items: center; gap: 7px;
    font-size: 13px; font-weight: 600; color: var(--text-color);
    justify-content: flex-end; text-decoration: none;
}
.header-contact svg { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; }

.btn-pdf {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--accent); color: #fff;
    padding: 8px 15px; border-radius: 6px;
    font-size: 12px; font-weight: 700; letter-spacing: 1px;
    margin-top: 10px; text-decoration: none;
    box-shadow: 0 4px 14px rgba(74,180,230,.32);
    transition: var(--transition);
}
.btn-pdf svg { width: 14px; height: 14px; }
.btn-pdf:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(74,180,230,.5); text-decoration: none; }

/* ── Bio ───────────────────────────────────────── */
.cv-bio {
    font-size: 14px; color: var(--text-gray); line-height: 1.75;
    padding: 14px 0 20px; max-width: 700px;
}

/* ── Info Bar ──────────────────────────────────── */
.info-bar {
    display: flex; flex-wrap: wrap; gap: 12px 28px;
    background: var(--bg-section); padding: 16px 22px;
    border-radius: var(--r); border: 1px solid var(--border);
    margin-bottom: 26px;
}
.info-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-gray); }
.info-label { color: var(--accent); font-weight: 700; font-size: 14px; }
.info-item a { color: var(--text-gray); }
.info-item a:hover { color: var(--accent); text-decoration: none; }

/* ── Stats Row ─────────────────────────────────── */
.stats-row {
    display: grid; grid-template-columns: repeat(4,1fr);
    gap: 16px; margin-bottom: 28px;
    padding: 22px;
    background: var(--bg-section); border-radius: var(--r); border: 1px solid var(--border);
}
.stat-box { text-align: center; border-right: 1px solid var(--border); }
.stat-box:last-child { border-right: none; }
.stat-num {
    display: block;
    font-family: 'Montserrat', sans-serif; font-size: 36px; font-weight: 900;
    color: var(--accent); line-height: 1; margin-bottom: 6px;
}
.stat-num::after { content: '+'; }
.stat-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); font-weight: 700; }

/* ══════════════════════════════════════════════════
   TWO-COLUMN LAYOUT
══════════════════════════════════════════════════ */
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; }

/* ── Timeline ──────────────────────────────────── */
.timeline { position: relative; }
.tl-item {
    display: grid; grid-template-columns: 130px 1fr auto;
    gap: 14px; margin-bottom: 28px;
    padding-left: 16px; border-left: 2px dotted var(--border);
    position: relative; transition: var(--transition);
}
.tl-item:hover { transform: translateX(5px); }
.tl-dot {
    position: absolute; left: -7px; top: 8px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--bg-dark);
    transition: var(--transition);
}
.tl-item:hover .tl-dot { transform: scale(1.35); box-shadow: 0 0 0 6px var(--accent-dim); }

.tl-date { display: flex; flex-direction: column; gap: 3px; }
.tl-date strong { background: var(--bg-section); color: var(--text-color); padding: 3px 8px; font-size: 11px; font-weight: 700; border-radius: 3px; width: fit-content; }
.tl-date span { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.tl-loc { color: var(--accent) !important; }

.tl-body h4 { font-family: 'Montserrat', sans-serif; font-size: 16px; font-weight: 800; margin-bottom: 3px; }
.tl-company { font-size: 11px; color: var(--accent); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.tl-desc { font-size: 12px; color: var(--text-gray); line-height: 1.65; }
.tl-desc ul { list-style: none; padding: 0; }
.tl-desc li { padding: 2px 0 2px 14px; position: relative; }
.tl-desc li::before { content: '•'; position: absolute; left: 0; color: var(--accent); }
.tl-logo { width: 50px; align-self: flex-start; }
.tl-logo img { max-width: 50px; max-height: 50px; object-fit: contain; }

/* ── Education ─────────────────────────────────── */
.edu-item {
    display: grid; grid-template-columns: 100px 1fr; gap: 14px;
    margin-bottom: 18px; padding-left: 16px;
    border-left: 2px dotted var(--border); position: relative;
    transition: var(--transition);
}
.edu-item:hover { transform: translateX(5px); }
.edu-item::before {
    content: ''; position: absolute; left: -6px; top: 6px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--bg-dark);
}
.edu-date { display: flex; flex-direction: column; gap: 2px; }
.edu-date strong { font-size: 12px; font-weight: 700; color: var(--text-color); }
.edu-date span   { font-size: 10px; color: var(--text-muted); }
.edu-uni         { color: var(--accent) !important; font-weight: 700 !important; }
.edu-body h4  { font-family: 'Montserrat', sans-serif; font-size: 14px; font-weight: 800; }
.edu-body p   { font-size: 13px; font-weight: 700; font-family: 'Montserrat', sans-serif; }

/* ── Languages ─────────────────────────────────── */
.lang-item {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; padding: 4px 14px;
    border-left: 2px dotted var(--border); position: relative;
}
.lang-item::before {
    content: ''; position: absolute; left: -5px; top: 50%; transform: translateY(-50%);
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.lang-name { font-weight: 700; font-size: 14px; }
.lang-dots { display: flex; gap: 4px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: var(--transition); }
.dot.on { background: var(--accent); }
.lang-item:hover .dot.on { transform: scale(1.3); }

/* ── Tools ─────────────────────────────────────── */
.tools-wrap { padding: 8px 0; }
.tools-row { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.tool-chip {
    width: 42px; height: 42px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 15px; color: #fff;
    cursor: default; transition: var(--transition); box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.tool-chip:hover { transform: translateY(-5px) scale(1.12); box-shadow: 0 8px 20px rgba(0,0,0,.4); }

/* Adobe */
.tool-Ps { background:#001e36; color:#31a8ff; border:1.5px solid #31a8ff; }
.tool-Ai { background:#330000; color:#ff9a00; border:1.5px solid #ff9a00; }
.tool-Ae { background:#00005b; color:#d291ff; border:1.5px solid #9999ff; }
.tool-Pr { background:#00005b; color:#ea77ff; border:1.5px solid #ea77ff; }
.tool-Id { background:#49021f; color:#ff3366; border:1.5px solid #ff3366; }
/* Office */
.tool-W { background:#2b579a; }
.tool-X { background:#217346; }
.tool-P { background:#b7472a; }
/* OS — svg fallback */
.tools-os .tool-chip {
    background: transparent;
    color: var(--text-color);
    font-size: 0; width: 40px; height: 40px;
    box-shadow: none;
}
.tools-os .tool-chip::before {
    content: '';
    width: 28px; height: 28px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
body[data-theme="dark"] .tools-os .tool-chip::before { filter: invert(1) opacity(.85); }

/* ══════════════════════════════════════════════════
   SERVICES
══════════════════════════════════════════════════ */
.services-sec { margin-top: 40px; }
.services-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; padding: 20px 0; }
.svc-card {
    text-align: center; padding: 24px 14px;
    border-radius: var(--r); border: 1px solid transparent;
    transition: var(--transition); cursor: default;
}
.svc-card:hover {
    background: var(--bg-section); border-color: var(--accent);
    transform: translateY(-7px);
}
.svc-icon { width: 58px; height: 58px; margin: 0 auto 14px; color: var(--accent); transition: var(--transition); }
.svc-icon svg { width: 100%; height: 100%; }
.svc-card:hover .svc-icon { transform: scale(1.15) rotate(-5deg); }
.svc-card h4 {
    font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 800;
    letter-spacing: 2px; margin-bottom: 8px;
}
.svc-card p { font-size: 11px; color: var(--text-gray); line-height: 1.65; }

/* ══════════════════════════════════════════════════
   SKILLS & AI TOOLS
══════════════════════════════════════════════════ */
.skills-sec { margin-top: 46px; }
.skills-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.skill-tab {
    padding: 8px 20px;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 24px;
    color: var(--text-gray);
    font-size: 13px; font-weight: 700; font-family: inherit;
    cursor: pointer; transition: var(--transition);
}
.skill-tab:hover { border-color: var(--tc,var(--accent)); color: var(--tc,var(--accent)); }
.skill-tab.active { background: var(--tc,var(--accent)); border-color: var(--tc,var(--accent)); color: #fff; }

.skills-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(210px,1fr)); gap: 12px; animation: fadeUp .4s ease; }
.skills-grid.hidden { display: none; }

.skill-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-section); border: 1px solid var(--border);
    border-radius: var(--r); padding: 12px 14px; transition: var(--transition);
}
.skill-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }

.skill-icon {
    width: 40px; height: 40px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 800; font-family: 'Montserrat',sans-serif;
    flex-shrink: 0;
}
.skill-info { flex: 1; min-width: 0; }
.skill-name { font-size: 13px; font-weight: 700; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.skill-bar-wrap { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 3px; }
.skill-bar {
    height: 100%; width: var(--w,80%); background: var(--c,var(--accent)); border-radius: 3px;
    animation: barGrow 1s ease-out forwards;
    transform-origin: left center;
}
@keyframes barGrow { from { transform: scaleX(0); } }

.skill-pct { font-size: 10px; font-weight: 700; color: var(--text-muted); text-align: right; }

/* ══════════════════════════════════════════════════
   CLIENTS
══════════════════════════════════════════════════ */
.clients-sec { margin-top: 46px; }

/* Marquee — desktop only */
/* ── Clients: unified section ── */
.clients-wrap {
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
    margin-top: 16px;
}
.clients-inner {
    display: flex; gap: 14px;
    width: max-content;
    will-change: transform;
}

/* Each client card */
.client-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 14px 20px; min-width: 120px; flex-shrink: 0;
    background: var(--bg-section); border: 1px solid var(--border);
    border-radius: var(--r); transition: var(--transition);
}
.client-item:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: var(--shadow); }
.client-item-logo { height: 46px; display: flex; align-items: center; justify-content: center; }
.client-item-logo img { max-width: 90px; max-height: 44px; object-fit: contain; filter: grayscale(40%) opacity(.8); transition: filter .3s; }
.client-item:hover .client-item-logo img { filter: none; }
.client-initials { width: 46px; height: 46px; border-radius: 10px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Montserrat',sans-serif; font-weight: 900; font-size: 15px; }
.client-item-name { font-size: 11px; font-weight: 700; text-align: center; }
.client-item-badge { font-size: 10px; color: var(--accent); font-weight: 700; text-align: center; }

/* Mobile: switch to grid, disable marquee JS */
@media (max-width: 640px) {
    .clients-wrap {
        overflow: visible;
        mask-image: none;
        -webkit-mask-image: none;
    }
    .clients-inner {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        width: 100% !important;
        transform: none !important;
        will-change: unset;
    }
    .client-item { min-width: unset; }
}

/* ══════════════════════════════════════════════════
   PORTFOLIO — 3D Cards
══════════════════════════════════════════════════ */
.portfolio-sec { margin-top: 46px; }

/* Filters */
.pf-filters { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 26px; }
.filter-btn {
    padding: 8px 20px; background: transparent;
    border: 1.5px solid var(--border); border-radius: 24px;
    color: var(--text-gray); font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer; transition: var(--transition);
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Empty */
.pf-empty { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.pf-empty div { font-size: 52px; margin-bottom: 12px; opacity: .3; }
.pf-empty p   { font-size: 15px; }

/* Grid */
.pf-grid {
    display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr));
    gap: 22px; perspective: 1400px;
}

/* Card */
.pf-card { aspect-ratio: 3/4; perspective: 1000px; }
.pf-card.hidden { display: none; }

.pf-inner {
    width: 100%; height: 100%;
    position: relative; transform-style: preserve-3d;
    transition: transform .72s cubic-bezier(.35,.1,.25,1.3);
    border-radius: var(--r-lg);
}

@media (hover: hover) { .pf-card:hover .pf-inner { transform: rotateY(180deg); } }
.pf-card.flipped .pf-inner { transform: rotateY(180deg); }

.pf-front, .pf-back {
    position: absolute; inset: 0; border-radius: var(--r-lg);
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    overflow: hidden;
}

/* Front */
.pf-front { background: var(--bg-card); box-shadow: 0 6px 28px rgba(0,0,0,.28); }
.pf-front img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.pf-card:hover .pf-front img { transform: scale(1.06); }
.pf-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 60px; background: linear-gradient(135deg,var(--bg-card),var(--bg-dark)); }

.pf-front-bar {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 18px 14px 14px;
    background: linear-gradient(to top, rgba(0,0,0,.78) 0%, transparent 100%);
    display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
}
.plat-icon { display:flex; align-items:center; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); color:rgba(255,255,255,.95); }
.plat-icon svg { display:block; }
.pf-mini-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.92); text-shadow: 0 1px 4px rgba(0,0,0,.9); }
.pf-mini-stats span { display:flex; align-items:center; gap:3px; }
.pf-mini-stats svg { flex-shrink:0; }

/* Back */
.pf-back {
    transform: rotateY(180deg);
    background: linear-gradient(145deg, var(--bg-card) 0%, color-mix(in srgb, var(--bg-card) 75%, var(--accent)) 100%);
    border: 1.5px solid rgba(74,180,230,.22);
    box-shadow: 0 10px 40px rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center; padding: 18px;
}
body[data-theme="light"] .pf-back { background: linear-gradient(145deg,#fff,#dbeafe); border-color: rgba(74,180,230,.35); }

.pf-back-body { width: 100%; display: flex; flex-direction: column; gap: 9px; }
.pf-back-body h4 { font-family: 'Montserrat',sans-serif; font-size: 15px; font-weight: 800; line-height: 1.3; }
.pf-meta { font-size: 12px; color: var(--text-gray); font-weight: 600; display:flex; align-items:center; gap:4px; }
.pf-meta svg { flex-shrink:0; }
.pf-desc { font-size: 11px; color: var(--text-muted); line-height: 1.65; border-top: 1px solid var(--border); padding-top: 9px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Stats */
.pf-stats { display: flex; gap: 6px; background: rgba(0,0,0,.18); border-radius: 10px; padding: 10px 8px; }
body[data-theme="light"] .pf-stats { background: rgba(74,180,230,.1); }
.pf-stat { flex: 1; text-align: center; border-right: 1px solid rgba(255,255,255,.1); }
.pf-stat:last-child { border-right: none; }
.ps-n { display: block; font-family: 'Montserrat',sans-serif; font-size: 18px; font-weight: 900; color: var(--accent); line-height: 1; margin-bottom: 3px; }
.ps-l { font-size: 9px; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; font-weight: 700; }

/* Action buttons */
.pf-actions { display: flex; gap: 8px; margin-top: 2px; }
.pf-btn-view {
    flex: 1; padding: 9px 10px; background: var(--accent); color: #fff;
    border: none; border-radius: 7px; font-size: 12px; font-weight: 700;
    font-family: inherit; text-align: center; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 5px;
    transition: var(--transition); text-decoration: none;
    box-shadow: 0 3px 12px rgba(74,180,230,.35);
}
.pf-btn-view:hover { transform: translateY(-2px); text-decoration: none; }
.pf-btn-zoom {
    padding: 9px 12px; background: transparent;
    color: var(--text-gray); border: 1.5px solid var(--border);
    border-radius: 7px; font-size: 12px; font-weight: 700;
    font-family: inherit; cursor: pointer; transition: var(--transition);
    white-space: nowrap;
}
.pf-btn-zoom:hover { border-color: var(--accent); color: var(--accent); }

/* Touch hint */
@media (hover: none) {
    .pf-front::after {
        content: '↻ Tap to flip';
        position: absolute; top: 10px; right: 10px;
        background: rgba(0,0,0,.55); color: rgba(255,255,255,.85);
        font-size: 10px; font-weight: 700; padding: 4px 8px;
        border-radius: 20px; letter-spacing: .5px;
    }
    .pf-card.flipped .pf-front::after { display: none; }
}

/* ══════════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════════ */
.lightbox {
    position: fixed; inset: 0; background: rgba(0,0,0,.95); z-index: 10000;
    display: none; align-items: center; justify-content: center;
    padding: 40px; opacity: 0; transition: opacity .3s;
}
.lightbox.active { display: flex; opacity: 1; }

.lb-close, .lb-prev, .lb-next {
    position: absolute; background: rgba(255,255,255,.1); border: 1.5px solid rgba(255,255,255,.2);
    color: #fff; width: 48px; height: 48px; border-radius: 50%;
    cursor: pointer; font-size: 22px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: var(--accent); border-color: var(--accent); }
.lb-close { top: 22px; right: 22px; }
.lb-prev  { left: 22px; top: 50%; transform: translateY(-50%); }
.lb-next  { right: 22px; top: 50%; transform: translateY(-50%); }

.lb-content { max-width: 88%; max-height: 88vh; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.lb-content img { max-width: 100%; max-height: 65vh; border-radius: var(--r); box-shadow: 0 20px 60px rgba(0,0,0,.8); }
.lb-info { text-align: center; color: #fff; max-width: 560px; }
.lb-info h3 { font-family: 'Montserrat',sans-serif; font-size: 20px; margin-bottom: 8px; }
.lb-info p  { color: rgba(255,255,255,.72); font-size: 14px; line-height: 1.6; margin-bottom: 10px; }
#lbMeta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; font-size: 13px; color: var(--accent); }
#lbMeta span, #lbMeta a { display:flex; align-items:center; gap:5px; }
#lbMeta svg { flex-shrink:0; }

/* ══════════════════════════════════════════════════
   CONTACT FORM
══════════════════════════════════════════════════ */
.contact-sec { margin-top: 50px; }
.contact-wrap {
    display: grid; grid-template-columns: 1fr 1.5fr; gap: 36px;
    background: var(--bg-section); padding: 30px;
    border-radius: var(--r); border: 1px solid var(--border); margin-top: 18px;
}
.contact-info h4 { font-family: 'Montserrat',sans-serif; font-size: 20px; margin-bottom: 10px; }
.contact-info > p { color: var(--text-gray); font-size: 14px; line-height: 1.7; margin-bottom: 22px; }
.contact-rows { display: flex; flex-direction: column; gap: 14px; }
.contact-row { display: flex; align-items: center; gap: 12px; color: var(--text-gray); font-size: 14px; }
.contact-row svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }

.contact-form { display: flex; flex-direction: column; gap: 14px; }
.form-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.contact-form input,
.contact-form textarea {
    width: 100%; padding: 12px 14px;
    background: var(--bg-card); border: 1.5px solid var(--border);
    border-radius: 6px; color: var(--text-color);
    font-size: 14px; font-family: inherit; transition: var(--transition);
}
.contact-form input:focus, .contact-form textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74,180,230,.15);
}
.contact-form textarea { resize: vertical; min-height: 110px; }

.btn-submit {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 13px 28px; background: var(--accent); color: #fff;
    border: none; border-radius: 6px;
    font-family: 'Montserrat',sans-serif; font-size: 13px; font-weight: 700;
    letter-spacing: 1.5px; cursor: pointer; transition: var(--transition);
    box-shadow: 0 4px 14px rgba(74,180,230,.32);
    width: fit-content;
}
.btn-submit svg { width: 16px; height: 16px; transition: transform .3s; }
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(74,180,230,.5); }
.btn-submit:hover svg { transform: translateX(4px); }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.form-msg { font-size: 14px; padding: 12px; border-radius: 6px; display: none; }
.form-msg.success { display: block; background: rgba(34,197,94,.12); color: #16a34a; border: 1px solid rgba(34,197,94,.25); }
.form-msg.error   { display: block; background: rgba(239,68,68,.12); color: #dc2626; border: 1px solid rgba(239,68,68,.25); }

/* ── Toast ─────────────────────────────────────── */
.toast {
    position: fixed; bottom: 22px; right: 22px; z-index: 10001;
    background: var(--bg-card); color: var(--text-color);
    padding: 14px 22px; border-radius: var(--r);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow-lg); font-weight: 600; max-width: 340px;
    transform: translateX(140%); transition: transform .4s cubic-bezier(.4,0,.2,1);
}
.toast.show    { transform: none; }
.toast.success { border-left-color: #22c55e; }
.toast.error   { border-left-color: #ef4444; }

/* ── Footer ────────────────────────────────────── */
.cv-footer {
    margin-top: 50px; padding: 24px;
    text-align: center; border-top: 1px solid var(--border);
    color: var(--text-muted); font-size: 13px;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .cv-wrap { padding: 24px 20px; }
    .cv-header { grid-template-columns: 1fr; text-align: center; gap: 18px; }
    .header-photo { margin: 0 auto; }
    .header-right { text-align: center; }
    .logo-circle { margin: 0 auto 10px; }
    .header-contact a { justify-content: center; }
    .header-name h1 { font-size: 44px; }
    .header-name h2 { font-size: 28px; letter-spacing: 5px; }
    .two-col { grid-template-columns: 1fr; gap: 0; }
    .stats-row { grid-template-columns: repeat(2,1fr); }
    .stat-box:nth-child(2) { border-right: none; }
    .services-grid { grid-template-columns: repeat(2,1fr); }
    .contact-wrap { grid-template-columns: 1fr; gap: 24px; padding: 20px; }
    .form-duo { grid-template-columns: 1fr; }
    .tl-item { grid-template-columns: 1fr; }
    .tl-date { flex-direction: row; flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 580px) {
    body { padding: 10px; }
    .stats-row { grid-template-columns: repeat(2,1fr); gap: 10px; padding: 16px; }
    .stat-num { font-size: 28px; }
    .services-grid { grid-template-columns: 1fr; }
    .skills-grid { grid-template-columns: 1fr; }

    /* Portfolio — single column, taller cards */
    .pf-grid { grid-template-columns: 1fr; gap: 16px; }
    .pf-card { aspect-ratio: 4/3; }

    /* Show title overlay on front face on mobile */
    .pf-front::before {
        content: attr(data-title);
        position: absolute; bottom: 0; left: 0; right: 0;
        padding: 28px 12px 10px;
        background: linear-gradient(to top, rgba(0,0,0,.82) 0%, transparent 100%);
        color: #fff; font-size: 13px; font-weight: 700; line-height: 1.3;
        z-index: 2; pointer-events: none;
    }

    /* Back card adjustments */
    .pf-back-body h4 { font-size: 14px; }
    .ps-n { font-size: 15px; }
    .pf-back { padding: 14px; }
    .pf-desc { -webkit-line-clamp: 2; }

    /* Tap hint more visible */
    .pf-front::after {
        font-size: 11px !important;
        padding: 5px 10px !important;
        top: 8px !important; right: 8px !important;
        background: rgba(74,180,230,.75) !important;
        color: #fff !important;
    }
    .pf-card.flipped .pf-front::after { display: none; }

    /* Filter buttons — scrollable row on mobile */
    .pf-filters {
        flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
        padding-bottom: 8px; gap: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .pf-filters::-webkit-scrollbar { display: none; }
    .filter-btn { flex-shrink: 0; padding: 7px 16px; font-size: 12px; }
}

/* Print / PDF */
@media print, .pdf-mode * {
    .theme-toggle, .back-to-top, .reading-progress,
    .clients-sec, .portfolio-sec, .contact-sec, .btn-pdf,
    .cv-footer, .skills-sec { display: none !important; }
}
