/* style.css */
/* Bold category-grid styling for the RSS feed dashboard. */

* {
    box-sizing: border-box;
}

:root {
    --page-bg: #5d5c5c;
    --panel-bg: #fffaf1;
    --panel-bg-alt: #93c27d;
    --text-main: #111;
    --text-muted: #000;
    --border-main: #111;
    --link-main: #42523b;
    --link-hover-bg: #111;
    --link-hover-text: #fffaf1;
    --error: #9f1239;
}

body {
    margin: 0;
    background:
        linear-gradient(90deg, rgba(17, 17, 17, 0.04) 1px, transparent 1px),
        linear-gradient(rgba(17, 17, 17, 0.04) 1px, transparent 1px),
        var(--page-bg);
    background-size: 24px 24px;
    color: var(--text-main);
    font-family: Arial, Helvetica, sans-serif;
}

.page-wrap {
    width: min(1320px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 48px;
}

.page-header {
    margin-bottom: 24px;
    border: 4px solid var(--border-main);
    background: var(--panel-bg-alt);
    padding: clamp(18px, 3vw, 30px);
    box-shadow: 8px 8px 0 var(--border-main);
}

.eyebrow {
    display: inline-block;
    margin: 0 0 10px;
    padding: 5px 9px;
    border: 2px solid var(--border-main);
    background: var(--text-main);
    color: var(--panel-bg);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.page-header h1 {
    margin: 0 0 8px;
    font-size: clamp(38px, 7vw, 82px);
    line-height: 0.92;
    letter-spacing: -0.06em;
    text-transform: uppercase;
}

.page-header p:last-child {
    max-width: 760px;
    margin: 0;
    color: var(--text-muted);
    font-size: clamp(16px, 2vw, 20px);
    line-height: 1.35;
    font-weight: 700;
}

.feed-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.feed-box {
    min-height: 390px;
    background: var(--panel-bg);
    color: var(--text-main);
    border: 4px solid var(--border-main);
    box-shadow: 6px 6px 0 var(--border-main);
    padding: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.feed-box-header {
    padding: 16px 18px 14px;
    border-bottom: 4px solid var(--border-main);
    background: var(--panel-bg-alt);
}

.feed-box h2 {
    margin: 0;
    font-size: clamp(26px, 3vw, 42px);
    line-height: 0.95;
    letter-spacing: -0.045em;
    text-transform: uppercase;
}

.feed-description {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.25;
    font-weight: 700;
}

.feed-box ol {
    list-style: decimal-leading-zero;
    padding: 14px 18px 18px 48px;
    margin: 0;
}

.feed-box li {
    padding: 0 0 12px;
    margin-bottom: 12px;
    border-bottom: 2px solid rgba(17, 17, 17, 0.18);
    line-height: 1.25;
    font-weight: 800;
}

.feed-box li:last-child {
    margin-bottom: 0;
    border-bottom: 0;
}

.feed-box a {
    color: var(--link-main);
    text-decoration: none;
    font-size: 16px;
}

.feed-box a:hover,
.feed-box a:focus {
    background: var(--link-hover-bg);
    color: var(--link-hover-text);
    outline: none;
}

.feed-box a[aria-disabled="true"] {
    color: var(--text-muted);
    cursor: default;
}

.feed-meta {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.3;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.feed-error,
.loading-message {
    margin: 18px;
    color: var(--error);
    font-weight: 800;
}

@media (max-width: 1050px) {
    .feed-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 680px) {
    .page-wrap {
        width: min(100% - 22px, 1320px);
        padding-top: 18px;
    }

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

    .page-header,
    .feed-box {
        box-shadow: 4px 4px 0 var(--border-main);
    }
}

/* Permanent Hex page. The Reader modal will reuse parts of this visual language later. */
.hex-page-wrap {
    max-width: 1100px;
}

.hex-card {
    border: 4px solid var(--border-main);
    background: var(--panel-bg);
    box-shadow: 8px 8px 0 var(--border-main);
}

.hex-header {
    padding: clamp(20px, 4vw, 38px);
    border-bottom: 4px solid var(--border-main);
    background: var(--panel-bg-alt);
}

.hex-back-link {
    display: inline-block;
    margin: 0 0 18px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    text-transform: uppercase;
}

.hex-back-link:hover,
.hex-back-link:focus {
    background: var(--text-main);
    color: var(--panel-bg);
    outline: none;
}

.hex-header h1,
.hex-error-card h1 {
    margin: 8px 0 14px;
    font-size: clamp(34px, 6vw, 68px);
    line-height: 0.98;
    letter-spacing: -0.05em;
}

.hex-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 18px;
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.hex-original-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    border-bottom: 4px solid var(--border-main);
}

.hex-section-label {
    margin: 0;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hex-original-button {
    display: inline-block;
    border: 3px solid var(--border-main);
    padding: 9px 13px;
    background: var(--text-main);
    color: var(--panel-bg);
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
    text-transform: uppercase;
}

.hex-original-button:hover,
.hex-original-button:focus {
    background: var(--panel-bg-alt);
    color: var(--text-main);
    outline: none;
}

.hex-discussion {
    padding: 22px;
}

.hex-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--border-main);
}

.hex-section-heading h2 {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1;
    letter-spacing: -0.04em;
    text-transform: uppercase;
}

.hex-section-heading span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.hex-placeholder {
    margin: 20px 0 4px;
    color: var(--text-muted);
    font-weight: 700;
}

.hex-error-card {
    padding: clamp(22px, 5vw, 44px);
}

.hex-error-card p:not(.eyebrow) {
    max-width: 620px;
    color: var(--text-muted);
    font-weight: 700;
}

@media (max-width: 680px) {
    .hex-card {
        box-shadow: 4px 4px 0 var(--border-main);
    }

    .hex-original-panel,
    .hex-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Reader modal for external stories. The dashboard remains loaded underneath it. */
body.reader-open {
    overflow: hidden;
}

.reader-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(17, 17, 17, 0.78);
    opacity: 0;
    transition: opacity 120ms ease;
}

.reader-backdrop.is-open {
    opacity: 1;
}

.reader-dialog {
    width: min(1500px, 96vw);
    height: min(920px, 94vh);
    display: flex;
    flex-direction: column;
    border: 4px solid var(--border-main);
    background: var(--panel-bg);
    box-shadow: 8px 8px 0 var(--border-main);
    overflow: hidden;
}

.reader-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 14px;
    border-bottom: 4px solid var(--border-main);
    background: var(--panel-bg-alt);
}

.reader-title-wrap {
    min-width: 0;
}

.reader-source {
    margin: 0 0 3px;
    font-size: 11px;
    line-height: 1.1;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.reader-title {
    margin: 0;
    max-width: 900px;
    overflow: hidden;
    font-size: clamp(16px, 2vw, 22px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.reader-action,
.reader-close {
    min-height: 38px;
    border: 3px solid var(--border-main);
    background: var(--panel-bg);
    color: var(--text-main);
    padding: 7px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
}

.reader-action:hover,
.reader-action:focus,
.reader-close:hover,
.reader-close:focus {
    background: var(--link-hover-bg);
    color: var(--link-hover-text);
    outline: none;
}

.reader-action-primary {
    background: var(--text-main);
    color: var(--panel-bg);
}

.reader-close {
    width: 42px;
    padding: 4px;
    font-size: 28px;
    line-height: 0.8;
}

.reader-frame-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: var(--panel-bg);
}

.reader-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.reader-frame-unavailable {
    display: grid;
    place-items: center;
    height: 100%;
    padding: 30px;
    text-align: center;
    font-size: clamp(18px, 3vw, 30px);
    font-weight: 900;
}

.reader-help {
    position: absolute;
    right: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
    margin: 0;
    border: 2px solid var(--border-main);
    background: var(--panel-bg);
    padding: 6px 8px;
    color: var(--text-main);
    font-size: 11px;
    font-weight: 800;
    pointer-events: none;
}

@media (max-width: 760px) {
    .reader-backdrop {
        padding: 0;
    }

    .reader-dialog {
        width: 100vw;
        height: 100dvh;
        border-width: 0;
        box-shadow: none;
    }

    .reader-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        border-bottom-width: 3px;
    }

    .reader-title {
        white-space: normal;
    }

    .reader-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .reader-action {
        flex: 1 1 auto;
        text-align: center;
    }

    .reader-close {
        flex: 0 0 42px;
    }

    .reader-help {
        right: 6px;
        bottom: 6px;
        left: 6px;
        max-width: none;
    }
}

