/* =========================================================
   YAPSPACE  –  hex blog grid
   ========================================================= */

/* ?? Canvas layers ?????????????????????????????????????????????????????????? */
#starfield,
#hex-bg-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

#starfield     { z-index: 0; }
#hex-bg-canvas { z-index: 1; }

/* ?? Scrollable page shell ?????????????????????????????????????????????????? */
#yap-page {
    position: fixed;
    inset: 0;
    z-index: 10;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* ?? Header ????????????????????????????????????????????????????????????????? */
#yap-header {
    padding: 1.6rem 2rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    pointer-events: none;
}

.back-link {
    position: fixed;
    top: 22px;
    left: 26px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.25s ease;
    pointer-events: all;
    z-index: 50;
}

.back-link:hover { color: rgba(255, 255, 255, 0.82); }
.back-arrow      { transition: transform 0.2s ease; }
.back-link:hover .back-arrow { transform: translateX(-5px); }

#yap-title {
    font-family: 'Orbitron', monospace;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff;
    position: relative;
    user-select: none;
    pointer-events: none;
    line-height: 1.1;
}

#yap-sub {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.65rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgba(0, 212, 255, 0.72);
}

/* ?? Hex grid ??????????????????????????????????????????????????????????????? */
#hex-grid {
    position: relative;
    width: calc(100% - 4rem);
    margin: 2rem auto 5rem;
    /* height set by JS */
}

/* ?? Individual hex cell ???????????????????????????????????????????????????? */
.hex-cell {
    position: absolute;
    width: 160px;
    height: 185px; /* ? 160 * 2/?3 */
    cursor: pointer;
    opacity: 0;
    transform: scale(0.6);
    transition:
        opacity   0.4s ease,
        transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        filter    0.3s ease;
    will-change: opacity, transform, filter;
}

.hex-cell.visible {
    opacity: 1;
    transform: scale(1);
}

.hex-cell:hover {
    transform: scale(1.1);
    filter:
        drop-shadow(0 0 10px var(--hc, #00d4ff))
        drop-shadow(0 0 28px color-mix(in srgb, var(--hc, #00d4ff) 45%, transparent));
    z-index: 5;
}

.hex-inner {
    width: 100%;
    height: 100%;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(
        155deg,
        color-mix(in srgb, var(--hc, #00d4ff) 15%, rgba(4, 6, 24, 0.88)),
        rgba(4, 6, 24, 0.85)
    );
    border: 1px solid color-mix(in srgb, var(--hc, #00d4ff) 22%, rgba(255, 255, 255, 0.06));
    box-shadow:
        inset 0 0 10px color-mix(in srgb, var(--hc, #00d4ff) 8%, rgba(0, 0, 0, 0.5)),
        0 0 20px color-mix(in srgb, var(--hc, #00d4ff) 8%, transparent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 3rem 1.4rem;
    text-align: center;
    transition: all 0.3s ease;
}

.hex-cell:hover .hex-inner {
    background: linear-gradient(
        155deg,
        color-mix(in srgb, var(--hc, #00d4ff) 28%, rgba(4, 6, 24, 0.92)),
        rgba(4, 6, 24, 0.88)
    );
    border-color: color-mix(in srgb, var(--hc, #00d4ff) 45%, rgba(255, 255, 255, 0.12));
    box-shadow:
        inset 0 0 14px color-mix(in srgb, var(--hc, #00d4ff) 12%, rgba(0, 0, 0, 0.4)),
        0 0 28px color-mix(in srgb, var(--hc, #00d4ff) 15%, transparent);
}

.hex-date {
    font-family: 'Orbitron', monospace;
    font-size: 0.52rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--hc, #00d4ff);
    opacity: 0.8;
    white-space: nowrap;
}

.hex-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #fff;
    line-height: 1.35;
    max-width: 90%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.hex-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin-top: 3px;
}

.hex-tag {
    font-size: 0.46rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 2px 6px;
}

/* ?? Empty state ???????????????????????????????????????????????????????????? */
#yap-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    gap: 1.5rem;
    color: rgba(255, 255, 255, 0.3);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.empty-hex {
    width: 100px;
    height: 115px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: emptyPulse 2.4s ease-in-out infinite alternate;
}

@keyframes emptyPulse {
    from { opacity: 0.4; }
    to   { opacity: 0.8; }
}

/* ?? Post overlay ??????????????????????????????????????????????????????????? */
#post-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(3, 2, 18, 0.82);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#post-overlay.open {
    opacity: 1;
    pointer-events: all;
}

#post-panel {
    position: relative;
    width: 100%;
    max-width: min(840px, 92vw);
    max-height: 84vh;
    background: rgba(4, 6, 24, 0.96);
    border: 1px solid rgba(0, 212, 255, 0.16);
    border-top: 2px solid color-mix(in srgb, var(--post-color, #00d4ff) 65%, rgba(255, 255, 255, 0.15));
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 0 0 1px rgba(0, 212, 255, 0.08),
        0 8px 60px rgba(0, 0, 0, 0.8),
        inset 0 0 20px rgba(0, 0, 0, 0.45),
        0 0 60px color-mix(in srgb, var(--post-color, #00d4ff) 18%, transparent);
    transform: translateY(24px) scale(0.96);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#post-overlay.open #post-panel {
    transform: translateY(0) scale(1);
}

#post-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 50%;
    color: rgba(0, 212, 255, 0.55);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    z-index: 1;
}

#post-close:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.5);
    color: #00d4ff;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.25);
}

#post-header {
    padding: 1.6rem 2rem 1.2rem;
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
    background: rgba(0, 212, 255, 0.04);
    flex-shrink: 0;
}

#post-meta {
    font-family: 'Orbitron', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--post-color, #00d4ff);
    opacity: 0.85;
    margin-bottom: 8px;
}

#post-title-el {
    font-family: 'Orbitron', monospace;
    font-size: clamp(1.1rem, 3.5vw, 1.65rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #fff;
    line-height: 1.25;
    margin-bottom: 12px;
}

#post-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

#post-tag-list .tag {
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 3px 11px;
}

/* ?? Post body (markdown rendered) ????????????????????????????????????????? */
#post-body {
    padding: 1.8rem 2rem 2rem;
    overflow-y: auto;
    flex: 1;
    line-height: 1.8;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.75);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.15) transparent;
}

#post-body::-webkit-scrollbar       { width: 4px; }
#post-body::-webkit-scrollbar-track { background: transparent; }
#post-body::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.2); border-radius: 2px; }
#post-body::-webkit-scrollbar-thumb:hover { background: rgba(0, 212, 255, 0.35); }

#post-body h1,
#post-body h2,
#post-body h3,
#post-body h4 {
    font-family: 'Orbitron', monospace;
    color: #fff;
    margin: 1.6em 0 0.6em;
    letter-spacing: 0.06em;
    line-height: 1.3;
    font-weight: 700;
}

#post-body h1 { font-size: 1.2rem; }
#post-body h2 { font-size: 1rem; color: var(--post-color, #00d4ff); }
#post-body h3 { font-size: 0.9rem; }
#post-body h4 { font-size: 0.82rem; }

#post-body p        { margin-bottom: 1em; }
#post-body a        { color: var(--post-color, #00d4ff); text-decoration: underline; text-underline-offset: 3px; transition: opacity 0.2s; }
#post-body a:hover  { opacity: 0.75; }
#post-body ul,
#post-body ol       { padding-left: 1.5rem; margin-bottom: 1em; }
#post-body li       { margin-bottom: 0.35em; }
#post-body blockquote {
    border-left: 2px solid var(--post-color, #00d4ff);
    margin: 1em 0;
    padding: 0.5em 1em;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    background: rgba(0, 212, 255, 0.03);
}
#post-body code {
    font-size: 0.85em;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'Consolas', 'Fira Code', monospace;
    color: rgba(0, 212, 255, 0.9);
}
#post-body pre {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 212, 255, 0.12);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    margin: 1em 0;
}
#post-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: rgba(0, 212, 255, 0.85);
}
#post-body hr {
    border: none;
    border-top: 1px solid rgba(0, 212, 255, 0.1);
    margin: 1.5em 0;
}
}
#post-body hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 1.5em 0;
}
