/* === Explore — Interactive Discovery Demos === */

.explore-hero {
    text-align: center;
    padding: 3rem 0 0.5rem;
}

.explore-hero h1 {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text-primary);
    max-width: 650px;
    margin: 0 auto 0.75rem;
}

.explore-hero p {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ===================== Grid ===================== */
.explore-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    padding: 2rem 2.5rem 3rem;
    max-width: 1440px;
    margin: 0 auto;
}

/* ===================== Tile ===================== */
.explore-tile {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.explore-tile.wide { grid-column: span 2; }

/* Demo area */
.tile-demo {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    flex: 1;
    min-height: 0;
}

.tile-demo canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius, 8px);
}

.tile-demo .demo-hud {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
    pointer-events: none;
}

/* Info strip */
.tile-info {
    padding: 0.625rem 1rem 0.875rem;
    border-top: 1px solid var(--border);
}

.tile-info h3 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.2rem;
    line-height: 1.3;
}

.tile-info p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

/* Button row inside tile */
.tile-btn-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 0 1rem 0.75rem;
}

.tile-btn-row .demo-btn,
.tile-btn-row .demo-btn-secondary {
    padding: 0.3rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    border: none;
}

.tile-btn-row .demo-btn {
    background: var(--accent);
    color: white;
    transition: opacity 0.15s;
}
.tile-btn-row .demo-btn:hover { opacity: 0.85; }

.tile-btn-row .demo-btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: border-color 0.15s;
}
.tile-btn-row .demo-btn-secondary:hover { border-color: var(--accent); }

/* ===================== Sorting ===================== */
.sort-bars-wrap {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 150px;
    width: 100%;
    padding: 0 4px;
}

.sort-bars-wrap .bar {
    flex: 1;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    transition: height 0.08s, background 0.15s;
    min-width: 0;
}

/* ===================== Color Mixer ===================== */
.color-mixer-wrap {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
}

.color-sliders {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    flex: 1;
}

.color-slider-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-slider-row label {
    font-size: 0.8125rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
    width: 1.25rem;
    flex-shrink: 0;
}

.color-slider-row input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    outline: none;
}

.color-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
}

.color-slider-row .r-slider::-webkit-slider-thumb { background: #ef4444; }
.color-slider-row .g-slider::-webkit-slider-thumb { background: #22c55e; }
.color-slider-row .b-slider::-webkit-slider-thumb { background: #3b82f6; }

.color-slider-row span {
    font-size: 0.6875rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-muted);
    width: 1.75rem;
    text-align: right;
}

.color-result {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--border);
    flex-shrink: 0;
    transition: background 0.15s, box-shadow 0.15s;
}

.color-hex {
    text-align: center;
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

/* ===================== Binary ===================== */
.binary-wrap { width: 100%; }

.binary-input {
    width: 100%;
    padding: 0.4rem 0.65rem;
    font-size: 0.9375rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    outline: none;
    margin-bottom: 0.5rem;
}

.binary-input:focus { border-color: var(--accent); }

.binary-output {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    line-height: 1.7;
    color: var(--text-primary);
    min-height: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.5rem;
    align-content: flex-start;
}

.binary-output .bit-group { display: inline-block; position: relative; }
.binary-output .bit-char { display: block; font-size: 0.625rem; color: var(--text-muted); text-align: center; margin-bottom: 1px; }
.binary-output .bit { display: inline-block; width: 1ch; text-align: center; }
.binary-output .bit.one { color: #22c55e; }
.binary-output .bit.zero { color: var(--text-muted); }

/* ===================== Wave Controls ===================== */
.wave-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.wave-control {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.wave-control label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.wave-control input[type="range"] {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-primary);
    border-radius: 2px;
    outline: none;
}

.wave-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid white;
}

/* ===================== Gear Controls ===================== */
.gear-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.gear-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gear-control label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
    min-width: 6.5rem;
}

.gear-control input[type="range"] {
    width: 120px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-primary);
    border-radius: 2px;
    outline: none;
}

.gear-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ec4899;
    cursor: pointer;
    border: 2px solid white;
}

.gear-control span {
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-secondary);
    width: 1.5rem;
}

.gear-ratio-label {
    font-size: 0.6875rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-muted);
}

/* ===================== Caesar Cipher ===================== */
.cipher-wrap { width: 100%; }

.cipher-input {
    width: 100%;
    padding: 0.4rem 0.65rem;
    font-size: 0.875rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    outline: none;
    margin-bottom: 0.5rem;
}

.cipher-input:focus { border-color: var(--accent); }

.cipher-shift-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.cipher-shift-row label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.cipher-shift-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-primary);
    border-radius: 2px;
    outline: none;
}

.cipher-shift-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    border: 2px solid white;
}

.cipher-shift-row span {
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-secondary);
    width: 1.5rem;
    text-align: right;
}

.cipher-alphabet {
    margin-bottom: 0.5rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.5625rem;
    line-height: 1;
    overflow: hidden;
}

.cipher-alpha-row {
    display: flex;
    gap: 1px;
    justify-content: center;
}

.cipher-alpha-row .cipher-letter {
    width: 1.1rem;
    text-align: center;
    padding: 0.15rem 0;
    color: var(--text-muted);
    background: var(--bg-primary);
    border-radius: 2px;
}

.cipher-alpha-row.shifted .cipher-letter {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.cipher-output {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #10b981;
    letter-spacing: 0.05em;
    min-height: 1.4rem;
    word-break: break-all;
}

/* ===================== Game of Life Grid ===================== */
.life-grid {
    display: grid;
    gap: 1px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    width: 100%;
    aspect-ratio: 1;
}

.life-grid .cell {
    background: var(--bg-primary);
    transition: background 0.1s;
}

.life-grid .cell.alive {
    background: #22c55e;
    box-shadow: 0 0 4px rgba(34,197,94,0.4);
}

/* ===================== Discover Link ===================== */
.tile-discover-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #22c55e;
    text-decoration: none;
    transition: color 0.2s, transform 0.2s;
}

.tile-discover-link:hover {
    color: #4ade80;
    transform: translateX(3px);
}

/* ===================== Spring Mesh ===================== */
.spring-canvas {
    cursor: grab;
}
.spring-canvas:active {
    cursor: grabbing;
}

/* ===================== CTA ===================== */
.explore-cta {
    text-align: center;
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--border);
}

.explore-cta h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.explore-cta p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.explore-cta-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===================== Responsive ===================== */
@media (max-width: 900px) {
    .explore-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .explore-tile.wide {
        grid-column: span 2;
    }
}

@media (max-width: 600px) {
    .explore-hero { padding: 2rem 0 0.5rem; }
    .explore-hero h1 { font-size: 1.75rem; }

    .explore-grid {
        grid-template-columns: 1fr;
    }

    .explore-tile.wide {
        grid-column: span 1;
    }

    .sort-bars-wrap { height: 110px; }

    .color-mixer-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    .color-result { width: 60px; height: 60px; align-self: center; }
}
