/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    height: 100%;
}

body {
    background: #0d0b0e;
    color: #f5f0e8;
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.65;
    letter-spacing: 0.02em;
    cursor: default;
    height: 100%;
    overflow-x: hidden;
}

a, button {
    cursor: crosshair;
}

/* === NAVIGATION LOZENGES === */
#nav-lozenges {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.lozenge {
    width: 12px;
    height: 12px;
    background: none;
    border: 1.5px solid #7a7062;
    transform: rotate(45deg);
    display: block;
    transition: border-color 150ms ease, background-color 150ms ease;
    cursor: crosshair;
}

.lozenge:hover,
.lozenge.active {
    border-color: #c9a84c;
    background-color: #c9a84c;
}

/* === SECTIONS / DECREES === */
.decree {
    height: 100vh;
    width: 100vw;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.decree[data-bg="primary"] {
    background-color: #0d0b0e;
}

.decree[data-bg="secondary"] {
    background-color: #1a1424;
}

/* === GHOST NUMERALS === */
.ghost-numeral {
    position: absolute;
    left: -5vw;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    font-family: 'Anybody', sans-serif;
    font-weight: 900;
    font-size: 40vw;
    color: #c9a84c;
    opacity: 0;
    pointer-events: none;
    line-height: 1;
    transition: opacity 0.6s ease;
    user-select: none;
}

.decree.in-view .ghost-numeral {
    opacity: 0.04;
}

/* === ANNOTATION COLUMN === */
.annotation-column {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    opacity: 0;
    transform: translateY(-50%) translateX(30px);
    transition: opacity 0.5s ease 0.6s, transform 0.5s ease 0.6s;
}

.decree.in-view .annotation-column {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.annotation-text {
    font-family: 'Fragment Mono', monospace;
    font-size: 0.75rem;
    color: #7a7062;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    letter-spacing: 0.1em;
}

/* === CONTENT AREA === */
.content-area {
    margin-left: 8rem;
    margin-right: 6rem;
    max-width: 900px;
    position: relative;
}

/* === TITLE (Section I) === */
.title-proclamation {
    position: relative;
    font-family: 'Anybody', sans-serif;
    font-weight: 900;
    font-size: clamp(6rem, 22vw, 18rem);
    text-transform: uppercase;
    letter-spacing: -0.03em;
    line-height: 0.85;
    margin-bottom: 1rem;
}

.title-main {
    position: relative;
    color: #f5f0e8;
    text-shadow: 0 0 40px rgba(230, 0, 126, 0.15);
    display: block;
    opacity: 0;
    transform: translateX(-60px);
}

.title-shadow {
    position: absolute;
    top: 0;
    left: 0;
    color: #e6007e;
    display: block;
    opacity: 0;
    transform: translate(0, 0);
}

/* Title animation states */
.title-proclamation.animate .title-main {
    opacity: 1;
    transform: translateX(0);
    animation: titleCrash 0.05s ease-out, screenShake 0.05s ease-in-out 0.05s 2;
}

.title-proclamation.animate .title-shadow {
    opacity: 0.7;
    transform: translate(4px, 4px);
    transition: opacity 0.1s ease 0.15s, transform 0.3s ease 0.15s;
}

@keyframes titleCrash {
    from { opacity: 0; transform: translateX(-60px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* === DECREE LINE === */
.decree-line {
    width: 100%;
    height: 2px;
    margin-bottom: 1.5rem;
}

.decree-line line {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 0.6s ease 0.55s;
}

.title-proclamation.animate ~ .decree-line line {
    stroke-dashoffset: 0;
}

/* === SUBTITLE === */
.subtitle {
    font-family: 'Work Sans', sans-serif;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    color: #f5f0e8;
    opacity: 0;
    transition: opacity 0.6s ease 1s;
}

.title-proclamation.animate ~ .subtitle {
    opacity: 1;
}

/* === SECTION HEADERS (stamp effect) === */
.section-header {
    position: relative;
    font-family: 'Unbounded', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 2rem;
    line-height: 1.1;
}

.stamp-main {
    position: relative;
    color: #e6007e;
    display: block;
    opacity: 0;
}

.stamp-shadow {
    position: absolute;
    top: 0;
    left: 0;
    color: #c9a84c;
    display: block;
    opacity: 0;
    transform: translate(0, 0);
}

.decree.in-view .stamp-main {
    opacity: 1;
    animation: stampIn 0.08s ease-out 0.2s both;
}

.decree.in-view .stamp-shadow {
    opacity: 0.5;
    transform: translate(3px, 3px);
    transition: opacity 0.15s ease 0.3s, transform 0.3s ease 0.3s;
}

@keyframes stampIn {
    0% { opacity: 0; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

/* === BODY TEXT REVEAL === */
.body-text p {
    color: #d9d0c4;
    margin-bottom: 1.2em;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.5s ease;
}

.decree.in-view .body-text p {
    clip-path: inset(0 0% 0 0);
}

.decree.in-view .body-text p:nth-child(1) { transition-delay: 0.4s; }
.decree.in-view .body-text p:nth-child(2) { transition-delay: 0.46s; }
.decree.in-view .body-text p:nth-child(3) { transition-delay: 0.52s; }

/* === BORDER DECREE === */
.border-decree {
    position: absolute;
    bottom: 2rem;
    left: 8rem;
    right: 6rem;
}

.decree-border-svg {
    width: 100%;
    height: 20px;
}

.decree-border-svg line,
.decree-border-svg polygon {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1s ease 0.8s;
}

.decree.in-view .decree-border-svg line,
.decree.in-view .decree-border-svg polygon {
    stroke-dashoffset: 0;
}

/* === THE SEAL (Section V) === */
.seal-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.lordly-seal {
    width: 60vmin;
    height: 60vmin;
    max-width: 500px;
    max-height: 500px;
}

.seal-circle,
.seal-hex-outer,
.seal-hex-inner,
.seal-bend {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 0.6s ease;
}

.decree.in-view .seal-circle { stroke-dashoffset: 0; transition-delay: 0s; }
.decree.in-view .seal-hex-outer { stroke-dashoffset: 0; transition-delay: 0.6s; }
.decree.in-view .seal-hex-inner { stroke-dashoffset: 0; transition-delay: 1.2s; }
.decree.in-view .seal-bend { stroke-dashoffset: 0; transition-delay: 1.8s; }

.decree.in-view .lordly-seal {
    animation: sealRotate 30s linear infinite 2.4s;
}

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

.seal-text {
    font-family: 'Fragment Mono', monospace;
    font-size: 0.85rem;
    color: #7a7062;
    margin-top: 2rem;
    min-height: 1.5em;
    letter-spacing: 0.05em;
}

/* === HERALDIC SVGs in annotation === */
.heraldic-chevron,
.heraldic-saltire,
.heraldic-lozenge,
.heraldic-roundel {
    opacity: 0.6;
}

/* === BACKGROUND PATTERN (subtle heraldic texture) === */
.decree::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 80px,
            rgba(201, 168, 76, 0.03) 80px,
            rgba(201, 168, 76, 0.03) 81px
        );
    pointer-events: none;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .content-area {
        margin-left: 1.5rem;
        margin-right: 1.5rem;
    }

    .annotation-column {
        display: none;
    }

    #nav-lozenges {
        right: 1rem;
    }

    .ghost-numeral {
        font-size: 60vw;
        left: -10vw;
    }

    .border-decree {
        left: 1.5rem;
        right: 1.5rem;
    }

    .title-proclamation {
        font-size: clamp(4rem, 18vw, 10rem);
    }
}
