/*
 * KOSMOPOLITIKA — v 0.1
 * ══════════════════════════════════════
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    --color-bg: #f5f5f0;
    --color-text: #1d1f21;
    --color-text-muted: #5c5c5c;
    --color-accent: #8b1a1a;
    --color-border: #c5c5c0;
    --font-mono: 'Space Mono', 'Courier New', monospace;
    --max-width: 720px;
}

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

body {
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-text);
    background: radial-gradient(ellipse at center, #f5f5f0 0%, #e0e0d8 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 2rem 1.5rem;
    position: relative;
}

/* ═══════════════════════════════════════════
   LAYERED BACKGROUND EFFECTS
   ═══════════════════════════════════════════ */

/* Layer 1: Pulsing radial glow */
.bg-pulse {
    position: absolute;
    top: -10%;
    left: -10%;
    right: -10%;
    bottom: -10%;
    background: radial-gradient(ellipse at center,
        rgba(139, 26, 26, 0.12) 0%,
        transparent 50%);
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}


/* Overlay container for additional effects */
.bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

/* Layer 3: Static/noise grain */
.bg-noise {
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.07;
    animation: noise 0.3s steps(3) infinite;
}

@keyframes noise {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-2%, 2%); }
    40% { transform: translate(2%, -2%); }
    60% { transform: translate(-1%, -1%); }
    80% { transform: translate(1%, 1%); }
    100% { transform: translate(0, 0); }
}


/* Layer 5: Drifting particles */
.bg-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(29, 31, 33, 0.3);
    border-radius: 50%;
    animation: drift 30s linear infinite;
}

.particle:nth-child(1) { left: 10%; top: 100%; animation-delay: 0s; animation-duration: 25s; }
.particle:nth-child(2) { left: 20%; top: 100%; animation-delay: -5s; animation-duration: 30s; }
.particle:nth-child(3) { left: 30%; top: 100%; animation-delay: -10s; animation-duration: 28s; }
.particle:nth-child(4) { left: 40%; top: 100%; animation-delay: -15s; animation-duration: 32s; }
.particle:nth-child(5) { left: 50%; top: 100%; animation-delay: -3s; animation-duration: 26s; }
.particle:nth-child(6) { left: 60%; top: 100%; animation-delay: -8s; animation-duration: 29s; }
.particle:nth-child(7) { left: 70%; top: 100%; animation-delay: -12s; animation-duration: 31s; }
.particle:nth-child(8) { left: 80%; top: 100%; animation-delay: -18s; animation-duration: 27s; }
.particle:nth-child(9) { left: 90%; top: 100%; animation-delay: -22s; animation-duration: 33s; }
.particle:nth-child(10) { left: 15%; top: 100%; animation-delay: -7s; animation-duration: 28s; }
.particle:nth-child(11) { left: 35%; top: 100%; animation-delay: -14s; animation-duration: 30s; }
.particle:nth-child(12) { left: 55%; top: 100%; animation-delay: -20s; animation-duration: 25s; }
.particle:nth-child(13) { left: 75%; top: 100%; animation-delay: -2s; animation-duration: 32s; }
.particle:nth-child(14) { left: 95%; top: 100%; animation-delay: -11s; animation-duration: 29s; }
.particle:nth-child(15) { left: 5%; top: 100%; animation-delay: -16s; animation-duration: 26s; }

@keyframes drift {
    0% { transform: translateY(0) translateX(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-120vh) translateX(20px); opacity: 0; }
}

/* Layout */
header, main, footer {
    max-width: var(--max-width);
    margin: 0 auto;
}

header {
    margin-bottom: 2rem;
}

main {
    min-height: 70vh;
}

footer {
    margin-top: 4rem;
    padding-top: 1rem;
    color: var(--color-text-muted);
}

/* Typography — all same size */
h1, h2, h3, p, li {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.7;
}

h1, h2, h3 {
    margin-bottom: 0.5em;
}

p { margin-bottom: 1em; }

a {
    color: var(--color-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Navigation */
.site-title {
    color: var(--color-accent);
}

.site-title::before {
    content: "◆ ";
}

/* ═══════════════════════════════════════════
   INDEX PAGE — INTRO
   ═══════════════════════════════════════════ */

.intro {
    margin-bottom: 3rem;
}

.ascii-title {
    color: var(--color-text);
    margin: 0 0 1.5em 0;
    line-height: 1.1;
    letter-spacing: 0;
    font-size: 14px;
}

.ascii-section-title {
    color: var(--color-text);
    margin: 0 0 2em 0;
    line-height: 1.1;
    letter-spacing: 0;
    font-size: 10px;
}

.intro .intro-text p {
    margin-bottom: 1em;
}

.intro .intro-text p:last-child {
    margin-bottom: 0;
}

.version-tag {
    display: block;
    text-align: right;
    margin-top: 1.5em;
    color: var(--color-text-muted);
}

.ascii-divider {
    text-align: center;
    color: var(--color-text-muted);
    margin: 2rem 0;
    letter-spacing: 0.1em;
}

.menu-divider {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    margin: 0;
}

/* Top divider: space above (from intro) and below (to menu) */
.intro + .menu-divider {
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

/* Bottom divider: space above (from menu) and below (to content) */
.tabs + .menu-divider {
    margin-top: 0.5rem;
    margin-bottom: 2rem;
}

/* Blinking cursor */
.cursor {
    animation: blink 1s step-end infinite;
    color: var(--color-text);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ═══════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════ */

.tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5em;
    margin: 0;
    padding: 0 2em;
}

.tab {
    font-family: var(--font-mono);
    font-size: 14px;
    background: none;
    border: none;
    color: var(--color-text-muted);
    padding: 0.25em 0;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--color-text);
}

.tab.active {
    color: var(--color-text);
}

.tab::before {
    content: "[ ";
    color: var(--color-text-muted);
    transition: color 0.2s;
}

.tab::after {
    content: " ]";
    color: var(--color-text-muted);
    transition: color 0.2s;
}

.tab.active::before,
.tab.active::after {
    color: var(--color-accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-text {
    max-width: 600px;
}

.tab-text h2 {
    color: var(--color-text-muted);
    margin-bottom: 1.5em;
}

.tab-text h2::before {
    content: "┌─ ";
}

.tab-text ul {
    margin-left: 1.5em;
    margin-bottom: 1em;
}

.tab-text li {
    margin-bottom: 0.5em;
}

/* ═══════════════════════════════════════════
   IDEAS — TAROT CARDS
   ═══════════════════════════════════════════ */

#ideas {
    background: transparent;
}

.ideas-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    background: transparent;
}

.idea-card,
.idea-card-image,
.idea-card-title {
    background: transparent !important;
}

.idea-card {
    aspect-ratio: 2/3;
    border: 3px double var(--color-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.idea-card:hover {
    border-color: var(--color-text);
    text-decoration: none;
}

.idea-card:hover * {
    text-decoration: none;
}

.idea-card-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    overflow: hidden;
    background: transparent;
    margin-top: 0.5em;
}

.idea-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.idea-card-title {
    padding: 0.75em;
    text-align: center;
    font-size: 12px;
    background: transparent;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 3.5em;
    border-top: 1px solid var(--color-border);
    transition: border-color 0.2s;
}

.idea-card:hover .idea-card-title {
    border-color: var(--color-text);
}

/* Text-only cards */
.idea-card.text-only .idea-card-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.idea-card.text-only .idea-card-image::before {
    content: attr(data-symbol);
    font-size: 3rem;
    color: var(--color-text-muted);
    opacity: 0.3;
    text-decoration: none;
    transition: color 0.2s, opacity 0.2s;
}

.idea-card.text-only:hover .idea-card-image::before {
    color: var(--color-text);
    opacity: 0.6;
    text-decoration: none;
}

/* ═══════════════════════════════════════════
   INDEX PAGE — EPISODES (ARCHIVE TAB)
   ═══════════════════════════════════════════ */

.archive-section {
    margin-top: 0;
}

.episodes > h2 {
    color: var(--color-text-muted);
    margin-bottom: 1.5em;
}

.episodes > h2::before {
    content: "┌─ ";
}

.episode-card {
    margin-bottom: 2em;
    padding-left: 1.5em;
    border-left: 1px solid var(--color-border);
}

.episode-card h2 {
    margin-bottom: 0.5em;
    font-size: 1.5em;
    font-weight: 700;
}

.episode-card h2 a {
    color: var(--color-text);
}

.episode-card h2 a::before {
    content: "▸ ";
    color: var(--color-accent);
}

.episode-card time {
    color: var(--color-text-muted);
    display: block;
    margin-bottom: 0.5em;
}

.episode-card p {
    color: var(--color-text-muted);
    margin-bottom: 0;
}

.episode-card-video {
    margin: 1em 0;
}

/* ═══════════════════════════════════════════
   EPISODE PAGE
   ═══════════════════════════════════════════ */

.episode-header {
    margin-bottom: 2em;
    padding-bottom: 1.5em;
    border-bottom: 1px solid var(--color-border);
}

.episode-header h1 {
    font-weight: 700;
}

.episode-header h1::before {
    content: "▸ ";
    color: var(--color-accent);
}

.episode-header time {
    color: var(--color-text-muted);
    display: block;
    margin: 0.5em 0 1em 0;
}

.episode-header .description {
    color: var(--color-text-muted);
}

/* YouTube embed */
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    margin: 2em 0;
    background: #1d1f21;
    border: 1px solid var(--color-border);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Episode content */
.episode-content {
    margin-top: 2em;
}

.episode-content h2 {
    margin-top: 2em;
    padding-top: 1.5em;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.episode-content h2::before {
    content: "┌─ ";
}

.episode-content h2:first-child {
    border-top: none;
    padding-top: 0;
}

.episode-content h3 {
    color: var(--color-accent);
    margin-top: 1.5em;
}

.episode-content h3::before {
    content: "◇ ";
}

.episode-content ul, .episode-content ol {
    margin-left: 1.5em;
    margin-bottom: 1em;
}

.episode-content li {
    margin-bottom: 0.5em;
}

/* ═══════════════════════════════════════════
   IDEA PAGE
   ═══════════════════════════════════════════ */

.idea-header {
    margin-bottom: 2em;
    text-align: center;
}

.idea-header h1 {
    font-weight: 700;
    margin-top: 1em;
}

.idea-header h1::before {
    content: "◆ ";
    color: var(--color-accent);
}

.idea-hero-image {
    max-width: 300px;
    margin: 0 auto;
    border: 1px solid var(--color-border);
    padding: 1rem;
}

.idea-hero-image img {
    width: 100%;
    height: auto;
}

.idea-content {
    margin-top: 2em;
    padding-top: 1.5em;
    border-top: 1px solid var(--color-border);
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */

footer::before {
    content: "────────────────────────────────────────\A\A";
    white-space: pre;
    color: var(--color-border);
}

footer p {
    color: var(--color-text-muted);
}

footer p::before {
    content: "◆ ";
    color: var(--color-accent);
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 700px) {
    .ideas-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    body {
        padding: 1rem;
    }

    .ideas-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
