/* ============================================
   diplomatic.boo — Phantom Embassy Styles
   ============================================ */

/* --- Custom Properties --- */
:root {
    --obsidian-void: #0C0B1E;
    --midnight-embassy: #12132D;
    --charcoal-chamber: #1A1A2A;
    --treaty-gold: #C5A55A;
    --faded-gilt: #9E8544;
    --ectoplasm-ivory: #E8E4D9;
    --phantom-azure: #4A5C8A;
    --sealed-vermillion: #8B2E3B;

    --font-display: 'Poiret One', sans-serif;
    --font-body: 'Cormorant Garamond', serif;
    --font-mono: 'Share Tech Mono', monospace;

    --ease-reveal: cubic-bezier(0.25, 0.1, 0.25, 1.0);
    --ease-exit: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--obsidian-void);
    color: var(--ectoplasm-ivory);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* --- Panel Base --- */
.panel {
    width: 100vw;
    min-height: 100vh;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
}

/* --- Spectral Dust Particles --- */
.dust-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.dust {
    position: absolute;
    bottom: -10px;
    left: var(--x);
    width: 2px;
    height: 2px;
    background: var(--treaty-gold);
    border-radius: 50%;
    opacity: 0;
    animation: dustFloat var(--dur) var(--delay) infinite linear;
}

.dust:nth-child(odd) {
    width: 3px;
    height: 3px;
}

@keyframes dustFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.2;
    }
    50% {
        opacity: 0.15;
        transform: translateY(-50vh) translateX(20px);
    }
    90% {
        opacity: 0.25;
    }
    100% {
        transform: translateY(-110vh) translateX(-15px);
        opacity: 0;
    }
}

/* --- Typography --- */
.display-text {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 7rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--treaty-gold);
    line-height: 1.2;
}

.section-heading {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.5vw, 3rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--treaty-gold);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.classification-label {
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--treaty-gold);
    opacity: 0.6;
    display: block;
    margin-bottom: 0.5rem;
}

.classification-label.classified {
    color: var(--sealed-vermillion);
    opacity: 0.9;
}

.tagline {
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 1.8vw, 1.5rem);
    color: var(--ectoplasm-ivory);
    opacity: 0;
    letter-spacing: 0.02em;
}

/* --- Gold Diamond Bullet --- */
.gold-diamond {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--treaty-gold);
    transform: rotate(45deg);
    margin-bottom: 1rem;
}

/* ============================================
   PANEL 1: The Seal (Opening)
   ============================================ */
#panel-seal {
    background: var(--obsidian-void);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.diagonal-gold-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.diagonal-gold-line svg {
    width: 100%;
    height: 100%;
}

.gold-diag {
    stroke: var(--treaty-gold);
    stroke-width: 2;
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    opacity: 0.5;
}

.gold-diag.animate {
    animation: drawLine 1500ms var(--ease-reveal) forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

.seal-upper {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.eagle-svg {
    width: clamp(140px, 20vw, 260px);
    height: auto;
}

.eagle-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    opacity: 0;
}

.eagle-path.animate {
    animation: drawEagle 2500ms var(--ease-reveal) forwards;
}

@keyframes drawEagle {
    0% {
        stroke-dashoffset: 500;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

.seal-lower {
    position: relative;
    z-index: 2;
    text-align: center;
}

#domain-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(15px);
}

#domain-title .letter.visible {
    animation: letterReveal 400ms var(--ease-reveal) forwards;
}

@keyframes letterReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#tagline.visible {
    animation: fadeIn 800ms var(--ease-reveal) forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* ============================================
   PANEL 2: The Credentials (About)
   ============================================ */
#panel-credentials {
    background: var(--obsidian-void);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.credentials-layout {
    display: flex;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 3rem;
    position: relative;
    z-index: 2;
}

.credentials-portrait {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ghost-portrait {
    width: 70%;
    max-width: 300px;
    height: auto;
    opacity: 0.8;
}

.credentials-text {
    flex: 0 0 60%;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    padding-left: 3rem;
}

.credentials-block {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 800ms var(--ease-reveal), transform 800ms var(--ease-reveal);
}

.credentials-block.revealed {
    opacity: 1;
    transform: translateX(0);
}

.credentials-block p {
    color: var(--ectoplasm-ivory);
    max-width: 500px;
}

.block-2 {
    padding-top: 1.5rem;
    margin-left: 1.5rem;
}

.block-3 {
    padding-top: 1.5rem;
    margin-left: 3rem;
}

.diagonal-break {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    z-index: 3;
}

.break-down {
    background: linear-gradient(
        165deg,
        transparent 49.5%,
        var(--obsidian-void) 49.5%,
        var(--obsidian-void) 50.5%,
        var(--midnight-embassy) 50.5%
    );
}

/* --- Diagonal Grid Overlay --- */
.diagonal-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-linear-gradient(
            30deg,
            transparent,
            transparent 79px,
            rgba(197, 165, 90, 0.03) 79px,
            rgba(197, 165, 90, 0.03) 80px
        ),
        repeating-linear-gradient(
            -30deg,
            transparent,
            transparent 79px,
            rgba(197, 165, 90, 0.03) 79px,
            rgba(197, 165, 90, 0.03) 80px
        );
}

/* ============================================
   PANEL 3: The Communique (Featured Content)
   ============================================ */
#panel-communique {
    background: var(--midnight-embassy);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 3rem;
}

.communique-columns {
    display: flex;
    gap: 2.5rem;
    max-width: 1400px;
    width: 100%;
    align-items: flex-start;
    position: relative;
    z-index: 2;
}

.communique-col {
    flex: 1;
    border: 1px solid var(--treaty-gold);
    padding: 2.5rem 2rem;
    position: relative;
    background: rgba(12, 11, 30, 0.4);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 700ms var(--ease-reveal), transform 700ms var(--ease-reveal);
}

.communique-col.revealed {
    opacity: 1;
    transform: translateY(0);
}

.col-2 {
    margin-top: 80px;
    transition-delay: 150ms;
}

.col-3 {
    margin-top: 160px;
    transition-delay: 300ms;
}

/* Deco Corner Ornaments */
.deco-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    z-index: 3;
}

.deco-corner svg {
    width: 100%;
    height: 100%;
}

.deco-tl { top: -1px; left: -1px; }
.deco-tr { top: -1px; right: -1px; }
.deco-bl { bottom: -1px; left: -1px; }
.deco-br { bottom: -1px; right: -1px; }

.communique-title {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--treaty-gold);
    margin-bottom: 1.2rem;
    line-height: 1.3;
}

.dispatch-text {
    color: var(--ectoplasm-ivory);
    margin-bottom: 1rem;
    font-style: italic;
}

/* Redaction Bars */
.redaction-bar {
    position: relative;
    color: transparent;
    cursor: pointer;
}

.redaction-bar::before {
    content: '';
    position: absolute;
    top: 2px;
    left: -2px;
    right: -2px;
    bottom: 2px;
    background: var(--obsidian-void);
    border: 1px solid rgba(197, 165, 90, 0.1);
    transition: opacity 500ms var(--ease-reveal);
    z-index: 1;
}

.redaction-bar:hover::before {
    opacity: 0.75;
}

.redaction-bar:hover {
    color: rgba(232, 228, 217, 0.25);
}

/* Wax Seal */
.wax-seal {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.wax-seal svg {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 0 12px rgba(197, 165, 90, 0.2));
}

.seal-small svg {
    width: 40px;
    height: 40px;
}

/* ============================================
   PANEL 4: The Treaty Room (Showcase)
   ============================================ */
#panel-treaty {
    background: var(--midnight-embassy);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 3rem;
}

.treaty-split {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.treaty-upper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--midnight-embassy);
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.treaty-lower {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--charcoal-chamber);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.treaty-cards-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
    max-width: 1100px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.treaty-card {
    background: rgba(197, 165, 90, 0.08);
    border: 1px solid rgba(197, 165, 90, 0.3);
    padding: 2.5rem 2rem;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 300ms var(--ease-reveal), border-color 300ms var(--ease-reveal);
    opacity: 0;
    will-change: transform;
}

.treaty-card.revealed {
    opacity: 1;
}

.treaty-card:hover {
    border-color: rgba(197, 165, 90, 0.6);
}

.card-1 {
    transform: rotate(-2deg);
}
.card-2 {
    transform: rotate(1.5deg);
    margin-top: 40px;
}
.card-3 {
    transform: rotate(1deg);
    margin-top: -20px;
}
.card-4 {
    transform: rotate(-1.5deg);
    margin-top: 20px;
}

.card-1.revealed { transform: rotate(-2deg); }
.card-2.revealed { transform: rotate(1.5deg); margin-top: 40px; }
.card-3.revealed { transform: rotate(1deg); margin-top: -20px; }
.card-4.revealed { transform: rotate(-1.5deg); margin-top: 20px; }

.treaty-title {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 1.8vw, 1.6rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--treaty-gold);
    margin-bottom: 0.5rem;
}

.treaty-date {
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.15em;
    color: var(--faded-gilt);
    opacity: 0.7;
    margin-bottom: 1rem;
}

.treaty-excerpt {
    color: var(--ectoplasm-ivory);
    opacity: 0.85;
}

/* ============================================
   PANEL 5: The Gallery of Envoys
   ============================================ */
#panel-gallery {
    background: var(--obsidian-void);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 3rem;
}

.gallery-header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 700ms var(--ease-reveal), transform 700ms var(--ease-reveal);
}

.gallery-header.revealed {
    opacity: 1;
    transform: translateY(0);
}

.honeycomb-cluster {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    max-width: 900px;
    position: relative;
    z-index: 2;
}

.hex-frame {
    width: 160px;
    height: 180px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: rgba(197, 165, 90, 0.08);
    border: none;
    position: relative;
    cursor: pointer;
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1), background 300ms var(--ease-reveal);
    opacity: 0;
    transform: scale(0.9);
}

.hex-frame.revealed {
    opacity: 1;
    transform: scale(1);
}

.hex-frame::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--obsidian-void);
    z-index: 0;
}

.hex-frame::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: rgba(197, 165, 90, 0.3);
    transition: background 300ms var(--ease-reveal);
    z-index: -1;
}

.hex-frame:hover {
    transform: scale(1.06);
    background: rgba(197, 165, 90, 0.2);
}

.hex-frame:hover::after {
    background: var(--treaty-gold);
}

.hex-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hex-silhouette {
    width: 80px;
    height: 80px;
    transition: opacity 300ms var(--ease-reveal);
}

.hex-frame:hover .hex-silhouette {
    opacity: 0.6;
}

.hex-info {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    text-align: center;
    opacity: 0;
    transition: opacity 300ms var(--ease-reveal), transform 300ms var(--ease-reveal);
    z-index: 2;
    width: 140px;
}

.hex-frame:hover .hex-info {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.envoy-name {
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--treaty-gold);
    display: block;
    white-space: nowrap;
}

.envoy-title {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    color: var(--ectoplasm-ivory);
    opacity: 0.6;
    display: block;
    margin-top: 2px;
}

/* Stagger honeycomb positions */
.hex-2 { margin-top: -20px; }
.hex-4 { margin-top: -20px; }

/* ============================================
   PANEL 6: The Archive (Footer/Close)
   ============================================ */
#panel-archive {
    background: var(--charcoal-chamber);
    display: flex;
    align-items: center;
    justify-content: center;
}

.archive-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.08;
    background-image:
        repeating-radial-gradient(
            circle at 20% 50%,
            transparent 0,
            rgba(197, 165, 90, 0.03) 1px,
            transparent 2px,
            transparent 40px
        ),
        repeating-radial-gradient(
            circle at 80% 30%,
            transparent 0,
            rgba(197, 165, 90, 0.02) 1px,
            transparent 2px,
            transparent 60px
        );
}

.archive-content {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    padding: 4rem 2rem;
}

.archive-eagle {
    width: 120px;
    height: auto;
}

.archive-message {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    color: var(--ectoplasm-ivory);
    opacity: 0.8;
    letter-spacing: 0.02em;
}

.archive-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.archive-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem 2.5rem;
}

.archive-link {
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ectoplasm-ivory);
    text-decoration: none;
    opacity: 0.5;
    transition: color 300ms var(--ease-reveal), opacity 300ms var(--ease-reveal);
}

.archive-link:hover {
    color: var(--phantom-azure);
    opacity: 1;
}

.archive-footer {
    margin-top: 1rem;
}

/* ============================================
   Scroll Reveal (Base State)
   ============================================ */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 700ms var(--ease-reveal), transform 700ms var(--ease-reveal);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    .credentials-layout {
        flex-direction: column;
        padding: 3rem 1.5rem;
    }

    .credentials-portrait {
        flex: 0 0 auto;
        margin-bottom: 2rem;
    }

    .credentials-text {
        padding-left: 0;
    }

    .block-2, .block-3 {
        margin-left: 0;
    }

    .communique-columns {
        flex-direction: column;
        gap: 2rem;
        padding: 2rem 1.5rem;
    }

    .col-2, .col-3 {
        margin-top: 0;
    }

    .treaty-cards-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .card-1, .card-2, .card-3, .card-4 {
        transform: none;
        margin-top: 0;
    }

    .card-1.revealed, .card-2.revealed, .card-3.revealed, .card-4.revealed {
        transform: none;
        margin-top: 0;
    }

    .honeycomb-cluster {
        gap: 1rem;
    }

    .hex-frame {
        width: 130px;
        height: 150px;
    }

    .hex-2, .hex-4 {
        margin-top: 0;
    }
}

@media (max-width: 600px) {
    html {
        scroll-snap-type: none;
    }

    .panel {
        min-height: auto;
        padding: 3rem 1rem;
    }

    #panel-seal {
        min-height: 100vh;
    }

    .display-text {
        font-size: clamp(1.8rem, 8vw, 3rem);
        letter-spacing: 0.15em;
    }

    .hex-frame {
        width: 110px;
        height: 125px;
    }

    .envoy-name {
        font-size: 0.6rem;
    }

    .envoy-title {
        font-size: 0.5rem;
    }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .dust-layer {
        display: none;
    }
}
