/* ============================================
   gazza.news - Styles
   Grainy-textured, zen-contemplative design
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #1A3A2A;
    color: #E8E0D0;
    font-family: 'Merriweather', Georgia, serif;
    font-weight: 400;
    font-size: clamp(15px, 1.6vw, 19px);
    line-height: 1.8;
    overflow-x: hidden;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Viewport Sections --- */
.viewport-section {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- Grain Overlay --- */
.grain-overlay {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    opacity: 0;
    pointer-events: none;
    z-index: 2;
    animation: grainFadeIn 500ms ease-out 0ms forwards;
}

@keyframes grainFadeIn {
    from { opacity: 0; }
    to { opacity: 0.08; }
}

.section-grain {
    opacity: 0.08;
    animation: none;
    transition: opacity 0.8s ease;
}

.closing-grain {
    opacity: 0.03;
    animation: none;
}

/* --- Crystalline Shapes --- */
.crystalline-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.crystal {
    position: absolute;
    fill: none;
    stroke: #F5F5F0;
    stroke-width: 0.5;
    opacity: 0;
    transform: scale(0);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

.crystal polygon {
    fill: #F5F5F0;
    opacity: 0.06;
}

.crystal.visible {
    opacity: 0.1;
    transform: scale(1);
}

/* Opening crystal positions */
.crystal-1 {
    width: 80px;
    height: 80px;
    top: 12%;
    right: 15%;
    transition-delay: 0ms;
}

.crystal-2 {
    width: 50px;
    height: 50px;
    top: 25%;
    left: 10%;
    transition-delay: 100ms;
}

.crystal-3 {
    width: 40px;
    height: 40px;
    bottom: 30%;
    right: 20%;
    transition-delay: 200ms;
}

.crystal-4 {
    width: 35px;
    height: 35px;
    bottom: 20%;
    left: 18%;
    transition-delay: 300ms;
}

.crystal-5 {
    width: 55px;
    height: 55px;
    top: 60%;
    right: 8%;
    transition-delay: 400ms;
}

/* Section crystal positions */
.crystal-s1 {
    width: 35px;
    height: 35px;
    top: 15%;
    right: 12%;
}

.crystal-s2 {
    width: 28px;
    height: 28px;
    bottom: 20%;
    left: 8%;
}

.crystal-s3 {
    width: 38px;
    height: 38px;
    top: 20%;
    left: 10%;
}

.crystal-s4 {
    width: 32px;
    height: 32px;
    top: 18%;
    right: 10%;
}

.crystal-s5 {
    width: 25px;
    height: 25px;
    bottom: 25%;
    left: 15%;
}

/* --- Botanical Frames --- */
.botanical-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.fern {
    position: absolute;
    opacity: 0.2;
}

.fern-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s ease-out;
}

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

.fern-left {
    left: -2%;
    top: 5%;
    width: 120px;
    height: 400px;
}

.fern-right {
    right: -2%;
    top: 5%;
    width: 120px;
    height: 400px;
}

/* Section fern accents */
.fern-accent {
    position: absolute;
    opacity: 0.2;
}

.fern-top-left {
    top: 3%;
    left: 3%;
    width: 100px;
    height: 100px;
}

.fern-bottom-right {
    bottom: 3%;
    right: 3%;
    width: 100px;
    height: 100px;
}

.fern-top-right {
    top: 3%;
    right: 3%;
    width: 100px;
    height: 100px;
}

.fern-bottom-left {
    bottom: 3%;
    left: 3%;
    width: 100px;
    height: 100px;
}

.fern-center-left {
    top: 10%;
    left: 2%;
    width: 80px;
    height: 250px;
}

.fern-center-right {
    top: 10%;
    right: 2%;
    width: 80px;
    height: 250px;
}

.fern-closing {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    opacity: 0.15;
}

/* --- Opening Section --- */
.opening-section {
    background-color: #1A3A2A;
    flex-direction: column;
    z-index: 1;
}

.opening-content {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 2rem;
}

.title-gazza {
    font-family: 'Caveat', cursive;
    font-size: clamp(56px, 12vw, 140px);
    font-weight: 700;
    color: #E8E0D0;
    letter-spacing: 0.08em;
    line-height: 1;
    margin-bottom: 0;
    position: relative;
}

.title-gazza .letter {
    display: inline-block;
    opacity: 0;
    transform: rotate(0deg) skewX(0deg);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.title-gazza .letter.visible {
    opacity: 1;
}

.title-gazza .letter.distorted {
    filter: url(#distort-text);
}

.title-news {
    font-family: 'Merriweather', Georgia, serif;
    font-size: clamp(20px, 3.5vw, 48px);
    font-weight: 400;
    color: #F5F5F0;
    letter-spacing: 0.3em;
    opacity: 0;
    transition: opacity 0.6s ease;
    margin-top: -0.2em;
}

.title-news.visible {
    opacity: 1;
}

.tagline {
    font-family: 'Fira Code', monospace;
    font-size: clamp(11px, 1.2vw, 14px);
    color: #7A7A72;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
}

.tagline.visible {
    opacity: 1;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    text-align: center;
    opacity: 0;
    animation: scrollIndicatorFadeIn 0.6s ease 2.8s forwards;
}

@keyframes scrollIndicatorFadeIn {
    to { opacity: 0.6; }
}

.scroll-text {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: #7A7A72;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}

.scroll-arrow {
    width: 20px;
    height: 20px;
    border-right: 1px solid #7A7A72;
    border-bottom: 1px solid #7A7A72;
    transform: rotate(45deg);
    margin: 0 auto;
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: rotate(45deg) translateY(0); }
    50% { transform: rotate(45deg) translateY(6px); }
}

/* --- Analysis Sections --- */
.analysis-section {
    background-color: #1A3A2A;
    flex-direction: column;
    padding: 4rem 2rem;
    gap: 3rem;
}

.analysis-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    max-width: 900px;
    width: 100%;
    padding: 2rem 0;
}

/* --- Card Flip --- */
.card-flip {
    width: 100%;
    max-width: 680px;
    height: 380px;
    perspective: 1200px;
    cursor: default;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.card-flip.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 4px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-front {
    background-color: rgba(90, 90, 82, 0.15);
    border: 1px solid #5C4A35;
    overflow: hidden;
}

.card-grain {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.15;
    pointer-events: none;
}

.card-back {
    background-color: rgba(26, 58, 42, 0.95);
    border: 1px solid #6B8A5A;
    transform: rotateY(180deg);
}

.card-label {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: #D4A040;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.card-label-truth {
    color: #6B8A5A;
}

.distorted-headline {
    font-family: 'Caveat', cursive;
    font-size: clamp(22px, 4vw, 36px);
    font-weight: 700;
    color: #E8E0D0;
    line-height: 1.3;
    margin-bottom: 1rem;
    transform: skewX(-1deg);
    filter: blur(0.3px);
}

.source-fake {
    font-size: 13px;
    color: #D4A040;
    margin-bottom: 0.5rem;
}

.card-instruction {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #7A7A72;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: auto;
}

.truth-headline {
    font-family: 'Merriweather', Georgia, serif;
    font-size: clamp(18px, 3vw, 26px);
    font-weight: 700;
    color: #F5F5F0;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.truth-body {
    font-size: clamp(13px, 1.4vw, 16px);
    color: #E8E0D0;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.source-real {
    font-size: 13px;
    color: #6B8A5A;
    margin-bottom: 0.8rem;
}

.truth-rating {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: auto;
}

.rating-label {
    font-size: 11px;
    color: #7A7A72;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.rating-value {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    font-weight: 700;
    color: #D4A040;
}

/* --- Analysis Text --- */
.analysis-text {
    max-width: 680px;
    width: 100%;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.analysis-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    font-family: 'Caveat', cursive;
    font-size: clamp(28px, 5.5vw, 64px);
    font-weight: 700;
    color: #F5F5F0;
    margin-bottom: 1.2rem;
    line-height: 1.2;
}

.analysis-body {
    color: #E8E0D0;
    margin-bottom: 1.5rem;
}

.analysis-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(92, 74, 53, 0.5);
}

.analysis-meta .fira {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: #7A7A72;
}

.fira {
    font-family: 'Fira Code', monospace;
}

/* --- Closing Section --- */
.closing-section {
    background-color: #1A3A2A;
    flex-direction: column;
    padding: 4rem 2rem;
    min-height: 100vh;
}

.closing-content {
    position: relative;
    z-index: 3;
    max-width: 700px;
    text-align: center;
    padding: 2rem;
}

.closing-title {
    font-family: 'Caveat', cursive;
    font-size: clamp(32px, 6vw, 72px);
    font-weight: 700;
    color: #F5F5F0;
    margin-bottom: 1.5rem;
    line-height: 1.15;
}

.closing-body {
    color: #E8E0D0;
    margin-bottom: 3rem;
    max-width: 580px;
    margin-left: auto;
    margin-right: auto;
}

.closing-principles {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    margin-bottom: 3rem;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.principle {
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
}

.principle-number {
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    color: #D4A040;
    min-width: 28px;
    padding-top: 0.15em;
}

.principle-text {
    color: #E8E0D0;
    font-size: clamp(14px, 1.5vw, 17px);
}

.closing-signature {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: #7A7A72;
    letter-spacing: 0.1em;
    padding-top: 2rem;
    border-top: 1px solid rgba(92, 74, 53, 0.3);
}

/* --- Distortion effects for upcoming sections --- */
.analysis-section .distorted-headline {
    transition: filter 0.5s ease, transform 0.5s ease;
}

.analysis-section.in-view .distorted-headline {
    filter: blur(0.3px);
    transform: skewX(-1deg);
}

.analysis-section.approaching .distorted-headline {
    filter: blur(2px);
    transform: skewX(-3deg);
}

/* --- Grain intensity transitions --- */
.analysis-section .section-grain {
    transition: opacity 0.8s ease;
}

.analysis-section.in-view .section-grain {
    opacity: 0.04;
}

.analysis-section:not(.in-view) .section-grain {
    opacity: 0.12;
}

/* --- Crystal rotation on scroll --- */
.crystal {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .analysis-section {
        padding: 3rem 1.2rem;
    }

    .card-flip {
        height: 420px;
    }

    .card-front,
    .card-back {
        padding: 1.8rem;
    }

    .fern-left,
    .fern-right {
        width: 80px;
        height: 280px;
    }

    .fern-accent {
        width: 70px !important;
        height: 70px !important;
    }

    .fern-center-left,
    .fern-center-right {
        width: 50px !important;
        height: 180px !important;
    }

    .closing-principles {
        gap: 1.4rem;
    }

    .crystal-1 { width: 55px; height: 55px; }
    .crystal-2 { width: 35px; height: 35px; }
    .crystal-3 { width: 28px; height: 28px; }
    .crystal-4 { width: 24px; height: 24px; }
    .crystal-5 { width: 38px; height: 38px; }
}

@media (max-width: 480px) {
    .card-flip {
        height: 460px;
    }

    .card-front,
    .card-back {
        padding: 1.4rem;
    }

    .analysis-content {
        gap: 2rem;
    }

    .closing-content {
        padding: 1rem;
    }
}
