/* =========================================================
   PORTFOLIO PAGE  –  HUD grid, card grid, sliding detail
   ========================================================= */

/* ?? Glitch title (mirrors about.css) ?????????????????????????????????????? */
.pf-title {
    font-family: 'Orbitron', monospace;
    font-size: clamp(1.4rem, 3.5vw, 2.2rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #fff;
    position: relative;
    user-select: none;
    pointer-events: none;
    animation: glitch-shake 8s infinite;
    white-space: nowrap;
}
.pf-title::before,
.pf-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%;
}
.pf-title::before { color: #00ffff; animation: glitch-slice-a 8s infinite; }
.pf-title::after  { color: #ff00ff; animation: glitch-slice-b 8s infinite; }

@keyframes glitch-shake {
    0%, 88%, 100% { transform: none; }
    90%  { transform: skewX(-2deg) translateX(2px); }
    92%  { transform: skewX( 1deg) translateX(-2px); }
    94%  { transform: skewX(-0.5deg); }
    96%  { transform: none; }
}
@keyframes glitch-slice-a {
    0%, 88%, 100% { opacity: 0; clip-path: none; transform: none; }
    90% { opacity: 0.8; clip-path: polygon(0 15% ,100% 15%, 100% 38%, 0 38%); transform: translate(-4px); }
    93% { opacity: 0.8; clip-path: polygon(0 58%, 100% 58%, 100% 76%, 0 76%); transform: translate(3px); }
    96% { opacity: 0; }
}
@keyframes glitch-slice-b {
    0%, 88%, 100% { opacity: 0; clip-path: none; transform: none; }
    91% { opacity: 0.75; clip-path: polygon(0 62%, 100% 62%, 100% 80%, 0 80%); transform: translate(4px); }
    94% { opacity: 0.75; clip-path: polygon(0 4%,  100% 4%,  100% 20%, 0 20%); transform: translate(-3px); }
    96% { opacity: 0; }
}

/* ?? HUD canvas ????????????????????????????????????????????????????????????? */
#hud-canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* ?? Page wrapper ??????????????????????????????????????????????????????????? */
#portfolio-page {
    position: fixed;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

/* ?? Header ????????????????????????????????????????????????????????????????? */
#pf-header {
    flex-shrink: 0;
    height: 66px;
    display: grid;
    grid-template-columns: 160px 1fr auto;
    align-items: center;
    padding: 0 28px;
    gap: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(24px) saturate(1.5);
    background: rgba(3, 2, 13, 0.7);
    pointer-events: all;
}

/* ?? Back link ?????????????????????????????????????????????????????????????? */
.back-link {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: color 0.25s ease;
    pointer-events: all;
    white-space: nowrap;
}
.back-link:hover { color: rgba(255, 255, 255, 0.8); }
.back-arrow { display: inline-block; transition: transform 0.2s ease; }
.back-link:hover .back-arrow { transform: translateX(-5px); }

/* ?? Stats bar ?????????????????????????????????????????????????????????????? */
#pf-stats {
    display: flex;
    align-items: center;
    gap: 18px;
    justify-content: flex-end;
}
.pf-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.pf-stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.05em;
    line-height: 1;
}
.pf-stat-label {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.5rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
}
.pf-stat-divider {
    width: 1px;
    height: 26px;
    background: rgba(255, 255, 255, 0.09);
}

/* ?? Body ??????????????????????????????????????????????????????????????????? */
#pf-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* ?? Sidebar ???????????????????????????????????????????????????????????????? */
#pf-sidebar {
    flex-shrink: 0;
    width: 208px;
    overflow-y: auto;
    padding: 20px 12px 20px 16px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(3, 2, 13, 0.5);
    backdrop-filter: blur(12px);
    pointer-events: all;
    display: flex;
    flex-direction: column;
    gap: 26px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
#pf-sidebar::-webkit-scrollbar { width: 3px; }
#pf-sidebar::-webkit-scrollbar-track { background: transparent; }
#pf-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.sidebar-section { display: flex; flex-direction: column; gap: 3px; }

.sidebar-label {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.5rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.22);
    margin-bottom: 7px;
    padding-left: 4px;
}

.filter-btn {
    background: none;
    border: 1px solid transparent;
    color: rgba(255, 255, 255, 0.38);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.67rem;
    letter-spacing: 0.1em;
    padding: 6px 10px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
}
.filter-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.65);
}
.filter-btn.active {
    background: rgba(0, 200, 255, 0.07);
    border-color: rgba(0, 200, 255, 0.18);
    color: #fff;
}
.filter-count {
    margin-left: auto;
    font-size: 0.57rem;
    color: rgba(255, 255, 255, 0.22);
    font-variant-numeric: tabular-nums;
}

/* ?? Grid wrap ?????????????????????????????????????????????????????????????? */
#pf-grid-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
    min-width: 0;
    min-height: 0;
    pointer-events: all;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}
#pf-grid-wrap::-webkit-scrollbar { width: 3px; }
#pf-grid-wrap::-webkit-scrollbar-track { background: transparent; }
#pf-grid-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

#pf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
    gap: 14px;
}

/* ?? Card ??????????????????????????????????????????????????????????????????? */
.pf-card {
    --c: #00d4ff;
    position: relative;
    background: rgba(5, 7, 26, 0.74);
    backdrop-filter: blur(16px) saturate(1.3);
    border: 1px solid color-mix(in srgb, var(--c) 20%, transparent);
    border-top: 2px solid var(--c);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    overflow: hidden;
    transition:
        border-color 0.28s ease,
        box-shadow   0.28s ease,
        transform    0.28s ease,
        opacity      0.35s ease;
}

/* Corner bracket – bottom right */
.pf-card::before {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 10px; height: 10px;
    border-bottom: 1px solid var(--c);
    border-right:  1px solid var(--c);
    opacity: 0;
    transition: opacity 0.28s ease;
}

/* Inner glow on hover */
.pf-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--c) 8%, transparent) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: none;
}

.pf-card:hover {
    border-color: color-mix(in srgb, var(--c) 55%, transparent);
    box-shadow: 0 0 28px color-mix(in srgb, var(--c) 10%, transparent),
                0 8px 24px rgba(0, 0, 0, 0.45);
    transform: translateY(-2px);
}
.pf-card:hover::before { opacity: 1; }
.pf-card:hover::after  { opacity: 1; }

.pf-card.active {
    border-color: var(--c);
    box-shadow: 0 0 36px color-mix(in srgb, var(--c) 18%, transparent),
                0 8px 28px rgba(0, 0, 0, 0.5);
}
.pf-card.active::before { opacity: 1; }

.pf-card.filtered {
    opacity: 0.08;
    pointer-events: none;
    transform: scale(0.97);
}

/* ?? Card sections ?????????????????????????????????????????????????????????? */
.card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.card-status {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.57rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--c);
    flex: 1;
}
.card-type {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.53rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.22);
    padding: 2px 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}
.card-date {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.3);
}

.card-body {
    padding: 14px 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.card-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.04em;
    line-height: 1.3;
}
.card-tech {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.63rem;
    letter-spacing: 0.08em;
    color: var(--c);
    opacity: 0.75;
}
.card-excerpt {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.71rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 300;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    gap: 8px;
}
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
}
.card-links { display: flex; gap: 8px; flex-shrink: 0; }

.card-link {
    color: rgba(255, 255, 255, 0.3);
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
    transition: color 0.2s ease;
}
.card-link:hover { color: var(--c); }

/* ?? Status dot ????????????????????????????????????????????????????????????? */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
    position: relative;
}
.status-dot.live     { background: #00ff88; box-shadow: 0 0 6px #00ff88; animation: dot-pulse 2.2s ease-in-out infinite; }
.status-dot.wip      { background: #ffcc00; box-shadow: 0 0 6px #ffcc00; animation: dot-pulse 1.5s ease-in-out infinite; }
.status-dot.archived { background: rgba(255,255,255,0.25); }
.status-dot.published { background: #00a8ff; box-shadow: 0 0 6px #00a8ff; animation: dot-pulse 1.8s ease-in-out infinite; }
.status-dot.cancelled { background: #ff4444; box-shadow: 0 0 6px #ff4444; }
.status-dot.cancelled::after { content: ''; position: absolute; inset: -1px; border: 1px solid #ff4444; border-radius: 50%; transform: rotate(45deg); }
.status-dot.cancelled::before { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-45deg); width: 8px; height: 1px; background: #ff4444; }
.status-dot.unfinished { background: #ff4444; box-shadow: 0 0 6px #ff4444; }
.status-dot.unfinished::after { content: ''; position: absolute; inset: -1px; border: 1px solid #ff4444; border-radius: 50%; transform: rotate(45deg); }
.status-dot.unfinished::before { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-45deg); width: 8px; height: 1px; background: #ff4444; }

@keyframes dot-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

/* ?? Tag pill ??????????????????????????????????????????????????????????????? */
.tag-pill {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.53rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    padding: 2px 6px;
    border-radius: 2px;
    white-space: nowrap;
}
.tag-more { color: rgba(255, 255, 255, 0.2); }

/* ?? Detail panel ??????????????????????????????????????????????????????????? */
#pf-detail {
    flex-shrink: 0;
    width: 0;
    overflow: hidden;
    transition: width 0.44s cubic-bezier(0.22, 1, 0.36, 1);
    border-left: 1px solid transparent;
    background: rgba(3, 2, 13, 0.6);
    backdrop-filter: blur(28px);
    --dc: #00d4ff;
}
#pf-detail.open {
    width: 400px;
    border-left-color: rgba(255, 255, 255, 0.07);
    overflow-y: auto;
    overflow-x: hidden;
    pointer-events: all;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
#pf-detail.open::-webkit-scrollbar { width: 3px; }
#pf-detail.open::-webkit-scrollbar-track { background: transparent; }
#pf-detail.open::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

#pf-detail-inner {
    width: 400px;
    padding: 24px 22px 32px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
}

#pf-detail-close {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.75rem;
    width: 26px;
    height: 26px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    transition: all 0.2s ease;
    margin-bottom: 18px;
}
#pf-detail-close:hover { background: rgba(255,255,255,0.07); color: #fff; }

#pf-detail-header {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    position: relative;
}
#pf-detail-header::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: var(--dc);
    box-shadow: 0 0 8px var(--dc);
    border-radius: 1px;
    margin-left: -22px;
}

#pf-detail-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.58rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
}
#pf-detail-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.18rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.05em;
    line-height: 1.3;
}
#pf-detail-tech {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.67rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.45);
}
#pf-detail-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
#pf-detail-date {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.25);
}
#pf-detail-links { display: flex; gap: 12px; }
.detail-link {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.63rem;
    letter-spacing: 0.14em;
    color: var(--dc);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--dc) 30%, transparent);
    padding-bottom: 1px;
    transition: all 0.2s ease;
}
.detail-link:hover { color: #fff; border-bottom-color: rgba(255,255,255,0.4); }

#pf-detail-tags { display: flex; flex-wrap: wrap; gap: 5px; }

/* ?? Markdown content ??????????????????????????????????????????????????????? */
.pf-md-content { flex: 1; }

.pf-md-content h1,
.pf-md-content h2,
.pf-md-content h3 {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    color: var(--dc);
    letter-spacing: 0.05em;
    margin: 1.5em 0 0.5em;
    line-height: 1.3;
}
.pf-md-content h1 { font-size: 1rem; }
.pf-md-content h2 { font-size: 0.9rem; }
.pf-md-content h3 { font-size: 0.8rem; color: rgba(255,255,255,0.6); }

.pf-md-content p {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.77rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.5);
    margin: 0.6em 0;
}
.pf-md-content strong { color: rgba(255, 255, 255, 0.85); font-weight: 600; }

.pf-md-content ul,
.pf-md-content ol {
    margin: 0.6em 0 0.6em 1.3em;
}
.pf-md-content li {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.75rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.46);
    margin: 0.15em 0;
}
.pf-md-content li::marker { color: var(--dc); }

.pf-md-content code {
    font-family: 'Courier New', monospace;
    font-size: 0.78em;
    background: rgba(255, 255, 255, 0.06);
    color: var(--dc);
    padding: 2px 5px;
    border-radius: 3px;
}
.pf-md-content pre {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 4px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 1em 0;
}
.pf-md-content pre code { background: none; padding: 0; font-size: 0.72rem; color: rgba(255,255,255,0.65); }

.pf-md-content a { color: var(--dc); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--dc) 35%, transparent); }
.pf-md-content a:hover { color: #fff; }

.pf-md-content hr { border: none; border-top: 1px solid rgba(255,255,255,0.07); margin: 1.4em 0; }

.pf-md-content blockquote {
    border-left: 2px solid var(--dc);
    margin: 1em 0;
    padding: 4px 14px;
    color: rgba(255,255,255,0.35);
    font-style: italic;
    font-size: 0.75rem;
}

/* ?? Empty states ??????????????????????????????????????????????????????????? */
#pf-empty,
#pf-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 55vh;
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.18);
    letter-spacing: 0.25em;
    text-transform: uppercase;
}
/* display:flex above overrides the browser's [hidden]{display:none} — restore it */
#pf-empty[hidden],
#pf-no-results[hidden] { display: none; }
.pf-empty-sub {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: lowercase;
    color: rgba(255, 255, 255, 0.1);
}

/* ?? Responsive ????????????????????????????????????????????????????????????? */
@media (max-width: 960px) {
    #pf-header { grid-template-columns: auto 1fr; height: auto; padding: 12px 18px; }
    .pf-title  { grid-column: 1 / -1; font-size: 1.6rem; }
    #pf-stats  { grid-column: 1 / -1; justify-content: flex-start; gap: 14px; }
    #pf-detail.open { width: 340px; }
    #pf-detail-inner { width: 340px; }
}

@media (max-width: 680px) {
    #pf-body { flex-direction: column; }
    #pf-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.06);
        padding: 10px 14px;
        gap: 18px;
        max-height: 52px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }
    .sidebar-section { flex-direction: row; align-items: center; gap: 5px; flex-shrink: 0; }
    .sidebar-label   { display: none; }
    #pf-grid { grid-template-columns: 1fr; }
    #pf-detail { height: 0; }
    #pf-detail.open {
        position: fixed;
        inset: 0;
        width: 100%;
        height: auto;
        z-index: 200;
    }
    #pf-detail-inner { width: 100%; }
}
