/* ============================================================
   drughubdnm.com — Tactical Terminal Design System
   Direction: Military-grade precision meets threat intelligence
   Palette: Near-black + amber + signal green
   Fonts: Space Grotesk (display) + IBM Plex Mono (body/data)
   ============================================================ */

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

/* --- DESIGN TOKENS --- */
:root {
    /* Palette */
    --color-bg: #0D0D0F;
    --color-surface: #141418;
    --color-surface-raised: #1A1A1F;
    --color-surface-inset: #0A0A0C;
    --color-primary: #D4840A;
    --color-primary-dim: #A36808;
    --color-primary-glow: rgba(212, 132, 10, 0.12);
    --color-verified: #3DB86A;
    --color-verified-dim: rgba(61, 184, 106, 0.15);
    --color-danger: #C44A3F;
    --color-text: #CACACF;
    --color-text-bright: #E8E8EC;
    --color-text-muted: #6E6E78;
    --color-border: rgba(255, 255, 255, 0.07);
    --color-border-accent: rgba(212, 132, 10, 0.35);

    /* Typography */
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'IBM Plex Mono', monospace;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1.25rem;
    --space-lg: 2rem;
    --space-xl: 3.5rem;
    --space-2xl: 5.5rem;

    /* Layout */
    --content-width: 780px;
    --page-gutter: 1.5rem;

    /* Shadows — layered micro approach */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.3), 0 4px 8px rgba(0, 0, 0, 0.2), 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* --- BASE --- */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Background grid pattern — CSS only, zero cost */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
}

/* --- TYPOGRAPHY --- */
h1,
h2,
h3 {
    font-family: var(--font-display);
    color: var(--color-text-bright);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

h1 {
    font-size: 1.75rem;
    margin-bottom: var(--space-md);
}

h2 {
    font-size: 1.2rem;
    margin-bottom: var(--space-md);
    padding-top: var(--space-lg);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
    color: var(--color-primary);
}

h3 {
    font-size: 1rem;
    margin-bottom: var(--space-sm);
    padding-top: var(--space-lg);
    color: var(--color-text-bright);
    font-weight: 600;
}

p {
    margin-bottom: var(--space-md);
}

strong {
    color: var(--color-text-bright);
    font-weight: 600;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-text-bright);
}

code {
    font-family: var(--font-body);
    font-size: 0.85em;
    background: var(--color-surface-inset);
    border: 1px solid var(--color-border);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    color: var(--color-primary);
    word-break: break-all;
}

/* --- LAYOUT --- */
.page-wrapper {
    position: relative;
    z-index: 1;
    flex: 1;
}

.container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 var(--page-gutter);
}

/* --- HEADER / NAV --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13, 13, 15, 0.92);
    border-bottom: 1px solid var(--color-border);
    padding: 0.25rem 0;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1080px;
}

.site-logo {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-bright);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.site-logo span {
    color: var(--color-primary);
}

.logo-img {
    width: 140px;
    height: auto;
    border-radius: 4px;
    display: block;
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
    list-style: none;
}

.nav-links a {
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-primary);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -0.65rem;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-primary);
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0.4rem 0.6rem;
    font-family: var(--font-body);
    font-size: 0.75rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- MAIN CONTENT --- */
main {
    padding: var(--space-lg) 0 var(--space-2xl);
}

/* Article header */
.article-header {
    border-left: 3px solid var(--color-primary);
    padding-left: var(--space-md);
    margin-bottom: var(--space-lg);
}

.article-header h1 {
    margin-bottom: var(--space-xs);
}

/* --- BREADCRUMBS --- */
.breadcrumb-nav {
    margin-bottom: var(--space-md);
}

.breadcrumb {
    display: flex;
    list-style: none;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    padding: 0;
    margin: 0;
}

.breadcrumb li+li::before {
    content: '/';
    margin: 0 0.5rem;
    color: var(--color-border-accent);
}

.breadcrumb a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--color-primary);
}

.breadcrumb [aria-current="page"] {
    color: var(--color-text);
}

.byline {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.3rem;
}

.byline strong {
    color: var(--color-text);
}

.last-updated {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Section styling — left accent bars */
.content-section {
    position: relative;
    padding-left: var(--space-md);
    border-left: 1px solid var(--color-border);
    margin-bottom: var(--space-lg);
}

.content-section:hover {
    border-left-color: var(--color-border-accent);
}

/* --- NODE ADDRESS BLOCK — terminal style --- */
.node-display {
    background: var(--color-surface-inset);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-verified);
    padding: var(--space-md) var(--space-md);
    margin: var(--space-md) 0;
    font-family: var(--font-body);
    font-size: 0.85rem;
    line-height: 1.6;
}

.node-display code {
    background: none;
    border: none;
    padding: 0;
    color: var(--color-text-bright);
    font-size: 0.85rem;
    display: block;
    word-break: break-all;
}

.node-display .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
    display: block;
}

.verification-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-verified);
    background: var(--color-verified-dim);
    padding: 0.3rem 0.7rem;
    border-radius: 2px;
    font-family: var(--font-body);
    margin-top: var(--space-xs);
}

/* --- VERIFICATION TABLE --- */
.verification-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-md) 0 var(--space-lg);
    font-size: 0.8rem;
}

.verification-table caption {
    text-align: left;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-bottom: var(--space-sm);
}

.verification-table thead th {
    text-align: left;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.7rem;
    padding: var(--space-sm) var(--space-sm);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.verification-table tbody td {
    padding: var(--space-sm) var(--space-sm);
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.verification-table tbody tr:hover {
    background: var(--color-surface);
}

.verification-table code {
    font-size: 0.75rem;
    background: none;
    border: none;
    padding: 0;
    color: var(--color-text-bright);
}

.status-active {
    color: var(--color-verified);
    font-weight: 600;
}

.status-valid {
    color: var(--color-verified);
}

/* --- LISTS --- */
.content-section ul,
.content-section ol {
    margin: var(--space-md) 0;
    padding-left: 1.5rem;
}

.content-section li {
    margin-bottom: var(--space-sm);
    line-height: 1.65;
}

.content-section li strong {
    color: var(--color-primary);
}

/* Ordered list — protocol steps */
.content-section ol {
    counter-reset: step;
    padding-left: 0;
    list-style: none;
}

.content-section ol li {
    counter-increment: step;
    padding-left: 2.5rem;
    position: relative;
}

.content-section ol li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0.15em;
    width: 1.6rem;
    height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-primary);
    border: 1px solid var(--color-border-accent);
    border-radius: 2px;
    font-family: var(--font-display);
}

/* Unordered list — dash style */
.content-section ul {
    list-style: none;
    padding-left: 0;
}

.content-section ul li {
    padding-left: 1.2rem;
    position: relative;
}

.content-section ul li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: 700;
}

/* --- PRIMARY NODE HIGHLIGHT — orange address --- */
.node-display--primary {
    border-left-color: var(--color-primary);
    background: linear-gradient(135deg, var(--color-surface-inset) 0%, rgba(212, 132, 10, 0.04) 100%);
}

.node-display--primary .label {
    color: var(--color-primary);
}

.node-display--primary .address-highlight {
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

/* --- CONTENT FIGURES --- */
.content-figure {
    margin: var(--space-lg) 0;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    overflow: hidden;
    background: var(--color-surface-inset);
}

.content-figure img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.content-figure figcaption {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.7rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    font-style: italic;
}

/* --- ARTICLE ATTRIBUTION — low-profile byline at bottom --- */
.article-attribution {
    margin-top: var(--space-xl);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}

.article-attribution p {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-style: italic;
    margin-bottom: 0;
}

/* --- FOOTER --- */
.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: var(--space-xl) 0 var(--space-lg);
    margin-top: auto;
    position: relative;
    z-index: 1;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: var(--space-xl);
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 var(--page-gutter);
}

.footer-disclaimer {
    font-size: 0.75rem;
    line-height: 1.65;
    color: var(--color-text-muted);
}

.footer-disclaimer p {
    margin-bottom: var(--space-sm);
}

.footer-nav-heading {
    font-family: var(--font-display);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
    font-weight: 600;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--color-primary);
}

.footer-bottom {
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    max-width: 1080px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--page-gutter);
    padding-right: var(--page-gutter);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

/* --- ENTRANCE ANIMATIONS --- */
.fade-up {
    opacity: 0;
    transform: translateY(16px);
    animation: fadeUp 0.45s ease forwards;
}

.fade-up-d1 {
    animation-delay: 0.05s;
}

.fade-up-d2 {
    animation-delay: 0.12s;
}

.fade-up-d3 {
    animation-delay: 0.19s;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scroll reveal — native CSS, no JS */
@supports (animation-timeline: view()) {
    .scroll-reveal {
        opacity: 0;
        transform: translateY(20px);
        animation: scrollFade linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 35%;
    }

    @keyframes scrollFade {
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Fallback for browsers without animation-timeline */
@supports not (animation-timeline: view()) {
    .scroll-reveal {
        opacity: 1;
        transform: none;
    }
}

/* --- CSS CONTAINMENT — off-screen optimization --- */
.content-section.scroll-reveal {
    content-visibility: auto;
    contain-intrinsic-size: auto 400px;
}

/* --- RESPONSIVE --- */
@media (max-width: 680px) {
    h1 {
        font-size: 1.35rem;
    }

    h2 {
        font-size: 1.05rem;
        padding-top: var(--space-lg);
    }

    body {
        font-size: 0.875rem;
    }

    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        flex-direction: column;
        padding: var(--space-md) var(--page-gutter);
        gap: var(--space-md);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a.active::after {
        display: none;
    }

    .site-header .container {
        position: relative;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-xs);
        text-align: center;
    }

    .verification-table {
        font-size: 0.7rem;
    }

    .verification-table thead {
        display: none;
    }

    .verification-table tbody tr {
        display: block;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        padding: var(--space-sm);
        margin-bottom: var(--space-sm);
    }

    .verification-table tbody td {
        display: block;
        border-bottom: none;
        padding: 0.2rem 0;
    }

    .verification-table tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.65rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--color-text-muted);
        margin-bottom: 0.15rem;
    }

    .node-display code {
        font-size: 0.72rem;
    }
}

@media (max-width: 420px) {
    :root {
        --page-gutter: 1rem;
    }

    h1 {
        font-size: 1.15rem;
    }
}

/* --- PRINT --- */
@media print {
    body::before {
        display: none;
    }

    .site-header,
    .site-footer {
        display: none;
    }

    body {
        color: #000;
        background: #fff;
    }

    h1,
    h2,
    h3 {
        color: #000;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    .node-display {
        border: 1px solid #ccc;
    }
}