/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #0f0f0f;
    --bg-card:  #1a1a1a;
    --text:     #e8e8e8;
    --muted:    #888888;
    --accent:   #f59e0b;
    --border:   #2a2a2a;
    --font:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono:     'SF Mono', 'Fira Code', monospace;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ===== HEADER ===== */
.site-header {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.site-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.site-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.site-title:hover { color: var(--accent); text-decoration: none; }
.site-description { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.01em; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}
.site-nav-link {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.site-nav-link:hover { color: var(--accent); text-decoration: none; }

/* ===== SITE HERO ===== */
.site-hero {
    width: 100%;
    max-height: 420px;
    overflow: hidden;
    line-height: 0;
    margin-bottom: 2rem;
}
.site-hero-image {
    width: 100%;
    height: 420px;
    object-fit: cover;
    object-position: center 65%;
    display: block;
}

/* ===== MAIN LAYOUT ===== */
.site-main { max-width: 1200px; margin: 0 auto; padding: 2rem; }

/* ===== POST FEED ===== */
.post-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.post-card-image-link { display: block; overflow: hidden; }
.post-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}
.post-card:hover .post-card-image { transform: scale(1.02); }

.post-card-content { padding: 1.25rem; }
.post-card-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.5rem; line-height: 1.3; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent); text-decoration: none; }
.post-card-excerpt { color: var(--muted); font-size: 0.875rem; margin-bottom: 0.75rem; line-height: 1.5; }

.post-card-footer { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.post-card-date { color: var(--muted); font-size: 0.8rem; }
.post-card-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ===== TAGS ===== */
.tag {
    display: inline-block;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    text-transform: lowercase;
    letter-spacing: 0.03em;
}

/* ===== SINGLE POST ===== */
.post { max-width: 860px; margin: 0 auto; }
.post-header { margin-bottom: 1.75rem; }
.post-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 1rem;
}
.post-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: 0.875rem; }
.post-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ===== FEATURE IMAGE ===== */
.post-feature-image {
    margin: 0 0 2rem;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.post-feature-image img {
    width: 100%;
    display: block;
    /* No height limit — charts should show at full resolution */
}
.post-feature-image img[data-zoomable] {
    cursor: zoom-in;
    user-select: none;
    -webkit-user-select: none;
}

/* ===== POST CONTENT ===== */
.post-content { font-size: 1.05rem; line-height: 1.8; }

.post-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 2.5rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
.post-content h3 { font-size: 1.2rem; font-weight: 600; margin: 2rem 0 0.5rem; }
.post-content p { margin-bottom: 1.25rem; }
.post-content ul, .post-content ol { margin: 0 0 1.25rem 1.5rem; }
.post-content li { margin-bottom: 0.4rem; }

.post-content img {
    border-radius: 4px;
    border: 1px solid var(--border);
    display: block;
    margin: 1.5rem auto;
}

/* Tables — key for data posts */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}
.post-content th {
    background: var(--bg-card);
    padding: 0.6rem 0.8rem;
    text-align: left;
    border: 1px solid var(--border);
    color: var(--accent);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.post-content td {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--border);
}
.post-content tr:nth-child(even) td { background: var(--bg-card); }

.post-content code {
    font-family: var(--mono);
    background: var(--bg-card);
    color: var(--accent);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.875em;
}
.post-content pre {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1.25rem 0;
}
.post-content pre code { background: none; padding: 0; color: var(--text); }

.post-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 1.5rem 0;
    padding: 0.5rem 1.25rem;
    color: var(--muted);
    font-style: italic;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.pagination a { color: var(--accent); }

/* ===== FOOTER ===== */
/* ===== AVATAR ===== */
.site-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 0.5rem;
    border: 2px solid var(--border);
}

/* ===== FOOTER ===== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    margin-top: 5rem;
}
.site-footer-links {
    margin-top: 0.5rem;
}
.site-footer-links a {
    color: var(--muted);
    text-decoration: none;
}
.site-footer-links a:hover {
    color: var(--accent);
}

/* ===== SUPPORT (KO-FI + OCTOPUS) ===== */
.post-support {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-top: 3rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
}
.post-support-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
}
.post-support-label {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0;
}
.post-support-btn {
    height: 36px;
    width: auto;
    border: 0;
    display: block;
    transition: opacity 0.15s;
}
.post-support-btn:hover {
    opacity: 0.85;
}
.post-support-divider {
    width: 1px;
    height: 60px;
    background: var(--border);
    flex-shrink: 0;
}
@media (max-width: 640px) {
    .post-support { flex-direction: column; }
    .post-support-divider { width: 100%; height: 1px; }
}

/* Minimal ko-fi on video posts */
.post-support--minimal {
    background: none;
    border: none;
    padding: 0.5rem 0;
    justify-content: flex-start;
}
.post-support--minimal .post-support-item {
    flex: none;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    text-align: left;
}
.post-support--minimal .post-support-label { display: none; }
.post-support--minimal .post-support-btn { height: 24px; }
.post-support--minimal .post-support-divider { display: none; }

/* ===== RELATED POSTS ===== */
.post-related {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.post-related-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted, #888);
    margin: 0 0 0.75rem;
}
.post-related-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}
.post-related-list a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.95rem;
}
.post-related-list a:hover { text-decoration: underline; }

/* ===== POST NAV ===== */
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.post-nav-prev,
.post-nav-next {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-decoration: none;
    max-width: 45%;
}
.post-nav-next {
    margin-left: auto;
    text-align: right;
}
.post-nav-label {
    color: var(--accent);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.post-nav-title {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.3;
}
.post-nav-prev:hover .post-nav-title,
.post-nav-next:hover .post-nav-title {
    color: var(--accent);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .site-main { padding: 1rem; }
    .post-feed { grid-template-columns: 1fr; }
    .site-header { padding: 1rem; }
    .site-nav { gap: 1rem; }
    .site-description { display: none; }
    .site-title { white-space: normal; }
    .post-nav { flex-direction: column; gap: 0.75rem; }
    .post-nav-prev,
    .post-nav-next {
        max-width: 100%;
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 0.75rem 1rem;
    }
    .post-nav-next { margin-left: 0; text-align: left; }
    .post-nav-prev:hover,
    .post-nav-next:hover {
        border-color: var(--accent);
        background: var(--card-bg);
    }
}

/* ===== VIDEO DIM OVERLAY ===== */
#yt-dim-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.93);
    z-index: 9998;
    cursor: pointer;
    transition: opacity 0.25s;
}
#yt-dim-overlay.active { display: block; }
.kg-embed-card.is-playing { position: relative; z-index: 9999; }

/* ===== VIDEOS PAGE (legacy) ===== */
.videos-title { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; margin-bottom: 0.5rem; }
.videos-subtitle { color: var(--muted); margin-bottom: 2rem; }

/* ===== COLLECTION PAGES (travel / videos) ===== */
.col-page { }
.col-page-header { margin-bottom: 1.75rem; }
.col-page-title { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; margin-bottom: 0.4rem; }
.col-page-sub { color: var(--muted); font-size: 0.95rem; }

.col-hero {
    display: block;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2.5rem;
    text-decoration: none;
    color: inherit;
    aspect-ratio: 21/9;
    background: #111;
}
.col-hero-img {
    position: absolute;
    inset: 0;
}
.col-hero-img img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    transition: transform 0.4s ease;
}
.col-hero:hover .col-hero-img img { transform: scale(1.025); }
.col-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.25) 55%, transparent 100%);
}
.col-hero-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 64px; height: 64px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    font-size: 1.4rem;
    padding-left: 4px;
    transition: background 0.2s, transform 0.2s;
    pointer-events: none;
}
.col-hero:hover .col-hero-play {
    background: var(--accent);
    color: #000;
    transform: translate(-50%, -50%) scale(1.1);
}
.col-hero-info {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 1.5rem 2rem;
}
.col-hero-badge {
    display: inline-block;
    background: var(--accent);
    color: #000;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 3px;
    margin-bottom: 0.55rem;
}
.col-hero-title {
    font-size: clamp(1.2rem, 3vw, 1.9rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 0.45rem;
}
.col-hero-sub {
    color: rgba(255,255,255,0.72);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 0.65rem;
    max-width: 580px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.col-hero-cta { color: var(--accent); font-size: 0.85rem; font-weight: 600; }

@media (max-width: 700px) {
    .col-hero { aspect-ratio: 16/9; }
    .col-hero-info { padding: 1rem 1.25rem; }
    .col-hero-play { width: 48px; height: 48px; font-size: 1.1rem; }
}

/* ===== VIDEO EMBED ===== */

/* First embed in a video post: prominent top-of-post player */
.post-content--video-hero .kg-embed-card:first-of-type {
    width: 100%;
    margin-left: 0;
    margin-top: 0;
    border-radius: 4px;
    padding-bottom: 56.25%; /* 16:9 of full column width */
}

.kg-embed-card {
    position: relative;
    width: min(1100px, 92vw);
    margin-left: calc(50% - min(550px, 46vw));
    padding-bottom: min(619px, 51.75vw); /* 16:9 of the above width */
    height: 0;
    overflow: hidden;
    border-radius: 6px;
    margin-top: 2rem;
    margin-bottom: 2rem;
}
.kg-embed-card iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}
/* Image captions */
.kg-image-card figcaption,
.kg-gallery-image figcaption {
    font-size: 0.78rem;
    color: #888;
    text-align: center;
    padding: 0.4rem 0.5rem 0;
    font-style: italic;
    line-height: 1.4;
}

/* fallback for manually-built embeds */
.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 6px;
    margin: 2rem 0;
}
.video-embed iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}
