body {
    background-color: #121212;
    line-height: 1.58;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

#particles-js {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.22;
}

.story-page-shell {
    position: relative;
    z-index: 2;
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: clamp(7.2rem, 10vw, 9rem) 0 clamp(4.5rem, 8vw, 7rem);
}

.story-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 2rem);
    align-items: end;
    min-height: clamp(380px, 54vh, 560px);
    padding: clamp(1.35rem, 3.4vw, 3rem);
    border: 1px solid rgba(255, 215, 0, 0.16);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 215, 0, 0.03), rgba(0, 0, 0, 0.55)),
        radial-gradient(circle at 12% 18%, rgba(255, 215, 0, 0.14), transparent 18rem),
        radial-gradient(circle at 76% 12%, rgba(255, 255, 255, 0.06), transparent 20rem),
        rgba(9, 9, 8, 0.72);
    box-shadow:
        0 22px 48px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
    isolation: isolate;
}

.story-hero-copy,
.story-actions,
.story-archive article,
.story-archive p,
.story-principles article {
    transform: translateY(18px);
    opacity: 0;
    transition:
        opacity 620ms var(--ease-decelerate),
        transform 620ms var(--ease-decelerate),
        border-color var(--motion-normal) var(--ease-standard),
        background var(--motion-normal) var(--ease-standard),
        box-shadow var(--motion-normal) var(--ease-standard);
}

.story-hero.visible .story-hero-copy,
.story-hero.visible .story-actions,
.story-archive.visible article,
.story-archive.visible p,
.story-principles.visible article {
    transform: translateY(0);
    opacity: 1;
}

.story-hero.visible .story-actions {
    transition-delay: 120ms;
}

.story-archive.visible article:nth-child(2),
.story-principles.visible article:nth-child(2) {
    transition-delay: 70ms;
}

.story-archive.visible article:nth-child(3),
.story-principles.visible article:nth-child(3) {
    transition-delay: 140ms;
}

.story-archive.visible p,
.story-principles.visible article:nth-child(4) {
    transition-delay: 210ms;
}

.story-hero::after {
    content: "moonfly";
    position: absolute;
    right: clamp(-1.5rem, -1vw, -0.4rem);
    bottom: clamp(-1rem, -1vw, -0.3rem);
    z-index: -1;
    color: rgba(255, 255, 255, 0.035);
    font-family: 'Baby Doll', cursive;
    font-size: clamp(6rem, 18vw, 15rem);
    line-height: 0.7;
    white-space: nowrap;
}

.story-kicker,
.era-kicker {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    min-height: 32px;
    padding: 0.32rem 0.78rem;
    border: 1px solid rgba(255, 215, 0, 0.28);
    border-radius: 999px;
    color: rgba(255, 215, 0, 0.95);
    background: rgba(255, 215, 0, 0.065);
    box-shadow: none;
    font-family: 'Baby Doll', cursive;
    font-size: 0.95rem;
    line-height: 1;
}

.history-title {
    max-width: 760px;
    margin: 0.85rem 0 0.9rem;
    color: #ffd700;
    font-family: 'Baby Doll', cursive;
    font-size: clamp(2.8rem, 7vw, 6.2rem);
    font-weight: 400;
    line-height: 0.9;
    letter-spacing: 0;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.42);
    text-wrap: balance;
}

.story-lead {
    max-width: 560px;
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1rem, 1.35vw, 1.15rem);
    text-wrap: pretty;
}

.story-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1.25rem;
}

.story-action-primary,
.story-action-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.72rem 1.05rem;
    border-radius: 999px;
    font-family: 'Baby Doll', cursive;
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
    transition:
        transform var(--motion-normal) var(--ease-decelerate),
        border-color var(--motion-normal) var(--ease-standard),
        background var(--motion-normal) var(--ease-standard),
        color var(--motion-normal) var(--ease-standard),
        box-shadow var(--motion-normal) var(--ease-standard);
}

.story-action-primary {
    border: 1px solid rgba(255, 215, 0, 0.82);
    color: #101010;
    background: #ffd700;
    box-shadow: none;
}

.story-action-secondary {
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.88);
    background: rgba(255, 255, 255, 0.055);
}

.story-action-primary:hover,
.story-action-secondary:hover {
    transform: translateY(-2px);
}

.story-action-secondary:hover {
    border-color: rgba(255, 215, 0, 0.32);
    color: #ffd700;
    background: rgba(255, 215, 0, 0.06);
}

.story-archive {
    display: grid;
    grid-template-columns: repeat(3, auto) minmax(260px, 1fr);
    gap: 0;
    align-items: stretch;
    margin: 0.9rem 0 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(10, 10, 9, 0.62);
    overflow: hidden;
}

.story-archive article,
.story-archive p {
    min-height: 72px;
    margin: 0;
    padding: 0.75rem 1rem;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.story-archive article {
    display: grid;
    align-content: space-between;
}

.story-archive strong {
    color: #ffd700;
    font-family: 'Baby Doll', cursive;
    font-size: clamp(1.55rem, 2.8vw, 2.25rem);
    font-weight: 400;
    line-height: 0.9;
    text-shadow: none;
}

.story-archive span {
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.82rem;
}

.story-archive p {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.94rem;
    text-wrap: pretty;
}

.story-principles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin: 0 0 clamp(3rem, 7vw, 5rem);
}

.story-principles article {
    min-height: 118px;
    padding: 0.9rem;
    border: 1px solid rgba(255, 215, 0, 0.12);
    border-radius: 8px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 44%),
        rgba(13, 13, 12, 0.76);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.story-principles article:hover {
    border-color: rgba(255, 215, 0, 0.28);
    background:
        linear-gradient(145deg, rgba(255, 215, 0, 0.07), transparent 44%),
        rgba(15, 15, 13, 0.86);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.story-principles span {
    display: block;
    margin-bottom: 0.55rem;
    color: #ffd700;
    font-family: 'Baby Doll', cursive;
    font-size: 1.2rem;
    line-height: 1;
}

.story-principles p {
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.98rem;
}

.timeline {
    position: relative;
    display: grid;
    gap: clamp(1rem, 2.4vw, 1.45rem);
}

.timeline::before {
    content: "";
    position: absolute;
    top: 0.6rem;
    bottom: 0.6rem;
    left: clamp(4.4rem, 8vw, 6rem);
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(255, 215, 0, 0.54), rgba(255, 215, 0, 0.14), transparent);
    box-shadow: none;
}

.era {
    position: relative;
    display: grid;
    grid-template-columns: clamp(5.4rem, 9vw, 7.2rem) minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 2rem);
    align-items: stretch;
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity var(--motion-slow) var(--ease-decelerate),
        transform var(--motion-slow) var(--ease-decelerate);
}

.era.visible {
    opacity: 1;
    transform: translateY(0);
}

.era-marker {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 1.1rem;
}

.era-marker::after {
    content: "";
    position: absolute;
    top: 1.62rem;
    right: -0.58rem;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #ffd700;
    box-shadow: none;
}

.era-marker span {
    display: inline-grid;
    min-width: 4.7rem;
    min-height: 2.2rem;
    place-items: center;
    border: 1px solid rgba(255, 215, 0, 0.18);
    border-radius: 999px;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.045);
    font-family: 'Baby Doll', cursive;
    font-size: 1.05rem;
}

.era-card {
    position: relative;
    padding: clamp(1.25rem, 2.6vw, 2rem);
    border: 1px solid rgba(255, 215, 0, 0.14);
    border-radius: 8px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.052), transparent 38%),
        rgba(11, 11, 10, 0.82);
        box-shadow:
        0 16px 36px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
    transition:
        border-color var(--motion-normal) var(--ease-standard),
        background var(--motion-normal) var(--ease-standard),
        box-shadow var(--motion-normal) var(--ease-standard),
        transform var(--motion-normal) var(--ease-decelerate),
        filter var(--motion-normal) var(--ease-standard);
}

.era-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.95), rgba(255, 215, 0, 0.1));
    opacity: 0.7;
}

.era:hover .era-card,
.era.active .era-card {
    border-color: rgba(255, 215, 0, 0.34);
    background:
        linear-gradient(145deg, rgba(255, 215, 0, 0.035), transparent 42%),
        rgba(15, 15, 13, 0.92);
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.36),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transform: translateY(-3px);
}

.era-index {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: rgba(255, 255, 255, 0.07);
    font-family: 'Baby Doll', cursive;
    font-size: clamp(2.6rem, 5vw, 4.4rem);
    line-height: 0.72;
    pointer-events: none;
}

.era-header {
    display: grid;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.era-title {
    margin: 0;
    color: #ffffff;
    font-family: 'Baby Doll', cursive;
    font-size: clamp(1.85rem, 3.2vw, 3rem);
    font-weight: 400;
    line-height: 0.98;
    letter-spacing: 0;
    text-wrap: balance;
}

.era-content {
    display: grid;
    gap: 0.85rem;
    max-width: 74ch;
    color: rgba(255, 255, 255, 0.8);
    font-size: clamp(1rem, 1.35vw, 1.1rem);
}

.era-content p,
.era-note {
    margin: 0;
}

.era-note {
    width: fit-content;
    max-width: 100%;
    margin-top: 1.2rem;
    padding: 0.68rem 0.85rem;
    border: 1px solid rgba(255, 215, 0, 0.16);
    border-radius: 8px;
    color: rgba(255, 215, 0, 0.92);
    background: rgba(255, 215, 0, 0.055);
    font-family: 'Baby Doll', cursive;
    font-size: 1rem;
    line-height: 1.2;
}

.story-closing {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(280px, 0.8fr);
    gap: clamp(1.2rem, 4vw, 3rem);
    align-items: end;
    margin-top: clamp(3rem, 7vw, 5.4rem);
    padding: clamp(1.6rem, 4vw, 2.7rem);
    border: 1px solid rgba(255, 215, 0, 0.18);
    border-radius: 8px;
    background:
        radial-gradient(circle at 20% 0%, rgba(255, 215, 0, 0.12), transparent 22rem),
        rgba(9, 9, 8, 0.86);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.3);
}

.story-closing h2 {
    margin: 0.85rem 0 0;
    color: #ffd700;
    font-family: 'Baby Doll', cursive;
    font-size: clamp(2.25rem, 5.4vw, 5rem);
    font-weight: 400;
    line-height: 0.9;
    text-wrap: balance;
    text-shadow: none;
}

.story-closing p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: clamp(1.02rem, 1.55vw, 1.2rem);
    text-wrap: pretty;
}

.highlight {
    color: #ffd700;
    font-weight: 700;
}

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(26px);
    transition:
        opacity 640ms var(--ease-decelerate),
        transform 640ms var(--ease-decelerate);
}

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

.scroll-hint {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 100;
    display: flex;
    gap: 0.7rem;
    align-items: center;
    max-width: 245px;
    padding: 0.8rem 0.95rem;
    border: 1px solid rgba(255, 215, 0, 0.22);
    border-radius: 8px;
    color: rgba(255, 215, 0, 0.9);
    background: rgba(7, 7, 7, 0.76);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: 'Baby Doll', cursive;
    font-size: 0.95rem;
    line-height: 1.15;
    transition:
        opacity var(--motion-moderate) var(--ease-standard),
        transform var(--motion-moderate) var(--ease-standard);
}

.scroll-hint.hidden {
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
}

.scroll-hint-icon {
    font-size: 1.45rem;
    animation: storyHintBounce 1.8s infinite;
}

@keyframes storyHintBounce {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(5px);
    }
}

@media (max-width: 900px) {
    .story-page-shell {
        width: min(720px, calc(100% - 32px));
        padding-top: 6.6rem;
    }

    .story-hero,
    .story-closing {
        grid-template-columns: 1fr;
    }

    .story-hero {
        min-height: auto;
    }

    .story-principles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .story-archive {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0;
    }

    .story-archive p {
        grid-column: 1 / -1;
    }

    .timeline::before {
        left: 2.4rem;
    }

    .era {
        grid-template-columns: 4.8rem minmax(0, 1fr);
        gap: 0.9rem;
    }

    .era-marker span {
        min-width: 4rem;
        font-size: 0.92rem;
    }

    .scroll-hint {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
        max-width: none;
        justify-content: center;
    }
}

@media (max-width: 560px) {
    .story-page-shell {
        width: min(100% - 24px, 460px);
        padding-top: 6rem;
    }

    .story-hero,
    .story-closing {
        padding: 1.15rem;
    }

    .history-title {
        font-size: clamp(2.9rem, 16vw, 4.8rem);
    }

    .story-principles {
        grid-template-columns: 1fr;
    }

    .story-archive {
        grid-template-columns: 1fr;
    }

    .timeline {
        gap: 1rem;
    }

    .timeline::before {
        left: 0.62rem;
    }

    .era {
        grid-template-columns: 1fr;
        padding-left: 1.7rem;
    }

    .era-marker {
        position: absolute;
        left: 0;
        top: 0;
        width: 1.2rem;
        height: 100%;
        padding: 0;
    }

    .era-marker span {
        display: none;
    }

    .era-marker::after {
        top: 1.4rem;
        right: auto;
        left: 0.2rem;
        width: 11px;
        height: 11px;
    }

    .era-card {
        padding: 1rem;
    }

    .era-title {
        font-size: clamp(1.75rem, 10vw, 2.45rem);
    }

    .era-note {
        font-size: 0.95rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    #particles-js,
    .scroll-hint-icon,
    .era.visible .era-marker::after {
        animation: none;
    }

    .reveal-on-scroll,
    .era,
    .era-card {
        transition-duration: 1ms !important;
        transform: none !important;
    }
}
