/* ============================================
   courts.studio - Styles
   Sci-Fi Judicial Operations HUD
   ============================================ */

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

:root {
    --void-black: #06080c;
    --onyx-panel: #0d1117;
    --gunmetal: #161b22;
    --slate-wire: #2a3140;
    --phantom-gray: #6e7a8a;
    --plasma-cyan: #00e5ff;
    --verdict-green: #39ff85;
    --alert-magenta: #ff2d6b;
    --evidence-gold: #ffc640;
    --ghost-white: #e2e8f0;

    --glow-cyan: 0 0 8px rgba(0, 229, 255, 0.4), 0 0 24px rgba(0, 229, 255, 0.15), 0 0 48px rgba(0, 229, 255, 0.05);
    --glow-green: 0 0 8px rgba(57, 255, 133, 0.4), 0 0 24px rgba(57, 255, 133, 0.15);
    --glow-magenta: 0 0 8px rgba(255, 45, 107, 0.4), 0 0 24px rgba(255, 45, 107, 0.15);
    --glow-gold: 0 0 8px rgba(255, 198, 64, 0.4), 0 0 24px rgba(255, 198, 64, 0.15);

    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Exo 2', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;

    --bezel-size: 48px;
    --bezel-side: 64px;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--void-black);
    color: var(--ghost-white);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.9rem, 1.8vw, 1.05rem);
    line-height: 1.7;
    letter-spacing: 0.02em;
}

.hidden {
    opacity: 0;
    visibility: hidden;
}

/* ---- Scan Lines Overlay ---- */
#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 229, 255, 0.03) 2px,
        rgba(0, 229, 255, 0.03) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

/* ---- Hexagonal Grid Underlay ---- */
#hex-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    background-image:
        linear-gradient(30deg, #161b22 12%, transparent 12.5%, transparent 87%, #161b22 87.5%, #161b22),
        linear-gradient(150deg, #161b22 12%, transparent 12.5%, transparent 87%, #161b22 87.5%, #161b22),
        linear-gradient(30deg, #161b22 12%, transparent 12.5%, transparent 87%, #161b22 87.5%, #161b22),
        linear-gradient(150deg, #161b22 12%, transparent 12.5%, transparent 87%, #161b22 87.5%, #161b22),
        linear-gradient(60deg, #1a2030 25%, transparent 25.5%, transparent 75%, #1a2030 75%, #1a2030),
        linear-gradient(60deg, #1a2030 25%, transparent 25.5%, transparent 75%, #1a2030 75%, #1a2030);
    background-size: 80px 140px;
    background-position: 0 0, 0 0, 40px 70px, 40px 70px, 0 0, 40px 70px;
    pointer-events: none;
    z-index: 0;
}

/* ---- HUD Bezel Frame ---- */
#hud-bezel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
}

/* Bezel Edges - drawn sequentially */
.bezel-edge {
    position: absolute;
    background: var(--plasma-cyan);
    opacity: 0;
}

.bezel-top {
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
}

.bezel-right {
    top: 0;
    right: 0;
    width: 2px;
    height: 0;
}

.bezel-bottom {
    bottom: 0;
    right: 0;
    height: 2px;
    width: 0;
}

.bezel-left {
    bottom: 0;
    left: 0;
    width: 2px;
    height: 0;
}

.bezel-edge.animate-top {
    opacity: 0.3;
    animation: drawTop 300ms linear forwards;
}

.bezel-edge.animate-right {
    opacity: 0.3;
    animation: drawRight 200ms linear forwards;
}

.bezel-edge.animate-bottom {
    opacity: 0.3;
    animation: drawBottom 300ms linear forwards;
}

.bezel-edge.animate-left {
    opacity: 0.3;
    animation: drawLeft 200ms linear forwards;
}

@keyframes drawTop {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes drawRight {
    from { height: 0; }
    to { height: 100%; }
}

@keyframes drawBottom {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes drawLeft {
    from { height: 0; }
    to { height: 100%; }
}

/* Corner Brackets */
.corner-bracket {
    position: absolute;
    width: 24px;
    height: 24px;
    opacity: 0;
    z-index: 101;
}

.corner-bracket.visible {
    animation: cornerAppear 100ms ease-out forwards;
}

@keyframes cornerAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.corner-tl {
    top: 6px;
    left: 6px;
    border-top: 1px solid var(--plasma-cyan);
    border-left: 1px solid var(--plasma-cyan);
}

.corner-tr {
    top: 6px;
    right: 6px;
    border-top: 1px solid var(--plasma-cyan);
    border-right: 1px solid var(--plasma-cyan);
}

.corner-bl {
    bottom: 6px;
    left: 6px;
    border-bottom: 1px solid var(--plasma-cyan);
    border-left: 1px solid var(--plasma-cyan);
}

.corner-br {
    bottom: 6px;
    right: 6px;
    border-bottom: 1px solid var(--plasma-cyan);
    border-right: 1px solid var(--plasma-cyan);
}

/* Corner bracket pulse */
@keyframes bracketPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.corner-bracket.visible {
    animation: cornerAppear 100ms ease-out forwards, bracketPulse 4s ease-in-out 0.1s infinite;
}

/* Bezel Readouts */
.bezel-readout {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 0.5625rem;
    color: var(--plasma-cyan);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bezel-readout.visible {
    opacity: 0.7;
}

.readout-tl {
    top: 14px;
    left: 40px;
}

.readout-tr {
    top: 14px;
    right: 80px;
}

.readout-bl {
    bottom: 14px;
    left: 40px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

.readout-br {
    bottom: 14px;
    right: 40px;
    font-size: 0.6875rem;
}

/* Signal Bars */
.signal-bar {
    display: inline-block;
    width: 3px;
    background: var(--plasma-cyan);
    opacity: 0.5;
}

.sb-1 { height: 4px; }
.sb-2 { height: 7px; }
.sb-3 { height: 10px; }
.sb-4 { height: 13px; }
.sb-5 { height: 16px; }

/* Progress Arc */
#progress-arc {
    position: absolute;
    top: 10px;
    right: 36px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#progress-arc.visible {
    opacity: 0.8;
}

#progress-circle {
    transition: stroke-dashoffset 0.5s ease;
}

/* Bezel Flash */
#bezel-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid var(--plasma-cyan);
    opacity: 0;
    pointer-events: none;
}

#bezel-flash.flash {
    animation: bezelFlash 50ms ease-out forwards;
}

@keyframes bezelFlash {
    0% { opacity: 0.4; }
    100% { opacity: 0; }
}

/* ---- Main HUD Grid ---- */
#hud-grid {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ---- Screens ---- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--bezel-size) var(--bezel-side);
    opacity: 0;
    transform: translateX(100%);
    transition: none;
    pointer-events: none;
}

.screen-active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.screen.slide-out-left {
    animation: slideOutLeft 400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen.slide-in-right {
    animation: slideInRight 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms forwards;
    pointer-events: auto;
}

.screen.slide-out-right {
    animation: slideOutRight 400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen.slide-in-left {
    animation: slideInLeft 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms forwards;
    pointer-events: auto;
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

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

/* Stagger Animation for screen content */
.stagger-item {
    opacity: 0;
    transform: translateY(12px);
}

.stagger-item.stagger-in {
    animation: staggerIn 300ms ease-out forwards;
}

@keyframes staggerIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Screen Titles */
.screen-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 3.5vw, 2.4rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    line-height: 1.1;
    color: var(--ghost-white);
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
    margin-bottom: 0.5rem;
}

.screen-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--phantom-gray);
    letter-spacing: 0.15em;
    margin-bottom: 2rem;
}

.screen-content {
    position: relative;
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

/* ---- Screen 0: IDENT ---- */
#screen-0 {
    background: var(--void-black);
}

/* Particle Field */
#particle-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--plasma-cyan);
    border-radius: 50%;
}

/* Gavel Container */
#gavel-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 2rem;
    opacity: 0;
}

#gavel-container.visible {
    opacity: 1;
}

#gavel-svg {
    width: 100%;
    height: 100%;
}

.gavel-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    opacity: 0;
}

.gavel-line.draw {
    animation: drawLine 60ms linear forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

/* Slow Y-axis rotation simulation */
@keyframes gavelRotate {
    0% { transform: scaleX(1); }
    25% { transform: scaleX(0.85) skewY(-2deg); }
    50% { transform: scaleX(0.7); }
    75% { transform: scaleX(0.85) skewY(2deg); }
    100% { transform: scaleX(1); }
}

#gavel-svg.rotating {
    animation: gavelRotate 20s linear infinite;
}

/* Domain Title */
#domain-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 6rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    line-height: 1.1;
    color: var(--ghost-white);
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
    text-align: center;
    margin-bottom: 1rem;
    transition: opacity 0.1s, visibility 0.1s;
}

.letter {
    display: inline-block;
    opacity: 0;
    transform: scale(1.2);
}

.letter.reveal {
    animation: letterStamp 150ms ease-out forwards;
}

@keyframes letterStamp {
    from {
        opacity: 0;
        transform: scale(1.2);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.dot-letter {
    color: var(--plasma-cyan);
}

/* Tagline */
#tagline {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.8rem, 2vw, 1.1rem);
    letter-spacing: 0.25em;
    color: var(--phantom-gray);
    text-align: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#tagline.fade-in {
    opacity: 1;
    visibility: visible;
}

/* Navigate Chevron */
#nav-chevron {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--plasma-cyan);
    letter-spacing: 0.2em;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#nav-chevron.pulse {
    opacity: 1;
    visibility: visible;
    animation: chevronPulse 1.5s ease-in-out infinite;
}

@keyframes chevronPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ---- Screen 1: BRIEF ---- */
#screen-1 {
    background: var(--void-black);
}

#brief-document {
    max-width: 700px;
    width: 100%;
}

.brief-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.9rem, 1.8vw, 1.05rem);
    line-height: 1.7;
    letter-spacing: 0.02em;
    color: var(--ghost-white);
    margin-bottom: 1.5rem;
}

/* Redaction System */
.redact-wrapper {
    position: relative;
    display: inline;
}

.redact-bar {
    position: absolute;
    top: 0;
    left: -2px;
    right: -2px;
    bottom: 0;
    background: #0a0a12;
    transform-origin: right;
    transform: scaleX(1);
    z-index: 1;
    transition: transform 300ms ease-out;
}

.redact-bar.revealed {
    transform: scaleX(0);
}

.redact-text {
    position: relative;
    color: var(--ghost-white);
}

.redact-text.glow-reveal {
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.6);
    animation: textGlowFade 500ms ease-out forwards;
}

@keyframes textGlowFade {
    from { text-shadow: 0 0 12px rgba(0, 229, 255, 0.6); }
    to { text-shadow: none; }
}

/* Circuit Traces */
.circuit-trace {
    position: absolute;
    width: 1px;
    background: var(--slate-wire);
}

.ct-1 {
    left: 10%;
    top: 30%;
    height: 40%;
}

.ct-2 {
    right: 10%;
    top: 25%;
    height: 50%;
}

.circuit-junction {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(0, 229, 255, 0.5);
    border-radius: 50%;
    top: 50%;
    left: -1.5px;
    animation: junctionPulse 2s ease-in-out infinite;
}

@keyframes junctionPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ---- Screen 2: SYSTEMS ---- */
#screen-2 {
    background: var(--void-black);
}

#scale-container {
    margin-bottom: 1.5rem;
}

#scale-beam {
    transform-origin: 200px 95px;
    animation: scaleRock 6s ease-in-out infinite;
}

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

#systems-columns {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
    max-width: 960px;
}

.system-panel {
    position: relative;
    flex: 1;
    background: rgba(13, 17, 23, 0.85);
    padding: 1.5rem 1.2rem;
    border: 1px solid var(--slate-wire);
    border-radius: 0;
    overflow-y: auto;
    max-height: 340px;
    transition: box-shadow 200ms ease;
}

/* Custom thin scrollbar */
.system-panel::-webkit-scrollbar {
    width: 4px;
}

.system-panel::-webkit-scrollbar-track {
    background: transparent;
}

.system-panel::-webkit-scrollbar-thumb {
    background: var(--plasma-cyan);
    border-radius: 0;
}

/* Panel top glow line */
.panel-glow-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.glow-green {
    background: var(--verdict-green);
    box-shadow: var(--glow-green);
}

.glow-cyan {
    background: var(--plasma-cyan);
    box-shadow: var(--glow-cyan);
}

.glow-gold {
    background: var(--evidence-gold);
    box-shadow: var(--glow-gold);
}

/* Panel hover state */
.system-panel:hover {
    box-shadow: var(--glow-cyan);
}

.panel-analysis:hover {
    box-shadow: var(--glow-green);
}

.panel-strategy:hover {
    box-shadow: var(--glow-cyan);
}

.panel-execution:hover {
    box-shadow: var(--glow-gold);
}

.system-panel:hover .panel-corner {
    width: 20px;
    height: 20px;
}

/* Panel corner brackets */
.panel-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    transition: width 200ms ease, height 200ms ease;
}

.pc-tl {
    top: 4px;
    left: 4px;
    border-top: 1px solid var(--plasma-cyan);
    border-left: 1px solid var(--plasma-cyan);
}

.pc-tr {
    top: 4px;
    right: 4px;
    border-top: 1px solid var(--plasma-cyan);
    border-right: 1px solid var(--plasma-cyan);
}

.pc-bl {
    bottom: 4px;
    left: 4px;
    border-bottom: 1px solid var(--plasma-cyan);
    border-left: 1px solid var(--plasma-cyan);
}

.pc-br {
    bottom: 4px;
    right: 4px;
    border-bottom: 1px solid var(--plasma-cyan);
    border-right: 1px solid var(--plasma-cyan);
}

.panel-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(0.75rem, 1.5vw, 1rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ghost-white);
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
    margin-bottom: 1rem;
    padding-top: 0.5rem;
}

.panel-content p {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.75rem, 1.4vw, 0.875rem);
    line-height: 1.7;
    color: var(--ghost-white);
    opacity: 0.8;
    margin-bottom: 1rem;
}

.panel-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border-top: 1px solid rgba(42, 49, 64, 0.5);
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--phantom-gray);
    letter-spacing: 0.1em;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--plasma-cyan);
}

/* Inter-panel traces */
.inter-panel-trace {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 20px;
    gap: 0;
}

.trace-line {
    width: 1px;
    flex: 1;
    background: var(--slate-wire);
}

.trace-junction {
    width: 4px;
    height: 4px;
    background: rgba(0, 229, 255, 0.5);
    border-radius: 50%;
    animation: junctionPulse 2s ease-in-out infinite;
}

/* ---- Screen 3: SIGNAL ---- */
#screen-3 {
    background: var(--void-black);
}

.signal-content {
    max-width: 600px;
}

#command-prompt-container {
    width: 100%;
    max-width: 500px;
    margin: 2rem auto;
}

#command-prompt {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0.75rem 0;
    font-family: var(--font-mono);
    font-size: clamp(0.75rem, 1.4vw, 0.875rem);
}

#prompt-prefix {
    color: var(--plasma-cyan);
    white-space: nowrap;
    margin-right: 0.5rem;
}

#input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

#command-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--ghost-white);
    font-family: var(--font-mono);
    font-size: clamp(0.75rem, 1.4vw, 0.875rem);
    caret-color: transparent;
}

#cursor-blink {
    display: inline-block;
    width: 1px;
    height: 1.2em;
    background: var(--plasma-cyan);
    animation: cursorBlink 1060ms step-end infinite;
    margin-left: -1px;
    flex-shrink: 0;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

#prompt-underline {
    width: 100%;
    height: 1px;
    background: var(--slate-wire);
    transition: background 300ms ease, box-shadow 300ms ease;
}

#prompt-underline.focus {
    background: var(--plasma-cyan);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

#prompt-underline.valid {
    background: var(--verdict-green);
    box-shadow: var(--glow-green);
}

#prompt-underline.invalid {
    background: var(--alert-magenta);
    box-shadow: var(--glow-magenta);
}

/* Shake animation */
@keyframes inputShake {
    0% { transform: translateX(0); }
    15% { transform: translateX(-3px); }
    30% { transform: translateX(3px); }
    50% { transform: translateX(-2px); }
    70% { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

#command-prompt.shake {
    animation: inputShake 300ms ease-out;
}

#prompt-feedback {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    margin-top: 0.75rem;
    letter-spacing: 0.08em;
    transition: opacity 0.3s ease;
}

#prompt-feedback.success {
    color: var(--verdict-green);
}

#prompt-feedback.error {
    color: var(--alert-magenta);
}

#signal-info {
    text-align: center;
    margin-top: 2rem;
}

#signal-info p {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.8rem, 1.6vw, 0.95rem);
    color: var(--phantom-gray);
    margin-bottom: 0.5rem;
}

.signal-hint {
    font-family: var(--font-mono);
    font-size: 0.625rem !important;
    letter-spacing: 0.12em;
    color: var(--slate-wire) !important;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    :root {
        --bezel-size: 36px;
        --bezel-side: 36px;
    }

    #systems-columns {
        flex-direction: column;
        gap: 1rem;
    }

    .inter-panel-trace {
        flex-direction: row;
        width: 100%;
        height: 20px;
    }

    .trace-line {
        width: auto;
        height: 1px;
    }

    .system-panel {
        max-height: 200px;
    }

    #scale-container {
        display: none;
    }

    .circuit-trace {
        display: none;
    }
}
