/* ============================================
   polytical.club -- Dark-Academia Political Observatory
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #1C1C24;
    --bg-secondary: #24242E;
    --bg-tertiary: #2E2E3A;
    --border-color: #4A4A5A;
    --border-hover: #5A5A6A;
    --text-primary: #D8D8E2;
    --text-secondary: #8A8A9A;
    --accent-warm: #C4A882;
    --accent-botanical: #6B8F71;
    --accent-alert: #B85C5C;
    --connector-line: #3A3A4A;
    --font-headline: 'Barlow Condensed', sans-serif;
    --font-body: 'Source Serif 4', serif;
    --font-data: 'IBM Plex Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--bg-primary);
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.72;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
}

/* --- Grid Underlay --- */
.grid-underlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
    animation: gridPulse 8s ease-in-out infinite;
    background-image: repeating-linear-gradient(
        to right,
        #4A4A5A 0px,
        #4A4A5A 0.5px,
        transparent 0.5px,
        transparent calc(100% / 12)
    );
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.03; }
    50% { opacity: 0.05; }
}

/* --- Fixed Header Bar --- */
.header-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background-color: rgba(28, 28, 36, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    display: flex;
    align-items: center;
}

.header-inner {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-title {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    white-space: nowrap;
}

.header-rule {
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

.header-session {
    font-family: var(--font-data);
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* --- Hero Dashboard --- */
.hero-dashboard {
    width: 100%;
    min-height: 100vh;
    padding: 96px 40px 40px;
    position: relative;
    overflow: hidden;
}

.hero-grid {
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 136px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 65% 35%;
    gap: 16px;
}

.hero-quadrant {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 1px 0 rgba(200, 200, 220, 0.08);
    padding: 32px;
    position: relative;
    overflow: hidden;
}

.hero-primary {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-data {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.hero-botanical {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-quote {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-headline {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.05;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.hero-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.72;
    color: var(--text-primary);
    max-width: 560px;
}

.hero-annotation {
    font-family: var(--font-data);
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-top: 20px;
}

/* --- Petal Polygons --- */
.petal-polygon {
    position: absolute;
    opacity: 0.2;
    pointer-events: none;
    z-index: 1;
}

.petal-1 {
    width: 180px;
    height: 180px;
    top: 15%;
    right: 8%;
    animation: petalRotate 120s linear infinite;
}

.petal-2 {
    width: 120px;
    height: 120px;
    bottom: 20%;
    left: 5%;
    animation: petalRotate 120s linear infinite reverse;
}

.petal-3 {
    width: 160px;
    height: 160px;
    top: 55%;
    right: 35%;
    animation: petalRotate 120s linear infinite;
    animation-delay: -40s;
}

@keyframes petalRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Pressed Flower Watermark --- */
.pressed-flower-watermark {
    position: absolute;
    top: 20%;
    left: 10%;
    width: 300px;
    height: 400px;
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
    background: var(--accent-botanical);
    clip-path: polygon(
        50% 0%, 65% 15%, 80% 10%, 75% 30%,
        95% 40%, 80% 55%, 85% 75%, 65% 70%,
        50% 90%, 35% 70%, 15% 75%, 20% 55%,
        5% 40%, 25% 30%, 20% 10%, 35% 15%
    );
}

/* --- Botanical Drawing --- */
.botanical-drawing {
    width: 160px;
    height: 160px;
}

.botanical-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.botanical-drawing.animate .botanical-path {
    stroke-dashoffset: 0;
}

/* --- Philosophy Quote --- */
.philosophy-quote {
    max-width: 400px;
}

.philosophy-quote p {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.72;
    color: var(--accent-warm);
    font-style: italic;
    margin-bottom: 12px;
}

.philosophy-quote cite {
    font-family: var(--font-data);
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    font-style: normal;
}

/* --- Annotation Brackets --- */
.annotation-bracket {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.annotation-bracket::before,
.annotation-bracket::after {
    content: '';
    position: absolute;
    background-color: var(--accent-botanical);
}

.annotation-bracket::before {
    top: 0;
    left: 0;
    width: 0;
    height: 2px;
    transition: width 0.2s ease-out 0.1s;
}

.annotation-bracket::after {
    top: 0;
    left: 0;
    width: 2px;
    height: 0;
    transition: height 0.2s ease-out;
}

.panel.visible .annotation-bracket::before {
    width: 24px;
}

.panel.visible .annotation-bracket::after {
    height: 24px;
}

/* --- Panel Titles & Body --- */
.panel-title {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: clamp(1.1rem, 2.5vw, 1.8rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.panel-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.72;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.panel-body:last-child {
    margin-bottom: 0;
}

/* --- Data Tickers --- */
.data-ticker-container {
    margin-top: 20px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid rgba(74, 74, 90, 0.4);
}

.data-row:last-child {
    border-bottom: none;
}

.data-label {
    font-family: var(--font-data);
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.data-value {
    font-family: var(--font-data);
    font-weight: 400;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    letter-spacing: 0.04em;
    color: var(--accent-warm);
}

/* --- Connector Stems --- */
.connector-stem-section,
.connector-stem-inline {
    display: flex;
    justify-content: center;
    padding: 0;
}

.connector-stem-section svg {
    width: 40px;
    height: 80px;
}

.connector-stem-inline svg {
    width: 40px;
    height: 60px;
}

/* --- Content Section --- */
.content-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px 60px;
}

/* --- Panel Rows (Dashboard Mosaic) --- */
.panel-row {
    display: grid;
    grid-template-columns: 7fr 32px 4fr;
    gap: 0;
    align-items: start;
}

.panel-row:nth-child(odd) .panel-main {
    margin-top: 0;
}

.panel-row:nth-child(even) .panel-main {
    margin-top: 40px;
}

.panel-row:nth-child(even) .panel-sidebar {
    margin-top: 0;
}

.panel-row:nth-child(odd) .panel-sidebar {
    margin-top: 40px;
}

.panel-main {
    grid-column: 1 / 2;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 1px 0 rgba(200, 200, 220, 0.08);
    padding: 32px;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1),
                opacity 0.5s ease-out;
}

.panel-sidebar {
    grid-column: 3 / 4;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 1px 0 rgba(200, 200, 220, 0.08);
    padding: 24px;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1),
                opacity 0.5s ease-out;
}

/* Stagger animation - applied via JS */
.panel.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Panel Hover Elevation */
@media (hover: hover) {
    .panel-main:hover,
    .panel-sidebar:hover {
        transform: translateY(-4px);
        background-color: var(--bg-tertiary);
        border-color: var(--border-hover);
        transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    }

    .panel-main.visible:hover,
    .panel-sidebar.visible:hover {
        transform: translateY(-4px);
    }
}

/* Hero panels - initial state */
.hero-quadrant {
    opacity: 0;
    transform: translateY(30px);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1),
                opacity 0.5s ease-out;
}

.hero-quadrant.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (hover: hover) {
    .hero-quadrant:hover {
        transform: translateY(-4px);
        background-color: var(--bg-tertiary);
        border-color: var(--border-hover);
        transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    }

    .hero-quadrant.visible:hover {
        transform: translateY(-4px);
    }
}

/* --- Sidebar Typography --- */
.sidebar-title {
    font-family: var(--font-headline);
    font-weight: 300;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-botanical);
    margin-bottom: 12px;
}

.sidebar-annotation {
    font-family: var(--font-data);
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.sidebar-annotation:last-of-type {
    margin-bottom: 16px;
}

.sidebar-timestamp {
    font-family: var(--font-data);
    font-weight: 400;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.04em;
    color: var(--accent-warm);
    display: block;
    margin-top: 8px;
}

/* --- Leaf Divider --- */
.leaf-divider {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

.leaf-divider svg {
    width: 40px;
    height: 20px;
}

.leaf-rotate-0 svg {
    transform: rotate(0deg);
}

.leaf-rotate-90 svg {
    transform: rotate(90deg);
}

/* --- Footer Registry --- */
.footer-registry {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 48px 40px 24px;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.footer-heading {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-botanical);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.footer-entry {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(74, 74, 90, 0.3);
}

.footer-label {
    font-family: var(--font-data);
    font-weight: 400;
    font-size: clamp(0.65rem, 0.85vw, 0.78rem);
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.footer-value {
    font-family: var(--font-data);
    font-weight: 400;
    font-size: clamp(0.65rem, 0.85vw, 0.78rem);
    letter-spacing: 0.04em;
    color: var(--text-primary);
    text-align: right;
}

.footer-bottom {
    max-width: 1400px;
    margin: 32px auto 0;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-copyright {
    font-family: var(--font-data);
    font-weight: 400;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

/* --- Tablet (768px) --- */
@media (max-width: 768px) {
    .hero-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        height: auto;
        min-height: 100vh;
    }

    .hero-primary {
        grid-column: 1;
        grid-row: 1;
    }

    .hero-data {
        grid-column: 1;
        grid-row: 2;
    }

    .hero-botanical {
        grid-column: 1;
        grid-row: 3;
    }

    .hero-quote {
        grid-column: 1;
        grid-row: 4;
    }

    .panel-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .panel-main {
        grid-column: 1;
    }

    .panel-sidebar {
        grid-column: 1;
        margin-top: 0 !important;
        border-top: none;
    }

    /* Alternating horizontal offsets for stagger rhythm */
    .panel-row:nth-child(odd) .panel-main {
        margin-left: 8px;
        margin-right: 0;
    }

    .panel-row:nth-child(even) .panel-main {
        margin-left: 0;
        margin-right: 8px;
        margin-top: 0;
    }

    .panel-row:nth-child(odd) .panel-sidebar {
        margin-left: 0;
        margin-right: 8px;
        margin-top: 0;
    }

    .panel-row:nth-child(even) .panel-sidebar {
        margin-left: 8px;
        margin-right: 0;
    }

    /* Sidebar separator on mobile */
    .panel-sidebar::before {
        content: '';
        display: block;
        width: 60%;
        height: 1px;
        background-color: var(--border-color);
        margin: 0 auto 16px;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .header-inner {
        padding: 0 20px;
    }

    .hero-dashboard {
        padding: 80px 20px 20px;
    }

    .content-section {
        padding: 0 20px 40px;
    }

    .footer-registry {
        padding: 32px 20px 16px;
    }

    /* Scale botanical elements down 40% on mobile */
    .petal-polygon {
        transform: scale(0.6);
    }

    .pressed-flower-watermark {
        width: 180px;
        height: 240px;
    }

    .botanical-drawing {
        width: 96px;
        height: 96px;
    }
}

/* --- Mobile (480px) --- */
@media (max-width: 480px) {
    .hero-dashboard {
        padding: 72px 16px 16px;
    }

    .hero-quadrant {
        padding: 20px;
    }

    .panel-main,
    .panel-sidebar {
        padding: 20px;
    }

    .content-section {
        padding: 0 16px 32px;
    }

    .footer-registry {
        padding: 24px 16px 12px;
    }

    .footer-entry {
        flex-direction: column;
        gap: 2px;
    }

    .footer-value {
        text-align: left;
    }
}
