/* ============================================================
   courthouse.app - Styles
   Hexagonal honeycomb courtroom-sketch aesthetic
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --amber: #D4820A;
    --indigo: #1A3A6B;
    --parchment: #FBF7F0;
    --sepia: #2C1810;
    --red: #B8372A;
    --green: #2D6B3F;
    --pencil: #8B8278;
    --yellow: #F5D547;
    --guideline: #D4CFC7;

    --hex-size: clamp(180px, 22vw, 320px);
    --hex-gap: 24px;
    --type-scale: 1.25;

    --font-display: 'Caveat', cursive;
    --font-section: 'Architects Daughter', cursive;
    --font-body: 'Nunito', sans-serif;
}

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--parchment);
    color: var(--sepia);
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    font-weight: 400;
    line-height: 1.65;
    overflow-x: hidden;
    position: relative;
}

/* --- Paper Grain Texture Overlay --- */
#paper-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Scan Lines Overlay --- */
#scan-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(44, 24, 16, 0.05) 3px,
        rgba(44, 24, 16, 0.05) 4px
    );
}

/* --- Hero Lens Flare --- */
#hero-lens-flare {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(212, 130, 10, 0.3) 0%,
        rgba(212, 130, 10, 0.15) 30%,
        rgba(245, 213, 71, 0.08) 55%,
        transparent 75%
    );
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: screen;
    filter: url(#sketchy-flare);
    animation: lensFlareBloom 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

@keyframes lensFlareBloom {
    0% {
        width: 0;
        height: 0;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        width: 800px;
        height: 800px;
        opacity: 0.7;
    }
}

/* --- Hexagonal Bokeh Ghosts (behind hero) --- */
.hex-bokeh-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 300%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

.hex-bokeh {
    position: absolute;
    width: 30px;
    height: 35px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: rgba(212, 130, 10, 0.12);
    opacity: 0;
    animation: bokehFloat 4s ease-in-out infinite;
}

.hex-bokeh-1 { top: 15%; left: 20%; width: 22px; height: 25px; animation-delay: 0s; }
.hex-bokeh-2 { top: 25%; left: 70%; width: 18px; height: 21px; animation-delay: 0.6s; }
.hex-bokeh-3 { top: 60%; left: 15%; width: 26px; height: 30px; animation-delay: 1.2s; }
.hex-bokeh-4 { top: 70%; left: 75%; width: 20px; height: 23px; animation-delay: 1.8s; }
.hex-bokeh-5 { top: 40%; left: 85%; width: 16px; height: 18px; animation-delay: 2.4s; }
.hex-bokeh-6 { top: 80%; left: 45%; width: 24px; height: 28px; animation-delay: 3.0s; }

@keyframes bokehFloat {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* --- Background Constellation SVG --- */
#bg-constellation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.15;
}

/* --- Circuit Traces SVG --- */
#circuit-traces {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.12;
}

/* --- Ink Splatter Container --- */
#ink-splatter-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 998;
}

.ink-splat {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--sepia);
    border-radius: 50%;
    opacity: 0;
    animation: inkSplat 600ms ease-out forwards;
}

@keyframes inkSplat {
    0% {
        transform: scale(0) translate(0, 0);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) translate(var(--splat-x), var(--splat-y));
        opacity: 0;
    }
}

/* ============================================================
   HEXAGONAL FLOOR SECTIONS
   ============================================================ */

.hex-floor {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    position: relative;
    padding: 60px 20px;
    overflow: hidden;
}

/* --- Elevator Door Transition --- */
.floor-elevator-door {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    display: flex;
    opacity: 0;
}

.floor-elevator-door.animating {
    opacity: 1;
}

.elevator-left,
.elevator-right {
    width: 50%;
    height: 100%;
    background: var(--sepia);
    position: relative;
}

.elevator-left {
    transform: translateX(-100%);
    border-right: 2px dashed var(--pencil);
}

.elevator-right {
    transform: translateX(100%);
    border-left: 2px dashed var(--pencil);
}

.elevator-left::after,
.elevator-right::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30px;
    height: 2px;
    background: var(--pencil);
    transform: translateY(-50%);
}

.elevator-left::after {
    right: 10px;
}

.elevator-right::after {
    left: 10px;
}

.floor-elevator-door.closing .elevator-left {
    animation: elevatorCloseLeft 300ms ease-in forwards;
}

.floor-elevator-door.closing .elevator-right {
    animation: elevatorCloseRight 300ms ease-in forwards;
}

.floor-elevator-door.opening .elevator-left {
    animation: elevatorOpenLeft 300ms ease-out forwards;
}

.floor-elevator-door.opening .elevator-right {
    animation: elevatorOpenRight 300ms ease-out forwards;
}

@keyframes elevatorCloseLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes elevatorCloseRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes elevatorOpenLeft {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

@keyframes elevatorOpenRight {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

/* ============================================================
   HEX CLUSTER LAYOUTS
   ============================================================ */

.hex-cluster {
    display: grid;
    gap: var(--hex-gap);
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
    max-width: 1400px;
    margin: 0 auto;
}

/* Lobby cluster: center hero + 6 surrounding nav cells */
.lobby-cluster {
    grid-template-columns: repeat(5, var(--hex-size));
    grid-template-rows: repeat(3, calc(var(--hex-size) * 1.15));
    justify-items: center;
    align-items: center;
}

.lobby-cluster .hex-hero {
    grid-column: 2 / 5;
    grid-row: 1 / 3;
    width: calc(var(--hex-size) * 2);
    height: calc(var(--hex-size) * 2.3);
    z-index: 5;
}

.lobby-cluster .hex-nav:nth-child(2) {
    grid-column: 1;
    grid-row: 1;
}

.lobby-cluster .hex-nav:nth-child(3) {
    grid-column: 5;
    grid-row: 1;
}

.lobby-cluster .hex-nav:nth-child(4) {
    grid-column: 1;
    grid-row: 2;
}

.lobby-cluster .hex-nav:nth-child(5) {
    grid-column: 5;
    grid-row: 2;
}

.lobby-cluster .hex-nav:nth-child(6) {
    grid-column: 2;
    grid-row: 3;
}

.lobby-cluster .hex-nav:nth-child(7) {
    grid-column: 4;
    grid-row: 3;
}

/* Standard cluster: staggered hex grid */
.cases-cluster,
.evidence-cluster,
.verdicts-cluster,
.archive-cluster,
.about-cluster,
.search-cluster {
    grid-template-columns: repeat(3, var(--hex-size));
    grid-template-rows: auto;
    justify-items: center;
}

/* Staggered honeycomb offset for even-indexed cells in standard clusters */
.cases-cluster > .hex-cell:nth-child(even):not(.hex-large),
.evidence-cluster > .hex-cell:nth-child(even):not(.hex-large),
.verdicts-cluster > .hex-cell:nth-child(even):not(.hex-large),
.archive-cluster > .hex-cell:nth-child(even):not(.hex-large),
.about-cluster > .hex-cell:nth-child(even):not(.hex-large),
.search-cluster > .hex-cell:nth-child(even):not(.hex-large) {
    transform: translateY(calc(var(--hex-size) * 0.15));
}

.cases-cluster > .hex-cell:nth-child(even):not(.hex-large):hover,
.evidence-cluster > .hex-cell:nth-child(even):not(.hex-large):hover,
.verdicts-cluster > .hex-cell:nth-child(even):not(.hex-large):hover,
.archive-cluster > .hex-cell:nth-child(even):not(.hex-large):hover,
.about-cluster > .hex-cell:nth-child(even):not(.hex-large):hover,
.search-cluster > .hex-cell:nth-child(even):not(.hex-large):hover {
    transform: translateY(calc(var(--hex-size) * 0.15 - 4px));
}

.cases-cluster .hex-large,
.evidence-cluster .hex-large,
.verdicts-cluster .hex-large,
.archive-cluster .hex-large,
.about-cluster .hex-large,
.search-cluster .hex-large {
    grid-column: 1 / -1;
    width: calc(var(--hex-size) * 1.6);
    height: calc(var(--hex-size) * 1.85);
}

/* ============================================================
   HEXAGONAL CELLS
   ============================================================ */

.hex-cell {
    position: relative;
    width: var(--hex-size);
    height: calc(var(--hex-size) * 1.15);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--parchment);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 300ms ease, filter 300ms ease;
    container-type: inline-size;
    container-name: hexcell;
}

.hex-cell:hover {
    transform: translateY(-4px);
}

.hex-cell.clicked {
    animation: hexClick 150ms ease-out;
}

@keyframes hexClick {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.3); background-color: rgba(245, 213, 71, 0.4); }
    100% { filter: brightness(1); }
}

/* --- Hex Border SVG --- */
.hex-border-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.hex-border-svg svg {
    width: 100%;
    height: 100%;
}

.hex-border-path {
    fill: none;
    stroke: var(--sepia);
    stroke-width: 2;
    stroke-dasharray: 8, 3, 14, 4, 6, 5;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 300ms ease, stroke-width 300ms ease;
}

.hex-cell:hover .hex-border-path {
    stroke-dashoffset: -40;
    stroke-width: 3;
}

/* --- Hex Content --- */
.hex-content {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 15%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* --- Speed Lines Burst --- */
.speed-lines-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    animation: speedLinesPulse 3s ease-in-out infinite;
}

@keyframes speedLinesPulse {
    0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

.site-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.15;
    color: var(--sepia);
}

.site-tagline {
    font-family: var(--font-section);
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--pencil);
    letter-spacing: 0.04em;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4.5vw, 3.6rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.15;
    color: var(--sepia);
}

.section-subtitle {
    font-family: var(--font-section);
    font-size: clamp(0.9rem, 1.8vw, 1.2rem);
    color: var(--pencil);
    letter-spacing: 0.04em;
}

.hex-nav-label {
    font-family: var(--font-section);
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sepia);
    display: block;
    margin-bottom: 6px;
}

.hex-nav-icon {
    width: 40px;
    height: 40px;
}

/* --- Case Cards --- */
.case-number {
    font-family: var(--font-section);
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    color: var(--pencil);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.case-title {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2.2vw, 1.6rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--sepia);
}

.case-status {
    font-family: var(--font-body);
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-block;
    margin-top: 4px;
}

.status-active {
    background: rgba(45, 107, 63, 0.15);
    color: var(--green);
    border: 1px solid var(--green);
}

.status-pending {
    background: rgba(26, 58, 107, 0.1);
    color: var(--indigo);
    border: 1px solid var(--indigo);
}

.status-urgent {
    background: rgba(184, 55, 42, 0.12);
    color: var(--red);
    border: 1px solid var(--red);
}

/* --- Evidence Cards --- */
.evidence-label {
    font-family: var(--font-section);
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    color: var(--amber);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 400;
}

.evidence-title {
    font-family: var(--font-display);
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--sepia);
}

.evidence-desc {
    font-family: var(--font-body);
    font-size: clamp(0.75rem, 1.3vw, 0.9rem);
    color: var(--pencil);
    line-height: 1.5;
    max-width: 38ch;
}

.evidence-diagram {
    width: 80%;
    max-width: 140px;
    margin-top: 6px;
}

/* --- Verdict Cards --- */
.verdict-badge {
    font-family: var(--font-section);
    font-size: clamp(0.75rem, 1.3vw, 0.95rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 12px;
    border-radius: 4px;
    display: inline-block;
}

.verdict-badge.sustained {
    background: rgba(45, 107, 63, 0.15);
    color: var(--green);
    border: 1.5px solid var(--green);
}

.verdict-badge.overruled {
    background: rgba(184, 55, 42, 0.12);
    color: var(--red);
    border: 1.5px solid var(--red);
}

.verdict-badge.pending {
    background: rgba(26, 58, 107, 0.1);
    color: var(--indigo);
    border: 1.5px solid var(--indigo);
}

.verdict-case {
    font-family: var(--font-display);
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--sepia);
}

.verdict-summary {
    font-family: var(--font-body);
    font-size: clamp(0.72rem, 1.2vw, 0.88rem);
    color: var(--pencil);
    line-height: 1.5;
    max-width: 38ch;
}

/* Verdict lens flare */
.verdict-flare {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(212, 130, 10, 0.3) 0%,
        rgba(245, 213, 71, 0.15) 40%,
        transparent 70%
    );
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: screen;
    opacity: 0;
    transition: width 600ms ease, height 600ms ease, opacity 600ms ease;
}

.hex-verdict.verdict-revealed .verdict-flare {
    width: 200%;
    height: 200%;
    opacity: 0.6;
}

/* --- Archive Entries --- */
.archive-year {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    font-weight: 700;
    color: var(--amber);
    line-height: 1;
}

.archive-title {
    font-family: var(--font-section);
    font-size: clamp(0.85rem, 1.6vw, 1.1rem);
    letter-spacing: 0.04em;
    color: var(--sepia);
}

.archive-count {
    font-family: var(--font-body);
    font-size: clamp(0.72rem, 1.2vw, 0.88rem);
    color: var(--pencil);
}

/* --- About Section --- */
.about-heading {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 2.5vw, 1.9rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--sepia);
}

.about-text {
    font-family: var(--font-body);
    font-size: clamp(0.78rem, 1.3vw, 0.95rem);
    color: var(--pencil);
    line-height: 1.55;
    max-width: 38ch;
}

/* --- Search Section --- */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 14px;
    background: var(--parchment);
    border: 2px solid var(--sepia);
    border-radius: 8px;
    width: 90%;
    max-width: 320px;
    border-style: dashed;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    color: var(--sepia);
    outline: none;
}

.search-input::placeholder {
    color: var(--pencil);
    opacity: 0.7;
}

.search-icon {
    flex-shrink: 0;
}

.search-result-hint {
    font-family: var(--font-section);
    font-size: clamp(0.8rem, 1.4vw, 1rem);
    color: var(--pencil);
    letter-spacing: 0.04em;
}

.filter-label {
    font-family: var(--font-section);
    font-size: clamp(0.85rem, 1.5vw, 1.05rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sepia);
    display: block;
    margin-bottom: 8px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.filter-tag {
    font-family: var(--font-body);
    font-size: clamp(0.68rem, 1.1vw, 0.82rem);
    font-weight: 600;
    padding: 4px 10px;
    border: 1.5px solid var(--pencil);
    border-radius: 20px;
    color: var(--pencil);
    cursor: pointer;
    transition: all 200ms ease;
}

.filter-tag:hover {
    border-color: var(--amber);
    color: var(--amber);
}

.filter-tag.active {
    background: var(--amber);
    color: var(--parchment);
    border-color: var(--amber);
}

/* ============================================================
   ACCENT HEXAGONS (Color field cells)
   ============================================================ */

.hex-accent-amber {
    background: var(--amber);
}

.hex-accent-indigo {
    background: var(--indigo);
}

.hex-accent-red {
    background: var(--red);
}

.hex-accent-green {
    background: var(--green);
}

.hex-accent .hex-border-path {
    stroke: rgba(251, 247, 240, 0.4);
}

.hex-vignette {
    width: 60%;
    max-width: 100px;
}

.qr-motif {
    width: 50%;
    max-width: 60px;
}

/* Objection text */
.objection-text {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    font-weight: 700;
    color: var(--parchment);
    letter-spacing: 0.02em;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
    animation: objectionPulse 2s ease-in-out infinite;
}

@keyframes objectionPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

/* ============================================================
   EVIDENCE TAG (swinging pendulum)
   ============================================================ */

.evidence-tag {
    position: absolute;
    bottom: 18%;
    right: 12%;
    z-index: 4;
    transform-origin: center top;
    animation: tagSwing 3s ease-in-out infinite;
    opacity: 0;
    transition: opacity 300ms ease;
}

.hex-cell:hover .evidence-tag {
    opacity: 1;
}

.evidence-tag-svg {
    width: 20px;
    height: 26px;
}

@keyframes tagSwing {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(8deg); }
}

/* ============================================================
   INK DRIP LOADER
   ============================================================ */

.ink-drip-loader {
    width: 80%;
    height: 8px;
    border: 1.5px solid var(--sepia);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-top: 8px;
}

.ink-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--sepia);
    border-radius: 2px;
    animation: inkDrip 4s ease-in-out infinite;
}

@keyframes inkDrip {
    0% { width: 0%; }
    70% { width: 68%; }
    100% { width: 68%; }
}

/* ============================================================
   GAVEL STAMP (on hero click)
   ============================================================ */

.gavel-stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: none;
}

.gavel-stamp.active {
    animation: stampPress 500ms ease-out forwards;
}

.gavel-stamp-svg {
    width: 80px;
    height: 80px;
}

@keyframes stampPress {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-15deg);
        opacity: 0;
    }
    40% {
        transform: translate(-50%, -50%) scale(1.2) rotate(0deg);
        opacity: 0.9;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 0;
    }
}

/* ============================================================
   COMPASS ROSE NAVIGATION
   ============================================================ */

#compass-rose {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compass-center {
    position: relative;
    width: 50px;
    height: 58px;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 200ms ease;
}

.compass-center:hover {
    transform: scale(1.1);
}

.compass-hex-shape {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.compass-icon {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compass-satellites {
    position: absolute;
    bottom: 0;
    right: 0;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 300ms ease, transform 300ms ease;
}

.compass-satellites.open {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.compass-sat {
    position: absolute;
    width: 50px;
    height: 58px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 200ms ease;
}

.compass-sat:hover {
    transform: scale(1.15);
}

/* Position satellites in a circular arrangement around the compass center */
.compass-sat:nth-child(1) { bottom: 70px; right: -5px; }
.compass-sat:nth-child(2) { bottom: 60px; right: -58px; }
.compass-sat:nth-child(3) { bottom: 10px; right: -70px; }
.compass-sat:nth-child(4) { bottom: -40px; right: -58px; }
.compass-sat:nth-child(5) { bottom: -50px; right: -5px; }
.compass-sat:nth-child(6) { bottom: -40px; right: 48px; }
.compass-sat:nth-child(7) { bottom: 10px; right: 60px; }

.compass-label {
    position: relative;
    z-index: 2;
    font-family: var(--font-section);
    font-size: 0.55rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sepia);
    pointer-events: none;
}

/* ============================================================
   GAVEL OVERLAY
   ============================================================ */

.gavel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    pointer-events: none;
}

.gavel-overlay.hidden {
    display: none;
}

.gavel-overlay .gavel-svg {
    animation: gavelDrop 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes gavelDrop {
    0% {
        transform: translateY(-40px);
        opacity: 0;
    }
    60% {
        transform: translateY(4px);
        opacity: 1;
    }
    80% {
        transform: translateY(-2px);
    }
    100% {
        transform: translateY(0);
        opacity: 0;
    }
}

.gavel-shockwave {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid var(--amber);
    border-radius: 50%;
    opacity: 0;
    animation: shockwave 500ms 200ms ease-out forwards;
}

@keyframes shockwave {
    0% {
        width: 10px;
        height: 10px;
        opacity: 0.8;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
        margin-top: -95px;
        margin-left: -95px;
    }
}

/* ============================================================
   SKETCHING REVEAL ANIMATION
   ============================================================ */

.hex-cell .hex-content {
    opacity: 0;
    transition: opacity 500ms ease;
}

.hex-cell.revealed .hex-content {
    opacity: 1;
}

.hex-cell .hex-border-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 800ms ease;
}

.hex-cell.revealed .hex-border-path {
    stroke-dashoffset: 0;
    stroke-dasharray: 8, 3, 14, 4, 6, 5;
}

/* ============================================================
   HEX CELL MORPH TRANSITIONS
   ============================================================ */

.hex-cell.morphing-out {
    animation: hexMorphOut 400ms ease-in forwards;
}

.hex-cell.morphing-in {
    animation: hexMorphIn 400ms ease-out forwards;
}

@keyframes hexMorphOut {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.8);
        opacity: 0.3;
    }
}

@keyframes hexMorphIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================================
   GUIDELINE MARKS (faint construction lines in negative space)
   ============================================================ */

.hex-floor::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 5%;
    width: 90%;
    height: 80%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(0deg, var(--guideline) 1px, transparent 1px),
        linear-gradient(90deg, var(--guideline) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.15;
    mask-image: radial-gradient(ellipse 60% 50% at center, black 0%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 60% 50% at center, black 0%, transparent 70%);
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
    :root {
        --hex-size: clamp(150px, 28vw, 260px);
    }

    .lobby-cluster {
        grid-template-columns: repeat(3, var(--hex-size));
        grid-template-rows: repeat(4, calc(var(--hex-size) * 1.15));
    }

    .lobby-cluster .hex-hero {
        grid-column: 1 / 4;
        grid-row: 1 / 3;
        width: calc(var(--hex-size) * 1.8);
        height: calc(var(--hex-size) * 2.07);
    }

    .lobby-cluster .hex-nav:nth-child(2) {
        grid-column: 1;
        grid-row: 3;
    }

    .lobby-cluster .hex-nav:nth-child(3) {
        grid-column: 2;
        grid-row: 3;
    }

    .lobby-cluster .hex-nav:nth-child(4) {
        grid-column: 3;
        grid-row: 3;
    }

    .lobby-cluster .hex-nav:nth-child(5) {
        grid-column: 1;
        grid-row: 4;
    }

    .lobby-cluster .hex-nav:nth-child(6) {
        grid-column: 2;
        grid-row: 4;
    }

    .lobby-cluster .hex-nav:nth-child(7) {
        grid-column: 3;
        grid-row: 4;
    }

    .cases-cluster,
    .evidence-cluster,
    .verdicts-cluster,
    .archive-cluster,
    .about-cluster,
    .search-cluster {
        grid-template-columns: repeat(3, var(--hex-size));
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --hex-size: 90vw;
    }

    html {
        scroll-snap-type: y proximity;
    }

    .hex-floor {
        padding: 30px 10px;
        min-height: auto;
    }

    .hex-cluster {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .lobby-cluster {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .lobby-cluster .hex-hero {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1.15;
    }

    .lobby-cluster .hex-nav:nth-child(2),
    .lobby-cluster .hex-nav:nth-child(3),
    .lobby-cluster .hex-nav:nth-child(4),
    .lobby-cluster .hex-nav:nth-child(5),
    .lobby-cluster .hex-nav:nth-child(6),
    .lobby-cluster .hex-nav:nth-child(7) {
        grid-column: 1;
        grid-row: auto;
    }

    .hex-cell {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1.15;
        clip-path: polygon(50% 0%, 100% 8%, 100% 92%, 50% 100%, 0% 92%, 0% 8%);
    }

    /* Disable stagger offset on mobile */
    .cases-cluster > .hex-cell:nth-child(even):not(.hex-large),
    .evidence-cluster > .hex-cell:nth-child(even):not(.hex-large),
    .verdicts-cluster > .hex-cell:nth-child(even):not(.hex-large),
    .archive-cluster > .hex-cell:nth-child(even):not(.hex-large),
    .about-cluster > .hex-cell:nth-child(even):not(.hex-large),
    .search-cluster > .hex-cell:nth-child(even):not(.hex-large) {
        transform: none;
    }

    .cases-cluster > .hex-cell:nth-child(even):not(.hex-large):hover,
    .evidence-cluster > .hex-cell:nth-child(even):not(.hex-large):hover,
    .verdicts-cluster > .hex-cell:nth-child(even):not(.hex-large):hover,
    .archive-cluster > .hex-cell:nth-child(even):not(.hex-large):hover,
    .about-cluster > .hex-cell:nth-child(even):not(.hex-large):hover,
    .search-cluster > .hex-cell:nth-child(even):not(.hex-large):hover {
        transform: translateY(-4px);
    }

    .cases-cluster .hex-large,
    .evidence-cluster .hex-large,
    .verdicts-cluster .hex-large,
    .archive-cluster .hex-large,
    .about-cluster .hex-large,
    .search-cluster .hex-large {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1.15;
    }

    .cases-cluster,
    .evidence-cluster,
    .verdicts-cluster,
    .archive-cluster,
    .about-cluster,
    .search-cluster {
        grid-template-columns: 1fr;
    }

    #compass-rose {
        bottom: 15px;
        right: 15px;
    }

    .compass-satellites.open {
        flex-direction: column;
    }

    .compass-sat:nth-child(1) { bottom: 65px; right: 0px; }
    .compass-sat:nth-child(2) { bottom: 55px; right: -50px; }
    .compass-sat:nth-child(3) { bottom: 10px; right: -60px; }
    .compass-sat:nth-child(4) { bottom: -35px; right: -50px; }
    .compass-sat:nth-child(5) { bottom: -45px; right: 0px; }
    .compass-sat:nth-child(6) { bottom: -35px; right: 50px; }
    .compass-sat:nth-child(7) { bottom: 10px; right: 55px; }

    .hex-floor::before {
        opacity: 0.08;
    }
}

/* ============================================================
   CONTAINER QUERIES for hex cell typography
   ============================================================ */

@container hexcell (max-width: 220px) {
    .case-title,
    .evidence-title,
    .verdict-case,
    .archive-title,
    .about-heading {
        font-size: 0.95rem;
    }

    .case-number,
    .evidence-label,
    .evidence-desc,
    .verdict-summary,
    .archive-count,
    .about-text {
        font-size: 0.7rem;
    }

    .hex-nav-label {
        font-size: 0.85rem;
    }

    .hex-nav-icon {
        width: 30px;
        height: 30px;
    }
}

@container hexcell (min-width: 400px) {
    .section-title {
        font-size: 3.2rem;
    }

    .section-subtitle {
        font-size: 1.3rem;
    }

    .evidence-desc,
    .verdict-summary,
    .about-text {
        font-size: 1rem;
    }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */

.hidden {
    display: none !important;
}

/* Ensure SVG arrows for evidence diagrams */
svg defs {
    display: block;
}
