/* ============================
   TRANSACTOLOGY.ORG — STYLES
   ============================ */

/* Palette: #1e1108 #f2e8d5 #b8860b #8A9BAE #6b4226 #e85d3a #c4235c #f8f4ef #2c1810 #352012 #3d2b1f #4a3728 */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #1e1108;
    color: #f2e8d5;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Three-Column Dashboard Layout --- */
#left-gutter {
    position: fixed;
    left: 0;
    top: 0;
    width: 15%;
    height: 100vh;
    background-color: #1e1108;
    border-right: 1px solid #b8860b;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#center-well {
    margin-left: 15%;
    margin-right: 20%;
    width: 65%;
    min-height: 100vh;
    padding: 10vh 4vw;
}

#right-rail {
    position: fixed;
    right: 0;
    top: 0;
    width: 20%;
    height: 100vh;
    overflow-y: auto;
    padding: 6vh 1.5vw;
    z-index: 10;
    scrollbar-width: none;
}

#right-rail::-webkit-scrollbar {
    display: none;
}

/* --- Watermark --- */
#watermark {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(4rem, 10vw, 8rem);
    color: #b8860b;
    opacity: 0;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.15em;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    user-select: none;
    pointer-events: none;
}

#watermark.visible {
    opacity: 0.15;
    transition: opacity 1.5s ease;
}

/* --- Aphorisms --- */
#aphorism-container {
    position: absolute;
    bottom: 15vh;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    text-align: center;
    height: 3em;
}

.aphorism {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.9rem, 1.5vw, 1.3rem);
    color: #f2e8d5;
    opacity: 0;
    position: absolute;
    width: 100%;
    left: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.aphorism.active {
    opacity: 0.8;
    transform: translateY(0);
}

.aphorism.exiting {
    opacity: 0;
    transform: translateY(-20px);
}

/* --- Gutter Section Numbers --- */
#gutter-sections {
    position: absolute;
    top: 10vh;
    display: flex;
    flex-direction: column;
    gap: 12vh;
    align-items: center;
}

.gutter-number {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #b8860b;
    opacity: 0.25;
    transition: opacity 0.4s ease, color 0.4s ease;
}

.gutter-number.active {
    opacity: 1;
    color: #e85d3a;
}

/* --- Ledger Entries --- */
.ledger-entry {
    margin-bottom: 10vh;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.ledger-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

.entry-block {
    position: relative;
    padding: 2rem 2rem 2rem 2.5rem;
}

.stagger-left {
    margin-left: 2vw;
}

.stagger-right {
    margin-left: 4vw;
}

/* --- Leather Border --- */
.leather-border {
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 0;
    background: repeating-linear-gradient(
        180deg,
        #3d2b1f 0px,
        #4a3728 3px,
        #352012 6px,
        #3d2b1f 9px
    );
    transition: height 0.5s ease;
}

.ledger-entry.visible .leather-border {
    height: 100%;
}

/* --- Entry Typography --- */
.entry-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(2.5rem, 8vw, 7rem);
    letter-spacing: -0.03em;
    color: #f2e8d5;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

h2.entry-heading {
    font-size: clamp(1.5rem, 3vw, 2.8rem);
}

.entry-text {
    margin-bottom: 1.5rem;
    color: #f2e8d5;
    opacity: 0.9;
    max-width: 65ch;
}

/* --- Coin Markers --- */
.coin-marker {
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(184, 134, 11, 0.3));
}

.coin-marker svg {
    opacity: 0;
    transform: rotate(0deg);
    transition: opacity 0.3s ease;
}

.ledger-entry.visible .coin-marker svg {
    opacity: 1;
    animation: coinSpin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes coinSpin {
    0% { transform: rotate(0deg); }
    90% { transform: rotate(365deg); }
    100% { transform: rotate(360deg); }
}

/* --- Balance Scale --- */
.scale-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.balance-scale .scale-beam {
    transform-origin: 60px 35px;
    animation: scaleOscillate 4s ease-in-out infinite;
}

@keyframes scaleOscillate {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

/* --- Section Divider --- */
.section-divider {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 6vh;
}

.strap {
    flex: 1;
    height: 3px;
    background-color: #6b4226;
    box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

.rivet {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #d4a84b, #b8860b 50%, #8a6508);
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* --- Dopamine Pulse --- */
.dopamine-pulse {
    position: absolute;
    top: 2rem;
    left: 2.5rem;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 93, 58, 0.4) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
}

.dopamine-pulse.fire {
    animation: pulseExpand 0.6s ease-out forwards;
}

@keyframes pulseExpand {
    0% { width: 0; height: 0; opacity: 0.8; transform: translate(-50%, -50%); }
    100% { width: 400px; height: 400px; opacity: 0; transform: translate(-50%, -50%); }
}

/* --- Right Rail Cards --- */
.rail-card {
    margin-bottom: 4vh;
    padding: 1.5rem;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.marble-card {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(138, 155, 174, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(138, 155, 174, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(138, 155, 174, 0.05) 0%, transparent 60%),
        #f8f4ef;
    background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    color: #352012;
    border: 1px solid rgba(184, 134, 11, 0.2);
}

.marble-card:hover {
    transform: perspective(600px) rotateY(-3deg) rotateX(2deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: #c4235c;
}

.rail-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: #352012;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.rail-definition {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    line-height: 1.6;
    color: #4a3728;
}

.rail-quote {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    color: #6b4226;
    line-height: 1.5;
    margin-top: 0.8rem;
}

.column-fragment {
    display: block;
    margin: 0 auto 0.5rem;
    opacity: 0.6;
}

/* --- Ledger Overlay --- */
#ledger-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #2c1810;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    display: flex;
    align-items: center;
}

#ledger-rule {
    width: 100%;
    height: 1px;
    background-color: #b8860b;
    transform: scaleX(0);
    transform-origin: left;
}

/* --- Hover States --- */
.entry-block:hover .leather-border {
    background: repeating-linear-gradient(
        180deg,
        #c4235c 0px,
        #a01d4a 3px,
        #c4235c 6px
    );
    box-shadow: 0 0 20px rgba(196, 35, 92, 0.3);
}

/* --- Mobile Top Bar --- */
#mobile-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background-color: #1e1108;
    border-bottom: 1px solid #b8860b;
    z-index: 50;
    align-items: center;
    padding: 0 1rem;
    gap: 1rem;
}

.mobile-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 0.85rem;
    color: #b8860b;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.mobile-aphorism-track {
    overflow: hidden;
    flex: 1;
}

.mobile-aphorism {
    font-family: 'Caveat', cursive;
    font-size: 0.9rem;
    color: #f2e8d5;
    opacity: 0.7;
    white-space: nowrap;
    display: inline-block;
    animation: marquee 12s linear infinite;
}

@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* --- Responsive: 768px --- */
@media (max-width: 768px) {
    #left-gutter {
        display: none;
    }

    #right-rail {
        display: none;
    }

    #mobile-bar {
        display: flex;
    }

    #center-well {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        padding: 60px 1.5rem 4rem;
    }

    .stagger-left {
        margin-left: 10px;
    }

    .stagger-right {
        margin-left: 20px;
    }

    .entry-heading {
        font-size: clamp(1.8rem, 6vw, 3rem);
    }

    /* Mobile rail cards as details elements */
    .mobile-rail {
        background:
            radial-gradient(ellipse at 20% 50%, rgba(138, 155, 174, 0.08) 0%, transparent 50%),
            #f8f4ef;
        color: #352012;
        padding: 1rem;
        margin-top: 2rem;
        border-radius: 4px;
        border: 1px solid rgba(184, 134, 11, 0.2);
    }

    .mobile-rail summary {
        font-family: 'Playfair Display', serif;
        font-weight: 700;
        font-size: 0.95rem;
        color: #352012;
        cursor: pointer;
    }

    .mobile-rail p {
        font-family: 'Nunito', sans-serif;
        font-size: 0.9rem;
        color: #4a3728;
        margin-top: 0.5rem;
        line-height: 1.6;
    }
}

/* --- Initial Load Animation --- */
body.loading #left-gutter,
body.loading #center-well,
body.loading #right-rail {
    opacity: 0;
}

#left-gutter {
    opacity: 0;
    transition: opacity 0.4s ease;
}

#center-well {
    opacity: 0;
    transition: opacity 0.4s ease 0.2s;
}

#right-rail {
    opacity: 0;
    transition: opacity 0.4s ease 0.4s;
}

body.loaded #left-gutter {
    opacity: 1;
}

body.loaded #center-well {
    opacity: 1;
}

body.loaded #right-rail {
    opacity: 1;
}
