/* ==========================================================================
   cjazz — Ghost Theme
   A minimal dark photo-grid theme with frosted glass UI
   ========================================================================== */

/* Variables
   ========================================================================== */

:root {
    --ghost-accent-color: #FF1A75;

    /* Colours */
	--color-bg:          #111111;
	--color-surface:     #1c1c1c;
	--color-surface-2:   #252525;
	--color-text:        #f0f0f0;
	--color-text-muted:  rgba(240, 240, 240, 0.55);
	--color-border:      rgba(255, 255, 255, 0.08);

    /* Glass */
	--glass-bg:          rgba(17, 17, 17, 0.72);
	--glass-border:      rgba(255, 255, 255, 0.1);
	
    /* Spacing / radius */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius:    14px;
    --radius-lg: 18px;

    /* Grid */
    --grid-gap:  8px;
    --grid-pad:  8px;

    /* Header */
    --header-top:  16px;
    --header-side: 16px;
}

/* Reset & Base
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin:  0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.9), rgba(255,255,255,0) 35%),
        linear-gradient(180deg, #eef1f4 0%, #e4e8eb 100%);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

figure {
    margin: 0;
}

button {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background: none;
}

/* Glass utility
   ========================================================================== */

.glass {
    background:            var(--glass-bg);
    backdrop-filter:       blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid      var(--glass-border);
}

/* Header
   ========================================================================== */

.site-header {
    position: fixed;
    top:   var(--header-top);
    left:  var(--header-side);
    right: var(--header-side);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}

.site-header > * {
    pointer-events: auto;
}

/* Home button */
.site-header .home {
    display: flex;
    align-items: center;
    justify-content: center;
    width:  48px;
    height: 48px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.site-header .home:hover {
    background-color: rgba(255, 255, 255, 0.12) !important;
    transform: scale(1.05);
}

/* Nav menu pill */
.site-header .menu {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px;
    border-radius: var(--radius);
}

.site-header .menu .item {
    display: flex;
    align-items: center;
    justify-content: center;
    width:  42px;
    height: 42px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    transition: background-color 0.15s ease, transform 0.15s ease;
    font-size: 0.82rem;
    font-weight: 500;
}

.site-header .menu .item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.08);
}

.site-header .menu .item svg {
    flex-shrink: 0;
}

/* Main
   ========================================================================== */

.site-main {
    padding-top: 82px; /* clear fixed header */
}

/* ============================================================
   IMAGE GRID  (homepage & tag archive)
   ============================================================ */

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--grid-gap);
    padding: var(--grid-pad);
}

@media (min-width: 641px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 10px;
    }
}

@media (min-width: 1020px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 12px;
        padding: 12px;
    }
}

/* Post card
   ========================================================================== */

.post {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    background-color: var(--color-surface);
}

.post-link {
    display: block;
    overflow: hidden;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
}

.post-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 0.45s ease, opacity 0.3s ease;
}

.post:hover .post-image {
    transform: scale(1.04);
    opacity: 0.9;
}

.post-placeholder {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: rgba(255, 255, 255, 0.06);
}

/* Tag header (archive pages)
   ========================================================================== */

.tag-header {
    padding: 32px 16px 16px;
    max-width: 680px;
}

.tag-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.tag-description {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* ============================================================
   ARTICLE POPOVER  (dialog overlay)
   ============================================================ */

.article-popover {
    position: fixed;
    inset: 0;
    z-index: 2000;
    width:      100%;
    max-width:  100%;
    height:     100%;
    max-height: 100%;
    border: none;
    background: transparent;
    padding: 20px;
    display: none;
    align-items: center;
    justify-content: center;
}

/* Native <dialog> open state */
.article-popover[open] {
    display: flex;
}

.article-popover::backdrop {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter:         blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.article-popover__inner {
    background:    var(--color-surface);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-lg);
    width:      100%;
    max-width:  740px;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
    animation: popover-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popover-in {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.article-popover__close {
    position: fixed;
    top:   20px;
    right: 20px;
    width:  48px;
    height: 48px;
    border-radius: var(--radius-sm);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    z-index: 10;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.article-popover__close:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.08);
}

.article-popover__content {
    padding: 0;
}

/* ============================================================
   POST FULL  (inside popover AND standalone /post-slug/ page)
   ============================================================ */

.post-full {
    padding-bottom: 56px;
}

.post-full-image {
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background-color: var(--color-surface-2);
}

.post-full-image img {
    width:  100%;
    height: 100%;
    object-fit: cover;
}

.post-full-image figcaption {
    padding: 8px 16px;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    text-align: center;
}

.post-full-content {
    padding: 32px 40px 0;
}

@media (max-width: 600px) {
    .post-full-content {
        padding: 24px 20px 0;
    }
}

.post-full-header {
    margin-bottom: 24px;
}

.post-full-title {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin: 0 0 14px;
}

.post-full-excerpt {
    font-size: 1rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin: 0 0 20px;
}

/* Tags row */
.post-full-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.post-full-tags .tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 11px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: background 0.15s, color 0.15s;
}

.post-full-tags .tag:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--color-text);
}

/* Post body typography */
.post-full-body,
.gh-content {
    font-size:   1rem;
    line-height: 1.75;
    color: rgba(240, 240, 240, 0.88);
}

.post-full-body p,
.gh-content p {
    margin: 0 0 1.4em;
}

.post-full-body h2,
.gh-content h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 2em 0 0.7em;
    color: var(--color-text);
}

.post-full-body h3,
.gh-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 1.8em 0 0.6em;
    color: var(--color-text);
}

.post-full-body img,
.gh-content img {
    max-width: 100%;
    border-radius: var(--radius-xs);
    margin: 1.4em 0;
}

.post-full-body figure,
.gh-content figure {
    margin: 1.6em 0;
}

.post-full-body figcaption,
.gh-content figcaption {
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 8px;
}

.post-full-body blockquote,
.gh-content blockquote {
    border-left: 3px solid var(--ghost-accent-color);
    padding-left: 18px;
    margin: 1.6em 0;
    color: var(--color-text-muted);
    font-style: italic;
}

.post-full-body a,
.gh-content a {
    color: var(--ghost-accent-color);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-full-body hr,
.gh-content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2em 0;
}

.post-full-body ul,
.post-full-body ol,
.gh-content ul,
.gh-content ol {
    padding-left: 1.6em;
    margin: 0 0 1.4em;
}

.post-full-body li,
.gh-content li {
    margin-bottom: 0.4em;
}

/* Ghost Koenig card support */
.gh-content .kg-gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 6px;
    margin: 1.5em 0;
}

.gh-content .kg-gallery-image img {
    width:  100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-xs);
    margin: 0;
}

.gh-content .kg-image-card {
    margin: 1.5em 0;
}

.gh-content .kg-width-wide {
    margin-left:  -40px;
    margin-right: -40px;
}

.gh-content .kg-width-full {
    margin-left:  -40px;
    margin-right: -40px;
    border-radius: 0;
}

@media (max-width: 600px) {
    .gh-content .kg-width-wide,
    .gh-content .kg-width-full {
        margin-left:  -20px;
        margin-right: -20px;
    }
}

.gh-content .kg-video-card {
    margin: 1.5em 0;
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.gh-content .kg-bookmark-card {
    margin: 1.5em 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    overflow: hidden;
    display: flex;
}

/* Post footer */
.post-full-footer {
    padding: 32px 40px 0;
}

.post-full-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    transition: color 0.15s;
}

.post-full-back:hover {
    color: var(--color-text);
}

/* ============================================================
   STATIC PAGE
   ============================================================ */

.page-full {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.page-full-image {
    margin: 0 0 32px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 2 / 1;
    background-color: var(--color-surface);
}

.page-full-image img {
    width:  100%;
    height: 100%;
    object-fit: cover;
}

.page-full-header {
    margin-bottom: 32px;
}

.page-full-title {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.15;
}

.page-full-body {
    font-size:   1.05rem;
    line-height: 1.75;
    color: rgba(240, 240, 240, 0.88);
}

.page-full-body p {
    margin: 0 0 1.5em;
}

.page-full-body a {
    color: var(--ghost-accent-color);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ============================================================
   ERROR PAGE
   ============================================================ */

.error-template {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    text-align: center;
    padding: 40px 20px;
    gap: 16px;
}

.error-code {
    font-size: 7rem;
    font-weight: 900;
    color: var(--ghost-accent-color);
    line-height: 1;
    letter-spacing: -0.06em;
}

.error-description {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    max-width: 360px;
}

.error-link {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    transition: background 0.15s;
    margin-top: 8px;
}

.error-link:hover {
    background: var(--color-surface-2);
}

/* ============================================================
   LOADING INDICATOR (infinite scroll)
   ============================================================ */

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    gap: 10px;
}

.loading-indicator::before {
    content: "";
    display: block;
    width:  18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--ghost-accent-color);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading state inside popover */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 220px;
    color: var(--color-text-muted);
    font-size: 0.88rem;
    gap: 10px;
}

.loading::before {
    content: "";
    display: block;
    width:  20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--ghost-accent-color);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* ============================================================
   SCROLLBAR (WebKit)
   ============================================================ */

::-webkit-scrollbar            { width: 5px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: rgba(255,255,255,0.18); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover{ background: rgba(255,255,255,0.3); }

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
    height: 40px;
}

/* ============================================================
   LIGHTROOM
   ============================================================ */

.article-popover__inner {
    background: rgba(20, 20, 20, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    width: 100%;
    max-width: 1200px;
    max-height: calc(100dvh - 40px);
    overflow: hidden;
    position: relative;
}

.article-popover__content {
    padding: 0;
}

.lightroom-view {
    position: relative;
    height: 100%;
    min-height: 70vh;
    max-height: calc(100dvh - 40px);
}

.lightroom-media {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
    background: #0d0d0d;
}

.lightroom-media img {
    max-width: 100%;
    max-height: calc(100dvh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
}

.lightroom-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px 24px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.lightroom-title {
    font-size: 1.1rem;
    color: #fff;
    margin: 0 0 6px;
}

.lightroom-excerpt {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
}