/* ================================================
   double-standard.org - Wabi-Sabi Jurisprudence
   ================================================ */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
    letter-spacing: 0.005em;
    color: #4A4036;
    background-color: #E8E0D4;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Plaster Texture Background --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 800px 600px at 20% 30%, rgba(212, 201, 184, 0.4), transparent),
        radial-gradient(ellipse 600px 900px at 75% 60%, rgba(168, 154, 140, 0.15), transparent),
        radial-gradient(ellipse 1000px 400px at 50% 80%, rgba(212, 201, 184, 0.3), transparent),
        radial-gradient(ellipse 500px 500px at 85% 15%, rgba(184, 134, 11, 0.02), transparent),
        radial-gradient(ellipse 700px 350px at 10% 70%, rgba(212, 201, 184, 0.2), transparent);
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    filter: url(#plasterNoise);
    opacity: 1;
}

/* --- Crack SVG Overlay --- */
.crack-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: visible;
}

.crack-line {
    fill: none;
    stroke: #B8860B;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crack-line-red {
    fill: none;
    stroke: #8B4049;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.35;
    filter: url(#redGlow);
}

.crack-branch {
    fill: none;
    stroke: #B8860B;
    stroke-width: 1.5;
    stroke-linecap: round;
    filter: url(#crackGlow);
}

.gold-fragment {
    fill: url(#goldGradient);
    opacity: 0.8;
    transition: filter 0.3s ease, opacity 0.8s ease;
}

.gold-fragment:hover {
    filter: brightness(1.1);
}

/* Gold leaf highlight accent */
.gold-fragment-highlight {
    fill: #D4AF37;
    opacity: 0.6;
}

/* --- HERO SECTION --- */
.section-hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

.plaster-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse 600px 400px at 35% 45%, rgba(212, 201, 184, 0.5), transparent),
        radial-gradient(ellipse 400px 600px at 65% 55%, rgba(168, 154, 140, 0.12), transparent);
    pointer-events: none;
    z-index: 0;
}

.hero-content {
    text-align: center;
    opacity: 0;
    transition: opacity 1.0s ease-out;
    position: relative;
    z-index: 2;
}

.hero-content.visible {
    opacity: 1;
}

.hero-title-wrap {
    display: inline-flex;
    align-items: baseline;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 72px;
    letter-spacing: 0.04em;
    color: #2C2520;
    position: relative;
}

.hero-title-left,
.hero-title-right {
    display: inline-block;
    position: relative;
}

.hero-crack-gap {
    display: inline-block;
    width: 0px;
    position: relative;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-crack-gap.split {
    width: 6px;
}

/* Subtle red bruise glow on the left side of the crack */
.hero-crack-gap::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -8px;
    width: 12px;
    height: calc(100% + 20px);
    background: radial-gradient(ellipse at center, rgba(139, 64, 73, 0.18), transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease-out 0.4s;
}

.hero-crack-gap.split::before {
    opacity: 1;
}

.hero-subtitle {
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 400;
    font-size: 20px;
    color: #4A4036;
    margin-top: 24px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- THE CODEX SECTION --- */
.section-codex {
    position: relative;
    z-index: 1;
    padding: 120px 0;
}

.codex-inner {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px;
}

.codex-entry {
    position: relative;
    padding: 80px 0;
    border-left: 1px solid #B8860B;
    padding-left: 32px;
    margin-left: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.codex-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Extended gold border above */
.codex-entry::before {
    content: '';
    position: absolute;
    left: -1px;
    top: -40px;
    width: 1px;
    height: 40px;
    background: #B8860B;
}

/* Extended gold border below */
.codex-entry::after {
    content: '';
    position: absolute;
    left: -1px;
    bottom: -40px;
    width: 1px;
    height: 40px;
    background: #B8860B;
}

.entry-header {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 16px;
    font-variant: small-caps;
    letter-spacing: 0.12em;
    color: #2C2520;
    margin-bottom: 28px;
    text-transform: lowercase;
}

.entry-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.entry-applied {
    position: relative;
}

.entry-label {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 15px;
    color: #8B7332;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.entry-applied p {
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
    color: #4A4036;
    text-indent: 24px;
}

/* --- Margin Notes --- */
.margin-note {
    position: absolute;
    right: -180px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 12px;
    color: #D4C9B8;
    opacity: 0;
    transition: opacity 0.6s ease;
    white-space: nowrap;
    pointer-events: none;
}

.margin-note.visible {
    opacity: 1;
}

/* --- Codex Hairline Dividers --- */
.codex-hairline {
    position: relative;
    height: 2px;
    margin: 0 0 0 20px;
    overflow: visible;
}

.codex-hairline svg {
    position: absolute;
    top: 0;
    left: 0;
    overflow: visible;
}

/* --- FRACTURE FIELD SECTION --- */
.section-fracture {
    position: relative;
    height: 100vh;
    z-index: 1;
    overflow: hidden;
    perspective: 1200px;
}

.fracture-container {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.fracture-fragment {
    position: absolute;
    max-width: 340px;
    padding: 20px 24px;
    font-family: 'Alegreya Sans', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #A89A8C;
    opacity: 0;
    transition: opacity 1.2s ease;
    will-change: transform, opacity;
}

.frag-1 {
    top: 8%;
    left: 10%;
    transform: translateZ(-40px);
}
.frag-1.visible { opacity: 0.35; }

.frag-2 {
    top: 22%;
    left: 55%;
    transform: translateZ(-80px);
}
.frag-2.visible { opacity: 0.25; }

.frag-3 {
    top: 38%;
    left: 5%;
    transform: translateZ(-20px);
}
.frag-3.visible { opacity: 0.45; }

.frag-4 {
    top: 50%;
    left: 60%;
    transform: translateZ(-100px);
}
.frag-4.visible { opacity: 0.20; }

.frag-5 {
    top: 65%;
    left: 25%;
    transform: translateZ(-60px);
}
.frag-5.visible { opacity: 0.30; }

.frag-6 {
    top: 15%;
    left: 70%;
    transform: translateZ(-30px);
}
.frag-6.visible { opacity: 0.40; }

.frag-7 {
    top: 75%;
    left: 65%;
    transform: translateZ(-50px);
}
.frag-7.visible { opacity: 0.15; }

.frag-8 {
    top: 82%;
    left: 8%;
    transform: translateZ(-70px);
}
.frag-8.visible { opacity: 0.30; }

.fracture-bg-transition {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1C1C1C;
    clip-path: circle(0% at 50% 50%);
    z-index: -1;
    will-change: clip-path;
}

/* --- THE SILENCE SECTION --- */
.section-silence {
    position: relative;
    height: 70vh;
    background: #1C1C1C;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.silence-content {
    position: relative;
    width: 100%;
    text-align: center;
}

.silence-word {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 48px;
    color: #E8E0D4;
    margin-bottom: 40px;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.silence-word.visible {
    opacity: 1;
}

.silence-line {
    width: calc(100% - 160px);
    height: 1px;
    background: #B8860B;
    margin: 0 auto;
    transform: scaleX(0);
    transition: transform 1.5s cubic-bezier(0.22, 1, 0.36, 1);
    transform-origin: center;
}

.silence-line.visible {
    transform: scaleX(1);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .margin-note {
        display: none;
    }
}

@media (max-width: 768px) {
    .hero-title-wrap {
        font-size: 48px;
    }

    .hero-subtitle {
        font-size: 17px;
        padding: 0 24px;
    }

    .codex-inner {
        padding: 0 16px;
    }

    .codex-entry {
        margin-left: 12px;
        padding-left: 20px;
    }

    .silence-word {
        font-size: 36px;
    }

    .fracture-fragment {
        max-width: 260px;
        font-size: 13px;
    }

    .silence-line {
        width: calc(100% - 80px);
    }
}

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

    .entry-header {
        font-size: 14px;
    }

    .entry-applied p {
        font-size: 15px;
    }

    .silence-word {
        font-size: 28px;
    }

    .silence-line {
        width: calc(100% - 48px);
    }
}
