/* ── Live-preview token defaults (T3 — moved from tokens.css 2026-06-01)
   JS overrides these at render time via setProperty('--live-*', value).
   This block must load before any canvas CSS that uses var(--live-*).    */
:root {
    --live-primary:     var(--color-brand-cyan);
    --live-primary-rgb: var(--color-brand-cyan-rgb);
    --live-secondary:   #1a202c;
    --live-bg:          #F4F4F4;
    --live-text:        #111827;
    --live-font:        'Kufam', sans-serif;
    --live-font-size:   16px;
    --live-radius:      12px;
    --live-opacity:     1;
}

#wf-avatar { z-index: 10; }

/* Keep iframe/live render constrained even if injected/custom CSS is aggressive */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}
.canvas-body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
}
.canvas-body > * {
    box-sizing: border-box;
}

/* Real full-width section layer (optional per section) */
.pf-section-band {
    width: 100%;
    background: #fff;
    padding: 0;
    box-sizing: border-box;
    display: flow-root;
}

/* ── Shared section shell + card (SSOT — mirrors canvas-*.js) ── */
.master-standard-shell {
    width: 100%; max-width: var(--cb-max-width); margin: 20px auto;
}
.master-id-card {
    background: var(--glass-bg); backdrop-filter: var(--glass-blur);
    border-radius: var(--live-radius);
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 30px 70px rgba(0,0,0,0.1);
    padding: var(--card-padding, 2.5rem); box-sizing: border-box; overflow: hidden;
}

/* ── Skills ── */
.master-skills-header-minimal { text-align: center; margin-bottom: 30px; }
.master-skills-title-minimal {
    display: inline-block; font-size: 1.8rem; font-weight: 900;
    color: var(--live-text); margin: 0; font-family: var(--live-font);
    border-bottom: 4px solid var(--live-primary); padding-bottom: 10px;
}
.m-skills-grid { display: grid; gap: 15px; width: 100%; }
.m-skill-card {
    background: rgba(255,255,255,0.02);
    border-radius: calc(var(--live-radius) / 2);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 15px; display: flex; align-items: center; gap: 12px;
    transition: all 0.2s ease; box-sizing: border-box;
}
.m-skill-card.mode-grid { flex-direction: column; text-align: center; padding: 20px 10px; gap: 10px; }
.m-skill-card.mode-bars { flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; }
.m-skill-card:hover { border-color: var(--live-primary); background: rgba(255,255,255,0.05); }
.m-skill-icon { width: 38px; height: 38px; object-fit: contain; }
.m-skill-icon-placeholder {
    width: 38px; height: 38px; background: rgba(var(--live-primary-rgb), 0.1);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: var(--live-primary);
}
.m-skill-name { font-weight: 800; font-size: 0.9rem; color: var(--live-text-2); }
.m-skill-perc { font-weight: 900; font-size: 0.75rem; color: var(--live-primary); opacity: 0.8; }
.m-skill-info { flex: 1; width: 100%; }
.m-skill-top  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.m-skill-progress-bg  { height: 5px; background: rgba(0,0,0,0.05); border-radius: 10px; overflow: hidden; width: 100%; }
.m-skill-progress-bar { height: 100%; background: var(--live-primary); border-radius: 10px; }
.m-skill-row {
    display: flex; align-items: center; gap: 15px;
    padding: 12px 10px; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.m-skill-row:last-child { border-bottom: none; }
.m-skill-row-icon { width: 24px; height: 24px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.m-skill-row-icon img { width: 24px; height: 24px; object-fit: contain; }
.m-skill-row-icon i  { font-size: 1.1rem; color: var(--live-primary); }
.m-skill-row-name { font-weight: 700; font-size: 1rem; color: var(--live-text-2); flex: 1; }
.m-skill-row-perc { font-weight: 800; font-size: 0.85rem; color: var(--live-primary); opacity: 0.7; }

/* ── Portfolio ── */
#portfolio-preview {
    overflow: hidden;
}
#portfolio-preview > .master-standard-shell,
#portfolio-preview .m-p-stack,
#portfolio-preview .m-p-groups,
#portfolio-preview .m-p-group,
#portfolio-preview .m-p-separate-card,
#portfolio-preview .master-id-card {
    min-width: 0;
    box-sizing: border-box;
}
.m-p-section-title {
    font-size: 1.8rem; font-weight: 900; color: var(--live-text);
    margin: 0 0 35px; font-family: var(--live-font); text-align: center;
    border-bottom: 4px solid var(--live-primary); padding-bottom: 12px;
}
.m-p-stack  { display: flex; flex-direction: column; }
.m-p-groups { display: flex; flex-direction: column; gap: 40px; }
.m-p-separate-card { margin-bottom: 20px; }
.m-p-separate-card:last-child { margin-bottom: 0; }
.m-p-group-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.m-p-group-title {
    margin: 0; font-size: 1.15rem; font-weight: 800;
    color: var(--live-text-2); font-family: var(--live-font);
    width: 100%;
}
.m-p-grid {
    display: grid;
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(var(--m-p-cols, 3), minmax(0, 1fr));
    gap: var(--m-p-gap, 20px);
    overflow: hidden;
}
.m-p-item { border-radius: calc(var(--live-radius) / 2); overflow: hidden; background: rgba(255,255,255,0.05); }
.m-p-img  { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-p-grid--masonry { display: block; columns: var(--m-p-cols, 3); column-gap: var(--m-p-gap, 20px); }
.m-p-grid--masonry .m-p-item { break-inside: avoid; margin-bottom: var(--m-p-gap, 20px); height: auto; }
.m-p-grid--masonry .m-p-img  { height: auto; object-fit: unset; }
.cvs-slide {
    width: 100%; background-size: cover; background-position: center;
    border-radius: calc(var(--live-radius) / 2);
}
#portfolio-preview .swiper,
#portfolio-preview .swiper-wrapper,
#portfolio-preview .swiper-slide {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
#portfolio-preview .swiper {
    overflow: hidden;
}
.swiper-button-next, .swiper-button-prev { color: var(--live-primary); }
.swiper-button-next::after, .swiper-button-prev::after { font-size: 1.2rem; font-weight: 900; }
.swiper-pagination-bullet-active { background: var(--live-primary); }

/* ── Gallery filter portfolio ── */
.pf-gf-wrap {
    width: 100%; max-width: var(--cb-max-width); margin: 20px auto;
    padding: var(--card-padding, 2.5rem); box-sizing: border-box;
    background: var(--glass-bg); backdrop-filter: var(--glass-blur);
    border-radius: var(--live-radius);
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 30px 70px rgba(0,0,0,0.1);
}
.pf-gf-title {
    font-size: 1.8rem; font-weight: 900; color: var(--live-text);
    margin: 0 0 28px; font-family: var(--live-font); text-align: center;
    border-bottom: 4px solid var(--live-primary); padding-bottom: 12px;
}
.pf-gf-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 28px; }
.pf-gf-btn {
    outline: none; cursor: pointer; transition: .25s;
    padding: 9px 20px; border-radius: 50px; font-size: 0.85rem;
    font-family: var(--live-font);
}
.pf-gf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.pf-gf-item { overflow: hidden; border-radius: calc(var(--live-radius) / 2); aspect-ratio: var(--pf-aspect); }
.pf-gf-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.pf-gf-item:hover img { transform: scale(1.08); }
.pf-gf-item.pf-gf-hidden { display: none; }

/* ── Masonry Fullview portfolio ── */
.mfv-root { width: 100%; position: relative; }
.mfv-categories-view { width: 100%; max-width: var(--cb-max-width); margin: 20px auto; }
.mfv-categories-shell {
    background: var(--glass-bg); backdrop-filter: var(--glass-blur);
    border-radius: var(--live-radius);
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 30px 70px rgba(0,0,0,0.1);
    padding: var(--card-padding, 2.5rem);
}
.mfv-title {
    margin: 0 0 24px; text-align: center; color: var(--live-text);
    font-family: var(--live-font); font-size: 1.8rem; font-weight: 900;
    border-bottom: 4px solid var(--live-primary); padding-bottom: 12px;
}
.mfv-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 18rem));
    gap: 10px;
    direction: rtl;
    justify-content: start;
}
.mfv-category-card {
    position: relative;
    min-height: 0;
    aspect-ratio: 10 / 16;
    text-align: right; cursor: pointer;
    border-radius: 9px; border: 1px solid rgba(255,255,255,0.12);
    background: linear-gradient(165deg, rgba(255,255,255,0.12), rgba(255,255,255,0.02));
    color: var(--live-text); padding: 5px; display: grid; grid-template-rows: 1fr auto auto; align-content: stretch;
    box-sizing: border-box;
    overflow: hidden;
    transition: transform var(--dur-fast, 150ms) var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
}
.mfv-category-card:hover { transform: translateY(-2px); border-color: rgba(var(--live-primary-rgb), 0.45); }
.mfv-category-mock {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 7px;
    border: 1px solid rgba(255,255,255,0.14);
    background: linear-gradient(145deg, rgba(var(--live-primary-rgb), 0.38), rgba(25, 34, 46, 0.4));
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 7px;
    box-sizing: border-box;
    isolation: isolate;
    overflow: hidden;
}
.mfv-category-thumb {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0;
    padding: 0;
    border: 0;
    object-fit: cover !important;
    object-position: center center !important;
    clip-path: inset(0 round 7px);
    display: block;
}
.mfv-category-thumb-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,0.55);
    font-size: 1rem;
}
.mfv-category-mock-label {
    position: relative;
    z-index: 1;
    display: inline-block;
    max-width: 100%;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(12, 18, 25, 0.72);
    color: rgba(255,255,255,0.92);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.3;
    padding: 3px 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mfv-category-card strong {
    margin-top: 6px;
    font-family: var(--live-font);
    font-size: 0.74rem;
    font-weight: 700;
    display: block;
    width: 100%;
    line-height: 1.25;
}
.mfv-category-card .mfv-count { margin-top: 2px; font-size: 0.66rem; color: rgba(255,255,255,0.7); }
.mfv-category-card.is-empty {
    opacity: 0.45;
    cursor: not-allowed;
    filter: saturate(0.4);
}
.mfv-category-card.is-empty:hover {
    transform: none;
    border-color: rgba(255,255,255,0.12);
}

.mfv-empty-state {
    border: 1px dashed rgba(255,255,255,0.2); border-radius: 12px;
    padding: 50px 20px; text-align: center; color: rgba(255,255,255,0.5);
}
.mfv-empty-state i { font-size: 2rem; display: block; margin-bottom: 8px; }
.mfv-empty-state p { margin: 0; font-family: var(--live-font); font-size: 0.88rem; }

.mfv-stage-view {
    position: fixed; inset: 0; z-index: 30; overflow-y: auto;
    background:
        radial-gradient(circle at 10% 12%, rgba(var(--live-primary-rgb), 0.2), transparent 34%),
        rgba(18, 24, 30, 0.98);
    padding: 5.4rem 0 1rem;
}
.mfv-stage-view[hidden],
.mfv-lightbox[hidden] {
    display: none !important;
}
.mfv-back-btn {
    position: fixed; top: 14px; left: 14px; z-index: 35;
    border: 1px solid rgba(var(--live-primary-rgb), 0.45);
    background: rgba(30, 37, 43, 0.92); color: var(--studio-text, #f8fafc);
    border-radius: 999px; padding: 0.5rem 0.85rem; cursor: pointer;
    font-family: var(--live-font); font-size: 0.78rem;
}
.mfv-stage-chip {
    position: fixed; top: 14px; right: 14px; z-index: 35;
    display: inline-flex; align-items: center; gap: 8px;
    border-radius: 999px; border: 1px solid rgba(255,255,255,0.18);
    background: rgba(30, 37, 43, 0.78); color: var(--studio-text-dim, #94a3b8);
    padding: 7px 11px; backdrop-filter: blur(8px);
}
.mfv-chip-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--live-primary);
    box-shadow: 0 0 8px rgba(var(--live-primary-rgb), 0.7);
}
.mfv-chip-title { color: var(--studio-text, #f8fafc); font-size: 0.82rem; font-weight: 700; }
.mfv-chip-count { font-size: 0.76rem; }

.mfv-stage-wrap {
    padding: 0 14px;
    display: flex;
    justify-content: center;
}
.mfv-group {
    width: min(100%, 1320px);
}
.mfv-group-title {
    margin: 0 0 12px; color: var(--studio-text, #f8fafc);
    font-family: var(--live-font); font-size: 1rem; font-weight: 700;
}
.mfv-grid { column-count: 1; column-gap: 12px; }
.mfv-grid--few {
    column-count: unset;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 320px));
    justify-content: center;
    gap: 12px;
}
.mfv-item {
    break-inside: avoid; width: 100%; margin: 0 0 12px;
    border: 1px solid rgba(255,255,255,0.12); border-radius: 10px;
    background: rgba(255,255,255,0.03); padding: 0; overflow: hidden; cursor: zoom-in;
}
.mfv-grid--few .mfv-item {
    margin: 0;
    width: min(100%, 320px);
}
.mfv-item img { width: 100%; display: block; height: auto; }
.mfv-group-empty {
    border: 1px dashed rgba(255,255,255,0.2); border-radius: 10px;
    padding: 30px 20px; text-align: center; color: rgba(255,255,255,0.55);
    font-family: var(--live-font); font-size: 0.86rem;
}

.mfv-lightbox {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(9, 12, 15, 0.92);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.mfv-lb-figure { margin: 0; max-width: min(92vw, 1600px); max-height: 88vh; }
.mfv-lb-figure img {
    max-width: 100%; max-height: 88vh; width: auto; display: block;
    border-radius: 10px; border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 30px 70px rgba(0,0,0,0.45);
}
.mfv-lb-close, .mfv-lb-arrow {
    position: fixed; z-index: 41;
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid rgba(var(--live-primary-rgb), 0.45);
    background: rgba(30, 37, 43, 0.88); color: #f8fafc;
    cursor: pointer; font-size: 1.1rem;
}
.mfv-lb-close { top: 14px; right: 14px; }
.mfv-lb-arrow { top: 50%; transform: translateY(-50%); }
.mfv-lb-prev { right: 14px; }
.mfv-lb-next { left: 14px; }

@media (min-width: 700px) { .mfv-grid { column-count: 2; } }
@media (min-width: 1080px) { .mfv-grid { column-count: 3; } }
@media (min-width: 1440px) { .mfv-grid { column-count: 3; } }

/* ── Footer (ID+class beats layout-base.css #footer-preview rules) ── */
#footer-preview.m-footer-shell {
    width: 100%; max-width: var(--section-max-width, var(--cb-max-width)); margin: 20px auto;
    padding: 0 var(--p-floating-margin); box-sizing: border-box;
    background: transparent; border-radius: 0; border: none;
    box-shadow: none; backdrop-filter: none; display: block;
}
#footer-preview.m-footer-shell > .m-footer-card {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: var(--glass-bg); backdrop-filter: blur(25px);
    border-radius: var(--live-radius);
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 30px 70px rgba(0,0,0,0.1);
    padding: clamp(24px, 4vw, 44px) clamp(16px, 3vw, 36px);
    box-sizing: border-box;
    text-align: center;
    margin-bottom: 0;
    overflow: hidden;
}
.m-footer-title {
    display: inline-block; font-size: 1.8rem; font-weight: 900;
    color: var(--live-text); margin: 0 0 30px; font-family: var(--live-font);
    border-bottom: 4px solid var(--live-primary); padding-bottom: 12px;
}
.m-footer-socials {
    display: flex; flex-wrap: wrap; gap: 12px;
    justify-content: center; margin-bottom: 24px; min-height: 48px; align-items: center;
}
.m-footer-social-chip {
    width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
    background: rgba(var(--live-primary-rgb), 0.08);
    border: 1px solid rgba(var(--live-primary-rgb), 0.2);
    border-radius: 50%; font-size: 1.3rem; color: var(--live-primary);
    text-decoration: none;
}
.m-footer-social-img { width: 24px; height: 24px; object-fit: contain; }
.m-footer-copyright { margin: 0; font-size: 0.78rem; color: rgba(255,255,255,0.2); font-family: var(--live-font); }
.m-footer-no-socials { margin: 0; color: rgba(255,255,255,0.2); font-size: 0.9rem; font-family: var(--live-font); }

/* ── Lightbox ── */
#pf-lightbox {
    display: none; position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.92); cursor: pointer;
    align-items: center; justify-content: center;
}
#pf-lightbox.open { display: flex; }
#pf-lightbox img {
    max-width: 92vw; max-height: 88vh; object-fit: contain;
    border-radius: 10px; box-shadow: 0 30px 80px rgba(0,0,0,0.5);
    cursor: default; pointer-events: none;
}
#pf-lightbox-close {
    position: absolute; top: 18px; right: 22px; font-size: 2rem;
    color: rgba(255,255,255,0.7); cursor: pointer; line-height: 1;
    user-select: none;
}
#pf-lightbox-close:hover { color: #fff; }
.pf-lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.12); border: none; color: #fff;
    font-size: 3rem; line-height: 1; cursor: pointer;
    padding: 0.1em 0.45em; border-radius: 8px;
    transition: background 0.18s; user-select: none; z-index: 1;
}
.pf-lb-nav:hover { background: rgba(255,255,255,0.28); }
#pf-lightbox-prev { left: 16px; }
#pf-lightbox-next { right: 16px; }

/* ── Link-item overlay ── */
.m-p-item--link { position: relative; cursor: pointer; }
.cvs-slide--link { position: relative; }
.cvs-link-overlay {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(0,0,0,0.55); color: #fff;
    border-radius: 5px; font-size: 0.9rem; line-height: 1;
    padding: 3px 8px; pointer-events: none; transition: background 0.15s;
}
.m-p-item--link:hover .cvs-link-overlay,
.cvs-slide--link:hover .cvs-link-overlay { background: var(--live-primary); }

/* ── Mobile ── */
@media (max-width: 768px) {
    :root { --p-floating-margin: 1em; }

    /* Skills: enforce safe mobile grid regardless of inline desktop column count */
    #skills-preview .m-skills-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px;
    }

    #skills-preview .m-skill-card,
    #skills-preview .m-skill-row {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
    }

    #skills-preview .m-skill-card.mode-grid {
        padding: 12px 8px;
        gap: 8px;
    }

    #skills-preview .m-skill-icon,
    #skills-preview .m-skill-icon-placeholder {
        width: 30px;
        height: 30px;
        max-width: 100%;
        max-height: 100%;
        flex-shrink: 0;
    }

    #skills-preview .m-skill-icon-placeholder i {
        font-size: 1rem;
        line-height: 1;
    }

    #skills-preview .m-skill-name,
    #skills-preview .m-skill-row-name {
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

@media (max-width: 420px) {
    #skills-preview .m-skills-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .mfv-categories-shell { padding: 16px; }
    .mfv-categories-grid { grid-template-columns: minmax(16rem, 18rem); gap: 8px; justify-content: start; }
    .mfv-category-card { padding: 5px; }
    .mfv-stage-view { padding-top: 4.7rem; }
    .mfv-stage-wrap { padding: 0 8px; }
    .mfv-back-btn { top: 10px; left: 10px; font-size: 0.72rem; padding: 0.45rem 0.7rem; }
    .mfv-stage-chip { top: 10px; right: 10px; padding: 6px 9px; }
    .mfv-lb-close, .mfv-lb-arrow { width: 38px; height: 38px; }
}
