/* ============================================
   PFTOLIGARCHY Validator Dashboard
   "A Roman senator who has discovered DeFi"
   ============================================ */

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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --gold-primary: #C9A84C;
    --gold-secondary: #D4AF37;
    --ivory: #F5F0E8;
    --text-primary: #F0EBE0;
    --text-secondary: #8B7355;
    --status-green: #8B9A46;
    --status-red: #9A4646;
    --border-gold: rgba(201, 168, 76, 0.4);
    --border-gold-hover: rgba(201, 168, 76, 0.7);
    --card-bg: #0d0d0d;
    --card-shadow: rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'IM Fell English', 'Cormorant Garamond', Georgia, serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* --- Marble Texture Overlay --- */
.marble-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.18;
    background:
        /* Primary veining - thin diagonal cracks */
        repeating-linear-gradient(
            42deg,
            transparent,
            transparent 35px,
            rgba(255,255,255,0.12) 35px,
            rgba(255,255,255,0.06) 36.5px,
            transparent 37px
        ),
        repeating-linear-gradient(
            -28deg,
            transparent,
            transparent 55px,
            rgba(255,255,255,0.10) 55px,
            rgba(255,255,255,0.04) 56px,
            transparent 57px
        ),
        /* Secondary veining - finer, denser */
        repeating-linear-gradient(
            78deg,
            transparent,
            transparent 70px,
            rgba(255,255,255,0.08) 70px,
            rgba(255,255,255,0.03) 71.5px,
            transparent 72px
        ),
        repeating-linear-gradient(
            -55deg,
            transparent,
            transparent 90px,
            rgba(255,255,255,0.06) 90px,
            rgba(255,255,255,0.02) 91px,
            transparent 92px
        ),
        /* Broad cloudy patches like real marble */
        radial-gradient(ellipse at 15% 30%, rgba(255,255,255,0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 75% 15%, rgba(255,255,255,0.07) 0%, transparent 35%),
        radial-gradient(ellipse at 50% 70%, rgba(255,255,255,0.06) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 60%, rgba(255,255,255,0.05) 0%, transparent 30%),
        radial-gradient(ellipse at 30% 85%, rgba(255,255,255,0.07) 0%, transparent 40%);
}

/* --- Greek Meander Border --- */
.meander-border {
    width: 100%;
    height: 20px;
    position: relative;
    z-index: 2;
    background:
        linear-gradient(var(--gold-primary) 0%, var(--gold-primary) 100%) no-repeat center/100% 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.meander-border::before {
    content: '&#x039B; &#x2014; &#x039B; &#x2014; &#x039B; &#x2014; &#x039B; &#x2014; &#x039B; &#x2014; &#x039B;';
    font-family: 'Cinzel', serif;
    font-size: 0.6rem;
    color: var(--gold-primary);
    letter-spacing: 0.5rem;
    opacity: 0.5;
}

.meander-top {
    background: repeating-linear-gradient(
        90deg,
        var(--gold-primary) 0px,
        var(--gold-primary) 10px,
        transparent 10px,
        transparent 14px,
        var(--gold-primary) 14px,
        var(--gold-primary) 24px,
        transparent 24px,
        transparent 28px
    );
    background-size: 28px 2px;
    background-repeat: repeat-x;
    background-position: center;
    height: 2px;
    opacity: 0.6;
}

.meander-bottom {
    background: repeating-linear-gradient(
        90deg,
        var(--gold-primary) 0px,
        var(--gold-primary) 10px,
        transparent 10px,
        transparent 14px,
        var(--gold-primary) 14px,
        var(--gold-primary) 24px,
        transparent 24px,
        transparent 28px
    );
    background-size: 28px 2px;
    background-repeat: repeat-x;
    background-position: center;
    height: 2px;
    opacity: 0.6;
}

/* --- Container --- */
.container {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 2rem 2rem;
}

/* --- Grand Header --- */
.grand-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.laurel-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.laurel {
    width: 50px;
    height: 100px;
    opacity: 0.7;
    flex-shrink: 0;
}

.title-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.site-title {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 3.2rem;
    font-weight: 900;
    color: var(--gold-primary);
    letter-spacing: 0.4em;
    text-shadow:
        0 0 40px rgba(201, 168, 76, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.gold-rule {
    width: 300px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
    margin: 0.8rem 0;
}

.subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    color: var(--text-secondary);
    letter-spacing: 0.2em;
    font-style: italic;
}

.builder-credit {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.15em;
    margin-top: 0.6rem;
    opacity: 0.7;
}

.builder-name {
    font-family: 'Cinzel', serif;
    color: var(--gold-primary);
    letter-spacing: 0.2em;
    font-size: 0.75rem;
}

/* --- Hero Section --- */
.hero-section {
    text-align: center;
    margin-bottom: 2.5rem;
}

.hero-image {
    max-width: 280px;
    height: auto;
    filter: drop-shadow(0 4px 25px rgba(201, 168, 76, 0.12));
    opacity: 0.9;
    transition: opacity 0.4s ease, filter 0.4s ease;
}

.hero-image:hover {
    opacity: 1;
    filter: drop-shadow(0 4px 35px rgba(201, 168, 76, 0.2));
}

@media (max-width: 768px) {
    .hero-image {
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .hero-image {
        max-width: 160px;
    }
}

/* --- Validator Seal --- */
.validator-seal {
    text-align: center;
    margin-bottom: 2rem;
}

.seal-label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.35em;
    margin-bottom: 0.8rem;
}

.seal-block {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    background: linear-gradient(135deg, #0d0d0d 0%, #111 50%, #0d0d0d 100%);
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    padding: 1rem 1.8rem;
    position: relative;
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(201, 168, 76, 0.05);
}

.seal-block::before,
.seal-block::after {
    content: '';
    position: absolute;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--border-gold);
}

.seal-block::before { left: 8px; }
.seal-block::after { right: 8px; }

.seal-ornament-left,
.seal-ornament-right {
    font-size: 1.4rem;
    color: var(--gold-primary);
    opacity: 0.5;
}

.validator-key {
    font-family: 'Courier New', 'Fira Mono', monospace;
    font-size: 0.85rem;
    color: var(--gold-primary);
    letter-spacing: 0.08em;
    word-break: break-all;
    line-height: 1.4;
}

.seal-domain {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.6rem;
    font-style: italic;
}

/* --- Frieze Divider --- */
.frieze-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.frieze-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-gold), transparent);
}

.frieze-ornament {
    color: var(--gold-primary);
    font-size: 1.2rem;
    opacity: 0.6;
}

/* --- Connection Status --- */
.connection-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    display: inline-block;
    transition: background-color 0.3s ease;
}

.status-dot.connected {
    background-color: var(--status-green);
    animation: pulse-green 2s ease-in-out infinite;
}

.status-dot.disconnected {
    background-color: var(--status-red);
    animation: pulse-red 1.5s ease-in-out infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139, 154, 70, 0.5); }
    50% { box-shadow: 0 0 8px 2px rgba(139, 154, 70, 0.3); }
}

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(154, 70, 70, 0.5); }
    50% { box-shadow: 0 0 8px 2px rgba(154, 70, 70, 0.3); }
}

.status-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: linear-gradient(145deg, #0e0e0e 0%, #0a0a0a 100%);
    border: 1px solid var(--border-gold);
    border-radius: 3px;
    padding: 1.5rem 1.2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.4s ease, border-color 0.4s ease;
    box-shadow:
        inset 0 1px 4px rgba(0, 0, 0, 0.4),
        inset 0 -1px 2px rgba(0, 0, 0, 0.2);
}

/* Marble texture on cards */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.12;
    background:
        repeating-linear-gradient(
            55deg,
            transparent,
            transparent 25px,
            rgba(255,255,255,0.08) 25px,
            rgba(255,255,255,0.03) 26px,
            transparent 27px
        ),
        repeating-linear-gradient(
            -35deg,
            transparent,
            transparent 40px,
            rgba(255,255,255,0.05) 40px,
            rgba(255,255,255,0.02) 41px,
            transparent 42px
        );
    pointer-events: none;
}

.stat-card:hover {
    border-color: var(--border-gold-hover);
    box-shadow:
        inset 0 1px 4px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(201, 168, 76, 0.08),
        0 0 40px rgba(201, 168, 76, 0.04);
}

.card-icon {
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    color: var(--gold-primary);
    opacity: 0.5;
    margin-bottom: 0.4rem;
}

.card-label {
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.3em;
    margin-bottom: 0.8rem;
}

.card-value {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--gold-primary);
    font-weight: 700;
    text-shadow: 0 0 20px rgba(201, 168, 76, 0.1);
    transition: opacity 0.3s ease;
    word-break: break-word;
}

.card-value.small-text {
    font-size: 1.1rem;
    font-family: 'Cinzel', serif;
}

/* State-specific colors */
.card-value.state-proposing {
    color: var(--gold-primary);
}

.card-value.state-full,
.card-value.state-validating {
    color: var(--status-green);
}

.card-value.state-connected {
    color: var(--ivory);
}

.card-value.state-disconnected {
    color: var(--status-red);
}

/* Gold pulse animation on data update */
@keyframes gold-pulse {
    0% { box-shadow: inset 0 0 0 1px rgba(201, 168, 76, 0.6); }
    100% { box-shadow: inset 0 0 0 1px rgba(201, 168, 76, 0); }
}

.stat-card.updated {
    animation: gold-pulse 0.8s ease-out;
}

/* --- Footer --- */
.dashboard-footer {
    text-align: center;
    padding: 1.5rem 0 1rem;
}

.footer-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.footer-motto {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-top: 0.5rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .site-title {
        font-size: 1.8rem;
        letter-spacing: 0.2em;
    }

    .laurel {
        width: 30px;
        height: 60px;
    }

    .laurel-title {
        gap: 0.8rem;
    }

    .seal-block {
        padding: 0.8rem 1rem;
    }

    .validator-key {
        font-size: 0.7rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 0.8rem;
    }

    .card-value {
        font-size: 1.3rem;
    }

    .container {
        padding: 2rem 1rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.4rem;
        letter-spacing: 0.15em;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .seal-block {
        flex-direction: column;
        gap: 0.3rem;
    }

    .seal-ornament-left,
    .seal-ornament-right {
        display: none;
    }
}
