:root {
    --color-primary: #B86F3C;
    --color-secondary: #F6F1E9;
    --color-bg-dialog: rgba(224, 164, 79, 0.25);
    --color-text-main: #4E3A2E;
    --color-text-author: #6A5244;
    --color-footer-bg: rgba(184, 111, 60, 0.25);
    --dialog-border: rgba(224, 164, 79, 0.45);
    --color-quotes: #B86F3C;
}

/* ============================================
   RESET E STRUTTURA PRINCIPALE
   ============================================ */

* {box-sizing: border-box;}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    background: var(--color-secondary);
    color: var(--color-text-main);
}

/* ============================================
   AREA PRINCIPALE
   ============================================ */

main {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    width: 100%;
    flex-shrink: 0;
    box-sizing: border-box;
    text-align: right;
    padding: .5rem 1rem;
    overflow: hidden;
    white-space: nowrap;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    background: var(--color-footer-bg);
}

/* ============================================
   BACKGROUND ANIMATO
   ============================================ */

#animated-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ============================================
   DIALOG
   ============================================ */

.dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    flex-shrink: 0;
    width: fit-content;
    max-width: 100%;
    max-height: 100%;
    background: var(--color-bg-dialog);
    border: 1px solid var(--dialog-border);
    border-radius: 14px;
    backdrop-filter: blur(20px);
    box-shadow: 0 0 35px rgba(0, 0, 0, .45);
    font-family: 'Montserrat', sans-serif;
    overflow: hidden;
}

.dialog-header {
    flex-shrink: 0;
    background: var(--color-primary);
    color: white;
    padding: 12px 18px;
    font-size: 1.3rem;
    font-weight: 500;
    white-space: normal;
    overflow-wrap: anywhere;
}

.dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 25px 35px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    text-align: center;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* ============================================
   FRASE
   ============================================ */

.phrase {
    width: 100%;
    font-family: 'Great Vibes', cursive;
    font-size: 2.2rem;
    margin: 10px 0;
    line-height: 1.4;
    text-align: center;
}

.phrase .quote {
    font-family: serif;
    font-size: 3rem;
    color: var(--color-quotes);
    margin: 0 8px;
}

/* ============================================
   AUTORE
   ============================================ */

.author {
    display: block;
    width: 100%;
    text-align: right;
    font-size: 1rem;
    color: var(--color-text-author);
    font-style: italic;
    margin-top: 15px;
}

/* Thinking iniziale centrato */
.author.thinking {text-align: center;}

/* ============================================
   PAROLE ANIMATE
   ============================================ */

.word {display: inline;}

/* ============================================
   ANIMAZIONE AUTORE
   ============================================ */

.author-reveal {display: none;}

@keyframes authorReveal {

    0% {
        opacity: 0;
        transform: translateY(24px);
        clip-path: inset(100% 0 0 0);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        clip-path: inset(0 0 0 0);
    }
}

/* ============================================
   SVG
   ============================================ */

.svg-scene {background: transparent;}

.ring-ext {stroke: var(--color-primary);}
.ring-mid {stroke: var(--dialog-border);}
.ring-int {stroke: var(--color-text-author);}

/* ============================================
   MOBILE
   ============================================ */

@media (max-width: 767px) {

    main {
        align-items: flex-start;
        justify-content: center;
    }
}