/* Root container */
#totem-app {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    position: relative;
    min-height: 400px;
}

#totem-app {
    position: relative;
}

/* All phases stack on top of each other */
.phase {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}
/* Phase containers */
.phase {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.phase.active {
    opacity: 1;
    pointer-events: auto;
    position: relative; /* active phase takes up space */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.phase.hidden {
    opacity: 0;
    pointer-events: none;
}


/* Intro screen */
.totem-title {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.totem-intro-text {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.totem-button {
    padding: 12px 24px;
    font-size: 1.1rem;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    background: #333;
    color: #fff;
    transition: background 0.3s ease;
}

.totem-button:hover {
    background: #555;
}





/* Transition container */
#phase-transition {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 260px;
    height: 260px;
}

/* Ensure transition phase is visible when active */
#phase-transition.phase.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

/* Animation wrapper */
.transition-animation {
    position: relative;
    width: 160px;
    height: 160px;
}

.transition-animation .circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    animation: totemEclipse 3s ease forwards;
}

@keyframes totemEclipse {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    40% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.1);
        opacity: 0;
    }
}



/* End of transition animation */






/* Reading screen */
.totem-image-wrapper {
    margin-bottom: 1rem;

    width: 200px;
    height: 200px;

    display: flex;
    justify-content: center;
    align-items: center;

    background: white;
    overflow: hidden;
}

.totem-image-wrapper img {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
}

.reading-totem-name {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.reading-meta {
    font-size: 0.95rem;
    opacity: 0.8;
    margin-bottom: 1.5rem;
}

.reading-meta span {
    display: inline-block;
    margin: 0 6px;
}

.reading-message {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.reading-yesno {
    font-weight: bold;
    margin-bottom: 2rem;
}

.daily-limit-note {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 2rem;
}




/* Reveal animation */
.hidden {
    opacity: 0;
    transform: translateY(12px);
}

.reveal {
    animation: fadeIn 1.8s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}



/* reading style */
.reading-meta {}
.reading-meta.reveal {
    font-style: italic;
    opacity: 0.9;
    letter-spacing: 0.6px;
    color: #5a4e3c;
    text-shadow: 0 0 6px rgba(139, 94, 60, 0.25);
    transition: text-shadow 0.6s ease, color 1.2s ease;
}

/* Base state: neutral, invisible during hidden phase */
.reading-meta {
    position: relative;
    padding-bottom: 6px;
}

/* Rune underline appears only when the block is revealed */
.reading-meta.reveal::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;

    height: 2px;
    background: linear-gradient(
        to right,
        rgba(139, 94, 60, 0) 0%,
        rgba(139, 94, 60, 0.4) 50%,
        rgba(139, 94, 60, 0) 100%
    );

    opacity: 0;
    transform: scaleX(0.6);
    transform-origin: center;
    animation: runeReveal 1.2s ease forwards;
    animation-delay: 0.4s; /* appears just after the fade-in */
}

/* The rune-like glow animation */
@keyframes runeReveal {
    0% {
        opacity: 0;
        transform: scaleX(0.6);
        filter: blur(2px);
    }
    60% {
        opacity: 1;
        transform: scaleX(1);
        filter: blur(0);
    }
    100% {
        opacity: 0.85;
        transform: scaleX(1);
    }
}



/* Copy text button */
.copy-reading-btn {
    padding: 10px 16px;
    background: #8b5e3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    letter-spacing: 0.5px;
    transition: background 0.3s ease, transform 0.2s ease;
}

.copy-reading-btn:hover {
    background: #6d4528;
    transform: translateY(-2px);
}


#phase-reading {
    background: #fdf8f2; /* warm parchment tone */
}

.hide-for-screenshot {
    display: none !important;
}
.screenshot-mode {
    overflow: visible !important;
    transform: none !important;
}
.screenshot-mode * {
    opacity: 1 !important;
    text-shadow: none !important;
    transform: none !important;
}


/* Hidden normally */
.screenshot-only {
    display: none;
    font-size: 0.8rem;
    text-align: center;
    margin-top: 20px;
    color: #5a4e3c;
    opacity: 0.8;
}

/* Visible only during screenshot */
.screenshot-mode .screenshot-only {
    display: block !important;
}



/* Title style */
.inner-totem-title {
    width: 100%;
    max-width: 480px;
    margin: 0 auto 24px auto;
    padding: 0 16px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;

    font-family: "Cormorant Garamond", serif;
    color: #5a4e3c;

    opacity: 0;
    transform: translateY(10px);
    transition: opacity .6s ease, transform .6s ease;
}

.inner-totem-title h1 {
    font-size: 2rem;
    letter-spacing: 1px;
    margin: 0;
}

.inner-totem-title.reveal {
    opacity: 1;
    transform: translateY(0);
}

.title-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(
        to right,
        rgba(139, 94, 60, 0),
        rgba(139, 94, 60, 0.5),
        rgba(139, 94, 60, 0)
    );
}


/* Starting state for all revealable blocks */
.reveal-block.hidden {
    opacity: 0;
    transform: translateY(12px);
}

/* Final state when revealed */
.reveal-block.reveal {
    opacity: 1;
    transform: translateY(0);
}

/* Animation speed */
.reveal-block {
    transition: opacity 1.8s ease, transform 1.8s ease;
}



/* Hide embed buttons in Embed mode */
.embed-mode #copy-btn,
.embed-mode #screenshot-btn,
.embed-mode #share-buttons,
.embed-mode .share-section {
    display: none !important;
}


/* Embed attribution */
#embed-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    opacity: 0.7;
}

#embed-footer a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}

#embed-footer a:hover {
    opacity: 1;
}


.button-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
}