/* Styling for Apple-Edition Encyclopedia */

body, html {
    scroll-behavior: smooth;
}

.encyclopedia-container {
    width: 100%;
    padding-top: 100px;
}

.encyclopedia-intro {
    padding: 10vh 10%;
    text-align: center;
    margin-bottom: 5vh;
}

.hero-title {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #ffffff, #888888);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .hero-title {
    background: linear-gradient(135deg, #111111, #666666);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.encyclopedia-phase {
    margin-bottom: 8rem;
}

.phase-hero {
    position: relative;
    width: 100%;
    height: 70vh; /* Immersive AI Render Shot */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phase-hero::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, var(--bg-color) 0%, transparent 20%, transparent 80%, var(--bg-color) 100%);
    z-index: 2;
    pointer-events: none;
}

.parallax-img {
    position: absolute;
    top: -20%;
    width: 100%;
    height: 140%;
    object-fit: cover;
    z-index: 1;
    opacity: 0.6; /* Ensure text readability over 3D image */
}

.phase-hero-text {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 900px;
    padding: 2rem;
}

.phase-hero-text h2 {
    font-size: 4.5rem;
    color: var(--text-color);
    letter-spacing: -0.02em;
    text-shadow: 0 10px 40px var(--bg-color);
}

.phase-badge {
    background: rgba(255, 149, 0, 0.15); /* Subtler Orange */
    border: 1px solid rgba(255, 149, 0, 0.5);
    color: var(--accent);
    padding: 0.6rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: inline-block;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}

.phase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    padding: 4rem 10%;
    max-width: 1800px;
    margin: 0 auto;
}

/* Feature Cards representing User's entries */
.feature-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 24px;
    padding: 2.5rem;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    cursor: default;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08), 0 2px 10px rgba(0, 0, 0, 0.03);
}

.feature-card:hover {
    transform: translateY(-8px);
    background: var(--surface-border);
    border-color: rgba(52, 199, 89, 0.4);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15), 0 0 20px rgba(52, 199, 89, 0.15);
}

/* Abstract Micro Visual (Weg B elements) */
.feature-card::before {
    content: '';
    position: absolute;
    top: 2.8rem;
    right: 2.5rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34c759;
    box-shadow: 0 0 20px 2px #34c759;
    opacity: 0.3;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-card.no-dot::before {
    display: none !important;
}

.feature-card:hover::before {
    opacity: 1;
    transform: scale(2);
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1.2rem;
    color: var(--text-color);
    font-weight: 600;
    padding-right: 2rem;
    letter-spacing: -0.01em;
}

.feature-card p {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.6;
    font-weight: 300;
}

@media (max-width: 768px) {
    .phase-hero { height: 50vh; }
    .hero-title { font-size: 3rem; }
    .phase-hero-text h2 { font-size: 2.5rem; }
    .phase-grid { padding: 2rem 5%; }
}

/* Deep Dive Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-box {
    width: 90vw;
    height: 85vh;
    background: var(--bg-color);
    border: 1px solid var(--surface-border);
    border-radius: 30px;
    display: flex;
    box-shadow: 0 40px 100px rgba(0,0,0,0.8);
    position: relative;
    overflow: hidden;
    transform: scale(1);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.hidden .modal-box {
    transform: scale(0.95);
}

.modal-close-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: var(--surface-border);
    border: none;
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease;
}

.modal-close-btn:hover {
    background: var(--accent);
}

@media (max-width: 900px) {
    .modal-box {
        flex-direction: column;
        overflow-y: auto;
        height: 90vh;
    }
    .modal-left, .modal-right {
        width: 100% !important;
        border-right: none !important;
    }
    .modal-right {
        height: 300px;
        flex: none;
        order: -1; /* Image on top */
    }
    .modal-left {
        padding: 2rem 1.5rem !important;
        flex: none;
    }
    .modal-close-btn {
        background: rgba(0,0,0,0.5); /* Safe visibility over image */
        color: white;
    }
}

.modal-left {
    width: 45%;
    padding: 5rem 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--surface-border);
}

.modal-badge {
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.modal-left h2 {
    font-size: 3rem;
    margin-bottom: 2rem;
    line-height: 1.1;
    color: var(--text-color);
}

.modal-text {
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1.7;
    font-weight: 300;
}

.modal-anim-desc {
    margin-top: 2rem;
    padding: 1.5rem 0 1.5rem 1.5rem;
    border-left: 4px solid var(--accent);
    background: transparent;
    font-size: 1.1rem;
    color: var(--text-color);
    line-height: 1.6;
    font-weight: 500;
}

.modal-right {
    width: 55%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
}

.modal-visual-svg {
    width: 80%;
    height: 80%;
}

/* Aroma Synthesizer Settings Panel */
.aroma-synthesizer {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 24px;
    padding: 3rem;
    margin: 0 auto 4rem auto;
    max-width: 1200px;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.synth-slider-group {
    flex: 1;
    min-width: 220px; /* Allows 4 sliders to fit nicely in 1200px */
    display: flex;
    flex-direction: column;
}

/* Toggles Layer */
.synth-toggles-layer {
    flex-basis: 100%;
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-top: 2rem;
    padding-top: 3rem;
    border-top: 1px solid var(--surface-border);
}

.synth-toggle-group {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.toggle-text {
    display: flex;
    flex-direction: column;
}

.toggle-text strong {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.toggle-sub {
    font-size: 0.8rem;
    color: #888;
}

/* Apple iOS Switch CSS */
.apple-switch-wrapper {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.apple-switch-wrapper input {
    opacity: 0;
    width: 0;
    height: 0;
}

.apple-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-border);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--surface-border);
}

.apple-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

input:checked + .apple-slider {
    background-color: #34c759; /* Green active by default, though we might want colors per switch? */
    border-color: #34c759;
}

#toggle-trouble:checked + .apple-slider {
    background-color: #ff3b30;
    border-color: #ff3b30;
}

#toggle-seeds:checked + .apple-slider {
    background-color: #8a5c32;
    border-color: #8a5c32;
}

input:checked + .apple-slider:before {
    transform: translateX(26px);
}

.synth-slider-group label {
    font-size: 1.1rem;
    color: #a1a1a6;
    margin-bottom: 1.5rem;
    font-weight: 300;
}

.synth-slider-group label strong {
    color: var(--text-color);
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Apple-Style Range Input */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 40px; /* Big interaction area vertically */
    background: transparent;
    cursor: pointer;
    margin: 10px 0; /* Add some space above/below to push elements away from the thumb */
    position: relative;
    z-index: 10; /* Ensures the slider thumb is always clickable and not blocked by overflowing labels */
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: var(--surface-border);
    border-radius: 4px;
    border: 1px solid var(--surface-border);
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6), inset 0 1px 3px rgba(255,255,255,0.8);
    margin-top: -8px; /* (8px track height - 24px thumb height) / 2 = -8px */
    transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28), box-shadow 0.2s ease;
    cursor: grab;
}

input[type=range]:active::-webkit-slider-thumb {
    transform: scale(1.15);
    cursor: grabbing;
}

.synth-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    font-size: 0.8rem;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    padding-bottom: 4rem; /* more space for rotated text */
}

.synth-ticks span {
    width: 200px;
    margin: 0 -100px; /* Places center exactly at the flex space node */
    box-sizing: border-box;
    text-align: right;
    padding-right: 105px; /* Leaves 5px margin left of the pivot */
    padding-top: 5px; /* Pushes text down 5px from the pivot */
    position: relative;
    transform: rotate(-45deg); /* Text climbs an uphill slope */
    transform-origin: top center; /* Pivots around X=100px, Y=0px */
    white-space: nowrap;
}

.synth-ticks span::before {
    content: '';
    position: absolute;
    top: -15px; /* Extends upwards from pivot */
    left: 50%; /* Center at X=100px */
    margin-left: -1px;
    width: 2px;
    height: 15px; /* Meets the pivot exactly at Y=0px */
    background: rgba(255,255,255,0.4);
    transform: rotate(45deg); /* Counters parent rotation */
    transform-origin: bottom center; /* Pivots around X=100px, Y=0px */
}

/* Interactive Card States */
.aroma-card {
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.aroma-card.dimmed-aroma {
    display: none !important;
}

.aroma-card.active-aroma {
    opacity: 1;
    filter: none;
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(255,255,255,0.02);
}

.modal-visual-svg text {
    text-shadow: 0px 0px 8px #000, 0px 0px 12px #000;
    pointer-events: none;
    z-index: 999; /* Note: SVG elements don't inherently respect z-index against their siblings, so we also rely on DOM order in JS */
}
