/* ============================================
   COMMUNITY RESERVES — cr-page
   Scoped under .cr-page to prevent global bleed
   ============================================ */

.cr-page {
    --forest:   #0a2e1a;
    --emerald:  #059669;
    --gold:     #f1c40f;
    --cream:    #f9f6ef;
    --fog:      #e8f0e9;
    --ink:      #0f1c10;
    --white:    #ffffff;
    --parchment:#fcf8f2;
    --ease:     cubic-bezier(0.16, 1, 0.3, 1);

    background: var(--cream);
    color: var(--ink);
    font-family: 'Open Sans', sans-serif;
    padding-bottom: 80px;
    overflow-x: hidden;
}

.cr-section { padding: 40px 0; }
.cr-wrap    { padding: 0 5%; max-width: 1400px; margin: 0 auto; }

/* === TITLE STYLING === */
.cr-header-desc {
    text-align: center;
    max-width: 800px;
    margin: 30px auto 40px auto;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #475569;
}
.cr-title-bar {
    width: 80px;
    height: 4px;
    background: var(--gold);
    border-radius: 2px;
    margin: 20px auto;
}

.cr-section-title {
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 800;
    color: var(--forest);
    letter-spacing: -.02em;
    line-height: 1.1;
    margin-bottom: 8px;
}

.cr-section-subtitle {
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: #475569;
    max-width: 600px;
    line-height: 1.6;
}

/* === STATS PANEL === */
.cr-stats-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 50px;
}
.cr-stat-box {
    background: linear-gradient(135deg, var(--forest) 0%, #0d3821 100%);
    color: var(--white);
    padding: 35px 25px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(10,46,26,0.15);
    position: relative;
    overflow: hidden;
    transition: all 0.4s var(--ease);
}
.cr-stat-box:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(10,46,26,0.25);
}
.cr-stat-box::before {
    content: '';
    position: absolute;
    top: -50px; right: -50px;
    width: 120px; height: 120px;
    background: rgba(241,196,15,0.08);
    border-radius: 50%;
}
.cr-stat-num {
    font-size: clamp(32px, 3.8vw, 48px);
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 8px;
}
.cr-stat-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #e8f0e9;
}

/* === INTERACTIVE CORRIDOR SIMULATOR (CAPSTONE) === */
.cr-simulator-card {
    background: var(--white);
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.06);
    border: 1px solid var(--fog);
    margin-bottom: 60px;
    position: relative;
}
.cr-sim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}
.cr-sim-title h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--forest);
    margin-bottom: 6px;
}
.cr-sim-title p {
    font-size: 0.9rem;
    color: #64748b;
}
.cr-sim-modes {
    display: flex;
    gap: 10px;
}
.cr-mode-btn {
    background: var(--cream);
    border: 1px solid var(--fog);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}
.cr-mode-btn.active {
    background: var(--emerald);
    color: var(--white);
    border-color: var(--emerald);
    box-shadow: 0 5px 15px rgba(5,150,105,0.25);
}

/* THE PATH SCENE CONTAINER */
.cr-path-scene {
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
    height: 180px;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    border: 2px dashed rgba(5,150,105,0.2);
    transition: background 0.5s ease;
}
.cr-path-scene.night {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-color: rgba(255,255,255,0.1);
}
.cr-forest-bg {
    position: absolute;
    bottom: 0; width: 100%;
    height: 60px;
    background: repeating-linear-gradient(90deg, var(--forest) 0px, var(--forest) 20px, #0f4c2e 20px, #0f4c2e 40px);
    opacity: 0.15;
}
.cr-path-scene.night .cr-forest-bg {
    opacity: 0.05;
}

/* SVG Safe Path Path line */
.cr-svg-line {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}
.cr-svg-path {
    fill: none;
    stroke: var(--gold);
    stroke-width: 4;
    stroke-dasharray: 8 8;
    animation: dash 30s linear infinite;
}
.cr-path-scene.night .cr-svg-path {
    stroke: var(--emerald);
}

@keyframes dash {
    to {
        stroke-dashoffset: -1000;
    }
}

/* The Animated Animal Character Avatar */
.cr-animal-avatar {
    position: absolute;
    width: 48px; height: 48px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    z-index: 10;
    transform: translate(-50%, -50%);
    font-size: 1.4rem;
    transition: left 0.1s linear, top 0.1s linear, background 0.3s ease;
}
.cr-path-scene.night .cr-animal-avatar {
    background: var(--forest);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

/* Controls */
.cr-sim-slider-wrap {
    margin-top: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.cr-sim-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 4px;
    background: var(--fog);
    outline: none;
    cursor: pointer;
}
.cr-sim-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--emerald);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(5,150,105,0.3);
    transition: transform 0.2s ease;
}
.cr-sim-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.cr-sim-label {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--forest);
    min-width: 130px;
}

/* === AGREEMENT COVENANT BOARD === */
.cr-covenant-section {
    background: var(--parchment);
    border-radius: 30px;
    padding: 50px;
    box-shadow: 0 20px 50px rgba(10,46,26,0.06);
    border: 1px solid #ebd9c3;
    position: relative;
    margin-bottom: 60px;
}
.cr-covenant-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

/* Left Covenant Column: The Clauses list */
.cr-clause-card {
    background: var(--white);
    border: 1px solid #ebd9c3;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.4s var(--ease);
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.cr-clause-card:hover {
    transform: translateX(8px);
    border-color: var(--gold);
    box-shadow: 0 8px 25px rgba(241,196,15,0.1);
}
.cr-clause-card.active {
    background: #fbf6ee;
    border-color: var(--gold);
    border-left: 6px solid var(--gold);
    box-shadow: 0 10px 30px rgba(10,46,26,0.05);
}
.cr-clause-icon {
    background: var(--cream);
    color: var(--forest);
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}
.cr-clause-card.active .cr-clause-icon {
    background: var(--gold);
    color: var(--forest);
}
.cr-clause-title {
    font-weight: 800;
    color: var(--forest);
    font-size: 0.95rem;
    margin-bottom: 4px;
}
.cr-clause-text {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.5;
}

/* Right Covenant Column: The Digital Treaty Seal */
.cr-treaty-paper {
    background: var(--white);
    border: 2px solid #e5d5c0;
    border-radius: 20px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 480px;
    position: relative;
    box-shadow: inset 0 0 40px rgba(229,213,192,0.2);
}
.cr-treaty-header {
    text-align: center;
    border-bottom: 2px double #e5d5c0;
    padding-bottom: 20px;
}
.cr-treaty-header h4 {
    font-family: 'Georgia', serif;
    font-size: 1.4rem;
    color: #5c4033;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.cr-treaty-header p {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8b5a2b;
    font-weight: 700;
}
.cr-treaty-body {
    padding: 30px 0;
    font-family: 'Georgia', serif;
    font-size: 0.92rem;
    line-height: 1.8;
    color: #5c4033;
    text-align: center;
    flex-grow: 1;
}
.cr-treaty-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px dashed #ebd9c3;
    padding-top: 20px;
}
.cr-party-signature {
    text-align: center;
}
.cr-party-label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #8b5a2b;
    margin-bottom: 12px;
}
.cr-sig-line {
    width: 140px;
    height: 1px;
    background: #ebd9c3;
    position: relative;
}
.cr-sig-img {
    font-family: 'Brush Script MT', cursive, sans-serif;
    font-size: 1.3rem;
    color: #0c4a60;
    position: absolute;
    bottom: 56px;
    left: 10px;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.cr-sig-img.signed {
    opacity: 1;
}

/* Dynamic Wax Seal Interactive Stamp */
.cr-wax-seal {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translate(-50%, 20px) scale(1.6);
    width: 80px; height: 80px;
    background: radial-gradient(circle, #b91c1c 0%, #7f1d1d 100%);
    border-radius: 50%;
    box-shadow: 0 10px 25px rgba(127,29,29,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px double #f87171;
    color: var(--white);
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    pointer-events: none;
}
.cr-wax-seal.stamp-active {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
    pointer-events: auto;
}
.cr-wax-seal.sealed {
    animation: bounceStamp 0.4s var(--ease);
}
@keyframes bounceStamp {
    0% { transform: translate(-50%, -100px) scale(2); opacity: 0; }
    70% { transform: translate(-50%, 0) scale(0.9); }
    100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

/* === CENSUS & DIRECTORY LIST === */
.cr-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}
.cr-download-btn {
    background: var(--forest);
    color: var(--white);
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    box-shadow: 0 10px 25px rgba(10,46,26,0.15);
    transition: all 0.3s ease;
}
.cr-download-btn:hover {
    background: var(--emerald);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(5,150,105,0.25);
    color: var(--white);
}

.cr-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.cr-card {
    background: var(--white);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    border: 1px solid var(--fog);
    transition: all 0.4s var(--ease);
}
.cr-card:hover {
    transform: translateY(-6px);
    border-color: var(--emerald);
    box-shadow: 0 20px 45px rgba(10,46,26,0.1);
}
.cr-card-district {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--emerald);
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.cr-card-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--forest);
    margin-bottom: 12px;
}
.cr-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #64748b;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
}

/* === RESPONSIVE BREAKPOINTS === */
@media (max-width: 1024px) {
    .cr-stats-panel {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .cr-covenant-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .cr-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .cr-grid {
        grid-template-columns: 1fr;
    }
}
