/* ===========================================
   pmt.moe - Pragmatic Magic Theory
   Fairycore x Systems Engineering
   =========================================== */

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

:root {
    --twilight-indigo: #1A1530;
    --sakura-pink: #FFB7D5;
    --spell-blue: #B8D4F0;
    --star-gold: #FFE4A0;
    --moonlight-lavender: #F0EAF8;
    --deep-amethyst: #2D2548;
    --muted-rose: #C4869B;
    --dusty-periwinkle: #8BA4C4;
    --ease-magic: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--twilight-indigo);
    color: var(--moonlight-lavender);
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.6vw, 1.05rem);
    line-height: 1.72;
    overflow-x: hidden;
    position: relative;
}

/* --- Top Ornament Ribbon Bar --- */
.ribbon-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: linear-gradient(90deg, #FFB7D5, #B8D4F0);
    clip-path: polygon(0 0, 100% 0, 100% 75%, 98% 100%, 95% 80%, 90% 100%, 85% 80%, 80% 100%, 75% 80%, 70% 100%, 65% 80%, 60% 100%, 55% 80%, 50% 100%, 45% 80%, 40% 100%, 35% 80%, 30% 100%, 25% 80%, 20% 100%, 15% 80%, 10% 100%, 5% 80%, 2% 100%, 0 75%);
    z-index: 1000;
}

.ribbon-title {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: 1.4rem;
    color: var(--twilight-indigo);
    letter-spacing: 0.05em;
}

.ribbon-star {
    color: var(--star-gold);
    font-size: 1.2rem;
    text-shadow: 0 0 8px rgba(255, 228, 160, 0.6);
}

/* --- Petal Container --- */
.petal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.petal {
    position: absolute;
    width: 12px;
    height: 18px;
    background: var(--sakura-pink);
    opacity: 0.15;
    border-radius: 50% 50% 50% 0;
    transform: rotate(45deg);
    animation: petalFall linear infinite;
}

@keyframes petalFall {
    0% {
        transform: translateY(-20px) rotate(45deg) translateX(0);
        opacity: 0.15;
    }
    50% {
        opacity: 0.12;
    }
    100% {
        transform: translateY(100vh) rotate(225deg) translateX(80px);
        opacity: 0;
    }
}

/* --- Floating Elements --- */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.floating-dot {
    position: absolute;
    border-radius: 50%;
    opacity: 0.3;
    animation: floatDrift linear infinite;
}

@keyframes floatDrift {
    0% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(30px, -20px);
    }
    50% {
        transform: translate(-15px, -40px);
    }
    75% {
        transform: translate(20px, -10px);
    }
    100% {
        transform: translate(0, 0);
    }
}

/* --- Star Scatter --- */
.star-scatter {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.bg-star {
    position: absolute;
    color: var(--star-gold);
    animation: starPulse 2s ease-in-out infinite alternate;
}

@keyframes starPulse {
    0% { opacity: 0.2; }
    100% { opacity: 0.6; }
}

/* --- Hero Section --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 56px;
    z-index: 10;
}

.hero-circle {
    position: absolute;
    width: 400px;
    height: 400px;
    opacity: 0;
    animation: heroCircleFadeIn 2s var(--ease-magic) 0.5s forwards;
}

@keyframes heroCircleFadeIn {
    to {
        opacity: 0.15;
    }
}

.hero-title {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--sakura-pink);
    text-shadow: 0 0 30px rgba(255, 228, 160, 0.4), 0 0 60px rgba(255, 183, 213, 0.2);
    letter-spacing: 0.02em;
    position: relative;
    z-index: 11;
    opacity: 0;
    filter: blur(8px);
    animation: blurFocusIn 1.2s var(--ease-magic) 0.3s forwards;
}

.hero-subtitle {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: var(--moonlight-lavender);
    letter-spacing: 0.5em;
    margin-top: 16px;
    position: relative;
    z-index: 11;
    opacity: 0;
    animation: subtitleGather 1.2s var(--ease-magic) 0.8s forwards;
}

@keyframes subtitleGather {
    0% {
        opacity: 0;
        letter-spacing: 0.5em;
    }
    100% {
        opacity: 1;
        letter-spacing: 0.02em;
    }
}

.hero-stars {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.hero-star {
    position: absolute;
    color: var(--star-gold);
    opacity: 0;
    filter: blur(8px);
    animation: starBlurFocus 0.8s var(--ease-magic) forwards;
}

@keyframes starBlurFocus {
    to {
        opacity: 0.7;
        filter: blur(0);
    }
}

/* --- Blur-Focus Animation --- */
@keyframes blurFocusIn {
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* --- Magic Circles --- */
.magic-circle {
    border-radius: 50%;
    border: 1px solid rgba(255, 183, 213, 0.2);
    position: relative;
    animation: slowSpin 60s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.magic-circle::before {
    content: '';
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    border: 1px dashed rgba(184, 212, 240, 0.25);
}

.magic-circle::after {
    content: '';
    position: absolute;
    inset: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 228, 160, 0.15);
}

.circle-formula {
    font-family: 'Caveat', cursive;
    font-size: 14px;
    color: var(--muted-rose);
    opacity: 0.6;
    white-space: nowrap;
    animation: slowSpin 60s linear infinite reverse;
}

@keyframes slowSpin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Divider Circles --- */
.divider-circle {
    width: 300px;
    height: 300px;
    margin: 40px auto;
    pointer-events: none;
    opacity: 0;
    filter: blur(6px);
}

.divider-circle.revealed {
    animation: blurFocusIn 0.8s var(--ease-magic) forwards;
}

.divider-circle-1 {
    grid-column: 3 / 7;
}

.divider-circle-2 {
    grid-column: 6 / 10;
}

/* --- Broken Grid Layout --- */
.broken-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    padding: 80px 40px 120px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

/* --- Theory Cards --- */
.theory-card {
    background: var(--deep-amethyst);
    border: 1px solid rgba(255, 183, 213, 0.15);
    border-radius: 12px;
    padding: 32px 28px;
    position: relative;
    transition: border 200ms var(--ease-magic), box-shadow 200ms var(--ease-magic);
    opacity: 0;
    filter: blur(6px);
}

.theory-card.revealed {
    animation: blurFocusIn 0.5s var(--ease-magic) forwards;
}

.theory-card:hover {
    border: 2px solid var(--sakura-pink);
    box-shadow: 0 8px 32px rgba(255, 183, 213, 0.2);
}

.theory-card:hover .annotation {
    opacity: 1;
}

/* Card positions - broken grid, irregular spans */
.card-1 {
    grid-column: 1 / 7;
    transform: rotate(-0.8deg);
}

.card-2 {
    grid-column: 5 / 12;
    margin-top: -20px;
    transform: rotate(0.5deg);
}

.card-3 {
    grid-column: 2 / 8;
    transform: rotate(1.2deg);
}

.card-4 {
    grid-column: 6 / 13;
    margin-top: -16px;
    transform: rotate(-0.6deg);
}

.card-5 {
    grid-column: 1 / 7;
    transform: rotate(0.8deg);
}

.card-6 {
    grid-column: 4 / 11;
    margin-top: -12px;
    transform: rotate(-1deg);
}

/* --- Ribbon Category Markers --- */
.ribbon-marker {
    position: absolute;
    top: -6px;
    left: -6px;
    padding: 4px 16px 4px 10px;
    clip-path: polygon(0 0, 100% 0, 90% 50%, 100% 100%, 0 100%);
    transform: rotate(-3deg);
    z-index: 5;
}

.ribbon-marker span {
    font-family: 'Fredoka', sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: var(--twilight-indigo);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ribbon-pink {
    background: var(--sakura-pink);
}

.ribbon-blue {
    background: var(--spell-blue);
}

/* --- Card Typography --- */
.card-heading {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    color: var(--sakura-pink);
    letter-spacing: 0.02em;
    margin-bottom: 16px;
    line-height: 1.3;
}

.card-body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    color: var(--moonlight-lavender);
    margin-bottom: 12px;
    line-height: 1.72;
}

.card-body em {
    color: var(--star-gold);
    font-style: italic;
}

.card-body strong {
    font-weight: 700;
    color: var(--sakura-pink);
}

/* --- Annotations --- */
.annotation {
    position: absolute;
    opacity: 0.7;
    transition: opacity 400ms var(--ease-magic);
    pointer-events: none;
}

.annotation-text {
    font-family: 'Caveat', cursive;
    font-size: 14px;
    color: var(--muted-rose);
    white-space: nowrap;
    display: block;
}

.annotation-line {
    width: 40px;
    height: 1px;
    background: var(--dusty-periwinkle);
    opacity: 0.5;
    margin-top: 4px;
}

.annotation-1 {
    top: -28px;
    right: 24px;
}

.annotation-2 {
    bottom: -24px;
    left: 32px;
}

.annotation-3 {
    top: -28px;
    right: 40px;
}

.annotation-4 {
    bottom: -24px;
    right: 24px;
}

.annotation-5 {
    top: -28px;
    left: 32px;
}

/* --- Footer Seal --- */
.footer-seal-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 20px 60px;
    position: relative;
    z-index: 10;
}

.footer-seal {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slowSpin 90s linear infinite;
}

.seal-ring {
    position: absolute;
    border-radius: 50%;
}

.seal-ring-outer {
    inset: 0;
    border: 2px solid rgba(255, 183, 213, 0.3);
}

.seal-ring-middle {
    inset: 12px;
    border: 1px dashed rgba(184, 212, 240, 0.25);
}

.seal-ring-inner {
    inset: 24px;
    border: 1px solid rgba(255, 228, 160, 0.2);
}

.seal-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: slowSpin 90s linear infinite reverse;
}

.seal-text {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: 1.8rem;
    color: var(--sakura-pink);
    letter-spacing: 0.1em;
}

.seal-subtitle {
    font-family: 'Caveat', cursive;
    font-size: 14px;
    color: var(--muted-rose);
    margin-top: 4px;
}

.footer-charter {
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
    color: var(--dusty-periwinkle);
    margin-top: 32px;
    letter-spacing: 0.06em;
    text-align: center;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .broken-grid {
        grid-template-columns: 1fr;
        padding: 60px 20px 80px;
        gap: 32px;
    }

    .theory-card {
        grid-column: 1 / -1 !important;
        margin-top: 0 !important;
        transform: rotate(0deg) !important;
    }

    .divider-circle {
        grid-column: 1 / -1 !important;
        width: 200px;
        height: 200px;
        margin: 20px auto;
    }

    .hero-circle {
        width: 250px;
        height: 250px;
    }

    .ribbon-bar {
        height: 48px;
    }

    .ribbon-title {
        font-size: 1.1rem;
    }

    .annotation {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .footer-seal {
        width: 150px;
        height: 150px;
    }
}
