/* =======================================
   FROM A STORYTELLER - TOOLS.CSS
   Version: 2.0
   Shared individual tool page layout
======================================= */

.tool-page {
    width: 100%;
    max-width: 1520px;
    margin: 0 auto;
    padding: 40px 28px 72px;
    box-sizing: border-box;
}

.tool-page section + section {
    margin-top: 0;
}

.tool-hero {
    max-width: 1380px;
    margin: 0 auto 32px;
    text-align: center;
}

.tool-eyebrow {
    margin: 0 0 12px;
    text-align: center;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.75;
}

.tool-hero h1 {
    max-width: 900px;
    margin: 0 auto 16px;
    line-height: 1.1;
    text-align: center;
}

.tool-tagline {
    margin: 0 auto 16px;
    font-size: 1.2rem;
    line-height: 1.5;
    max-width: 900px;
    text-align: center;
}

.tool-intro {
    margin: 0 auto;
    max-width: 920px;
    line-height: 1.7;
    opacity: 0.9;
    text-align: center;
}

/*
   Match the game-page approach: react to the ACTUAL width available to
   the tool, rather than switching the whole layout at one viewport width.
*/
.tool-play-section {
    margin-bottom: 48px;
    container-type: inline-size;
    container-name: tool-play;
}

.tool-shell {
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 2.15fr) minmax(280px, 0.95fr);
    gap: 24px;
    align-items: center;
    background: linear-gradient(180deg, rgba(18, 18, 18, 0.96), rgba(12, 12, 12, 0.96));
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.30);
    box-sizing: border-box;
}

.tool-shell-main {
    width: 100%;
    min-width: 0;
    justify-self: center;
}

.tool-shell-frame {
    width: 100%;
    min-width: 0;
    background: linear-gradient(180deg, rgba(28, 28, 28, 0.92), rgba(18, 18, 18, 0.92));
    border: 1px solid rgba(212, 175, 55, 0.18);
    border-radius: 20px;
    padding: 20px;
    box-sizing: border-box;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-shell-sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-self: center;
}

.info-card {
    height: 100%;
    background: linear-gradient(180deg, rgba(18, 18, 18, 0.94), rgba(10, 10, 10, 0.94));
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
    box-sizing: border-box;
}

.info-card h2 {
    margin: 0 0 14px;
    line-height: 1.2;
}

.info-card p,
.info-card ul {
    margin: 0;
    line-height: 1.7;
    opacity: 0.9;
}

.info-card ul {
    margin-top: 4px;
    padding-left: 20px;
}

.info-card li + li {
    margin-top: 10px;
}

/* ============================
   SHARED TOOL UI
============================ */

.tool-widget {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
    padding: 32px 24px;
    box-sizing: border-box;
}

.tool-widget-title {
    margin: 0 0 16px;
    line-height: 1.2;
}

.tool-widget-result {
    min-height: 72px;
    margin: 0 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 1px solid rgba(212, 175, 55, 0.16);
    border-radius: 16px;
    background: rgba(6, 6, 6, 0.6);
    font-size: 1.4rem;
    line-height: 1.4;
    color: #f5f1e8;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.tool-widget-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tool-button {
    border: 1px solid rgba(212, 175, 55, 0.38);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.16), rgba(212, 175, 55, 0.08));
    color: #f5f1e8;
    padding: 14px 26px;
    border-radius: 999px;
    font: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.tool-button:hover {
    transform: translateY(-1px);
    border-color: rgba(212, 175, 55, 0.55);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.22), rgba(212, 175, 55, 0.12));
}

.tool-button:active {
    transform: translateY(0);
}

.tool-button:focus-visible {
    outline: 2px solid rgba(212, 175, 55, 0.65);
    outline-offset: 3px;
}

/* ---------- Container-responsive tool layout ---------- */

@container tool-play (max-width: 1040px) {
    .tool-shell {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .tool-shell-main,
    .tool-shell-sidebar {
        width: 100%;
        max-width: 960px;
        margin-left: auto;
        margin-right: auto;
    }

    .tool-shell-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }
}

@container tool-play (max-width: 700px) {
    .tool-shell-sidebar {
        grid-template-columns: 1fr;
    }
}

/* Fallback for browsers without container queries. */
@supports not (container-type: inline-size) {
    @media (max-width: 1120px) {
        .tool-shell {
            grid-template-columns: 1fr;
            align-items: start;
        }

        .tool-shell-main,
        .tool-shell-sidebar {
            width: 100%;
            max-width: 960px;
            margin-left: auto;
            margin-right: auto;
        }
    }
}

@media (max-width: 768px) {
    .tool-page {
        padding: 28px 20px 56px;
    }

    .tool-shell {
        gap: 18px;
        padding: 18px;
        border-radius: 20px;
    }

    .tool-shell-frame {
        min-height: 0;
        padding: 10px;
        border-radius: 16px;
    }

    .tool-tagline {
        font-size: 1.08rem;
    }

    .tool-widget {
        padding: 20px 8px;
    }

    .tool-widget-result {
        font-size: 1.15rem;
        padding: 18px;
    }
}