/**
 * ECHO v1.0 - Overlay Styles
 * 
 * Нейтральные стили без дизайна.
 * CSS отвечает ТОЛЬКО за: слои, transitions, opacity, pointer-events.
 */

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

/* Base font family for all Echo text elements */
.echo-text,
.echo-name,
.echo-hint,
.echo-affordance {
    font-family: 'Cormorant Garamond', Georgia, serif;
}

/* ============================================================================
   OVERLAY CONTAINER
   ============================================================================ */

.echo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: visible;
}

.echo-overlay[aria-hidden="true"] {
    opacity: 0;
    pointer-events: none;
}

.echo-overlay.echo-visible {
    opacity: 1;
    pointer-events: none;
}

/* ============================================================================
   BACKGROUND LAYER
   ============================================================================ */

.echo-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
    cursor: default;
}

.echo-overlay.echo-visible .echo-background {
    pointer-events: auto;
}

/* ============================================================================
   CONTENT LAYER
   ============================================================================ */

.echo-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    transition: opacity 0.2s ease;
}

/* Display mode: затемнённый и размытый фон окна с текстом эха */
.echo-overlay.echo-visible.echo-reading .echo-content {
    background: rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2rem 2.25rem;
    border-radius: 8px;
    max-width: 32em;
    box-sizing: border-box;
}

/* Input mode: затемнённый и размытый фон формы; форма крупнее, прямоугольная (не слишком тёмный) */
.echo-overlay.echo-visible.echo-input .echo-content,
.echo-overlay.echo-fading.echo-input .echo-content {
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 2.25rem 2.5rem;
    border-radius: 10px;
    width: min(92vw, 520px);
    min-width: 380px;
    max-width: min(92vw, 540px);
    box-sizing: border-box;
}

/* ============================================================================
   ECHO TEXT
   ============================================================================ */

.echo-text {
    font-size: 20px;
    font-weight: 300;
    letter-spacing: 0.01em;
    color: rgb(230, 225, 216);
    line-height: 1.6;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.echo-name {
    font-size: 14px;
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.02em;
    color: rgb(230, 225, 216);
    margin-bottom: 0.5em;
    opacity: 0.55;
    transition: opacity 0.2s ease;
}

.echo-hint {
    font-size: 18px;
    font-weight: 300;
    letter-spacing: 0.015em;
    color: rgb(230, 225, 216);
    line-height: 1.5;
    margin-top: 1em;
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

.echo-affordance {
    position: relative;
    z-index: 1;
    font-size: 14px;
    font-weight: 300;
    letter-spacing: 0.015em;
    color: rgb(230, 225, 216);
    margin-top: 0.8em;
    opacity: 0.45;
    cursor: default;
}

/* ============================================================================
   STATES
   ============================================================================ */

.echo-overlay[aria-hidden="true"] .echo-content {
    opacity: 0;
    pointer-events: none;
}

.echo-overlay.echo-visible .echo-content {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================================
   FADING STATE
   ============================================================================ */

.echo-overlay.echo-fading {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.echo-overlay.echo-fading .echo-content {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

/* ============================================================================
   READING STATE
   ============================================================================ */

.echo-overlay.echo-reading .echo-content {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================================
   INPUT STATE
   ============================================================================ */

.echo-overlay.echo-input .echo-content {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================================
   UI STRUCTURE (Header + Viewer + Composer)
   ============================================================================ */

.echo-ui-header {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: rgb(230, 225, 216);
    margin-bottom: 2em;
    opacity: 0.6;
    text-align: center;
}

.echo-viewer {
    margin-bottom: 2em;
    min-height: 120px;
}

/* Ряд: стрелки по краям + блок эхо по центру */
.echo-viewer-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2em;
    min-height: 120px;
}

.echo-viewer-row .echo-viewer {
    flex: 1;
    margin-bottom: 0;
    min-width: 0;
}

.echo-nav-arrow {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    color: rgb(230, 225, 216);
    background: transparent;
    border: none;
    padding: 0.5rem;
    opacity: 0.5;
    cursor: default;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.echo-nav-arrow:hover {
    opacity: 0.85;
}

.echo-nav-arrow:focus {
    outline: none;
    opacity: 0.8;
}

.echo-viewer-empty {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 17px;
    font-weight: 300;
    letter-spacing: 0.015em;
    color: rgb(230, 225, 216);
    opacity: 0.5;
    text-align: center;
    padding: 2em 1em;
    line-height: 1.6;
}

.echo-nav-hint {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 13px;
    font-weight: 300;
    letter-spacing: 0.02em;
    color: rgb(230, 225, 216);
    opacity: 0.4;
    margin-top: 1em;
    text-align: center;
}

.echo-composer {
    display: flex;
    flex-direction: column;
    gap: 1em;
    border-top: 1px solid rgba(230, 225, 216, 0.1);
    padding-top: 2em;
}

/* В режиме только формы — форма растянута по ширине контейнера, прямоугольная */
.echo-overlay.echo-input .echo-composer {
    width: 100%;
    min-width: 0;
}

.echo-overlay.echo-input .echo-input-textarea {
    min-height: 160px;
    width: 100%;
    box-sizing: border-box;
}

.echo-overlay.echo-input .echo-input-name {
    width: 100%;
    box-sizing: border-box;
}

.echo-input-textarea {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 18px;
    font-weight: 300;
    line-height: 1.6;
    letter-spacing: 0.01em;
    color: rgb(230, 225, 216);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(230, 225, 216, 0.2);
    padding: 1em;
    resize: vertical;
    min-height: 120px;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.echo-input-textarea:focus {
    border-color: rgba(230, 225, 216, 0.4);
    background: rgba(0, 0, 0, 0.4);
}

.echo-input-textarea::placeholder {
    color: rgba(230, 225, 216, 0.5);
}

.echo-input-name {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 16px;
    font-weight: 300;
    letter-spacing: 0.015em;
    color: rgb(230, 225, 216);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(230, 225, 216, 0.2);
    padding: 0.75em 1em;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.echo-input-name:focus {
    border-color: rgba(230, 225, 216, 0.4);
    background: rgba(0, 0, 0, 0.4);
}

.echo-input-name::placeholder {
    color: rgba(230, 225, 216, 0.5);
}

.echo-input-submit {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 16px;
    font-weight: 300;
    letter-spacing: 0.02em;
    color: rgb(230, 225, 216);
    background: transparent;
    border: 1px solid rgba(230, 225, 216, 0.3);
    padding: 0.75em 1.5em;
    cursor: default;
    opacity: 0.7;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    align-self: flex-start;
}

.echo-input-submit:hover {
    opacity: 1;
    border-color: rgba(230, 225, 216, 0.5);
}

.echo-input-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.echo-confirmation {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 18px;
    font-weight: 300;
    letter-spacing: 0.02em;
    color: rgb(230, 225, 216);
    opacity: 0.8;
    text-align: center;
    padding: 2em;
}

.echo-error {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 17px;
    font-weight: 300;
    letter-spacing: 0.02em;
    color: rgb(230, 225, 216);
    opacity: 0.85;
    text-align: center;
    padding: 2em;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .echo-content {
        max-width: 95%;
        padding: 1em;
    }

    .echo-overlay.echo-visible.echo-reading .echo-content {
        padding: 1.5rem 1.25rem;
        max-width: 95%;
    }

    .echo-overlay.echo-visible.echo-input .echo-content {
        padding: 1.5rem 1.25rem;
        min-width: 90vw;
        max-width: 90vw;
    }

    .echo-overlay.echo-input .echo-input-textarea {
        min-height: 140px;
    }

    .echo-viewer-row {
        gap: 0.5rem;
    }

    .echo-nav-arrow {
        font-size: 24px;
        padding: 0.35rem;
    }

    .echo-ui-header {
        font-size: 17px;
        margin-bottom: 1.5em;
    }
    
    .echo-viewer {
        margin-bottom: 1.5em;
        min-height: 100px;
    }
    
    .echo-viewer-empty {
        font-size: 16px;
        padding: 1.5em 1em;
    }
    
    .echo-nav-hint {
        font-size: 12px;
    }
    
    .echo-composer {
        padding-top: 1.5em;
    }
    
    .echo-text {
        font-size: 18px;
    }
    
    .echo-name {
        font-size: 14px;
    }
    
    .echo-hint {
        font-size: 16px;
    }
    
    .echo-affordance {
        font-size: 14px;
    }
    
    .echo-confirmation,
    .echo-error {
        font-size: 16px;
        padding: 1.5em;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

.echo-overlay[aria-hidden="true"] {
    visibility: hidden;
}

.echo-overlay.echo-visible {
    visibility: visible;
}

/* ============================================================================
   SCROLL BEHAVIOR
   ============================================================================ */

.echo-overlay {
    overflow: visible;
}

.echo-content {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    max-height: 80vh;
}

/* ============================================================================
   POINTER EVENTS CONTROL
   ============================================================================ */

.echo-overlay[aria-hidden="true"] * {
    pointer-events: none;
}

/* Overlay itself doesn't block pointer events */
.echo-overlay.echo-visible {
    pointer-events: none;
}

/* Only content and background intercept events when needed */
.echo-overlay.echo-visible .echo-background {
    pointer-events: auto;
}

.echo-overlay.echo-visible .echo-content {
    pointer-events: auto;
}

/* Allow page scrolling through overlay when not interacting with content */
.echo-overlay.echo-visible {
    touch-action: pan-y;
}

/* ============================================================================
   INTENTIONAL ECHO ENTRY ELEMENTS
   ============================================================================ */

/* Quiet entry: "Оставить здесь эхо" (Contact и др.) */
.echo-quiet-entry {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 16px;
    font-weight: 300;
    letter-spacing: 0.015em;
    color: rgb(230, 225, 216);
    cursor: default;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

/* Footer: "Оставить здесь эхо" — активная точка входа, заметная */
.echo-footer-trace {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 19px;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: rgb(230, 225, 216);
    cursor: default;
    opacity: 0.85;
    transition: opacity 0.25s ease;
    padding: 0.5em 0;
    display: inline-block;
}

.echo-footer-trace:hover {
    opacity: 1;
}

/* ⚠️ NO VISUAL INTERACTIVITY
   NO hover effects, NO pointer cursor, NO underline.
   Interaction is possible, but not visually promised. */
