/* =========================================================
   diplomatic.boo - Styles
   Monochrome Marble Codex
   ========================================================= */

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

html {
    scroll-behavior: smooth;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    background-color: #FBFBFB;
    color: #383838;
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw + 0.35rem, 1.2rem);
    line-height: 1.95;
    letter-spacing: 0.015em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --- Ghost Grid (fixed datum plane) --- */
.ghost-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.02;
    background:
        repeating-linear-gradient(
            to right,
            #C8C8C8 0px,
            #C8C8C8 1px,
            transparent 1px,
            transparent 120px
        ),
        repeating-linear-gradient(
            to bottom,
            #C8C8C8 0px,
            #C8C8C8 1px,
            transparent 1px,
            transparent 120px
        );
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.ghost-grid.threshold-active {
    opacity: 0.06;
}

.ghost-grid.garden-active {
    opacity: 0;
}

/* --- Navigation Marker --- */
.nav-marker {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    z-index: 100;
    cursor: pointer;
    border-radius: 50%;
    background:
        radial-gradient(circle at 40% 35%, #FFFFFF 0%, #EFEFEF 40%, #DEDEDE 70%, #C8C8C8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.nav-marker:hover {
    transform: translateX(-50%) scale(1.15);
}

.compass-rose {
    animation: compassRotate 120s linear infinite;
    transform-origin: center center;
}

.compass-rose.slowing {
    animation: compassSlow 3s cubic-bezier(0.25, 0.1, 0.25, 1.0) forwards;
}

@keyframes compassRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes compassSlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(15deg); }
}

/* Compass wobble (secondary 12-second sinusoidal oscillation) */
.nav-marker {
    animation: compassWobble 12s ease-in-out infinite;
}

@keyframes compassWobble {
    0%, 100% { transform: translateX(-50%) rotate(0deg); }
    25% { transform: translateX(-50%) rotate(1.5deg); }
    50% { transform: translateX(-50%) rotate(0deg); }
    75% { transform: translateX(-50%) rotate(-1.5deg); }
}

/* --- Navigation Overlay --- */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99;
    background-color: #0F0F0F;
    background-color: rgba(15, 15, 15, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.nav-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.nav-overlay-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.nav-overlay-link {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    text-decoration: none;
    color: #F0F0F0;
    transition: color 0.5s ease-out;
}

.nav-overlay-link:hover {
    color: #FFFFFF;
    text-decoration: none;
}

.nav-numeral {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.6rem, 0.7vw + 0.15rem, 0.8rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #999999;
    min-width: 2.5rem;
}

.nav-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw + 0.5rem, 4.5rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    line-height: 1.0;
}

/* --- Tatami Frame System --- */
.tatami-frame {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.frame-content {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 0 clamp(2rem, 6vw, 5rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

/* --- Breath Gaps --- */
.breath-gap {
    height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #FBFBFB;
}

.breath-rule {
    width: 60px;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        #C8C8C8,
        transparent
    );
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.breath-rule.visible {
    opacity: 1;
}

/* --- Annotations --- */
.annotation {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.6rem, 0.7vw + 0.15rem, 0.8rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #999999;
    margin-bottom: 2.5rem;
}

/* --- Body Text --- */
.body-text {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw + 0.35rem, 1.2rem);
    line-height: 1.95;
    letter-spacing: 0.015em;
    color: #383838;
    text-align: center;
}

/* --- Links (no blue, monochrome only) --- */
a {
    color: #383838;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: #C8C8C8;
    text-decoration-thickness: 1px;
    transition: color 0.5s ease-out, text-decoration-color 0.5s ease-out, text-decoration-thickness 0.5s ease-out;
}

a:hover {
    color: #161616;
    text-decoration-color: #161616;
    text-decoration-thickness: 2px;
}

/* =========================================================
   FRAME I: THE SEAL
   ========================================================= */

.frame-content--seal {
    opacity: 0;
    animation: sealFadeIn 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0) 0.3s forwards;
}

@keyframes sealFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.protocol-handshake {
    margin-bottom: 3rem;
}

.handshake-svg {
    overflow: visible;
}

/* Protocol Handshake animation: approach, interlock, withdraw (10s cycle) */
.handshake-arc-left {
    animation: arcApproachLeft 10s cubic-bezier(0.25, 0.1, 0.25, 1.0) infinite;
}

.handshake-arc-right {
    animation: arcApproachRight 10s cubic-bezier(0.25, 0.1, 0.25, 1.0) infinite;
}

@keyframes arcApproachLeft {
    0% { transform: translateX(-40px); opacity: 0.4; }
    20% { transform: translateX(0px); opacity: 1; }
    35% { transform: translateX(20px); opacity: 1; }
    50% { transform: translateX(20px); opacity: 1; }
    70% { transform: translateX(0px); opacity: 1; }
    100% { transform: translateX(-40px); opacity: 0.4; }
}

@keyframes arcApproachRight {
    0% { transform: translateX(40px); opacity: 0.4; }
    20% { transform: translateX(0px); opacity: 1; }
    35% { transform: translateX(-20px); opacity: 1; }
    50% { transform: translateX(-20px); opacity: 1; }
    70% { transform: translateX(0px); opacity: 1; }
    100% { transform: translateX(40px); opacity: 0.4; }
}

.seal-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(3.5rem, 10vw + 0.5rem, 8.5rem);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #161616;
    line-height: 1.0;
    text-align: center;
}

.seal-subtitle {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(1.4rem, 4vw + 0.2rem, 3.4rem);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #161616;
    line-height: 1.0;
    text-align: center;
    margin-top: 0.5rem;
}

.seal-rule {
    width: 60px;
    height: 1px;
    background-color: #C8C8C8;
    margin-top: 2.5rem;
}

/* =========================================================
   FRAME II: THE THRESHOLD
   ========================================================= */

.frame-content--threshold {
    max-width: 560px;
}

.threshold-text {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.9s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 0.9s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.threshold-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

.cracked-marble-divider {
    margin-top: 3rem;
    width: 100%;
    max-width: 560px;
    display: flex;
    justify-content: center;
    opacity: 0;
    transition: opacity 1s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.cracked-marble-divider.revealed {
    opacity: 1;
}

.cracked-marble-divider svg {
    width: 100%;
    height: auto;
}

/* =========================================================
   FRAME III: THE NETWORK
   ========================================================= */

.constellation-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.15;
    pointer-events: none;
}

.constellation-svg {
    width: 100%;
    height: 100%;
}

.frame-content--network {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5rem;
}

.network-statement {
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.network-statement.revealed {
    opacity: 1;
    transform: translateY(0);
}

.statement-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.seal-fragment {
    flex-shrink: 0;
}

.network-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 2.8rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #161616;
    line-height: 1.0;
}

.coordinates {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 480px;
    margin: 0.75rem auto 0;
}

.coord-left, .coord-right {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.6rem, 0.7vw + 0.15rem, 0.8rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #999999;
}

/* =========================================================
   FRAME IV: THE ARCHIVE
   ========================================================= */

.vein-genesis-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.08;
    pointer-events: none;
}

.frame-content--archive {
    width: 100%;
    max-width: 900px;
}

.marble-panel {
    width: 100%;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    background-color: #EFEFEF;
    background-image:
        repeating-linear-gradient(
            15deg,
            transparent,
            transparent 80px,
            rgba(200, 200, 200, 0.15) 80px,
            rgba(200, 200, 200, 0.15) 81px,
            transparent 81px,
            transparent 200px
        ),
        repeating-linear-gradient(
            165deg,
            transparent,
            transparent 120px,
            rgba(222, 222, 222, 0.2) 120px,
            rgba(222, 222, 222, 0.2) 121px,
            transparent 121px,
            transparent 300px
        ),
        repeating-linear-gradient(
            78deg,
            transparent,
            transparent 60px,
            rgba(200, 200, 200, 0.1) 60px,
            rgba(200, 200, 200, 0.1) 61px,
            transparent 61px,
            transparent 160px
        ),
        radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.3) 0%, transparent 70%),
        radial-gradient(ellipse at 70% 60%, rgba(255,255,255,0.2) 0%, transparent 60%);
    background-blend-mode: soft-light, normal, normal, normal, normal;
}

.archive-window {
    max-width: 640px;
    background-color: #FFFFFF;
    padding: 3.5rem;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 1s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.archive-window.revealed {
    opacity: 1;
    transform: translateY(0);
}

.archive-text {
    margin-top: 1.5rem;
}

.archive-text:first-of-type {
    margin-top: 2rem;
}

/* =========================================================
   FRAME V: THE GARDEN
   ========================================================= */

.tatami-frame--garden {
    background-color: #FBFBFB;
}

.frame-content--garden {
    text-align: center;
    gap: 3rem;
}

.garden-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(2rem, 5vw + 0.5rem, 4.5rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #161616;
    line-height: 1.0;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 1s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 1s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.garden-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

.breathing-ring {
    display: flex;
    align-items: center;
    justify-content: center;
}

.breathing-circle {
    animation: breathe 5s cubic-bezier(0.25, 0.1, 0.25, 1.0) infinite;
    animation-play-state: paused;
}

.breathing-circle.active {
    animation-play-state: running;
}

@keyframes breathe {
    0% { r: 0; opacity: 0; }
    10% { opacity: 1; }
    40% { r: 40; opacity: 1; }
    60% { r: 40; opacity: 1; }
    80% { r: 40; opacity: 0.5; }
    90% { opacity: 0; }
    100% { r: 0; opacity: 0; }
}

.garden-whisper {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 1.1vw + 0.35rem, 1.2rem);
    color: #383838;
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.garden-whisper.revealed {
    opacity: 1;
}

/* =========================================================
   FRAME VI: THE HORIZON
   ========================================================= */

.frame-content--horizon {
    gap: 3rem;
}

.protocol-handshake-reverse .handshake-svg {
    overflow: visible;
}

/* Reverse handshake: starts interlocked, separates */
.handshake-arc-left-rev {
    animation: arcSeparateLeft 10s cubic-bezier(0.25, 0.1, 0.25, 1.0) infinite;
}

.handshake-arc-right-rev {
    animation: arcSeparateRight 10s cubic-bezier(0.25, 0.1, 0.25, 1.0) infinite;
}

@keyframes arcSeparateLeft {
    0% { transform: translateX(20px); opacity: 1; }
    20% { transform: translateX(20px); opacity: 1; }
    40% { transform: translateX(0px); opacity: 1; }
    60% { transform: translateX(-40px); opacity: 0.4; }
    80% { transform: translateX(0px); opacity: 1; }
    100% { transform: translateX(20px); opacity: 1; }
}

@keyframes arcSeparateRight {
    0% { transform: translateX(-20px); opacity: 1; }
    20% { transform: translateX(-20px); opacity: 1; }
    40% { transform: translateX(0px); opacity: 1; }
    60% { transform: translateX(40px); opacity: 0.4; }
    80% { transform: translateX(0px); opacity: 1; }
    100% { transform: translateX(-20px); opacity: 1; }
}

.horizon-closing {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.8rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #161616;
    line-height: 1.0;
    text-align: center;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 1s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 1s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.horizon-closing.revealed {
    opacity: 1;
    transform: translateY(0);
}

.marble-strip-divider {
    width: 100%;
    max-width: 400px;
    height: 6px;
    background: linear-gradient(
        to right,
        transparent,
        #DEDEDE 30%,
        #DEDEDE 70%,
        transparent
    );
    box-shadow: 0 0 20px rgba(200, 200, 200, 0.3);
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.marble-strip-divider.revealed {
    opacity: 1;
}

/* --- Final Space --- */
.final-space {
    height: 30vh;
    background-color: #FBFBFB;
}

/* --- Edge-Lit Marble Strips (decorative) --- */
.edge-lit-strip {
    width: 100%;
    height: 6px;
    background: linear-gradient(
        to right,
        transparent,
        #DEDEDE,
        transparent
    );
    box-shadow: 0 0 20px rgba(200, 200, 200, 0.3);
}

/* --- Constellation Node Animation --- */
.constellation-node {
    fill: #C8C8C8;
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

.constellation-node.pulse {
    opacity: 1;
}

.constellation-line {
    stroke: #DEDEDE;
    stroke-width: 0.5;
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

.constellation-line.bright {
    opacity: 1;
}

/* --- Vein Branch Lines --- */
.vein-branch {
    stroke: #DEDEDE;
    stroke-width: 0.75;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 12s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.vein-branch.growing {
    stroke-dashoffset: 0;
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .coordinates {
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
    }

    .statement-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .marble-panel {
        padding: 1.5rem;
    }

    .archive-window {
        padding: 2rem;
    }

    .nav-overlay-content {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .seal-rule {
        width: 40px;
    }

    .marble-strip-divider {
        max-width: 200px;
    }

    .frame-content--network {
        gap: 3rem;
    }
}
