:root {
    --rfc-bg: #0a0a0a;
    --rfc-bg-2: #0f120f;
    --rfc-fg: #e4e4e7;
    --rfc-muted: #71717a;
    --rfc-dim: #3f3f46;
    --rfc-phos: #4ade80;
    --rfc-phos-dim: #22c55e;
    --rfc-cream: #fef3c7;
    --rfc-amber: #fbbf24;
    --rfc-border: rgba(74, 222, 128, 0.18);
    --rfc-border-2: rgba(74, 222, 128, 0.08);
    --rfc-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

body.rfc-body {
    background: var(--rfc-bg);
    color: var(--rfc-fg);
    font-family: var(--rfc-mono);
    font-size: 15px;
    line-height: 1.7;
    background-image:
        linear-gradient(rgba(74, 222, 128, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 222, 128, 0.022) 1px, transparent 1px);
    background-size: 32px 32px;
    background-attachment: fixed;
}
body.rfc-body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg,
            rgba(74, 222, 128, 0.018) 0,
            rgba(74, 222, 128, 0.018) 1px,
            transparent 1px,
            transparent 3px);
    z-index: 1;
}

.rfc-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 24px 120px;
    position: relative;
    z-index: 2;
}

.rfc-back {
    color: var(--rfc-muted);
    text-decoration: none;
    font-size: 12px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    display: inline-block;
    transition: color .15s;
}
.rfc-back:hover { color: var(--rfc-phos); }

/* ── Hero ─────────────────────────────────────────────────────────── */
.rfc-hero {
    margin: 40px 0 40px;
    border-left: 2px solid var(--rfc-phos);
    padding: 6px 0 6px 24px;
    position: relative;
}
.rfc-hero::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 14px;
    width: 10px;
    height: 10px;
    background: var(--rfc-phos);
    border-radius: 50%;
    box-shadow: 0 0 14px rgba(74, 222, 128, 0.7);
    animation: rfc-blink 2s steps(2) infinite;
}
@keyframes rfc-blink { 50% { opacity: .55; } }

.rfc-hero-eyebrow {
    color: var(--rfc-phos);
    font-size: 12px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    margin-bottom: 14px;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}
.rfc-hero-title {
    font-size: clamp(32px, 5.5vw, 54px);
    font-weight: 600;
    letter-spacing: -0.03em;
    margin: 0 0 18px;
    color: #fff;
    font-family: var(--rfc-mono);
}
.rfc-hero-title::before {
    content: '~/';
    color: var(--rfc-muted);
    font-weight: 400;
}
.rfc-hero-tagline {
    color: var(--rfc-muted);
    max-width: 64ch;
    font-size: 14px;
    line-height: 1.8;
}

/* ── ASCII topology diagram ─────────────────────────────────────── */
.rfc-topology {
    margin: 40px 0 48px;
    padding: 22px 26px;
    border: 1px solid var(--rfc-border);
    background: var(--rfc-bg-2);
    position: relative;
    overflow-x: auto;
}
.rfc-topology::before {
    content: 'nwg.d · category distribution';
    position: absolute;
    top: -10px;
    left: 18px;
    padding: 2px 10px;
    background: var(--rfc-bg);
    color: var(--rfc-phos);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.rfc-topology pre {
    margin: 0;
    color: var(--rfc-phos);
    font-size: 12px;
    line-height: 1.45;
    text-shadow: 0 0 6px rgba(74, 222, 128, 0.35);
    white-space: pre;
    font-family: var(--rfc-mono);
}
.rfc-topology .dim { color: var(--rfc-dim); text-shadow: none; }
.rfc-topology .lbl { color: var(--rfc-cream); text-shadow: 0 0 4px rgba(254, 243, 199, 0.25); }

/* ── Stats strip ────────────────────────────────────────────────── */
.rfc-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    background: var(--rfc-border);
    border: 1px solid var(--rfc-border);
    margin-bottom: 48px;
}
.rfc-stat {
    background: var(--rfc-bg);
    padding: 18px 22px;
}
.rfc-stat-label {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--rfc-muted);
}
.rfc-stat-value {
    font-size: 24px;
    color: var(--rfc-phos);
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

/* ── Category quick-nav strip ───────────────────────────────────── */
.rfc-catnav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 40px;
    padding: 14px 18px;
    border: 1px dashed var(--rfc-border);
    background: var(--rfc-bg-2);
    align-items: center;
}
.rfc-catnav-label {
    color: var(--rfc-muted);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-right: 4px;
}
.rfc-catnav a {
    color: var(--rfc-phos);
    text-decoration: none;
    font-size: 12px;
    padding: 3px 10px;
    border: 1px solid var(--rfc-border);
    transition: background .12s, color .12s;
    font-variant-numeric: tabular-nums;
}
.rfc-catnav a:hover {
    background: var(--rfc-phos);
    color: var(--rfc-bg);
}
.rfc-catnav a .count {
    color: var(--rfc-muted);
    margin-left: 5px;
}
.rfc-catnav a:hover .count { color: var(--rfc-bg); }

/* ── Channel sections (line-printer) ────────────────────────────── */
.rfc-channel {
    margin-bottom: 44px;
    scroll-margin-top: 80px;
}
.rfc-channel-head {
    color: var(--rfc-phos);
    font-size: 13px;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    text-shadow: 0 0 6px rgba(74, 222, 128, 0.3);
    white-space: nowrap;
    overflow: hidden;
}
.rfc-channel-head .dim { color: var(--rfc-dim); text-shadow: none; }
.rfc-channel-head .count { color: var(--rfc-muted); text-shadow: none; }
.rfc-channel-desc {
    color: var(--rfc-muted);
    font-size: 12.5px;
    margin: 0 0 14px 4px;
    max-width: 72ch;
}

.rfc-entries {
    border: 1px solid var(--rfc-border-2);
    background: var(--rfc-bg-2);
}
.rfc-row {
    display: grid;
    grid-template-columns: 72px 120px 1fr 220px;
    gap: 14px;
    padding: 10px 16px;
    align-items: baseline;
    color: var(--rfc-fg);
    text-decoration: none;
    border-left: 2px solid transparent;
    border-bottom: 1px dashed var(--rfc-border-2);
    transition: background .12s, border-color .12s;
    font-size: 13.5px;
}
.rfc-row:last-child { border-bottom: none; }
.rfc-row:hover {
    background: rgba(74, 222, 128, 0.05);
    border-left-color: var(--rfc-phos);
}
.rfc-row:hover .rfc-row-title { color: var(--rfc-cream); }

.rfc-row-num {
    color: var(--rfc-phos);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.rfc-row-date {
    color: var(--rfc-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.rfc-row-title {
    color: var(--rfc-fg);
    transition: color .12s;
}
.rfc-row-author {
    color: var(--rfc-muted);
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rfc-legend {
    margin-top: 80px;
    padding-top: 24px;
    border-top: 1px solid var(--rfc-border);
    font-size: 12px;
    color: var(--rfc-muted);
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}
.rfc-legend-item::before {
    content: '◆ ';
    color: var(--rfc-phos);
}

/* ── Individual RFC page ────────────────────────────────────────── */
.rfc-paper {
    max-width: 860px;
    margin: 0 auto;
    padding: 48px 24px 120px;
    position: relative;
    z-index: 2;
}

.rfc-memo {
    border: 1px solid var(--rfc-border);
    background: var(--rfc-bg-2);
    padding: 26px 30px;
    margin: 32px 0 40px;
    position: relative;
}
.rfc-memo::before {
    content: 'network-working-group/memo';
    position: absolute;
    top: -10px;
    left: 18px;
    padding: 2px 10px;
    background: var(--rfc-bg);
    color: var(--rfc-phos);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.rfc-memo-ruler {
    color: var(--rfc-dim);
    font-size: 11px;
    margin-bottom: 14px;
    white-space: nowrap;
    overflow: hidden;
    font-family: var(--rfc-mono);
}
.rfc-memo-num {
    color: var(--rfc-phos);
    font-size: 13px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 8px;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}
.rfc-memo-title {
    color: #fff;
    font-size: clamp(22px, 3.2vw, 30px);
    font-weight: 600;
    margin: 0 0 20px;
    line-height: 1.3;
    letter-spacing: -0.015em;
    font-family: var(--rfc-mono);
}
.rfc-memo-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 22px;
    font-size: 13px;
    border-top: 1px dashed var(--rfc-border);
    padding-top: 16px;
    margin: 0;
}
.rfc-memo-meta dt {
    color: var(--rfc-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 11px;
    align-self: baseline;
}
.rfc-memo-meta dd {
    color: var(--rfc-fg);
    margin: 0;
}
.rfc-memo-meta dd.cat { color: var(--rfc-phos); }
.rfc-memo-meta dd a { color: var(--rfc-phos); text-decoration: none; }
.rfc-memo-meta dd a:hover { text-decoration: underline; }

.rfc-content {
    color: var(--rfc-fg);
    font-size: 15px;
    line-height: 1.85;
}
.rfc-content h1,
.rfc-content h2,
.rfc-content h3,
.rfc-content h4 {
    color: var(--rfc-phos);
    font-weight: 600;
    margin: 2.4em 0 0.6em;
    letter-spacing: -0.01em;
    font-family: var(--rfc-mono);
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.2);
}
.rfc-content h1 { font-size: 22px; }
.rfc-content h2 { font-size: 19px; }
.rfc-content h3 { font-size: 16px; color: var(--rfc-cream); text-shadow: none; }
.rfc-content h4 { font-size: 14px; color: var(--rfc-cream); text-shadow: none; opacity: 0.85; }
.rfc-content h1::before,
.rfc-content h2::before { content: '§ '; color: var(--rfc-muted); font-weight: 400; }

.rfc-content p { margin: 0 0 1.1em; }
.rfc-content a {
    color: var(--rfc-phos);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}
.rfc-content a:hover { color: var(--rfc-cream); }
.rfc-content strong { color: #fff; font-weight: 600; }
.rfc-content em { color: var(--rfc-cream); font-style: italic; }
.rfc-content code {
    background: rgba(74, 222, 128, 0.08);
    padding: 1px 6px;
    color: var(--rfc-phos);
    font-size: 13px;
    border: 1px solid var(--rfc-border);
}
.rfc-content pre {
    background: var(--rfc-bg-2);
    border: 1px solid var(--rfc-border);
    border-left: 2px solid var(--rfc-phos);
    padding: 16px 18px;
    overflow-x: auto;
    font-size: 13px;
    margin: 1.4em 0;
    line-height: 1.6;
}
.rfc-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--rfc-fg);
}
.rfc-content blockquote {
    border-left: 2px solid var(--rfc-cream);
    padding: 2px 0 2px 20px;
    color: var(--rfc-muted);
    margin: 1.4em 0;
    font-style: italic;
}
.rfc-content ul,
.rfc-content ol { padding-left: 24px; margin: 0 0 1.1em; }
.rfc-content li { margin: 0.35em 0; }
.rfc-content ul li::marker { color: var(--rfc-phos); }
.rfc-content ol li::marker { color: var(--rfc-cream); }
.rfc-content hr {
    border: none;
    border-top: 1px dashed var(--rfc-border);
    margin: 2.4em 0;
}
.rfc-content img { max-width: 100%; height: auto; border: 1px solid var(--rfc-border); }
.rfc-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.4em 0;
    font-size: 13px;
}
.rfc-content th,
.rfc-content td {
    border: 1px solid var(--rfc-border);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}
.rfc-content th {
    background: rgba(74, 222, 128, 0.06);
    color: var(--rfc-phos);
    font-weight: 600;
}

.rfc-pagenav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 72px;
    padding-top: 24px;
    border-top: 1px solid var(--rfc-border);
}
.rfc-pagenav a {
    color: var(--rfc-muted);
    text-decoration: none;
    font-size: 13px;
    display: block;
    line-height: 1.5;
    transition: color .12s;
}
.rfc-pagenav a.next { text-align: right; }
.rfc-pagenav a:hover { color: var(--rfc-phos); }
.rfc-pagenav .label {
    display: block;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.6;
    margin-bottom: 6px;
    color: var(--rfc-phos);
}

@media (max-width: 820px) {
    .rfc-row {
        grid-template-columns: 64px 1fr;
        gap: 10px;
        padding: 10px 12px;
    }
    .rfc-row-date,
    .rfc-row-author { display: none; }
    .rfc-topology pre { font-size: 10px; }
    .rfc-memo { padding: 20px 22px; }
    .rfc-memo-meta { grid-template-columns: 1fr; gap: 4px; }
    .rfc-memo-meta dt { margin-top: 10px; }
}
