/* martialaw.quest — Styles */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #4a453d;
    background: #1c1a17;
    overflow-x: hidden;
}

/* Navigation Stars */
#nav-stars {
    position: fixed;
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 1000;
}

.nav-star {
    background: none;
    border: none;
    cursor: pointer;
    color: #7a8085;
    transition: color 0.3s, transform 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    padding: 4px;
}

.nav-star.active {
    color: #b49a6a;
    animation: starPulse 3s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.nav-star:hover {
    color: #9e8b7a;
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Sections */
.codex-section {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8vh 6vw;
    overflow: hidden;
}

.section-dark {
    background: #1c1a17;
    color: #e2d9c4;
}

.section-light {
    background: #e8dfc8;
    color: #4a453d;
}

.section-content {
    position: relative;
    max-width: 1400px;
    width: 100%;
    z-index: 2;
}

/* Section Numbers */
.section-number {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7a8085;
    display: block;
    margin-bottom: 3rem;
}

/* Section I - The Edict */
.title-edict {
    font-family: 'Abril Fatface', cursive;
    font-size: clamp(3rem, 7vw, 6.5rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1.08;
    color: #8b7355;
    text-align: center;
    margin-bottom: 3rem;
}

.title-edict .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
}

.title-edict .char.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55), transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.constellation {
    text-align: center;
    margin-top: 2rem;
}

.constellation-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.constellation-path.drawn {
    stroke-dashoffset: 0;
}

.constellation-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: #7a8085;
    display: block;
    margin-top: 1rem;
}

/* Annotations */
.annotation {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    color: #9e8b7a;
    position: absolute;
    transform: rotate(-1.5deg);
    max-width: 200px;
    opacity: 0.85;
}

.annotation-1 {
    bottom: 15%;
    right: 8%;
    transform: rotate(1.8deg);
}

/* Orbital Rings */
.orbital-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

/* Section Spacers */
.section-spacer {
    height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1c1a17;
}

.section-light + .section-spacer {
    background: #e8dfc8;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem 64px;
    margin-top: 2rem;
}

.content-block {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55), transform 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.content-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.content-block[data-col="2"] { grid-column: 2 / span 4; }
.content-block[data-col="3"] { grid-column: 3 / span 5; }
.content-block[data-col="4"] { grid-column: 4 / span 5; }
.content-block[data-col="6"] { grid-column: 6 / span 4; }
.content-block[data-col="7"] { grid-column: 7 / span 4; }

.content-block[data-span="4"] { grid-column-end: span 4; }
.content-block[data-span="5"] { grid-column-end: span 5; }
.content-block[data-span="6"] { grid-column-end: span 6; }

.content-block p {
    margin-bottom: 1.2rem;
}

/* Pull Quote */
.pull-quote p {
    font-family: 'Abril Fatface', cursive;
    font-size: 2.5rem;
    line-height: 1.2;
    color: #8b7355;
    letter-spacing: 0.02em;
}

.section-light .pull-quote p {
    color: #2d2a26;
}

/* Redaction bars */
.redacted {
    position: relative;
    display: inline;
}

.redacted::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1c1a17;
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.section-dark .redacted::after {
    background: #e2d9c4;
}

.redacted:hover::after {
    transform: translateX(105%);
}

/* Shifted blocks for Section III */
.shifted-block {
    position: relative;
}

/* Constellation backgrounds */
.constellation-bg {
    position: absolute;
    top: 50%;
    right: 10%;
    transform: translateY(-50%);
    z-index: 1;
    pointer-events: none;
}

.constellation-chain {
    position: absolute;
    top: 50%;
    right: 5%;
    transform: translateY(-50%);
    z-index: 1;
}

/* Section IV Sky Map */
.sky-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.35;
}

/* Section V */
.section-transition {
    transition: background-color 1.5s ease;
}

.section-transition.transitioning {
    background: #e8dfc8;
    color: #4a453d;
}

.section-transition.transitioning .section-number,
.section-transition.transitioning .annotation {
    color: #7a8085;
}

.restoration-text {
    max-width: 680px;
    margin: 4rem auto;
    text-align: center;
}

.restoration-text p {
    margin-bottom: 2rem;
}

.constellation-phoenix {
    text-align: center;
    margin-top: 3rem;
}

.wax-seal {
    text-align: center;
    margin-top: 4rem;
    opacity: 0;
    transition: opacity 1s ease;
}

.wax-seal.visible {
    opacity: 1;
}

/* Star scatter background pattern */
.section-dark::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, #7a8085 1px, transparent 1px);
    background-size: 80px 80px;
    opacity: 0.08;
    pointer-events: none;
}

/* Nav star glow all */
.nav-star.glow-all {
    color: #b49a6a;
    filter: drop-shadow(0 0 4px #b49a6a);
    transition: color 0.3s, filter 0.3s;
}

/* Responsive */
@media (max-width: 900px) {
    .content-grid {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .content-block {
        grid-column: auto !important;
    }

    .constellation-chain,
    .constellation-bg {
        position: relative;
        top: auto;
        right: auto;
        transform: none;
        text-align: center;
        margin-top: 2rem;
    }

    .sky-map {
        opacity: 0.2;
    }

    #nav-stars {
        right: 1vw;
    }
}
