/**
 * State Induction Lab — Styles
 *
 * Two visual modes:
 *   Selector  — light, warm, matching primer aesthetic (#faf8f4)
 *   Experience — dark, meditative, full-screen overlay
 */

/* ==========================================================================
   Custom Properties
   ========================================================================== */

.sil-induction {
    /* Circle sizing */
    --sil-circle-min: 320px;
    --sil-circle-max: 480px;

    /* Breath timing — set by JS */
    --sil-inhale-dur: 5s;
    --sil-exhale-dur: 5s;

    /* State theme — set by JS */
    --sil-circle-fill: radial-gradient(circle, #bf6a00 0%, #7a3d00 100%);
    --sil-circle-ring: rgba(255, 180, 80, 0.4);
    --sil-text-color: #fff8ee;
    --sil-bg-color: #1a0e00;
}

/* ==========================================================================
   Selector UI (Light Theme)
   ========================================================================== */

.sil-selector {
    background: #faf8f4;
    max-width: 680px;
    margin: 0 auto;
    padding: 48px 32px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #2c2c2c;
}

/* ---- Header ---- */

.sil-selector__header {
    text-align: center;
    margin-bottom: 40px;
}

.sil-selector__title {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-size: 28px;
    font-weight: 500;
    color: #2c2c2c;
    margin: 0 0 8px;
    letter-spacing: 0.01em;
}

.sil-selector__subtitle {
    font-size: 14px;
    color: #666;
    margin: 0;
    font-style: italic;
}

/* ---- Section labels ---- */

.sil-selector__section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #888;
    font-weight: 600;
    margin: 0 0 14px;
}

/* ---- State tiles ---- */

.sil-state-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.sil-state-tiles--bottom {
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 32px;
}

.sil-state-tile {
    position: relative;
    background: #fff;
    border: 1px solid #e8e5e0;
    border-radius: 8px;
    padding: 20px 14px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.sil-state-tile:hover {
    border-color: #c9a96e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.sil-state-tile--active {
    border-color: #c9a96e;
    box-shadow: 0 0 0 2px rgba(201, 169, 110, 0.3);
}

.sil-state-tile__indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.sil-state-tile__name {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 17px;
    font-weight: 600;
    color: #2c2c2c;
    line-height: 1.2;
}

.sil-state-tile__alt {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sil-state-tile__desc {
    font-size: 11.5px;
    color: #777;
    font-style: italic;
    line-height: 1.4;
    margin-top: 2px;
}

/* State color indicators */
.sil-state-tile[data-state="gross"] .sil-state-tile__indicator      { background: radial-gradient(circle, #bf6a00, #7a3d00); }
.sil-state-tile[data-state="subtle"] .sil-state-tile__indicator     { background: radial-gradient(circle, #7c3aed, #3b1a6e); }
.sil-state-tile[data-state="causal"] .sil-state-tile__indicator     { background: radial-gradient(circle, #1e3a5f, #060a12); }
.sil-state-tile[data-state="witnessing"] .sil-state-tile__indicator { background: radial-gradient(circle, rgba(200,220,255,0.6), rgba(180,200,230,0.2)); border: 1px solid #d0d0d0; }
.sil-state-tile[data-state="nondual"] .sil-state-tile__indicator    { background: radial-gradient(circle, rgba(255,255,255,0.3), transparent); border: 1px solid #ccc; }

/* Full journey tile */
.sil-state-tile--journey {
    grid-column: 1 / -1;
    flex-direction: row;
    gap: 14px;
    text-align: left;
    padding: 14px 20px;
}

.sil-state-tile--journey .sil-state-tile__indicator {
    width: 32px;
    height: 32px;
    background: conic-gradient(from 180deg, #bf6a00, #7c3aed, #1e3a5f, rgba(200,220,255,0.4), transparent, #bf6a00);
    flex-shrink: 0;
}

.sil-state-tile--journey .sil-state-tile__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ---- Option groups (perspective, duration, breath) ---- */

.sil-selector__options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 32px;
    margin-bottom: 40px;
}

.sil-option-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sil-option-group__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #888;
    font-weight: 600;
    min-width: 90px;
    flex-shrink: 0;
}

.sil-segmented {
    display: flex;
    border: 1px solid #e8e5e0;
    border-radius: 6px;
    overflow: hidden;
    flex-wrap: wrap;
}

.sil-segmented__btn {
    background: #fff;
    border: none;
    border-right: 1px solid #e8e5e0;
    padding: 8px 14px;
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.sil-segmented__btn:last-child {
    border-right: none;
}

.sil-segmented__btn:hover {
    background: #f5f3ef;
}

.sil-segmented__btn--active {
    background: #2c2c2c;
    color: #fff;
}

/* Breath description */

.sil-breath-desc {
    font-size: 11px;
    color: #888;
    font-style: italic;
    margin-top: -10px;
    padding-left: 102px;
    min-height: 16px;
}

/* Estimated time */

.sil-estimated-time {
    font-family: 'Raleway', -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    font-variant-numeric: tabular-nums;
    text-align: center;
    min-height: 18px;
    letter-spacing: 0.02em;
}

/* ---- Begin button ---- */

.sil-begin-area {
    text-align: center;
}

.sil-begin-btn {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 20px;
    font-weight: 500;
    background: #2c2c2c;
    color: #faf8f4;
    border: none;
    border-radius: 8px;
    padding: 16px 56px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 0.05em;
}

.sil-begin-btn:hover {
    background: #444;
    transform: translateY(-1px);
}

.sil-begin-btn:active {
    transform: translateY(0);
}

.sil-begin-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   Experience Mode — Full-Screen Overlay
   ========================================================================== */

.sil-experience {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--sil-bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 1.2s ease;
    overflow: hidden;
}

.sil-experience--visible {
    opacity: 1;
}

/* ---- Circle area ---- */

.sil-circle-area {
    position: relative;
    width: var(--sil-circle-max);
    height: var(--sil-circle-max);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ---- Circle visual (the breathing element) ---- */

.sil-circle {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--sil-circle-fill);
    border: 1px solid var(--sil-circle-ring);
    box-shadow: 0 0 80px rgba(255, 255, 255, 0.03) inset,
                0 0 40px rgba(0, 0, 0, 0.3);
    width: var(--sil-circle-min);
    height: var(--sil-circle-min);
    opacity: 0;
    transition: none;
}

.sil-circle--visible {
    opacity: 1;
    transition: opacity 2s ease;
}

/* Phase-specific breathing transitions */

.sil-circle.phase-inhale {
    width: var(--sil-circle-max);
    height: var(--sil-circle-max);
    transition: width var(--sil-inhale-dur) cubic-bezier(0.45, 0.05, 0.55, 0.95),
                height var(--sil-inhale-dur) cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.sil-circle.phase-holdTop {
    width: var(--sil-circle-max);
    height: var(--sil-circle-max);
    transition: none;
}

.sil-circle.phase-exhale {
    width: var(--sil-circle-min);
    height: var(--sil-circle-min);
    transition: width var(--sil-exhale-dur) cubic-bezier(0.45, 0.05, 0.55, 0.95),
                height var(--sil-exhale-dur) cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.sil-circle.phase-holdBottom {
    width: var(--sil-circle-min);
    height: var(--sil-circle-min);
    transition: none;
}

/* ---- Circle content (text + timer) ---- */

.sil-circle-content {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ---- Instruction text ---- */

.sil-instruction {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(var(--sil-circle-min) - 80px);
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transform: translate(-50%, -50%);
}

.sil-instruction__text {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--sil-text-color);
    opacity: 0;
    /* transition controlled by JS per phase */
}

/* ---- Timer ---- */

.sil-timer {
    position: absolute;
    top: calc(50% + 64px);
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Raleway', -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: var(--sil-text-color);
    opacity: 0;
    transition: opacity 1.5s ease;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    text-align: center;
    white-space: nowrap;
}

.sil-timer--visible {
    opacity: 0.35;
}

/* ---- Experience footer ---- */

.sil-experience__footer {
    position: absolute;
    bottom: 28px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.sil-state-label {
    font-family: 'Raleway', sans-serif;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--sil-text-color);
    opacity: 0.3;
}

.sil-experience__controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sil-pause-btn,
.sil-stop-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--sil-text-color);
    opacity: 0.15;
    cursor: pointer;
    padding: 8px 12px;
    transition: opacity 0.2s;
    letter-spacing: 0.1em;
}

.sil-stop-btn {
    font-size: 14px;
}

.sil-pause-btn:hover,
.sil-stop-btn:hover {
    opacity: 0.4;
}

/* ---- Pause overlay ---- */

.sil-pause-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sil-pause-overlay--visible {
    opacity: 1;
    pointer-events: auto;
}

.sil-pause-overlay__text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

.sil-resume-btn {
    font-family: 'Raleway', sans-serif;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 10px 28px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.sil-resume-btn:hover {
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   Post-Experience Screen
   ========================================================================== */

.sil-post {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #faf8f4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s ease;
}

.sil-post--visible {
    opacity: 1;
    pointer-events: auto;
}

.sil-post__content {
    max-width: 480px;
    text-align: center;
}

.sil-post__reflection {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.55;
    color: #2c2c2c;
    font-style: italic;
    margin: 0 0 48px;
}

.sil-post__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.sil-post__btn {
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    border: 1px solid #2c2c2c;
    border-radius: 6px;
    padding: 12px 32px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    background: #fff;
    color: #2c2c2c;
}

.sil-post__btn--primary {
    background: #2c2c2c;
    color: #faf8f4;
}

.sil-post__btn:hover {
    background: #444;
    color: #fff;
    border-color: #444;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .sil-induction {
        --sil-circle-min: 260px;
        --sil-circle-max: 400px;
    }

    .sil-selector {
        padding: 32px 20px;
        border-radius: 8px;
    }

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

    .sil-state-tiles--bottom {
        grid-template-columns: 1fr;
    }

    .sil-option-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .sil-breath-desc {
        padding-left: 0;
    }

    .sil-circle-content {
        width: calc(var(--sil-circle-min) - 60px);
    }
}

@media (max-width: 480px) {
    .sil-induction {
        --sil-circle-min: 220px;
        --sil-circle-max: 330px;
    }

    .sil-state-tiles {
        grid-template-columns: 1fr;
    }

    .sil-selector__title {
        font-size: 24px;
    }

    .sil-segmented__btn {
        padding: 7px 10px;
        font-size: 11px;
    }

    .sil-instruction__text {
        font-size: 15px;
    }

    .sil-circle-content {
        width: calc(var(--sil-circle-min) - 48px);
    }

    .sil-begin-btn {
        padding: 14px 40px;
        font-size: 18px;
    }
}
