/* ==========================================================================
   SLRG.XYZ // DUAL-THEME BRUTALIST DESIGN SYSTEM (V15)
   ========================================================================= */

/* 0. GOOGLE FONTS IMPORT */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* 1. DUAL-THEME VARIABLES */
:root {
    /* Default Dark Mode */
    --bg-color: #111111;
    --text-color: #f7f7f7;
    --border-color: #ffffff;
    --card-bg: #111111;
    --muted-color: #aaaaaa;
    
    --accent-green: #009B3A; /* Jamaican Flag Green */
    --accent-red: #ff4d4d;   /* Raw Brutalist Red for Drafts/Coming Soon */
    --border-width: 2.5px;
    --shadow-size: 6px;
    
    /* Typography Tokens */
    --font-mono: 'Space Mono', monospace;
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Light Mode */
:root[data-theme="light"],
html[data-theme="light"],
body[data-theme="light"],
body.light-mode {
    --bg-color: #ffffff;
    --text-color: #050505;
    --border-color: #000000;
    --card-bg: #ffffff;
    --muted-color: #555555;
    --accent-red: #d32f2f;
}

/* Dark Mode */
:root[data-theme="dark"],
html[data-theme="dark"],
body[data-theme="dark"],
body.dark-mode {
    --bg-color: #111111;
    --text-color: #f7f7f7;
    --border-color: #ffffff;
    --card-bg: #111111;
    --muted-color: #aaaaaa;
    --accent-red: #ff4d4d;
}

/* 2. BASE VIEWPORT LOCK */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    line-height: 1.5;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
}

body {
    /* Mathematically balanced symmetrical margins */
    padding: 18px 12px 12px 18px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.site-wrapper {
    width: 100%;
    max-width: 960px;
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
}

/* ==========================================================================
   3. THE BRUTALIST FLOATING CARD COMPONENT
   ========================================================================= */
.brutalist-card {
    background-color: var(--card-bg);
    border: var(--border-width) solid var(--border-color);
    box-shadow: var(--shadow-size) var(--shadow-size) 0px var(--accent-green);
    margin-right: var(--shadow-size);
    margin-bottom: var(--shadow-size);
    padding: 18px 20px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ==========================================================================
   4. CARD 1: HEADER & HERO (WITH AUTO-COLLAPSE)
   ========================================================================= */
.panel-header {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 10px;
    padding: 16px 20px;
    transition: padding 0.2s ease;
}

.header-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: nowrap;
    gap: 8px;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.logo {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    background-color: transparent;
    letter-spacing: 1px;
    line-height: 1;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
}

.tagline {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-green);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-action-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    outline: none;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: color 0.15s ease, transform 0.15s ease;
}

.header-action-btn:hover {
    color: var(--accent-green);
    text-decoration: none;
}

.header-action-btn:active {
    transform: scale(0.90);
}

.header-theme-btn {
    padding: 0 1px;
}

.header-coffee-btn {
    opacity: 0.90;
    padding: 0 1px;
}

.header-coffee-btn:hover {
    opacity: 1;
}

/* LUCIDE ICONS UNIFIED SYSTEM */
.icon-lucide {
    width: 14px;
    height: 14px;
    stroke-width: 2.2;
    stroke: currentColor;
    fill: none;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
}

.header-action-btn .icon-lucide {
    width: 15px;
    height: 15px;
}

.header-theme-btn .icon-lucide {
    width: 16px;
    height: 16px;
}

.header-coffee-btn .icon-lucide {
    width: 14px;
    height: 14px;
}

.nav-back-btn .icon-lucide {
    width: 16px;
    height: 16px;
}

.audio-deck-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.audio-deck-btn .icon-lucide {
    width: 11px;
    height: 11px;
    stroke-width: 2.5;
}

.article-date.draft-lock {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

.article-date.draft-lock .icon-lucide,
.icon-lock {
    width: 13px;
    height: 13px;
    stroke: var(--accent-red) !important;
    color: var(--accent-red) !important;
    stroke-width: 2.2;
}

/* Collapsible Hero Section */
#hero-collapse-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s ease;
}

#hero-collapse-wrapper.hero-collapsed {
    display: none !important;
}

.header-divider {
    border-top: var(--border-width) solid var(--border-color);
    width: 100%;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hero-large-text {
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: -0.2px;
}

.hero-title {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-green);
    opacity: 0.95;
    line-height: 1.5;
}

/* ==========================================================================
   5. CARD 2: MAIN BODY (CLEAN POSITIONED SCROLLBAR)
   ========================================================================= */
.panel-body {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 18px 8px 18px 20px;
    overflow: hidden;
}

/* GLOBAL SLIM GREEN BRUTALIST SCROLLBAR (SHARP ZERO-RADIUS, ZERO ARROWS) */
::-webkit-scrollbar {
    width: 3px !important;
    height: 3px !important;
}

/* REMOVE UP/DOWN ARROWS COMPLETELY */
::-webkit-scrollbar-button,
::-webkit-scrollbar-button:start,
::-webkit-scrollbar-button:end,
::-webkit-scrollbar-button:single-button,
::-webkit-scrollbar-button:vertical:decrement,
::-webkit-scrollbar-button:vertical:increment,
::-webkit-scrollbar-button:horizontal:decrement,
::-webkit-scrollbar-button:horizontal:increment {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
    border: none !important;
    font-size: 0 !important;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-track-piece,
::-webkit-scrollbar-corner {
    background: transparent !important;
    margin: 0 !important; /* Aligned precisely to full top and bottom of scroll area */
    border: none !important;
    border-radius: 0 !important;
    -webkit-border-radius: 0 !important;
}

::-webkit-scrollbar-thumb {
    background-color: var(--accent-green) !important;
    border-radius: 0 !important;
    -webkit-border-radius: 0 !important;
    -moz-border-radius: 0 !important;
    border: none !important;
    outline: none !important;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #00c94d !important;
}

.body-scroll-area {
    flex: 1 1 0;
    overflow-y: auto;
    min-height: 0;
    padding-right: 12px;
    overscroll-behavior: contain;
}

.hidden {
    display: none !important;
}

/* --- LIST VIEW --- */
.article-layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
}

.article-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 2px;
    transition: background-color 0.1s ease;
}

.article-item.selectable,
.article-item.is-draft {
    cursor: pointer;
}

.article-item.item-blinking {
    background-color: var(--accent-green) !important;
    color: #ffffff !important;
}
.article-item.item-blinking * {
    color: #ffffff !important;
}

.article-item.item-locked-blinking {
    background-color: var(--accent-red) !important;
    color: #ffffff !important;
}
.article-item.item-locked-blinking * {
    color: #ffffff !important;
}

.article-title-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.article-title {
    font-family: var(--font-mono);
    font-size: 14.5px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.3;
    color: var(--text-color);
    letter-spacing: -0.2px;
    margin: 0;
    flex: 1 1 auto;
}

.article-date {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    color: var(--accent-green);
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
}

.article-date.draft-lock {
    color: var(--accent-red) !important;
    font-size: 13px;
    user-select: none;
    line-height: 1;
}

.article-desc {
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
}

/* LIVE / UNLOCKED: Green teaser text */
.article-item.selectable .article-desc {
    color: var(--accent-green);
    opacity: 0.95;
}

/* LOCKED DRAFT: Red teaser text */
.article-item.is-draft .article-desc {
    color: var(--accent-red);
    opacity: 0.95;
}

/* HIDE DASHED ARTICLE LIST DIVIDER (MAINTAIN CLEAN GAP SPACING) */
.article-divider {
    display: none;
}

/* --- DETAIL VIEW (STICKY HEADER + SCROLLABLE BODY) --- */
.detail-view-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.detail-sticky-header {
    flex-shrink: 0;
    background: var(--bg-card);
    z-index: 5;
    padding-bottom: 2px;
}

.detail-header-nav {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 14px;
    gap: 12px;
    flex-wrap: wrap;
}

/* MATCHING DASHED DIVIDER ABOVE TITLE */
.detail-header-nav::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.5px;
    background: repeating-linear-gradient(to right, var(--border-color) 0, var(--border-color) 6px, transparent 6px, transparent 12px);
    opacity: 0.35;
}

.nav-back-btn {
    background: transparent;
    border: none;
    padding: 0 4px;
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.15s ease, transform 0.15s ease;
}

.nav-back-btn:hover {
    color: var(--accent-green);
    text-decoration: none;
}

.nav-back-btn:active {
    transform: scale(0.90);
}

/* BRUTALIST AUDIO CONTROLS (WRAPPED IN SINGLE BRACKETS) */
.audio-deck-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-green);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.pill-bracket {
    color: var(--accent-green);
    user-select: none;
}

.audio-deck-btn {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--accent-green);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    outline: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.audio-deck-btn:hover {
    text-decoration: underline;
}

.audio-deck-btn.is-active {
    color: #ffffff;
    background-color: var(--accent-green);
    padding: 1px 4px;
}

/* WHITE DETAIL TITLE */
.detail-main-title {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.3;
    margin-bottom: 8px;
    color: var(--text-color);
    letter-spacing: -0.2px;
}

/* RAW METADATA BLOCK: SINGLE INLINE ROW WITH // SEPARATOR, NO LABELS */
.raw-metadata-box {
    position: relative;
    padding: 2px 0 12px 0;
    margin-bottom: 0;
    background: transparent;
}

.raw-metadata-box::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1.5px;
    background: repeating-linear-gradient(to right, var(--border-color) 0, var(--border-color) 6px, transparent 6px, transparent 12px);
    opacity: 0.35;
}

.meta-inline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.5px;
    flex-wrap: wrap;
    color: var(--accent-green);
}

.meta-sep {
    color: var(--accent-green);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    user-select: none;
}

.meta-val,
.meta-val-tags {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.5px;
    color: var(--accent-green);
}

/* GREEN UNBOLDED TAGS WITHOUT BRACKETS */
.tag-badge {
    display: inline-block;
    color: var(--accent-green);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* SCROLLABLE ARTICLE BODY WITH SYMMETRICAL SLIM GREEN SCROLLBAR */
.detail-body-paragraphs {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 16px 8px 16px 0; /* Perfectly balanced 16px top and bottom margin */
    font-size: 14.5px;
    line-height: 1.7;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 16px, black calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0px, black 16px, black calc(100% - 16px), transparent 100%);
}

.detail-body-paragraphs p {
    color: var(--text-color);
    opacity: 0.94;
    margin: 0 0 16px 0;
}

.detail-body-paragraphs p:last-child {
    margin-bottom: 0;
}

.detail-body-paragraphs strong {
    font-weight: 700;
    color: var(--text-color);
}

/* EXTERNAL ARTICLE SOURCE LINK WITH MATCHING DASHED DIVIDER */
.article-source-bar {
    position: relative;
    margin-top: 20px;
    padding-top: 14px;
    opacity: 0.85;
}

.article-source-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.5px;
    background: repeating-linear-gradient(to right, var(--border-color) 0, var(--border-color) 6px, transparent 6px, transparent 12px);
    opacity: 0.35;
}

.article-source-link {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-green);
    text-decoration: none;
    letter-spacing: 0.5px;
}

.article-source-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   6. CARD 3: FOOTER
   ========================================================================= */
.panel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-color);
    opacity: 0.85;
    flex-shrink: 0;
    padding: 10px 16px;
    letter-spacing: 0.5px;
}

.footer-status {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.footer-action-btn,
.footer-refresh-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0.85;
    transition: color 0.15s ease, transform 0.2s ease, opacity 0.15s ease;
    flex-shrink: 0;
}

.footer-action-btn:hover,
.footer-refresh-btn:hover {
    color: var(--accent-green);
    opacity: 1;
    transform: translateY(-2px);
}

.footer-action-btn:active,
.footer-refresh-btn:active {
    transform: translateY(-3px) scale(0.9);
}

.footer-action-btn .icon-lucide,
.footer-refresh-btn .icon-lucide {
    width: 13px;
    height: 13px;
}

/* ==========================================================================
   7. DESKTOP RESPONSIVE UPGRADES (MIN-WIDTH: 768px)
   ========================================================================= */
@media (min-width: 768px) {
    body {
        padding: 28px 22px 22px 28px;
    }

    .site-wrapper {
        gap: 16px;
    }

    .brutalist-card {
        padding: 20px 24px;
    }

    .logo {
        font-size: 22px;
    }

    .tagline {
        font-size: 12px;
    }

    .hero-large-text {
        font-size: 21px;
    }

    .hero-title {
        font-size: 14px;
    }

    .article-title {
        font-size: 16px;
    }

    .detail-main-title {
        font-size: 21px;
    }

    .detail-paragraphs {
        font-size: 15px;
    }

    .ascii-art-block {
        font-size: 11.5px;
    }
}
