/* ========================================
   courthouse.app — Styles
   Swiss International Typographic Style
   Burgundy-Cream Palette
   ======================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
    --deep-burgundy: #6B1D2A;
    --wine-shadow: #4A0E1C;
    --rose-dust: #C4727E;
    --warm-cream: #F5EDE0;
    --pale-ivory: #FFFBF5;
    --burgundy-ink: #3D1F28;
    --muted-mauve: #8C6B73;
    --burnished-gold: #C49A3C;

    --font-display: 'Space Grotesk', sans-serif;
    --font-expressive: 'Fraunces', serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

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

body {
    background-color: var(--warm-cream);
    color: var(--burgundy-ink);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.65;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Page Wrapper (Perspective Container) ---------- */
#page-wrapper {
    position: relative;
    width: 100%;
    perspective: 1200px;
}

/* ---------- Swiss Grid Overlay ---------- */
#swiss-grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.8s ease;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent,
            transparent 59px,
            rgba(107, 29, 42, 0.05) 59px,
            rgba(107, 29, 42, 0.05) 60px
        ),
        repeating-linear-gradient(
            to right,
            transparent,
            transparent 59px,
            rgba(107, 29, 42, 0.05) 59px,
            rgba(107, 29, 42, 0.05) 60px
        );
}

body:hover #swiss-grid-overlay {
    opacity: 1;
}

/* ---------- Timeline Spine ---------- */
#timeline-spine {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

.timeline-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background-color: var(--deep-burgundy);
    opacity: 0.4;
}

/* ---------- Timeline Nodes ---------- */
.timeline-node {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    z-index: 110;
    pointer-events: all;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.timeline-node:nth-child(2) { top: calc(100vh * 0.5 / 6 + 100vh * 0 / 6); }
.timeline-node:nth-child(3) { top: calc(100vh * 0.5 / 6 + 100vh * 1 / 6); }
.timeline-node:nth-child(4) { top: calc(100vh * 0.5 / 6 + 100vh * 2 / 6); }
.timeline-node:nth-child(5) { top: calc(100vh * 0.5 / 6 + 100vh * 3 / 6); }
.timeline-node:nth-child(6) { top: calc(100vh * 0.5 / 6 + 100vh * 4 / 6); }
.timeline-node:nth-child(7) { top: calc(100vh * 0.5 / 6 + 100vh * 5 / 6); }

.node-circle {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--warm-cream);
    border: 2px solid var(--deep-burgundy);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.timeline-node:hover .node-circle {
    width: 16px;
    height: 16px;
    background-color: var(--rose-dust);
}

.timeline-node.active .node-circle {
    background-color: var(--deep-burgundy);
    animation: node-pulse 2s ease-in-out infinite;
}

@keyframes node-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(107, 29, 42, 0); }
    50% { box-shadow: 0 0 20px rgba(107, 29, 42, 0.3); }
}

.node-label {
    display: block;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-mauve);
    margin-top: 4px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.timeline-node:hover .node-label,
.timeline-node.active .node-label {
    opacity: 1;
    transform: translateY(0);
}

/* Alternate label position above/below */
.timeline-node:nth-child(odd) .node-label {
    order: -1;
    margin-top: 0;
    margin-bottom: 4px;
    transform: translateY(4px);
}

.timeline-node:nth-child(odd):hover .node-label,
.timeline-node:nth-child(odd).active .node-label {
    transform: translateY(0);
}

/* ---------- Timeline Sections ---------- */
.timeline-section {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
}

.section-content {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 20px;
    display: flex;
    align-items: center;
}

/* ---------- Left Cards ---------- */
.left-card {
    justify-content: flex-start;
    padding-left: 5vw;
    padding-right: 52vw;
}

.left-card .content-card {
    width: 40vw;
    max-width: 560px;
    transform: translateZ(30px);
}

/* ---------- Right Cards ---------- */
.right-card {
    justify-content: flex-end;
    padding-right: 5vw;
    padding-left: 52vw;
}

.right-card .content-card {
    width: 40vw;
    max-width: 560px;
    transform: translateZ(30px);
}

/* ---------- Trial (Wider Right Card) ---------- */
.center-wide-card {
    justify-content: flex-end;
    padding-right: 5vw;
    padding-left: 45vw;
}

.center-wide-card .content-card {
    width: 50vw;
    max-width: 700px;
    transform: translateZ(30px);
}

/* ---------- Verdict (Full Width Centered) ---------- */
.center-full-card {
    justify-content: center;
    padding-left: 10vw;
    padding-right: 10vw;
}

.center-full-card .content-card {
    width: 80vw;
    max-width: 1000px;
    text-align: center;
    transform: translateZ(30px);
}

/* ---------- Content Cards ---------- */
.content-card {
    background: linear-gradient(135deg, #F5EDE0 0%, #FFFFFF 100%);
    border-radius: 0;
    padding: 0;
    position: relative;
    box-shadow:
        0 1px 2px rgba(74, 14, 28, 0.06),
        0 4px 8px rgba(74, 14, 28, 0.04),
        0 12px 24px rgba(74, 14, 28, 0.03);
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Card border on timeline-facing edge */
.left-card .content-card {
    border-right: 1px solid var(--deep-burgundy);
    transform: translateX(-40px) translateZ(30px);
}

.left-card .content-card.visible {
    opacity: 1;
    transform: translateX(0) translateZ(30px);
}

.right-card .content-card,
.center-wide-card .content-card {
    border-left: 1px solid var(--deep-burgundy);
    transform: translateX(40px) translateZ(30px);
}

.right-card .content-card.visible,
.center-wide-card .content-card.visible {
    opacity: 1;
    transform: translateX(0) translateZ(30px);
}

.center-full-card .content-card {
    border-top: 1px solid var(--deep-burgundy);
    border-bottom: 1px solid var(--deep-burgundy);
    transform: translateY(30px) translateZ(30px);
}

.center-full-card .content-card.visible {
    opacity: 1;
    transform: translateY(0) translateZ(30px);
}

/* ---------- Card Image ---------- */
.card-image {
    width: 100%;
    overflow: hidden;
}

.section-illustration {
    width: 100%;
    height: auto;
    display: block;
}

/* ---------- Card Heading ---------- */
.card-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--deep-burgundy);
    padding: 24px 32px 0 32px;
}

.card-heading-verdict {
    color: var(--burnished-gold);
}

/* ---------- Card Body ---------- */
.card-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.65;
    letter-spacing: 0.005em;
    color: var(--burgundy-ink);
    padding: 16px 32px;
}

/* ---------- Fraunces Pull Quotes ---------- */
.card-quote {
    padding: 16px 32px 8px 32px;
}

.fraunces-quote {
    font-family: var(--font-expressive);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    line-height: 1.3;
    color: var(--muted-mauve);
    font-variation-settings: 'WONK' 0, 'SOFT' 0, 'wght' 300;
    transition: font-variation-settings 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.fraunces-quote.wonk-active {
    animation: wonk-reveal 800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes wonk-reveal {
    0% { font-variation-settings: 'WONK' 0, 'SOFT' 0, 'wght' 300; }
    60% { font-variation-settings: 'WONK' 1, 'SOFT' 100, 'wght' 500; }
    100% { font-variation-settings: 'WONK' 0, 'SOFT' 50, 'wght' 400; }
}

/* ---------- Counter Blocks ---------- */
.counter-block {
    padding: 20px 32px 28px 32px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.counter-label {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--muted-mauve);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.counter-value {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    font-variant-numeric: tabular-nums;
    color: var(--muted-mauve);
    transition: color 0.3s ease;
}

.counter-value.counting {
    color: var(--rose-dust);
}

.counter-value.completed {
    color: var(--deep-burgundy);
}

/* ---------- Verdict Counter Special ---------- */
.counter-block-verdict {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px;
}

.counter-verdict-number {
    font-family: var(--font-expressive);
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 8rem);
    line-height: 1;
    color: var(--burnished-gold);
}

.counter-verdict-number.counting {
    color: var(--rose-dust);
}

.counter-verdict-number.completed {
    color: var(--burnished-gold);
}

.counter-label-verdict {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 1rem);
    color: var(--muted-mauve);
    text-transform: none;
    letter-spacing: 0.02em;
}

/* ---------- Connector Lines ---------- */
.connector-line {
    position: absolute;
    top: 50%;
    height: 2px;
    background-color: var(--deep-burgundy);
    opacity: 0.4;
    z-index: 5;
}

.connector-right {
    right: 0;
    width: calc(50vw - 40vw - 5vw);
    left: auto;
    right: 5vw;
    width: calc(50vw - 40vw - 5vw - 1px);
    transform: translateX(calc(40vw + 1px));
}

.left-card .connector-right {
    left: auto;
    right: auto;
    left: calc(40vw + 5vw);
    width: calc(50vw - 40vw - 5vw);
}

.connector-left {
    right: auto;
    left: 0;
}

.right-card .connector-left {
    left: auto;
    right: auto;
    right: calc(40vw + 5vw);
    width: calc(50vw - 40vw - 5vw);
}

.connector-both {
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
}

/* ---------- Floating 3D Objects ---------- */
.floating-object {
    position: absolute;
    z-index: 50;
    pointer-events: none;
    transform: translateZ(20px);
}

.floating-object svg {
    width: 60px;
    height: 60px;
}

@keyframes object-float {
    0% { transform: translateY(0px) rotate(0deg) translateZ(20px); }
    50% { transform: translateY(-8px) rotate(1deg) translateZ(20px); }
    100% { transform: translateY(0px) rotate(0deg) translateZ(20px); }
}

.float-obj-1 {
    top: 20%;
    right: 15%;
    animation: object-float 5.5s ease-in-out infinite alternate;
    animation-delay: 0.5s;
}

.float-obj-2 {
    top: 30%;
    left: 12%;
    animation: object-float 6.2s ease-in-out infinite alternate;
    animation-delay: 1.2s;
}

.float-obj-3 {
    top: 25%;
    right: 18%;
    animation: object-float 5.8s ease-in-out infinite alternate;
    animation-delay: 2.1s;
}

.float-obj-6 {
    top: 15%;
    right: 20%;
    animation: object-float 6.5s ease-in-out infinite alternate;
    animation-delay: 0.8s;
}

/* ---------- Section Depth Tilt ---------- */
.timeline-section[data-depth] {
    transition: transform 0.1s linear;
}

/* ---------- Section: Verdict Special Styling ---------- */
.section-verdict {
    background: linear-gradient(180deg, transparent 0%, rgba(196, 154, 60, 0.03) 50%, transparent 100%);
}

.section-verdict .content-card {
    background: linear-gradient(135deg, #F5EDE0 0%, #FFFBF5 60%, #FFFFFF 100%);
}

/* ---------- Responsive Adjustments ---------- */
@media (max-width: 900px) {
    .left-card,
    .right-card,
    .center-wide-card {
        padding-left: 5vw;
        padding-right: 5vw;
        justify-content: center;
    }

    .left-card .content-card,
    .right-card .content-card,
    .center-wide-card .content-card {
        width: 85vw;
        max-width: 560px;
    }

    .center-full-card {
        padding-left: 5vw;
        padding-right: 5vw;
    }

    .center-full-card .content-card {
        width: 90vw;
    }

    .connector-line {
        display: none;
    }

    #timeline-spine {
        left: 20px;
        transform: none;
    }

    .timeline-node {
        left: 20px;
        transform: none;
    }

    .floating-object {
        display: none;
    }
}

@media (max-width: 600px) {
    .card-heading {
        padding: 16px 20px 0 20px;
    }

    .card-body {
        padding: 12px 20px;
    }

    .card-quote {
        padding: 12px 20px 4px 20px;
    }

    .counter-block {
        padding: 16px 20px 20px 20px;
        flex-direction: column;
        gap: 4px;
    }
}

/* ---------- Selection ---------- */
::selection {
    background-color: var(--rose-dust);
    color: var(--pale-ivory);
}
