
/* ============================================
   FREE TRAINING PAGE
   Minimal royal parchment / scroll experience.
   Preserves the Admin-managed background image
   and existing royal-scroll design.
   ============================================ */

/* --- Page Background --- */
.ft-page-body {
    position: relative;
    z-index: auto;
    overflow-x: hidden;
    background: var(--color-bg-primary, #211812);
}

.ft-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(180, 120, 50, 0.12), transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(180, 120, 50, 0.08), transparent 60%),
        var(--color-bg-primary, #211812);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* ============================================
   ROYAL SCROLL WRAPPER
   ============================================ */

.ft-scroll-wrapper {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    padding: 44px 24px;
}

.ft-opened-scroll {
    position: relative;
    width: 100%;
    max-width: 1200px;
    z-index: 2;
}

/* --- Gold Glow --- */
.ft-scroll-glow {
    position: absolute;
    top: -45px;
    left: 50%;
    width: min(500px, 80%);
    height: 130px;
    transform: translateX(-50%);
    background: radial-gradient(
        ellipse,
        rgba(230, 169, 60, 0.27) 0%,
        rgba(230, 169, 60, 0.08) 45%,
        transparent 72%
    );
    pointer-events: none;
    z-index: 0;
    animation: ftGlowPulse 3.5s ease-in-out infinite;
}

@keyframes ftGlowPulse {
    0%,
    100% {
        opacity: 0.55;
    }

    50% {
        opacity: 1;
    }
}

/* --- Main Parchment --- */
.ft-scroll-outer {
    position: relative;
    isolation: isolate;
    width: 100%;
    padding: 48px 28px 40px;
    border: 1px solid rgba(230, 200, 130, 0.8);
    border-radius: 12px;
    background:
        linear-gradient(
            135deg,
            rgba(139, 105, 20, 0.95) 0%,
            rgba(200, 160, 80, 0.75) 1.2%,
            transparent 2.2%
        ),
        linear-gradient(
            225deg,
            rgba(139, 105, 20, 0.95) 0%,
            rgba(200, 160, 80, 0.75) 1.2%,
            transparent 2.2%
        ),
        linear-gradient(
            180deg,
            #F4E4C1 0%,
            #EEDDB8 24%,
            #E8D5A8 58%,
            #DCC89D 82%,
            #C8B080 100%
        );
    box-shadow:
        0 22px 65px rgba(0, 0, 0, 0.48),
        0 0 28px rgba(200, 160, 80, 0.12),
        inset 0 0 70px rgba(80, 50, 20, 0.12);
}

/* --- Parchment Texture --- */
.ft-scroll-outer::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 3px,
            rgba(100, 70, 30, 0.025) 3px,
            rgba(100, 70, 30, 0.025) 6px
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 4px,
            rgba(100, 70, 30, 0.018) 4px,
            rgba(100, 70, 30, 0.018) 8px
        );
}

/* ============================================
   GOLD SCROLL RODS AND CAPS
   ============================================ */

.ft-scroll-rod-top,
.ft-scroll-rod-bottom {
    position: absolute;
    left: -8px;
    right: -8px;
    height: 22px;
    border: 1px solid rgba(100, 65, 10, 0.65);
    border-radius: 6px;
    background: linear-gradient(
        180deg,
        #F0D88A 0%,
        #C8A050 28%,
        #9B7B2A 45%,
        #C8A050 65%,
        #8B6914 100%
    );
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.42);
    z-index: 5;
}

.ft-scroll-rod-top {
    top: -1px;
}

.ft-scroll-rod-bottom {
    bottom: -1px;
}

.ft-scroll-rod-cap-outer {
    position: absolute;
    top: -8px;
    width: 30px;
    height: 36px;
    border: 1px solid rgba(100, 65, 10, 0.7);
    border-radius: 6px;
    background: linear-gradient(
        180deg,
        #F0D88A 0%,
        #C8A050 35%,
        #A08030 65%,
        #705010 100%
    );
    box-shadow: 0 4px 9px rgba(0, 0, 0, 0.4);
    z-index: 6;
}

.ft-scroll-rod-cap-outer.left {
    left: -5px;
}

.ft-scroll-rod-cap-outer.right {
    right: -5px;
}

/* --- Empty Scroll Content Area --- */
.ft-scroll-content {
    position: relative;
    z-index: 1;
    min-width: 0;
    min-height: 0;
}

/* ============================================
   RESPONSIVE SCROLL DESIGN
   ============================================ */

/* --- Tablet --- */
@media (max-width: 992px) {
    .ft-scroll-wrapper {
        padding: 34px 18px;
    }

    .ft-scroll-outer {
        padding: 44px 20px 34px;
    }
}

/* --- Mobile --- */
@media (max-width: 768px) {
    .ft-scroll-wrapper {
        padding: 24px 12px;
    }

    .ft-scroll-outer {
        padding: 40px 14px 28px;
        border-radius: 9px;
    }

    .ft-scroll-rod-top,
    .ft-scroll-rod-bottom {
        height: 18px;
    }

    .ft-scroll-rod-cap-outer {
        width: 24px;
        height: 30px;
    }
}

/* --- Small Mobile --- */
@media (max-width: 480px) {
    .ft-scroll-wrapper {
        padding: 18px 8px;
    }

    .ft-scroll-outer {
        padding: 36px 10px 24px;
    }
}

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .ft-scroll-glow {
        animation: none;
    }
}


/* =========================================================
   FREE TRAINING — ADMIN-MANAGED CONTENT
   Gallery, optional introduction, dynamic table and buttons
   ========================================================= */

/* --- Image Gallery --- */
.ft-gallery {
    width: 100%;
    margin: 0 auto 28px;
}

.ft-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 20px;
    align-items: start;
}

.ft-gallery-item {
    min-width: 0;
    margin: 0;
    padding: 10px;
    overflow: hidden;
    background: rgba(255, 248, 226, 0.82);
    border: 1px solid rgba(167, 124, 52, 0.7);
    border-radius: 8px;
    box-shadow: 0 5px 16px rgba(48, 28, 12, 0.16);
}

.ft-gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
    border-radius: 4px;
}

.ft-gallery-item figcaption {
    margin-top: 10px;
    color: #5c3d2e;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}

/* --- Optional Introduction --- */
.ft-introduction {
    width: 100%;
    margin: 0 auto 30px;
    color: #4b3022;
    text-align: center;
    overflow-wrap: anywhere;
}

.ft-intro-title {
    margin: 0 0 14px;
    color: #704719;
    font-size: clamp(1.35rem, 2.5vw, 2rem);
    font-weight: 700;
    line-height: 1.35;
}

.ft-intro-description {
    color: #4b3022;
    font-size: 1rem;
    line-height: 1.8;
    white-space: normal;
}

/* --- Dynamic Table --- */
.ft-table-section {
    width: 100%;
    margin: 28px auto 0;
}

.ft-table-scroll {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border: 1px solid rgba(142, 100, 39, 0.75);
    border-radius: 8px;
    background: rgba(255, 250, 235, 0.94);
    box-shadow: 0 6px 18px rgba(48, 28, 12, 0.14);
    -webkit-overflow-scrolling: touch;
}

.ft-dynamic-table {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    color: #352116;
    font-weight: 500;
    font-size: 0.96rem;
    line-height: 1.6;
}

.ft-dynamic-table th,
.ft-dynamic-table td {
    padding: 13px 16px;
    border: 1px solid rgba(151, 112, 54, 0.38);
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
    text-shadow: 0 0.3px 0 rgba(53, 33, 22, 0.35);
}

.ft-dynamic-table thead th {
    background: #4a3020;
    color: #ffe19a;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    letter-spacing: 0.2px;
    font-weight: 700;
    white-space: normal;
}

.ft-dynamic-table tbody tr:nth-child(even) {
    background: rgba(221, 193, 139, 0.2);
}

.ft-dynamic-table tbody tr:hover {
    background: rgba(218, 174, 83, 0.16);
}

/* --- Optional Serial-Number Column --- */
.ft-dynamic-table .ft-serial-heading,
.ft-dynamic-table .ft-serial-cell {
    width: 76px;
    text-align: center;
    white-space: nowrap;
}

/* --- Clickable Table Buttons --- */
.ft-table-button {
    display: inline-block;
    max-width: 100%;
    padding: 9px 16px;
    border: 1px solid #a87824;
    border-radius: 5px;
    background: linear-gradient(135deg, #f3d58a, #d6a744);
    color: #392414;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
    box-shadow: 0 3px 8px rgba(55, 34, 13, 0.16);
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.ft-table-button:hover {
    background: linear-gradient(135deg, #ffe7a5, #e5b953);
    color: #2d1b10;
    box-shadow: 0 5px 12px rgba(55, 34, 13, 0.22);
    transform: translateY(-1px);
}

.ft-table-button:focus-visible {
    outline: 3px solid #8a5b16;
    outline-offset: 3px;
}

/* --- Smaller Screens --- */
@media (max-width: 600px) {
    .ft-gallery {
        margin-bottom: 22px;
    }

    .ft-gallery-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .ft-gallery-item {
        padding: 7px;
    }

    .ft-introduction {
        margin-bottom: 22px;
    }

    .ft-intro-description {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .ft-table-section {
        margin-top: 22px;
    }

    .ft-dynamic-table {
        font-size: 0.9rem;
    }

    .ft-dynamic-table th,
    .ft-dynamic-table td {
        padding: 10px 12px;
    }

    .ft-table-button {
        padding: 8px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ft-table-button {
        transition: none;
    }

    .ft-table-button:hover {
        transform: none;
    }
}

/* After-table images: use the available frame more effectively */
.ft-gallery-after-table .ft-gallery-grid {
    grid-template-columns: minmax(0, 1fr);
}

.ft-gallery-after-table .ft-gallery-item {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}


.ft-gallery-after-table .ft-gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    object-fit: contain;
    margin: 0;
    box-sizing: border-box;
}
