/* Main CSS - Core styles, layout, colors */

/* Color Palette Variables */
:root {
    /* Pale Green */
    --green-bg: #d4e6d4;
    --green-accent: #a8d4a8;
    --green-dark: #7cb87c;

    /* Pale Yellow */
    --yellow-bg: #f5f0d4;
    --yellow-accent: #e6dca0;
    --yellow-dark: #d4c878;

    /* Pale Pink */
    --pink-bg: #f4d4d4;
    --pink-accent: #e8b4b4;
    --pink-dark: #d89494;

    /* Background */
    --bg-main: #fdfdf8;
    --bg-warm: #faf8f2;

    /* Text */
    --text-primary: #2c2c2c;
    --text-secondary: #5c5c5c;
    --text-muted: #8c8c8c;

    /* Shadows */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);

    /* Spacing */
    --card-padding: 2rem 2.5rem;
    --card-radius: 12px;
}

/* Reset and Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 0.25em;
}

h2 {
    font-size: 1.25rem;
    font-weight: 400;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 1em;
}

h3 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.5em;
}

/* Labels that cross the blob edge */
.card-video h3,
.card-audio h3 {
    position: relative;
    margin-top: -2.5rem;
    margin-left: -1rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    display: inline-block;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

h4 {
    font-size: 1.2rem;
    font-weight: 600;
    font-style: normal;
    margin-bottom: 0.5em;
}

p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1em;
}

/* Navigation Hint */
.nav-hint {
    position: fixed;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    pointer-events: none;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.5s ease;
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 2rem;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
}

.nav-hint.hidden {
    opacity: 0.6;
}

.nav-hint-secondary {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
}

/* Zoom Controls */
.zoom-controls {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.zoom-btn:hover {
    background: white;
    transform: scale(1.1);
}

.zoom-btn:active {
    transform: scale(0.95);
}

.zoom-reset {
    font-size: 1.1rem;
}

/* Audio Toggle Button */
.audio-toggle {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
    z-index: 1000;
}

.audio-toggle:hover {
    background: white;
    transform: scale(1.1);
}

.audio-toggle .audio-on {
    display: none;
}

.audio-toggle .audio-off {
    display: inline;
    opacity: 0.5;
}

.audio-toggle.playing .audio-on {
    display: inline;
}

.audio-toggle.playing .audio-off {
    display: none;
}

.audio-toggle.playing {
    color: var(--green-dark);
}

/* Card Base Styles */
.card {
    position: absolute;
    background: rgba(255, 255, 255, 0.85);
    padding: var(--card-padding);
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    cursor: default;
    max-width: 320px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    overflow: visible;
    /* Hide until positioned by JS */
    visibility: hidden;
}

/* Show cards after JS has positioned them */
.card.positioned {
    visibility: visible;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    opacity: 1;
    background: rgba(255, 255, 255, 0.95);
    transform: translate(-50%, -50%) scale(1.08);
    z-index: 100;
}

/* Organic blob shapes using border-radius */
.card:nth-child(1) { border-radius: 60% 40% 50% 45% / 50% 60% 35% 55%; }
.card:nth-child(2) { border-radius: 45% 55% 40% 60% / 55% 45% 60% 40%; }
.card:nth-child(3) { border-radius: 50% 45% 55% 50% / 40% 55% 45% 60%; }
.card:nth-child(4) { border-radius: 40% 60% 45% 55% / 60% 40% 55% 45%; }
.card:nth-child(5) { border-radius: 55% 45% 60% 40% / 45% 55% 40% 60%; }
.card:nth-child(6) { border-radius: 45% 50% 55% 45% / 55% 40% 50% 55%; }
.card:nth-child(7) { border-radius: 50% 55% 45% 50% / 45% 50% 55% 45%; }
.card:nth-child(8) { border-radius: 55% 40% 50% 55% / 50% 55% 45% 50%; }
.card:nth-child(9) { border-radius: 40% 55% 60% 45% / 55% 45% 50% 55%; }
.card:nth-child(10) { border-radius: 60% 45% 40% 55% / 40% 60% 55% 45%; }
.card:nth-child(11) { border-radius: 45% 60% 55% 40% / 60% 45% 40% 55%; }
.card:nth-child(12) { border-radius: 55% 50% 45% 60% / 50% 55% 60% 40%; }
.card:nth-child(13) { border-radius: 50% 40% 55% 45% / 45% 50% 40% 60%; }
.card:nth-child(14) { border-radius: 40% 55% 50% 60% / 55% 40% 45% 50%; }
.card:nth-child(15) { border-radius: 60% 50% 40% 50% / 40% 55% 60% 45%; }
.card:nth-child(16) { border-radius: 50% 45% 60% 40% / 60% 50% 45% 55%; }
.card:nth-child(17) { border-radius: 45% 55% 50% 55% / 50% 40% 55% 50%; }
.card:nth-child(18) { border-radius: 55% 60% 45% 50% / 45% 55% 50% 60%; }
.card:nth-child(19) { border-radius: 50% 40% 55% 60% / 55% 50% 60% 40%; }
.card:nth-child(20) { border-radius: 60% 55% 40% 45% / 40% 60% 50% 55%; }
.card:nth-child(21) { border-radius: 45% 50% 60% 55% / 60% 45% 55% 40%; }
.card:nth-child(22) { border-radius: 55% 45% 50% 40% / 50% 55% 40% 60%; }
.card:nth-child(23) { border-radius: 40% 60% 55% 50% / 55% 40% 60% 45%; }
.card:nth-child(24) { border-radius: 50% 55% 40% 60% / 45% 50% 55% 50%; }
.card:nth-child(25) { border-radius: 60% 40% 50% 45% / 50% 60% 45% 55%; }
.card:nth-child(26) { border-radius: 48% 52% 45% 55% / 52% 48% 55% 45%; }
.card:nth-child(27) { border-radius: 55% 45% 52% 48% / 45% 55% 48% 52%; }
.card:nth-child(28) { border-radius: 52% 48% 55% 45% / 48% 52% 45% 55%; }
.card:nth-child(29) { border-radius: 45% 55% 48% 52% / 55% 45% 52% 48%; }
.card:nth-child(30) { border-radius: 50% 50% 45% 55% / 50% 50% 55% 45%; }
.card:nth-child(31) { border-radius: 55% 45% 50% 50% / 45% 55% 50% 50%; }
.card:nth-child(32) { border-radius: 48% 52% 52% 48% / 52% 48% 48% 52%; }
.card:nth-child(33) { border-radius: 52% 48% 48% 52% / 48% 52% 52% 48%; }
.card:nth-child(34) { border-radius: 46% 54% 50% 50% / 54% 46% 50% 50%; }
.card:nth-child(35) { border-radius: 54% 46% 50% 50% / 46% 54% 50% 50%; }

/* Specific blob shapes for cards that might be missed */
#card-youtube3 { border-radius: 52% 48% 55% 45% / 48% 52% 45% 55%; }
#card-ch6 { border-radius: 45% 55% 48% 52% / 55% 45% 52% 48%; }
#card-vimeo6 { border-radius: 50% 50% 45% 55% / 50% 50% 55% 45%; }
#card-feltlive { border-radius: 48% 52% 45% 55% / 52% 48% 55% 45%; }
#card-vimeo1 { border-radius: 55% 45% 52% 48% / 45% 55% 48% 52%; }
#card-vimeo2 { border-radius: 52% 48% 55% 45% / 48% 52% 45% 55%; }
#card-vimeo3 { border-radius: 45% 55% 48% 52% / 55% 45% 52% 48%; }
#card-vimeo4 { border-radius: 50% 50% 45% 55% / 50% 50% 55% 45%; }
#card-vimeo5 { border-radius: 48% 52% 52% 48% / 52% 48% 48% 52%; }
#card-youtube1 { border-radius: 52% 48% 48% 52% / 48% 52% 52% 48%; }
#card-youtube2 { border-radius: 46% 54% 50% 50% / 54% 46% 50% 50%; }

/* Card Color Variants */
.card-green {
    background: linear-gradient(135deg, rgba(255,255,255,0.85) 0%, rgba(212,230,212,0.85) 100%);
    border: 1px solid var(--green-accent);
}

.card-yellow {
    background: linear-gradient(135deg, rgba(255,255,255,0.85) 0%, rgba(245,240,212,0.85) 100%);
    border: 1px solid var(--yellow-accent);
}

.card-pink {
    background: linear-gradient(135deg, rgba(255,255,255,0.85) 0%, rgba(244,212,212,0.85) 100%);
    border: 1px solid var(--pink-accent);
}

/* Title Card */
.card-title {
    text-align: center;
    padding: 3rem 2.5rem;
    max-width: 400px;
    background: white;
    border: 2px solid var(--green-accent);
}

.card-title h1 {
    font-size: 2rem;
    color: var(--text-primary);
}

.card-title h2 {
    font-size: 1.1rem;
    margin-bottom: 1.5em;
}

.card-title .author {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25em;
}

.card-title .subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.75em;
}

.card-title .site-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 0.5em;
}

/* Card Tags - small label pills across border */
.card-tag {
    position: absolute;
    top: -0.6em;
    left: 1.5rem;
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.3em 0.9em;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-muted);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.card-green .card-tag {
    background: rgba(80, 140, 80, 0.15);
    color: rgba(60, 100, 60, 0.9);
}

.card-yellow .card-tag {
    background: rgba(180, 160, 60, 0.15);
    color: rgba(140, 120, 40, 0.9);
}

.card-pink .card-tag {
    background: rgba(180, 100, 100, 0.15);
    color: rgba(140, 70, 70, 0.9);
}

/* Image cards already have the tag positioned, just adjust top */
.card-image .card-tag {
    top: -0.6em;
}

/* Chapter Cards */
.card-chapter {
    min-width: 240px;
    padding: 2.5rem 3rem;
    text-align: center;
}

.card-chapter h3 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25em;
    margin-top: 0;
}

.card-chapter h4 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 0.75em;
}

/* Chapter preview popup on hover */
.card-chapter .chapter-preview {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    margin-top: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    z-index: 200;
    backdrop-filter: blur(8px);
}

.card-chapter:hover .chapter-preview {
    display: block;
}

.chapter-preview::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid rgba(255, 255, 255, 0.95);
}

/* PDF Link */
.pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.pdf-link:hover {
    background: white;
    border-color: var(--green-accent);
    transform: translateY(-1px);
}

.pdf-icon {
    font-size: 1.1rem;
}

/* Image Card */
.card-image {
    padding: 0;
    overflow: hidden;
    max-width: 360px;
    background: white;
}

.card-image figure {
    margin: 0;
}

.card-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 9999px;
}

.card-image figcaption {
    padding: 1.25rem 1.5rem 1.5rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    text-align: center;
}

.card-image figcaption strong {
    display: block;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.25em;
}

.card-image .credit {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Card-image with text content */
.card-image h3 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 1rem 1.5rem 0.25rem;
    text-align: center;
}

.card-image h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0 1.5rem 0.5rem;
    text-align: center;
}

.card-image p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 1.5rem 1.25rem;
    text-align: center;
    line-height: 1.4;
}

.card-image .image-preview {
    display: block;
    padding: 1.25rem 1.25rem 0;
}

/* Audio Cards */
.card-audio {
    min-width: 300px;
}

.card-audio h3 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25em;
}

.card-audio h4 {
    margin-bottom: 1em;
}

.embed-container {
    margin-bottom: 1rem;
    overflow: hidden;
    border-radius: 9999px;
}

.embed-container iframe {
    display: block;
}

.audio-player {
    width: 100%;
    border-radius: 9999px;
}

.external-link {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.external-link:hover {
    color: var(--text-primary);
}

/* Video Cards */
.card-video {
    min-width: 340px;
    max-width: 400px;
}

.card-video h3 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5em;
}

.card-video h4 {
    font-size: 1.1rem;
    margin-bottom: 0.25em;
}

.video-subtitle {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 0.75em;
}

/* Video Preview Thumbnail System */
.video-preview {
    position: relative;
    cursor: pointer;
}

.video-thumbnail {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.video-thumbnail:hover {
    opacity: 0.8;
}

/* Placeholder thumbnail for local videos */
.video-thumbnail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--yellow-bg) 0%, var(--yellow-accent) 100%);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Play button overlay */
.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: transform 0.3s ease, background 0.3s ease;
}

.video-play-btn::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 18px solid var(--text-primary);
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    margin-left: 4px;
}

.video-preview:hover .video-play-btn {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(255, 255, 255, 1);
}

/* Video popup on hover */
.video-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 480px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.video-preview:hover .video-popup,
.video-popup:hover {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.video-popup iframe,
.video-popup video {
    width: 100%;
    height: 270px;
    border-radius: 8px;
    display: block;
}

.video-popup-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 8px;
    text-align: center;
    color: var(--text-primary);
}

/* Small card variant */
.card-small {
    min-width: 200px;
    max-width: 220px;
    padding: 1.25rem !important;
}

.card-small h3 {
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
}

/* Image preview with popup (similar to video) */
.image-preview {
    position: relative;
    display: block;
    cursor: pointer;
    text-decoration: none;
}

.image-thumbnail {
    width: 100%;
    height: 140px;
    object-fit: cover;
    object-position: center 30%;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.image-thumbnail-large {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.image-preview:hover .image-thumbnail-large {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.image-preview:hover .image-thumbnail {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Image popup on hover */
.image-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 400px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    pointer-events: none;
    z-index: 1000;
}

.image-preview:hover .image-popup {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.image-popup img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.image-popup-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 8px;
    text-align: center;
    color: var(--text-primary);
}

/* Links Card */
.card-links {
    min-width: 280px;
    padding: 2.5rem 2.5rem;
}

.card-links h3 {
    text-align: center;
    margin-bottom: 1rem;
}

.link-list {
    list-style: none;
}

.link-list li {
    margin-bottom: 0.75rem;
}

.link-list li:last-child {
    margin-bottom: 0;
}

.link-list a {
    display: block;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.link-list a:hover {
    background: white;
    border-color: var(--pink-accent);
    transform: translateX(4px);
}

.link-source {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25em;
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --card-padding: 1.25rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .card {
        max-width: 280px;
    }

    .card-title {
        padding: 2rem 1.5rem;
        max-width: 320px;
    }

    .card-audio {
        min-width: 260px;
    }
}
