/* ==========================================================================
   political.quest -- Hand-drawn quest log for civic adventurers
   Palette: parchment, trail brown, quest green, urgent red, reward gold
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Open Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: #6b5b4a;
    background-color: #f4ede0;
    background-image:
        radial-gradient(ellipse at 20% 12%, rgba(139, 115, 85, 0.10) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 70%, rgba(74, 124, 89, 0.07) 0%, transparent 60%),
        radial-gradient(circle at 50% 100%, rgba(107, 91, 74, 0.08) 0%, transparent 60%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Parchment grain overlay -- subtle paper texture using stacked gradients */
.parchment-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.55;
    background-image:
        repeating-linear-gradient(
            13deg,
            transparent 0px,
            transparent 2px,
            rgba(139, 115, 85, 0.025) 2px,
            rgba(139, 115, 85, 0.025) 3px
        ),
        repeating-linear-gradient(
            -47deg,
            transparent 0px,
            transparent 3px,
            rgba(107, 91, 74, 0.018) 3px,
            rgba(107, 91, 74, 0.018) 4px
        );
}

body > * {
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   Banner Ribbons -- folded political bunting / RPG title plates
   ========================================================================== */
.banner-ribbon {
    display: inline-block;
    background: #cc0000;
    color: #f4ede0;
    font-family: 'Lora', serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 14px 56px;
    clip-path: polygon(5% 0, 95% 0, 100% 50%, 95% 100%, 5% 100%, 0 50%);
    position: relative;
    box-shadow: 0 4px 0 rgba(107, 91, 74, 0.18);
}

.banner-main {
    background: #cc0000;
    font-size: clamp(1.5rem, 4vw, 2.8rem);
    padding: 18px 72px;
    margin-bottom: 18px;
}

.banner-chapter {
    background: #2a6041;
    font-size: clamp(1rem, 2.4vw, 1.4rem);
    padding: 12px 48px;
}

.banner-victory {
    background: #ffd700;
    color: #6b5b4a;
    font-size: clamp(1.4rem, 3.6vw, 2.2rem);
    padding: 16px 64px;
    margin: 18px 0;
}

.banner-text {
    display: inline-block;
    transform: translateZ(0);
}

/* ==========================================================================
   Quest Header (Hero)
   ========================================================================== */
.quest-header {
    text-align: center;
    padding: 80px 24px 60px;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.quest-tagline {
    font-family: 'Lora', serif;
    font-style: italic;
    color: #8b7355;
    max-width: 640px;
    margin: 8px auto 32px;
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    line-height: 1.7;
}

.hero-stars {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin: 24px 0 36px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 24px;
    max-width: 640px;
    margin: 32px auto;
    padding: 24px;
    background: #ffffff;
    border: 3px solid #6b5b4a;
    border-radius: 12px 4px 16px 8px;
    box-shadow: 4px 4px 0 #6b5b4a;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-num {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    color: #2a6041;
    line-height: 1;
}

.stat-label {
    font-family: 'Open Sans', sans-serif;
    font-size: 0.78rem;
    color: #8b7355;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
}

.cta-scroll {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #2a6041;
    color: #f4ede0;
    text-decoration: none;
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 14px 32px;
    border: 3px solid #6b5b4a;
    border-radius: 4px 14px 8px 16px;
    box-shadow: 4px 4px 0 #6b5b4a;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    margin-top: 8px;
}

.cta-scroll:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #6b5b4a;
    background: #4a7c59;
}

.cta-arrow {
    display: inline-block;
    animation: bob 1.6s ease-in-out infinite;
    font-size: 1.2rem;
}

@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(4px); }
}

/* ==========================================================================
   Stars (CSS clip-path)
   ========================================================================== */
.star {
    display: inline-block;
    background: #ffd700;
    clip-path: polygon(
        50% 0%,
        61% 35%,
        98% 35%,
        68% 57%,
        79% 91%,
        50% 70%,
        21% 91%,
        32% 57%,
        2% 35%,
        39% 35%
    );
    filter: drop-shadow(1px 2px 0 rgba(107, 91, 74, 0.55));
}

.star-sm { width: 12px; height: 12px; }
.star-md { width: 18px; height: 18px; }
.star-lg { width: 26px; height: 26px; }

.hero-stars .star {
    animation: twinkle 2.8s ease-in-out infinite;
}
.hero-stars .star:nth-child(2) { animation-delay: 0.4s; }
.hero-stars .star:nth-child(3) { animation-delay: 0.8s; }
.hero-stars .star:nth-child(4) { animation-delay: 1.2s; }
.hero-stars .star:nth-child(5) { animation-delay: 1.6s; }

@keyframes twinkle {
    0%, 100% { transform: scale(1)   rotate(0deg);   opacity: 1;   }
    50%      { transform: scale(1.2) rotate(12deg);  opacity: 0.85;}
}

/* ==========================================================================
   Quest Log -- the trail
   ========================================================================== */
.quest-log {
    position: relative;
    max-width: 1100px;
    margin: 32px auto 60px;
    padding: 60px 24px;
}

/* The dashed central trail */
.trail-path {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 3px dashed #6b5b4a;
    transform: translateX(-50%);
    z-index: 1;
}

/* Decorative compass-rose / map tacks at trail ends */
.trail-path::before,
.trail-path::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    background: #ffd700;
    border: 3px solid #6b5b4a;
    border-radius: 50%;
    box-shadow: inset 0 0 0 4px #f4ede0, inset 0 0 0 7px #cc0000;
}
.trail-path::before { top: -10px; }
.trail-path::after  { bottom: -10px; background: #2a6041; box-shadow: inset 0 0 0 4px #f4ede0, inset 0 0 0 7px #ffd700; }

/* Chapter banner blocks sit centered along the trail */
.chapter-banner {
    text-align: center;
    margin: 48px 0 32px;
    position: relative;
    z-index: 3;
}

.chapter-banner::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -24px;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background: #ffd700;
    clip-path: polygon(
        50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%,
        50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%
    );
    filter: drop-shadow(1px 2px 0 rgba(107, 91, 74, 0.55));
}

.chapter-blurb {
    max-width: 540px;
    margin: 14px auto 0;
    font-family: 'Lora', serif;
    font-style: italic;
    color: #8b7355;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border: 2px dashed #8b7355;
    border-radius: 14px 4px 12px 8px;
    padding: 12px 20px;
}

/* ==========================================================================
   Quest Cards
   ========================================================================== */
.quest-card {
    position: relative;
    background: #ffffff;
    border: 3px solid #6b5b4a;
    border-radius: 4px 12px 8px 16px;
    padding: 24px 26px;
    width: 42%;
    margin: 36px 0;
    z-index: 2;
    box-shadow: 5px 5px 0 rgba(107, 91, 74, 0.6);
    opacity: 0;
    transform: scale(0.95) translateY(8px);
    transition:
        opacity 0.5s ease,
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.25s ease;
}

.quest-card.is-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.quest-card:hover {
    box-shadow: 8px 8px 0 rgba(107, 91, 74, 0.6);
    transform: scale(1.01) translateY(-2px);
}

.quest-left {
    margin-right: 55%;
    border-radius: 4px 12px 8px 16px;
}

.quest-right {
    margin-left: 55%;
    border-radius: 12px 4px 16px 8px;
}

/* Inner imperfection -- second border to suggest hand-drawn ink */
.quest-card::before {
    content: '';
    position: absolute;
    inset: 5px;
    border: 1px dashed rgba(107, 91, 74, 0.35);
    border-radius: inherit;
    pointer-events: none;
}

/* Quest node circle on the trail */
.quest-node {
    position: absolute;
    top: 28px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffd700;
    border: 2px solid #6b5b4a;
    box-shadow: 0 0 0 3px #f4ede0, 0 0 0 4px rgba(107, 91, 74, 0.3);
    z-index: 3;
}

.quest-left .quest-node {
    right: -76px;
}

.quest-right .quest-node {
    left: -76px;
}

/* Connector line between card and trail node */
.quest-connector {
    position: absolute;
    top: 34px;
    height: 0;
    border-top: 2px dashed #6b5b4a;
    z-index: 1;
}

.quest-connector-left {
    right: -64px;
    width: 56px;
}

.quest-connector-right {
    left: -64px;
    width: 56px;
}

.quest-rank {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #8b7355;
    margin-bottom: 6px;
}

.quest-title {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    color: #6b5b4a;
    line-height: 1.25;
    margin-bottom: 10px;
    position: relative;
}

.quest-title::after {
    content: '';
    display: block;
    width: 42px;
    height: 3px;
    background: #ffd700;
    margin-top: 8px;
    border-radius: 2px;
}

.quest-desc {
    font-size: 0.96rem;
    color: #6b5b4a;
    margin-bottom: 16px;
}

.quest-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.reward-tag,
.xp-tag {
    display: inline-block;
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 5px 12px;
    border: 2px solid #6b5b4a;
    border-radius: 4px 10px 6px 12px;
    background: #f4ede0;
    color: #6b5b4a;
}

.reward-green  { background: #2a6041; color: #f4ede0; border-color: #2a6041; }
.reward-gold   { background: #ffd700; color: #6b5b4a; border-color: #6b5b4a; }
.reward-forest { background: #4a7c59; color: #f4ede0; border-color: #4a7c59; }
.reward-red    { background: #cc0000; color: #f4ede0; border-color: #cc0000; }

.xp-tag {
    background: #ffffff;
    color: #cc0000;
    border-color: #cc0000;
}

/* Progress bar */
.quest-progress {
    position: relative;
    height: 12px;
    background: #f4ede0;
    border: 2px solid #6b5b4a;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 4px;
}

.quest-progress-fill {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #ffd700 0%, #4a7c59 100%);
    width: 0%;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 2px solid #6b5b4a;
}

.quest-card[data-progress-applied="true"] .quest-progress-fill {
    /* width is set via inline style by JS */
}

.quest-progress-label {
    position: absolute;
    top: -22px;
    right: 0;
    font-family: 'Lora', serif;
    font-size: 0.72rem;
    color: #8b7355;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

/* Difficulty accent stripe at top of card */
.quest-card::after {
    content: attr(data-difficulty);
    position: absolute;
    top: -14px;
    left: 18px;
    background: #6b5b4a;
    color: #f4ede0;
    font-family: 'Lora', serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 3px 12px;
    border-radius: 8px 4px 8px 4px;
    border: 2px solid #6b5b4a;
}

.quest-card[data-difficulty="novice"]::after    { background: #4a7c59; border-color: #4a7c59; }
.quest-card[data-difficulty="apprentice"]::after{ background: #2a6041; border-color: #2a6041; }
.quest-card[data-difficulty="journey"]::after   { background: #8b7355; border-color: #8b7355; }
.quest-card[data-difficulty="champion"]::after  { background: #cc0000; border-color: #cc0000; }

/* ==========================================================================
   Quest Complete (Footer celebration)
   ========================================================================== */
.quest-complete {
    text-align: center;
    max-width: 680px;
    margin: 80px auto 40px;
    padding: 48px 28px;
    background: #ffffff;
    border: 4px solid #6b5b4a;
    border-radius: 24px 8px 20px 12px;
    box-shadow: 8px 8px 0 #6b5b4a;
    position: relative;
}

.quest-complete::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 2px dashed rgba(107, 91, 74, 0.4);
    border-radius: inherit;
    pointer-events: none;
}

.checkmark-circle {
    position: relative;
    width: 110px;
    height: 110px;
    margin: 0 auto 24px;
    background: #2a6041;
    border: 4px solid #6b5b4a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 0 #6b5b4a;
    animation: pop-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.checkmark {
    color: #ffd700;
    font-size: 4rem;
    line-height: 1;
    font-weight: 700;
    transform: translate(0, -3px);
}

@keyframes pop-in {
    0%   { transform: scale(0)   rotate(-180deg); }
    70%  { transform: scale(1.1) rotate(0deg);    }
    100% { transform: scale(1)   rotate(0deg);    }
}

.burst {
    position: absolute;
    width: 4px;
    height: 18px;
    background: #ffd700;
    border-radius: 2px;
    top: 50%;
    left: 50%;
    transform-origin: 50% 70px;
    animation: burst-out 1.4s ease-out 0.6s both;
}
.burst-1 { transform: translate(-50%, -50%) rotate(0deg);   }
.burst-2 { transform: translate(-50%, -50%) rotate(60deg);  background: #cc0000; }
.burst-3 { transform: translate(-50%, -50%) rotate(120deg); background: #4a7c59; }
.burst-4 { transform: translate(-50%, -50%) rotate(180deg); }
.burst-5 { transform: translate(-50%, -50%) rotate(240deg); background: #cc0000; }
.burst-6 { transform: translate(-50%, -50%) rotate(300deg); background: #4a7c59; }

@keyframes burst-out {
    0%   { opacity: 0; transform-origin: 50% 70px; }
    50%  { opacity: 1; }
    100% { opacity: 0; }
}

.victory-blurb {
    font-family: 'Lora', serif;
    font-style: italic;
    color: #8b7355;
    max-width: 480px;
    margin: 12px auto 32px;
}

.reward-screen {
    background: #f4ede0;
    border: 3px solid #6b5b4a;
    border-radius: 12px 4px 12px 4px;
    padding: 16px 20px;
    text-align: left;
    margin: 20px 0 28px;
}

.reward-row {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px dashed rgba(107, 91, 74, 0.4);
}

.reward-row:last-child {
    border-bottom: none;
}

.reward-row-final {
    margin-top: 4px;
    padding-top: 16px;
    border-top: 2px solid #6b5b4a;
    border-bottom: none;
}

.reward-icon {
    width: 36px;
    height: 36px;
    border: 2px solid #6b5b4a;
    border-radius: 8px 4px 10px 4px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Lora', serif;
    font-weight: 700;
    color: #6b5b4a;
    position: relative;
}

.icon-voice::before  { content: '\266B'; color: #cc0000; font-size: 1.2rem; }
.icon-map::before    { content: '\2691'; color: #2a6041; font-size: 1.2rem; }
.icon-shield::before { content: '\2694'; color: #8b7355; font-size: 1.2rem; }
.icon-crown::before  { content: '\2605'; color: #ffd700; font-size: 1.4rem; -webkit-text-stroke: 1px #6b5b4a; }

.reward-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reward-name {
    font-family: 'Lora', serif;
    font-weight: 700;
    color: #6b5b4a;
    font-size: 1rem;
}

.reward-desc {
    font-size: 0.82rem;
    color: #8b7355;
}

.reward-amt {
    font-family: 'Lora', serif;
    font-weight: 700;
    color: #2a6041;
    font-size: 1.1rem;
    background: #ffd700;
    border: 2px solid #6b5b4a;
    border-radius: 4px 8px 4px 10px;
    padding: 2px 12px;
}

.reward-amt-big {
    font-size: 1.4rem;
    background: #cc0000;
    color: #ffd700;
}

.restart-btn {
    background: #cc0000;
    color: #f4ede0;
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 1.05rem;
    border: 3px solid #6b5b4a;
    border-radius: 4px 14px 8px 16px;
    padding: 14px 28px;
    cursor: pointer;
    box-shadow: 5px 5px 0 #6b5b4a;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    margin-top: 8px;
}

.restart-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0 #6b5b4a;
    background: #2a6041;
}

.restart-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #6b5b4a;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.quest-footer {
    text-align: center;
    padding: 32px 24px 60px;
    color: #8b7355;
    border-top: 2px dashed #8b7355;
    max-width: 720px;
    margin: 40px auto 0;
}

.footer-stars {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 16px;
    margin-top: -10px;
    background: #f4ede0;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    padding: 0 12px;
}

.footer-text {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 1rem;
    color: #6b5b4a;
}

.footer-sub {
    font-size: 0.85rem;
    margin-top: 4px;
    font-style: italic;
}

/* ==========================================================================
   Responsive -- collapse trail to single column on small screens
   ========================================================================== */
@media (max-width: 760px) {
    .trail-path {
        left: 28px;
        transform: none;
    }

    .quest-card,
    .quest-left,
    .quest-right {
        width: auto;
        max-width: 100%;
        margin-left: 56px;
        margin-right: 0;
        border-radius: 4px 12px 8px 16px;
    }

    .quest-left .quest-node,
    .quest-right .quest-node {
        left: -42px;
        right: auto;
    }

    .quest-connector-left,
    .quest-connector-right {
        left: -34px;
        right: auto;
        width: 30px;
    }

    .chapter-banner {
        margin-left: 56px;
        text-align: left;
    }

    .chapter-banner::before {
        left: -34px;
        transform: none;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .quest-header {
        padding: 56px 16px 40px;
    }

    .banner-ribbon {
        padding: 12px 28px;
    }

    .banner-main {
        padding: 14px 36px;
    }

    .quest-log {
        padding: 32px 12px;
    }
}
