/* ================================================
   judge.club — Styles
   Victorian Appellate Courtroom / Dark Academia
   ================================================ */

/* ---- CSS Custom Properties ---- */
:root {
    --deep-chamber: #1A1410;
    --burnished-walnut: #2A2118;
    --antique-gold: #C9A84C;
    --aged-parchment: #D4C5A9;
    --faded-ink: #8B8068;
    --oxblood: #6B1D1D;
    --tarnished-brass: #8B7340;
    --vellum-glow: #F5ECD7;
    --brass-accent: #A89070;
}

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

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

body {
    background-color: var(--deep-chamber);
    color: var(--aged-parchment);
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Leather Grain Texture (CSS-only) ---- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 800ms ease;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(139, 115, 64, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 115, 64, 0.02) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 80%, rgba(42, 33, 24, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 40% 30%, rgba(168, 144, 112, 0.02) 0%, transparent 30%),
        radial-gradient(circle at 70% 60%, rgba(26, 20, 16, 0.05) 0%, transparent 35%),
        radial-gradient(ellipse at 10% 90%, rgba(139, 115, 64, 0.015) 0%, transparent 45%),
        radial-gradient(ellipse at 90% 10%, rgba(42, 33, 24, 0.03) 0%, transparent 40%);
}

body.leather-visible::before {
    opacity: 1;
}

/* ---- Gilt Edge Effect ---- */
.gilt-edge {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    z-index: 100;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(201, 168, 76, 0.08) 20%,
        rgba(201, 168, 76, 0.15) 50%,
        rgba(201, 168, 76, 0.08) 80%,
        transparent 100%
    );
}

/* ================================================
   OPENING CHAMBER
   ================================================ */
#opening-chamber {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--deep-chamber);
    z-index: 1;
}

.chamber-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

/* Site Title — Engraved brass plate effect */
.site-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(2.8rem, 6vw, 5rem);
    letter-spacing: 0.12em;
    color: var(--antique-gold);
    line-height: 1.1;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.6),
        0 -1px 0 rgba(255, 220, 120, 0.15);
    min-height: 1.2em;
    margin-bottom: 1.5rem;
}

.site-title .char {
    display: inline-block;
    opacity: 0;
    transition: opacity 200ms ease, text-shadow 400ms ease;
}

.site-title .char.visible {
    opacity: 1;
}

.site-title .char.glow {
    text-shadow:
        0 0 20px rgba(201, 168, 76, 0.8),
        0 0 40px rgba(201, 168, 76, 0.4),
        0 1px 0 rgba(0, 0, 0, 0.6),
        0 -1px 0 rgba(255, 220, 120, 0.15);
}

/* Epigraph */
.epigraph {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--faded-ink);
    letter-spacing: 0.03em;
    line-height: 1.6;
    opacity: 0;
    transition: opacity 1.5s ease-in;
    margin-bottom: 3rem;
}

.epigraph.visible {
    opacity: 1;
}

/* Hero Wax Seal */
.hero-seal {
    width: 100px;
    height: 100px;
    margin-bottom: 3rem;
    opacity: 0;
    transition: opacity 600ms ease;
}

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

.hero-seal svg {
    width: 100%;
    height: 100%;
}

/* Seal path-draw animation */
.seal-outer {
    stroke-dasharray: 340;
    stroke-dashoffset: 340;
    transition: stroke-dashoffset 1.2s ease;
}

.seal-drawing .seal-outer {
    stroke-dashoffset: 0;
}

.seal-icon line,
.seal-icon path,
.seal-icon circle {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.8s ease 0.8s;
}

.seal-drawing .seal-icon line,
.seal-drawing .seal-icon path,
.seal-drawing .seal-icon circle {
    stroke-dashoffset: 0;
}

.seal-fill {
    transition: opacity 0.6s ease 1.6s;
}

.seal-drawing .seal-fill {
    opacity: 1;
}

.seal-inner-ring {
    transition: opacity 0.4s ease 1.4s;
}

.seal-drawing .seal-inner-ring {
    opacity: 0.6;
}

/* Seal pulse-attention glow */
@keyframes sealPulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(201, 168, 76, 0.0));
    }
    50% {
        filter: drop-shadow(0 0 16px rgba(201, 168, 76, 0.25)) drop-shadow(0 0 30px rgba(168, 120, 40, 0.1));
    }
}

.seal-pulsing svg {
    animation: sealPulse 4s ease-in-out infinite;
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 600ms ease;
}

.scroll-indicator.visible {
    opacity: 1;
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* ================================================
   CODEX WRAPPER & TWO-COLUMN LAYOUT
   ================================================ */
.codex-wrapper {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem 6rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 400ms ease, transform 400ms ease;
}

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

/* Central gutter rule */
.gutter-rule {
    position: absolute;
    left: 26%;
    top: 0;
    width: 1px;
    height: 0;
    background-color: rgba(139, 115, 64, 0.25);
    transition: height 600ms ease;
    z-index: 1;
}

.gutter-rule.drawn {
    height: 100%;
}

/* ---- Codex Section ---- */
.codex-section {
    display: grid;
    grid-template-columns: 22% 1fr;
    gap: 0 4%;
    margin-bottom: 6rem;
    position: relative;
}

/* ---- Citation Margin ---- */
.citation-margin {
    padding-right: 1rem;
    padding-top: 4.5rem;
    opacity: 0;
    transform: translateX(-15px);
    transition: opacity 300ms ease, transform 300ms ease;
}

.citation-margin.visible {
    opacity: 1;
    transform: translateX(0);
}

.citation-entry {
    margin-bottom: 1.2rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 300ms ease, transform 300ms ease;
}

.citation-entry.visible {
    opacity: 1;
    transform: translateX(0);
}

.citation-entry:hover {
    cursor: default;
}

.citation-entry:hover .citation-ref,
.citation-entry:hover .citation-detail,
.citation-entry:hover .citation-date,
.citation-entry:hover .citation-docket {
    color: var(--aged-parchment);
    transform: scale(1.02);
    transition: color 200ms ease, transform 200ms ease;
}

.citation-ref {
    display: block;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 500;
    font-style: italic;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--faded-ink);
    transition: color 200ms ease, transform 200ms ease;
}

.citation-detail {
    display: block;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 0.8rem;
    line-height: 1.5;
    color: rgba(139, 128, 104, 0.75);
    transition: color 200ms ease, transform 200ms ease;
}

.citation-date {
    display: block;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--faded-ink);
    letter-spacing: 0.05em;
    transition: color 200ms ease, transform 200ms ease;
}

.citation-docket {
    display: block;
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-weight: 400;
    font-size: 0.78rem;
    color: var(--brass-accent);
    letter-spacing: 0.02em;
    transition: color 200ms ease, transform 200ms ease;
}

.margin-rule {
    border: none;
    border-top: 0.5px solid rgba(139, 115, 64, 0.2);
    margin-top: 0.8rem;
}

/* ---- Main Content Column ---- */
.main-content {
    padding-left: 2rem;
}

/* ---- Section Cartouche ---- */
.section-cartouche {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
}

.cartouche-svg {
    width: 100%;
    max-width: 500px;
    height: 50px;
    display: block;
    margin: 0 auto 0.8rem;
}

/* Acanthus path-draw animation */
.acanthus-left,
.acanthus-right {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1s ease;
}

.section-cartouche.animate-in .acanthus-left {
    stroke-dashoffset: 0;
}

.section-cartouche.animate-in .acanthus-right {
    stroke-dashoffset: 0;
}

.section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 800;
    font-size: clamp(2.2rem, 5vw, 4rem);
    letter-spacing: 0.03em;
    color: var(--antique-gold);
    line-height: 1.1;
    margin-bottom: 0.6rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 400ms ease 0.8s, transform 400ms ease 0.8s;
    position: relative;
    display: inline-block;
}

.section-cartouche.animate-in .section-title {
    opacity: 1;
    transform: translateY(0);
}

/* Heading underline-draw on hover */
.section-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--antique-gold);
    transition: width 300ms ease;
}

.section-title:hover::after {
    width: 100%;
}

/* Cartouche rule with diamond terminators */
.cartouche-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.cartouche-rule hr {
    flex: 1;
    border: none;
    border-top: 1px solid rgba(201, 168, 76, 0.3);
}

.diamond-left,
.diamond-right {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: rgba(201, 168, 76, 0.4);
    transform: rotate(45deg);
    flex-shrink: 0;
}

/* ---- Section Body ---- */
.section-body {
    margin-top: 2rem;
}

.body-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--aged-parchment);
    margin-bottom: 1.5rem;
    text-align: justify;
    text-justify: inter-word;
}

/* Paragraph stagger animation */
.animate-paragraph {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms ease, transform 400ms ease;
}

.animate-paragraph.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Verdict Panels ---- */
.verdict-panel {
    position: relative;
    background-color: rgba(42, 33, 24, 0.6);
    padding: 2rem 2.5rem;
    margin: 2rem 0 2.5rem;
    border-radius: 2px;
    border: 2px solid rgba(139, 115, 64, 0.6);
    outline: 1px solid rgba(139, 115, 64, 0.3);
    outline-offset: 3px;
    transition: background-color 200ms ease, border-color 200ms ease, outline-color 200ms ease;
}

.verdict-panel:hover {
    background-color: rgba(42, 33, 24, 0.75);
    border-color: rgba(201, 168, 76, 0.8);
    outline-color: rgba(201, 168, 76, 0.5);
}

.animate-panel {
    opacity: 0;
    transition: opacity 500ms ease, background-color 200ms ease, border-color 200ms ease, outline-color 200ms ease;
}

.animate-panel.visible {
    opacity: 1;
}

.panel-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    line-height: 1.6;
    color: var(--vellum-glow);
    font-style: italic;
    margin-bottom: 1rem;
}

.panel-attribution {
    display: block;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--faded-ink);
    text-align: right;
}

/* ---- Section End Seal ---- */
.section-end-seal {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
    opacity: 0.7;
}

.section-end-seal svg {
    filter: drop-shadow(0 1px 3px rgba(107, 29, 29, 0.3));
}

/* ================================================
   CLOSING SECTION
   ================================================ */
.closing-section {
    padding: 6rem 2rem 4rem;
    text-align: center;
}

.closing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Large closing seal */
.closing-seal {
    width: 120px;
    height: 120px;
    margin-bottom: 2.5rem;
    opacity: 0;
    transition: opacity 600ms ease;
}

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

.closing-seal svg {
    width: 100%;
    height: 100%;
}

.closing-statement {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(2rem, 4vw, 3.2rem);
    letter-spacing: 0.06em;
    color: var(--antique-gold);
    line-height: 1.1;
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 1s ease;
}

.closing-statement.visible {
    opacity: 1;
}

/* Closing double rule */
.closing-rule {
    width: 100%;
    max-width: 400px;
    margin-bottom: 2rem;
}

.double-rule-top {
    border: none;
    border-top: 2px solid rgba(139, 115, 64, 0.5);
    margin-bottom: 4px;
}

.double-rule-bottom {
    border: none;
    border-top: 1px solid rgba(139, 115, 64, 0.3);
}

/* Colophon */
.colophon {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--faded-ink);
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 1s ease 0.3s;
}

.colophon.visible {
    opacity: 1;
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 900px) {
    .codex-section {
        grid-template-columns: 1fr;
        gap: 2rem 0;
    }

    .citation-margin {
        padding-right: 0;
        padding-top: 0;
        padding-bottom: 1.5rem;
        border-bottom: 0.5px solid rgba(139, 115, 64, 0.2);
        margin-bottom: 1.5rem;
        transform: translateX(0);
    }

    .citation-entry {
        transform: translateX(0);
        transform: translateY(8px);
    }

    .citation-entry.visible {
        transform: translateY(0);
    }

    .gutter-rule {
        display: none;
    }

    .main-content {
        padding-left: 0;
    }

    .body-text {
        text-align: left;
    }

    .verdict-panel {
        padding: 1.5rem;
    }
}

@media (max-width: 600px) {
    .site-title {
        font-size: clamp(2rem, 10vw, 3rem);
        letter-spacing: 0.08em;
    }

    .section-title {
        font-size: clamp(1.6rem, 6vw, 2.4rem);
    }

    .codex-wrapper {
        padding: 2rem 1rem 4rem;
    }

    .closing-statement {
        font-size: clamp(1.6rem, 6vw, 2.4rem);
    }
}

/* ================================================
   SELECTION STYLING
   ================================================ */
::selection {
    background-color: rgba(201, 168, 76, 0.3);
    color: var(--vellum-glow);
}

::-moz-selection {
    background-color: rgba(201, 168, 76, 0.3);
    color: var(--vellum-glow);
}

/* ================================================
   SCROLLBAR STYLING
   ================================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--deep-chamber);
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 115, 64, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 115, 64, 0.5);
}