/* Declare cascade layers in order */
@layer reset, base, components, utilities;

/* ------------------------------ */
/* RESET LAYER                    */
/* ------------------------------ */
@layer reset {
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    html {
        overflow-x: hidden;
    }

    body {
        min-height: 100vh;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
    }

    main {
        flex: 1;
    }
}

/* ------------------------------ */
/* BASE LAYER                     */
/* ------------------------------ */
@layer base {

    /* DO NOT TOUCH — gradient stays */
    html {
        background: linear-gradient(
            to bottom,
            #2a2a2a 0%,
            #2a2a2a 40%,
            #7a7a7a 70%,
            #4fbf6b 100%
        );
        background-attachment: fixed;
    }

    body {
        background: transparent;
        color: #1f1f21;
        font-family: "Inter", "Segoe UI", sans-serif;
        line-height: 1.6;
        display: flex;
        flex-direction: column;
        isolation: isolate;
    }

    .title {
        font-size: 1.8rem;
        font-weight: 600;
        margin-bottom: 15px;
    }

    .nav-grid a {
        color: #1f1f21;
        text-decoration: none;
    }
}

.warning-banner {
    background: rgba(255, 255, 0, 0.25);
    border: 1px solid rgba(255, 255, 0, 0.4);
    padding: 12px 16px;
    margin: 20px auto;
    max-width: 900px;
    border-radius: 8px;
    font-family: Tahoma, Verdana, sans-serif;
    font-size: 14px;
}

/* ------------------------------ */
/* COMPONENTS LAYER               */
/* ------------------------------ */
@layer components {

    /* -------------------------------------- */
    /* CONTENT GLASS WRAPPER                  */
    /* -------------------------------------- */
    .content-glass {
        max-width: 1100px;
        margin: 40px auto;
        padding: 25px;

        background: rgba(255,255,255,0.55);
        border: 1px solid rgba(255,255,255,0.7);
        border-radius: 12px;

        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);

        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.8),
            0 4px 12px rgba(0,0,0,0.15);
    }

    .content-glass > * + * {
        margin-top: 20px;
    }

    /* -------------------------------------- */
    /* GAIA TOPIC LISTING (GLASS THEME)       */
    /* -------------------------------------- */

    .topic-header {
        font-family: "Trebuchet MS", Tahoma, Verdana, sans-serif;
        font-size: 20px;
        font-weight: bold;
        margin-bottom: 15px;
        color: #ffffff;
        text-shadow:
            1px 1px 2px rgba(0,0,0,0.45),
            0 0 3px rgba(0,0,0,0.25),
            -1px -1px 1px rgba(255,255,255,0.18);
    }

    .topic-row {
        display: grid;
        grid-template-columns: 1fr 120px 200px;
        align-items: center;

        padding: 14px 18px;
        margin-bottom: 10px;

        background: rgba(255,255,255,0.55);
        border: 1px solid rgba(255,255,255,0.7);
        border-radius: 10px;

        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);

        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.8),
            0 3px 6px rgba(0,0,0,0.12);

        transition: transform 0.1s ease, box-shadow 0.1s ease;
    }

    .topic-row:hover {
        transform: translateY(-2px);
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.9),
            0 6px 12px rgba(0,0,0,0.15);
    }

    .topic-title {
        font-size: 15px;
        font-weight: bold;
        color: #1f1f21;
        text-decoration: none;
    }

    .topic-title:hover {
        text-decoration: underline;
    }

    .topic-replies {
        font-size: 13px;
        color: #333;
        text-align: center;
    }

    .topic-lastpost {
        font-size: 12px;
        color: #444;
        text-align: right;
        line-height: 1.4;
    }

    .topic-row.sticky {
        border-left: 6px solid #4a90e2;
        background: rgba(255,255,255,0.75);
    }

    .topic-row.announcement {
        border-left: 6px solid #ffcc00;
        background: rgba(255,255,255,0.85);
    }

    .pagination {
        display: flex;
        justify-content: center;
        gap: 8px;
        margin: 25px 0;
    }

    .pagination a {
        padding: 6px 10px;
        font-size: 12px;
        text-decoration: none;
        color: #1f1f21;

        background: rgba(255,255,255,0.55);
        border: 1px solid rgba(255,255,255,0.7);
        border-radius: 6px;

        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);

        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.8),
            0 2px 4px rgba(0,0,0,0.12);

        transition: background 0.1s ease;
    }

    .pagination a:hover {
        background: rgba(255,255,255,0.75);
    }

    /* -------------------------------------- */
    /* GAIA POST LAYOUT (THREAD VIEW)         */
    /* -------------------------------------- */

    .post-container {
        display: grid;
        grid-template-columns: 180px 1fr;
        gap: 20px;

        padding: 20px;
        margin-bottom: 20px;

        background: rgba(255,255,255,0.55);
        border: 1px solid rgba(255,255,255,0.7);
        border-radius: 12px;

        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);

        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.8),
            0 4px 12px rgba(0,0,0,0.15);
    }

    .post-user {
        text-align: center;
        font-family: Tahoma, Verdana, sans-serif;
        font-size: 12px;
        color: #333;
    }

    .post-user img {
        max-width: 150px;
        border-radius: 8px;
        margin-bottom: 10px;
    }

    .post-body {
        font-family: Tahoma, Verdana, sans-serif;
        font-size: 14px;
        color: #1f1f21;
        line-height: 1.6;
    }

    .post-meta {
        font-size: 11px;
        color: #555;
        margin-bottom: 10px;
    }

    /* -------------------------------------- */
    /* SIGNATURE AREA — unchanged             */
    /* -------------------------------------- */

    .post-signature {
        margin-top: 25px;
        background: rgba(255,255,255,0.3);
        border-radius: 10px;
        padding: 15px;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }

    .signature-inner-box {
        background: rgba(255,255,255,0.5);
        border-radius: 0;
        padding: 15px;
        width: 100%;
        min-height: 60px;
        margin-bottom: 15px;
    }

    .signature-text {
        text-align: center;
        font-family: Tahoma, Verdana, sans-serif;
        font-size: 14px;
    }

    /* -------------------------------------- */
    /* EDITOR UI — Gaia Layout + Glass Theme  */
    /* -------------------------------------- */

    .toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 12px;
    }

    .md-btn {
        padding: 6px 10px;
        font-family: Tahoma, Verdana, sans-serif;
        font-size: 12px;

        background: rgba(255,255,255,0.55);
        border: 1px solid rgba(255,255,255,0.7);
        border-radius: 6px;

        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);

        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.8),
            0 2px 4px rgba(0,0,0,0.12);

        cursor: pointer;
        user-select: none;
        transition: background 0.1s ease, transform 0.05s ease;
    }

    .md-btn:hover {
        background: rgba(255,255,255,0.75);
    }

    .md-btn:active {
        transform: translateY(1px);
        background: rgba(255,255,255,0.9);
    }

    .popup {
        position: absolute;
        background: rgba(255,255,255,0.85);
        padding: 12px;

        border: 1px solid rgba(255,255,255,0.7);
        border-radius: 8px;

        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);

        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.8),
            0 3px 6px rgba(0,0,0,0.15);

        z-index: 999;
    }

    .hidden { display: none; }

    .popup-close {
        margin-top: 10px;
        padding: 6px 10px;
        font-size: 12px;
        font-family: Tahoma, Verdana, sans-serif;

        background: rgba(255,255,255,0.55);
        border: 1px solid rgba(255,255,255,0.7);
        border-radius: 6px;

        cursor: pointer;
    }

    .color-row {
        display: flex;
        gap: 6px;
        margin-bottom: 10px;
    }

    .color-swatch {
        width: 22px;
        height: 22px;
        border-radius: 4px;
        border: 1px solid rgba(255,255,255,0.7);
        cursor: pointer;
    }

    .size-row button {
        padding: 6px 10px;
        font-size: 12px;
        font-family: Tahoma, Verdana, sans-serif;

        background: rgba(255,255,255,0.55);
        border: 1px solid rgba(255,255,255,0.7);
        border-radius: 6px;

        cursor: pointer;
    }

    .size-row button:hover {
        background: rgba(255,255,255,0.75);
    }

    #editor-wrapper {
        display: grid;
        grid-template-columns: 2fr 1fr;
        grid-template-rows: auto 1fr;
        gap: 20px;
        width: 100%;
        margin-top: 20px;
    }

    #preview-box {
        grid-column: 1 / 3;
        background: rgba(255,255,255,0.65);
        border: 1px solid rgba(255,255,255,0.7);
        padding: 15px;
        border-radius: 8px;

        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);

        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.8),
            0 3px 6px rgba(0,0,0,0.12);
    }

    #preview-area {
        min-height: 150px;
        padding: 10px;
        background: rgba(255,255,255,0.9);
        border: 1px solid rgba(0,0,0,0.15);
        border-radius: 6px;
    }

    #editor-main,
    #editor-sidebar {
        background: rgba(255,255,255,0.55);
        border: 1px solid rgba(255,255,255,0.7);
        border-radius: 8px;
        padding: 15px;

        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);

        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.8),
            0 3px 6px rgba(0,0,0,0.12);
    }

    #post-body {
        width: 100%;
        height: 400px;
        border-radius: 6px;
        border: 1px solid rgba(0,0,0,0.25);
        padding: 10px;
        resize: vertical;

        background: rgba(255,255,255,0.9);
        font-family: Tahoma, Verdana, sans-serif;
        font-size: 14px;
    }
}

/* ------------------------------ */
/* UTILITIES LAYER                */
/* ------------------------------ */
@layer utilities {
    /* Add future utility classes here */
}
