/* =========================
   Paper stack wrapper
   ========================= */
.paper-stack {
    position: relative;
    overflow: visible;
    margin-bottom: 2rem;
}

/* The top sheet must CLIP content */
.paper-stack>.card,
.paper-stack .paper-top {
    position: relative;
    z-index: 2;
    overflow: hidden !important;

    /* paper shape */
    border-radius: 12px;

    /* a slightly warmer "paper" background (still theme-friendly) */
    background: var(--bs-card-bg) !important;

    /* a bit more "paper edge" than a UI card */
    border: 1px solid rgba(0, 0, 0, 0.09);

    /* softer, layered shadow like paper on a desk */
    box-shadow:
        0 10px 18px rgba(0, 0, 0, 0.10),
        0 1px 0 rgba(0, 0, 0, 0.04);
}

/* Ensure header/body are opaque */
.paper-stack .paper-top .card-header,
.paper-stack .paper-top .card-body {
    background: transparent !important;
}

/* Subtle paper grain + gentle gradient (no images needed) */
.paper-stack .paper-top::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;

    /* warm paper tone + soft vignette + tiny speckle approximation */
    background:
        radial-gradient(1200px 400px at 20% 0%, rgba(0, 0, 0, 0.03), transparent 55%),
        radial-gradient(900px 500px at 100% 20%, rgba(0, 0, 0, 0.025), transparent 60%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.60), rgba(255, 255, 255, 0.00));

    opacity: 0.9;
}

/* Keep actual content above the texture */
.paper-stack .paper-top .card-header,
.paper-stack .paper-top .card-body {
    position: relative;
    z-index: 1;
}

/* Header styling: more like a paper label */
.paper-stack .paper-top .card-header {
    font-weight: 700;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

/* Optional: light ruled lines on the body (subtle) */
.paper-stack .paper-top .card-body {
    background-image: repeating-linear-gradient(to bottom,
            rgba(0, 0, 0, 0.03),
            rgba(0, 0, 0, 0.03) 1px,
            transparent 1px,
            transparent 32px);
    background-size: auto;
}

/* =========================
   Folded corner (top-right)
   ========================= */
.paper-stack .paper-top::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 42px;
    height: 42px;
    z-index: 2;
    pointer-events: none;

    /* a folded-corner triangle */
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.0) 50%, rgba(0, 0, 0, 0.06) 50%),
        linear-gradient(225deg, rgba(255, 255, 255, 0.0) 50%, rgba(255, 255, 255, 0.65) 50%);

    clip-path: polygon(0 0, 100% 0, 100% 100%);
    border-top-right-radius: 12px;
}

/* =========================
   The two sheets behind
   ========================= */
.paper-stack::before,
.paper-stack::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 12px;
    z-index: 1;
    pointer-events: none;

    background: var(--bs-card-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);

    /* faint shadow so they read as separate sheets */
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.07);
}

.paper-stack::before {
    transform: translate(10px, 10px) rotate(1.2deg);
    opacity: 0.98;
}

.paper-stack::after {
    transform: translate(18px, 18px) rotate(-0.9deg);
    opacity: 0.96;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.06);
}

/* Organic rotation per card */
.paper-1 {
    transform: rotate(-0.4deg);
}

.paper-2 {
    transform: rotate(0.3deg);
}

.paper-3 {
    transform: rotate(-0.2deg);
}

.paper-4 {
    transform: rotate(0.5deg);
}

.paper-5 {
    transform: rotate(-0.6deg);
}

.paper-6 {
    transform: rotate(0.2deg);
}

.paper-7 {
    transform: rotate(-0.3deg);
}

.paper-8 {
    transform: rotate(0.4deg);
}

.paper-9 {
    transform: rotate(-0.1deg);
}

/* Nice interaction: lift the paper a little */
.paper-stack:hover>.card,
.paper-stack:hover .paper-top {
    transform: translateY(-3px);
    transition: transform 160ms ease, box-shadow 160ms ease;
    box-shadow:
        0 16px 24px rgba(0, 0, 0, 0.13),
        0 1px 0 rgba(0, 0, 0, 0.05);
}

/* NAV */

.deck-controls .card-body {
    padding: 0.9rem 1rem;
}

.deck-controls-main .card-body {
    display: flex;
    justify-content: center;
}

.deck-controls-pills .card-body {
    padding: 0.75rem 1rem;
}

.deck-nav,
.deck-nav-single {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex-wrap: wrap;
}

.deck-nav-single .deck-btn {
    min-width: 0;
    width: min(260px, 100%);
}

.deck-btn {
    flex: 1;
    min-width: 200px;
    border-radius: 999px;
    border: 1px solid rgba(31, 35, 24, 0.18);
    background: rgba(255, 255, 255, 0.45);
    color: rgba(31, 35, 24, 0.88);
    padding: 10px 18px;
    font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: 0.2px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.06);
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
    text-decoration: none;
    cursor: pointer;
}

.deck-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.09);
    background: rgba(255, 255, 255, 0.62);
    border-color: rgba(31, 35, 24, 0.26);
}

.deck-btn:active {
    transform: translateY(0);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.06);
}

.deck-btn-prev {
    color: inherit;
}

.deck-btn-next {
    background: #5e5c59;
    border-color: rgba(20, 28, 16, 0.22);
    color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.14);
}

.deck-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(63, 95, 27, 0.22), 0 14px 30px rgba(0, 0, 0, 0.10);
}

.deck-btn[disabled] {
    opacity: 0.45;
    pointer-events: none;
}

.deck-index {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.deck-pills {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 16px 18px;
    background: #EDDAC0;
    border: 1px solid rgba(31, 35, 24, 0.10);
    border-radius: 22px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.08);
}

.deck-pill {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(31, 35, 24, 0.18);
    background: rgba(255, 255, 255, 0.45);
    color: rgba(31, 35, 24, 0.88);
    font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: 0.2px;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.06);
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
    cursor: pointer;
}

.deck-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.09);
    background: rgba(255, 255, 255, 0.62);
    border-color: rgba(31, 35, 24, 0.26);
}

.deck-pill.active {
    background: #3f5f1b;
    border-color: rgba(20, 28, 16, 0.22);
    color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.14);
}

.deck-pill:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(63, 95, 27, 0.22), 0 14px 30px rgba(0, 0, 0, 0.10);
}

.deck-pill-title,
.deck-pill-title:link,
.deck-pill-title:visited,
.deck-pill-title:hover,
.deck-pill-title:active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid rgba(31, 35, 24, 0.18);
    background: rgba(255, 255, 255, 0.45);
    color: rgba(31, 35, 24, 0.88);
    font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: 0.2px;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.06);
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
    white-space: nowrap;
    cursor: pointer;
}

.deck-pill-title:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.09);
    background: rgba(255, 255, 255, 0.62);
    border-color: rgba(31, 35, 24, 0.26);
}

.deck-pill-title.active,
.deck-pill-title.active:link,
.deck-pill-title.active:visited,
.deck-pill-title.active:hover,
.deck-pill-title.active:active {
    background: #3f5f1b;
    border-color: rgba(20, 28, 16, 0.22);
    color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.14);
}

.paper-stack .paper-top .card-header {
    font-size: 1.35rem;
    line-height: 1.3;
}

@media (max-width: 900px) {
    .deck-pills {
        gap: 10px;
        padding: 12px 12px;
        border-radius: 18px;
    }

    .deck-btn,
    .deck-pill,
    .deck-pill-title,
    .deck-pill-title:link,
    .deck-pill-title:visited,
    .deck-pill-title:hover,
    .deck-pill-title:active {
        font-size: 1.02rem;
        padding: 9px 14px;
    }
}

@media (max-width: 420px) {
    .deck-nav-single {
        flex-direction: column;
        align-items: stretch;
    }

    .deck-nav-single .deck-btn {
        width: 100%;
    }
}