/* ============================
   diplomacy.quest - Styles
   ============================ */

:root {
    --diplomatic-black: #0A0B14;
    --burnished-gold: #C9A84C;
    --midnight-blue: #1B2A4A;
    --treaty-ivory: #F4ECD8;
    --vellum: #E8DCC8;
    --aged-brass: #7A7568;
    --seal-crimson: #8B2D2D;
    --obsidian: #06070E;

    --font-display: 'Poiret One', sans-serif;
    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Libre Baskerville', serif;
    --font-mono: 'DM Mono', monospace;

    --ease-heavy: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html { scroll-behavior: smooth; }

body {
    background-color: var(--diplomatic-black);
    color: #D4CFC4;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.85;
    overflow-x: hidden;
    transition: background-color 0.6s ease;
}

::selection {
    background: var(--burnished-gold);
    color: var(--diplomatic-black);
}

/* ============================
   Triple Rule Divider
   ============================ */
.triple-rule {
    max-width: 80%;
    margin: 0 auto;
    padding: 2rem 0;
    border: none;
    background: transparent;
    position: relative;
    height: 20px;
}

.triple-rule::before,
.triple-rule::after {
    content: '';
    position: absolute;
    left: 0;
    width: 0;
    background: var(--burnished-gold);
    transition: width 0.8s var(--ease-heavy);
}

.triple-rule::before {
    top: 0;
    height: 1px;
}

.triple-rule::after {
    bottom: 0;
    height: 1px;
}

.triple-rule.visible::before,
.triple-rule.visible::after {
    width: 100%;
}

/* Center thick line */
.triple-rule {
    border-top: none;
}

/* ============================
   The Embassy Facade
   ============================ */
.facade {
    height: 100vh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.facade-text {
    position: relative;
    z-index: 10;
    padding-left: clamp(40px, 8vw, 120px);
    max-width: 50%;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 7vw, 6rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--burnished-gold);
    line-height: 1.1;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s var(--ease-heavy), transform 0.8s var(--ease-heavy);
}

.hero-title.visible {
    opacity: 1;
    transform: translateX(0);
}

.hero-subtitle {
    font-family: var(--font-heading);
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--vellum);
    letter-spacing: 0.06em;
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 0.8s ease 0.5s;
}

.hero-title.visible ~ .hero-subtitle,
.facade.active .hero-subtitle {
    opacity: 1;
}

.starburst-hero {
    position: absolute;
    right: -5%;
    top: 10%;
    width: 70%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.starburst-hero svg {
    animation: starburst-rotate 120s linear infinite;
    will-change: transform;
}

@keyframes starburst-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================
   The Credentials Hall
   ============================ */
.credentials {
    padding: 100px 20px;
    position: relative;
    overflow: hidden;
}

.credentials-floor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-conic-gradient(
        var(--treaty-ivory) 0% 25%,
        var(--vellum) 25% 50%
    ) 0 0 / 40px 40px;
    opacity: 0.04;
    pointer-events: none;
    transform: rotate(45deg) scale(1.5);
}

.credential-block {
    max-width: 600px;
    padding: 40px;
    margin-bottom: 40px;
    background: rgba(26, 42, 74, 0.3);
    clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
    border: 1px solid var(--burnished-gold);
    opacity: 0;
    transition: opacity 0.6s var(--ease-heavy), transform 0.6s var(--ease-heavy);
}

.block-1 {
    margin-left: 10%;
    transform: rotate(-1deg) translateX(-60px);
}

.block-2 {
    margin-left: auto;
    margin-right: 10%;
    transform: rotate(0.5deg) translateX(60px);
}

.block-3 {
    margin-left: 15%;
    transform: rotate(-0.5deg) translateX(-60px);
}

.credential-block.visible {
    opacity: 1;
}

.block-1.visible { transform: rotate(-1deg) translateX(0); }
.block-2.visible { transform: rotate(0.5deg) translateX(0); }
.block-3.visible { transform: rotate(-0.5deg) translateX(0); }

.annotation {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    color: var(--aged-brass);
    display: block;
    margin-bottom: 0.75rem;
}

.block-heading {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: 0.06em;
    color: var(--treaty-ivory);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.block-body {
    color: #D4CFC4;
    line-height: 1.85;
}

/* ============================
   The Treaty Table
   ============================ */
.treaty-table {
    background: var(--treaty-ivory);
    color: #2A2A2E;
    padding: 100px 20px;
}

.treaty-layout {
    display: grid;
    grid-template-columns: 17.5% 65% 17.5%;
    max-width: 1200px;
    margin: 0 auto;
    gap: 0;
}

.margin-left,
.margin-right {
    padding: 0 16px;
}

.margin-note {
    margin-bottom: 40px;
}

.sticky-note {
    position: sticky;
    top: 100px;
}

.margin-text {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--aged-brass);
}

.treaty-main {
    padding: 0 40px;
    border-left: 1px solid var(--burnished-gold);
    border-right: 1px solid var(--burnished-gold);
}

.treaty-heading {
    font-family: var(--font-heading);
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: var(--midnight-blue);
    letter-spacing: 0.06em;
    margin-bottom: 2rem;
    line-height: 1.3;
}

.treaty-body {
    color: #2A2A2E;
    margin-bottom: 1.5rem;
    line-height: 1.85;
}

.small-starburst {
    display: flex;
    justify-content: center;
    margin: 3rem 0;
    opacity: 0.15;
}

/* ============================
   The Cipher Room
   ============================ */
.cipher-room {
    background: var(--diplomatic-black);
    padding: 100px 20px;
    position: relative;
}

.cipher-room::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, rgba(27, 42, 74, 0.1) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

.cipher-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

.cipher-block {
    padding: 40px;
    background: rgba(27, 42, 74, 0.2);
    border: 1px solid rgba(201, 168, 76, 0.15);
}

.cipher-label {
    color: var(--burnished-gold);
    opacity: 0.7;
}

.cipher-text {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.7;
    color: #D4CFC4;
    min-height: 120px;
}

.cipher-char {
    display: inline;
    transition: color 0.2s ease;
}

.cipher-char.revealed {
    color: #D4CFC4;
}

.cipher-char.flash {
    color: var(--burnished-gold);
}

.cipher-char.hidden {
    color: var(--aged-brass);
    opacity: 0.4;
}

/* ============================
   The Seal Chamber
   ============================ */
.seal-chamber {
    background: var(--treaty-ivory);
    padding: 120px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.diplomatic-seal {
    animation: seal-press 3s ease-in-out infinite;
    margin-bottom: 2rem;
}

@keyframes seal-press {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.seal-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2.8rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--diplomatic-black);
    margin-bottom: 1rem;
}

.seal-closing {
    font-family: var(--font-heading);
    font-weight: 600;
    font-style: italic;
    font-size: 1.2rem;
    color: var(--midnight-blue);
    letter-spacing: 0.06em;
}

.wax-seal-accent {
    margin-top: 3rem;
}

.wax-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--seal-crimson), #5a1e1e);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    margin: 0 auto;
}

/* ============================
   Mobile
   ============================ */
@media (max-width: 768px) {
    .facade-text {
        max-width: 90%;
        padding-left: 20px;
    }

    .starburst-hero {
        opacity: 0.2;
        right: -30%;
    }

    .credential-block {
        margin-left: 5% !important;
        margin-right: 5% !important;
    }

    .treaty-layout {
        grid-template-columns: 1fr;
    }

    .margin-left,
    .margin-right {
        display: none;
    }

    .treaty-main {
        border-left: none;
        border-right: none;
        padding: 0;
    }

    .cipher-grid {
        grid-template-columns: 1fr;
    }

    .credentials-floor {
        display: none;
    }
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--diplomatic-black); }
::-webkit-scrollbar-thumb { background: var(--burnished-gold); border-radius: 2px; }
