/* ============================================================
   Western Skies RP — Document system styling.
   Shared by docs.html (hub + viewer), doc-editor.html and
   docs-admin.html so a document looks identical while you are
   editing it and after you publish it.
   ============================================================ */

:root {
    /* Mapped onto the Basalt & Ember palette in css/styles.css */
    --doc-gold: var(--fg);
    --doc-border: var(--surface-3);
    --doc-rust: var(--accent);
    --doc-panel: linear-gradient(165deg, rgba(var(--surf2-rgb),.8), rgba(var(--surf-rgb),.55));
    /* Live height of the sticky site nav, measured by js/docs-chrome.js.
       The fallback covers the moment before that script runs. */
    --nav-h: 64px;
}

body.docs-body {
    background:
        radial-gradient(ellipse at 20% 0%, rgba(var(--accent-rgb), 0.13), transparent 55%),
        radial-gradient(ellipse at 80% 100%, rgba(var(--mesh-rgb), 0.12), transparent 60%),
        var(--bg) !important;
    background-attachment: fixed !important;
}

/* ---------- Layout ---------- */

.doc-page { display: flex; max-width: 1500px; margin: 0 auto; padding: 2rem 1rem 4rem; gap: 1.5rem; }
.doc-main { flex: 1; min-width: 0; }

.doc-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--nav-h) + 1rem);
    height: fit-content;
    max-height: calc(100vh - var(--nav-h) - 2rem);
    overflow-y: auto;
    background: var(--doc-panel);
    border: 2px solid var(--doc-border);
    border-radius: 10px;
    padding: 1.25rem;
}
/* Small eyebrow label, per the new type scale */
.doc-sidebar h3 {
    font-family: var(--ui);
    color: var(--fg-3);
    font-size: 0.6875rem;
    font-weight: 800;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.doc-toc { list-style: none; padding: 0; margin: 0; }
.doc-toc li { margin: 0.15rem 0; }
.doc-toc a {
    display: block;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    padding: 0.35rem 0.5rem;
    border-radius: 5px;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 2px solid transparent;
    line-height: 1.3;
}
.doc-toc a:hover { color: var(--doc-gold); background: rgba(var(--fg-rgb), 0.1); border-left-color: var(--doc-rust); }
.doc-toc a.active { color: var(--doc-gold); background: rgba(var(--fg-rgb), 0.06); border-left-color: var(--doc-gold); }
.doc-toc .level-1 { font-weight: 600; padding-left: 0.5rem; }
.doc-toc .level-2 { padding-left: 1.25rem; }
.doc-toc .level-3 { padding-left: 2rem; font-size: 0.82rem; opacity: 0.85; }

.doc-header { text-align: center; margin-bottom: 1.5rem; padding-bottom: 1rem; position: relative; }
.doc-header::after {
    content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100px; height: 3px;
    background: linear-gradient(90deg, var(--doc-rust), var(--doc-gold), var(--doc-rust));
}
.doc-header h1 {
    font-family: var(--display); color: var(--doc-gold);
    font-size: clamp(1.9rem, 4vw, 2.9rem); font-weight: 500;
    letter-spacing: -0.03em;
}
.doc-header p { color: rgba(255, 255, 255, 0.7); margin-top: 0.4rem; }

.doc-card {
    background: linear-gradient(135deg, rgba(var(--accent-rgb),0.10), rgba(var(--surf2-rgb),0.55) 50%, rgba(var(--bg-rgb),0.55));
    border: 2px solid var(--doc-border);
    border-radius: 10px;
    padding: 2rem 2.5rem;
    box-shadow: 0 0 30px rgba(var(--fg-rgb), 0.06);
    color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(2px);
}

/* ---------- Rendered document content ---------- */

.doc-content { font-family: var(--ui); font-size: 1.05rem; }
.doc-content h1, .doc-content h2, .doc-content h3 {
    font-family: var(--display);
    color: var(--doc-gold);
    margin: 1.6rem 0 0.5rem;
    /* Keep anchor jumps clear of the sticky nav. */
    scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}
.doc-content h1 { font-size: 1.9rem; }
.doc-content h2 { font-size: 1.5rem; }
.doc-content h3 { font-size: 1.2rem; }
.doc-content > *:first-child { margin-top: 0; }
.doc-content p { margin: 0.7rem 0; line-height: 1.75; }
.doc-content a { color: var(--doc-gold); text-decoration: underline; }
.doc-content a:hover { color: var(--doc-rust); }
.doc-content code {
    font-family: 'Consolas', monospace;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(var(--fg-rgb), 0.5);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.9em;
}
.doc-content hr { border: none; border-top: 1px solid var(--doc-border); margin: 2rem 0; opacity: 0.7; }

.doc-content blockquote {
    border-left: 3px solid var(--doc-rust);
    margin: 1rem 0;
    padding: 0.4rem 0 0.4rem 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
}

.doc-content ul { list-style: disc outside; margin: 0.8rem 0; padding-left: 2.2rem; }
.doc-content ol { list-style: decimal outside; margin: 0.8rem 0; padding-left: 2.2rem; }
.doc-content li { margin: 0.4rem 0; line-height: 1.65; }

.doc-content table { border-collapse: collapse; margin: 1.2rem 0; width: 100%; }
.doc-content th, .doc-content td {
    border: 1px solid var(--doc-border);
    padding: 0.55rem 0.85rem;
    vertical-align: top;
    text-align: left;
}
.doc-content th { background: rgba(var(--fg-rgb), 0.06); font-weight: 600; font-family: var(--display); }

.doc-content figure { margin: 1.2rem 0; max-width: 100%; }
.doc-content figure img { width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--doc-border); }
.doc-content figcaption {
    text-align: center; font-size: 0.85rem; color: rgba(255, 255, 255, 0.55);
    margin-top: 0.4rem; font-style: italic;
}

.doc-callout {
    display: flex; gap: 0.8rem; align-items: flex-start;
    margin: 1.1rem 0; padding: 0.9rem 1.1rem;
    border-radius: 8px; border-left: 4px solid;
    line-height: 1.65;
}
.doc-callout i { margin-top: 0.2rem; font-size: 1.05rem; flex-shrink: 0; }
.doc-callout-info    { background: rgba(var(--info-rgb), 0.12); border-color: var(--info); }
.doc-callout-info i  { color: var(--info); }
.doc-callout-warn    { background: rgba(var(--warm-rgb), 0.10); border-color: var(--warm); }
.doc-callout-warn i  { color: var(--doc-gold); }
.doc-callout-danger  { background: rgba(var(--danger-rgb), 0.10); border-color: var(--danger); }
.doc-callout-danger i{ color: var(--danger-lit); }
.doc-callout-success { background: rgba(var(--live-rgb), 0.12); border-color: var(--live); }
.doc-callout-success i { color: var(--live); }

/* ---------- Shared chrome ---------- */

.doc-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.doc-toolbar-group { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.doc-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: rgba(var(--fg-rgb), 0.06);
    border: 1px solid var(--doc-border);
    color: var(--doc-gold);
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
.doc-btn:hover:not(:disabled) { background: rgba(var(--fg-rgb), 0.3); color: #fff; }
.doc-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.doc-btn-primary { background: var(--doc-rust); border-color: var(--doc-rust); color: #fff; font-weight: 600; }
.doc-btn-primary:hover:not(:disabled) { background: var(--fg); border-color: var(--fg); color: var(--on-accent); }
.doc-btn-danger { background: rgba(var(--danger-rgb), 0.16); border-color: var(--danger); color: var(--danger-lit); }
.doc-btn-danger:hover:not(:disabled) { background: rgba(205, 92, 92, 0.35); color: #fff; }
.doc-btn-sm { padding: 0.25rem 0.55rem; font-size: 0.78rem; }

.doc-status { font-size: 0.85rem; color: rgba(255, 255, 255, 0.55); }
.doc-status.saving { color: var(--doc-gold); }
.doc-status.saved { color: var(--live); }
.doc-status.error { color: var(--danger-lit); }

.doc-loading, .doc-error, .doc-empty { text-align: center; padding: 3rem; color: rgba(255, 255, 255, 0.6); }
.doc-loading i { font-size: 3rem; color: var(--doc-gold); animation: docspin 1s linear infinite; margin-bottom: 0.5rem; }
@keyframes docspin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.doc-error { color: var(--danger); }
.doc-error a { color: var(--doc-gold); }

.doc-user {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-size: 0.85rem; color: rgba(255, 255, 255, 0.75);
}
.doc-user img { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--doc-border); }
.doc-badge {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 0.15rem 0.45rem; border-radius: 4px; font-weight: 700;
    background: rgba(var(--fg-rgb), 0.2); color: var(--doc-gold); border: 1px solid var(--doc-border);
}
.doc-badge-owner { background: rgba(var(--warm-rgb), 0.14); color: var(--warm); border-color: rgba(var(--warm-rgb),.4); }

/* ---------- Hub cards ---------- */

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.doc-tile {
    display: block; text-decoration: none;
    background: linear-gradient(165deg, rgba(var(--surf2-rgb),0.6), rgba(var(--surf-rgb),0.6));
    border: 2px solid var(--doc-border);
    border-radius: 10px;
    padding: 1.3rem;
    transition: all 0.2s;
}
.doc-tile:hover { transform: translateY(-3px); border-color: var(--doc-gold); box-shadow: var(--sh-md); }
.doc-tile-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.5rem; }
.doc-tile-head i { font-size: 1.4rem; color: var(--doc-rust); }
.doc-tile-head h3 { font-family: var(--display); color: var(--doc-gold); font-size: 1.15rem; margin: 0; }
.doc-tile p { color: rgba(255, 255, 255, 0.7); font-size: 0.9rem; margin: 0 0 0.7rem; line-height: 1.5; }
.doc-tile-meta {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.75rem; color: rgba(255, 255, 255, 0.45);
    border-top: 1px solid rgba(var(--fg-rgb), 0.4); padding-top: 0.6rem; gap: 0.5rem; flex-wrap: wrap;
}

/* ---------- Login gate ---------- */

.doc-gate {
    max-width: 460px; margin: 4rem auto; text-align: center;
    background: var(--doc-panel);
    border: 2px solid var(--doc-border);
    border-radius: 12px; padding: 2.5rem 2rem;
}
.doc-gate i.doc-gate-icon { font-size: 3rem; color: var(--doc-gold); margin-bottom: 1rem; }
.doc-gate h2 { font-family: var(--display); color: var(--doc-gold); margin-bottom: 0.6rem; }
.doc-gate p { color: rgba(255, 255, 255, 0.7); margin-bottom: 1.5rem; line-height: 1.6; }
.doc-discord-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
    background: #5865F2; color: #fff; border: none;
    padding: 0.8rem 1.6rem; border-radius: 8px;
    font-size: 1rem; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all 0.2s;
}
.doc-discord-btn:hover:not(:disabled) { background: #4752C4; transform: translateY(-2px); }
.doc-discord-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- Modals ---------- */

.doc-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000; padding: 1rem;
}
.doc-modal {
    background: linear-gradient(135deg, var(--band-1), var(--band-2));
    border: 2px solid var(--doc-border);
    border-radius: 12px;
    padding: 1.75rem;
    max-width: 640px; width: 100%;
    max-height: 85vh; overflow-y: auto;
}
.doc-modal h3 {
    font-family: var(--display); color: var(--doc-gold);
    margin-bottom: 1rem; padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--doc-border);
}
.doc-modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.4rem; }

.doc-field { margin-bottom: 1rem; }
.doc-field label {
    display: block; color: var(--doc-gold); font-size: 0.85rem;
    margin-bottom: 0.35rem; font-weight: 600;
}
.doc-field input[type="text"],
.doc-field input[type="url"],
.doc-field textarea,
.doc-field select {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--doc-border);
    border-radius: 6px;
    padding: 0.55rem 0.7rem;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
}
.doc-field input:focus, .doc-field textarea:focus, .doc-field select:focus {
    outline: none; border-color: var(--doc-gold);
}
.doc-field-hint { font-size: 0.78rem; color: rgba(255, 255, 255, 0.45); margin-top: 0.3rem; }

.doc-checkbox { display: flex; align-items: center; gap: 0.5rem; color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; cursor: pointer; }

/* Icon picker */
.doc-icon-group {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.9px;
    color: var(--doc-gold); margin: 1rem 0 0.5rem;
    padding-bottom: 0.3rem; border-bottom: 1px solid rgba(var(--fg-rgb), 0.45);
}
.doc-icon-group:first-child { margin-top: 0; }
.doc-icon-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 0.4rem;
}
.doc-icon-btn {
    display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(var(--fg-rgb), 0.5);
    border-radius: 7px; padding: 0.6rem 0.3rem;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.doc-icon-btn i { font-size: 1.25rem; color: var(--doc-gold); }
.doc-icon-btn span {
    font-size: 0.66rem; text-align: center; line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis; width: 100%;
}
.doc-icon-btn:hover { border-color: var(--doc-gold); background: rgba(var(--fg-rgb), 0.06); color: #fff; }
.doc-icon-btn.selected { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.18); }
.doc-icon-btn.selected i { color: #fff; }

/* Inline icon chooser button used on forms */
.doc-icon-choose {
    display: inline-flex; align-items: center; gap: 0.6rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--doc-border);
    border-radius: 6px; padding: 0.5rem 0.8rem;
    color: var(--doc-gold); cursor: pointer;
    font-family: inherit; font-size: 0.88rem;
}
.doc-icon-choose:hover { background: rgba(var(--fg-rgb), 0.18); }
.doc-icon-choose i:first-child { font-size: 1.2rem; }

/* Role picker */
.doc-role-list {
    max-height: 240px; overflow-y: auto;
    border: 1px solid var(--doc-border); border-radius: 6px;
    padding: 0.5rem; background: rgba(0, 0, 0, 0.25);
}
.doc-role {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.35rem 0.45rem; border-radius: 5px; cursor: pointer;
    font-size: 0.88rem; color: rgba(255, 255, 255, 0.85);
}
.doc-role:hover { background: rgba(var(--fg-rgb), 0.1); }
.doc-role .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   Inline formatting marks
   ============================================================ */

.doc-align-center  { text-align: center; }
.doc-align-right   { text-align: right; }
.doc-align-justify { text-align: justify; }

/* Alignment on a figure/gallery means centre the box, not the text. */
figure.doc-align-center, .doc-gallery.doc-align-center { margin-left: auto; margin-right: auto; }
figure.doc-align-right { margin-left: auto; margin-right: 0; }

/* ---- Floated images: following blocks wrap alongside ---- */
.doc-content figure.doc-float-left {
    float: left;
    margin: 0.3rem 1.5rem 0.9rem 0;
}
.doc-content figure.doc-float-right {
    float: right;
    margin: 0.3rem 0 0.9rem 1.5rem;
}
/* A float must never bleed into the next section: anything that starts one
   clears it. Without this a tall image beside a short paragraph would push
   the following heading sideways. */
.doc-content h1, .doc-content h2, .doc-content h3,
.doc-content h4, .doc-content h5,
.doc-content hr, .doc-content table,
.doc-content .doc-pagebreak, .doc-content .doc-callout { clear: both; }
/* Contain the floats so they cannot escape the bottom of the document card. */
.doc-content::after { content: ''; display: block; clear: both; }

/* Wrapping around a floated image needs room. Below that, stack instead. */
@media (max-width: 640px) {
    .doc-content figure.doc-float-left,
    .doc-content figure.doc-float-right {
        float: none;
        width: 100% !important;
        margin: 1.2rem 0;
    }
}

.doc-size-xs  { font-size: 0.75em; }
.doc-size-sm  { font-size: 0.875em; }
.doc-size-lg  { font-size: 1.25em; }
.doc-size-xl  { font-size: 1.6em; }
.doc-size-xxl { font-size: 2.1em; }

.doc-font-serif   { font-family: var(--ui); }
.doc-font-sans    { font-family: 'Segoe UI', Helvetica, Arial, sans-serif; }
.doc-font-mono    { font-family: 'Consolas', 'Courier New', monospace; }
.doc-font-display { font-family: var(--display); letter-spacing: 0.5px; }

.doc-content sup, .doc-content sub { font-size: 0.7em; line-height: 0; }

/* Highlight needs a little breathing room or it looks cramped. */
.doc-content span[style*="background-color"] {
    padding: 0.05em 0.25em;
    border-radius: 3px;
}

/* ============================================================
   Additional block types
   ============================================================ */

/* --- Checklist --- */
.doc-checklist { list-style: none; margin: 0.8rem 0; padding-left: 0.2rem; }
.doc-checklist li {
    display: flex; align-items: flex-start; gap: 0.6rem;
    margin: 0.35rem 0; line-height: 1.65;
}
.doc-checklist li i { color: var(--doc-gold); margin-top: 0.25rem; flex-shrink: 0; }
.doc-checklist li.checked { color: rgba(255, 255, 255, 0.5); }
.doc-checklist li.checked i { color: var(--live); }
.doc-checklist li.checked > span { text-decoration: line-through; }

/* --- Code block --- */
.doc-code {
    position: relative;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--doc-border);
    border-radius: 8px;
    margin: 1.1rem 0;
    overflow: hidden;
}
.doc-code-lang {
    position: absolute; top: 0; right: 0;
    background: rgba(var(--fg-rgb), 0.18);
    color: var(--doc-gold);
    font-family: 'Consolas', monospace; font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 0.15rem 0.55rem; border-bottom-left-radius: 6px;
}
.doc-code pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; }
.doc-code code {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.88rem; line-height: 1.6;
    background: none; border: none; padding: 0; color: var(--fg-2);
    white-space: pre;
}

/* --- Collapsible section --- */
.doc-details {
    border: 1px solid var(--doc-border);
    border-radius: 8px;
    margin: 1rem 0;
    background: rgba(0, 0, 0, 0.18);
    overflow: hidden;
}
.doc-details > summary {
    cursor: pointer; padding: 0.75rem 1rem;
    font-family: var(--display); color: var(--doc-gold);
    background: rgba(var(--fg-rgb), 0.08);
    list-style: none; user-select: none;
    display: flex; align-items: center; gap: 0.5rem;
}
.doc-details > summary::-webkit-details-marker { display: none; }
.doc-details > summary::before {
    content: '\f105'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    transition: transform 0.2s; color: var(--doc-rust);
}
.doc-details[open] > summary::before { transform: rotate(90deg); }
.doc-details > summary:hover { background: rgba(var(--fg-rgb), 0.16); }
.doc-details > div { padding: 0.9rem 1.1rem; line-height: 1.7; }

/* --- Columns --- */
.doc-columns { display: grid; gap: 1.5rem; margin: 1.1rem 0; }
.doc-columns-2 { grid-template-columns: 1fr 1fr; }
.doc-columns-3 { grid-template-columns: 1fr 1fr 1fr; }
.doc-column { min-width: 0; line-height: 1.7; }

/* --- Spacer & page break --- */
.doc-spacer { width: 100%; }
.doc-pagebreak {
    border-top: 1px dashed rgba(var(--fg-rgb), 0.6);
    margin: 1.5rem 0; position: relative; height: 0;
}
.doc-pagebreak::after {
    content: 'PAGE BREAK'; position: absolute; top: -0.6rem; left: 50%;
    transform: translateX(-50%); background: var(--surface);
    color: rgba(255, 255, 255, 0.3); font-size: 0.62rem;
    letter-spacing: 1px; padding: 0 0.5rem;
}

/* --- Video embed (responsive 16:9) --- */
.doc-embed { margin: 1.2rem 0; }
.doc-embed-frame {
    position: relative; width: 100%; padding-top: 56.25%;
    border-radius: 8px; overflow: hidden; border: 1px solid var(--doc-border);
    background: #000;
}
.doc-embed-frame iframe {
    position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}

/* --- Button --- */
.doc-button-wrap { margin: 1.1rem 0; }
.doc-doc-button {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.7rem 1.5rem; border-radius: 8px;
    font-family: var(--display); font-size: 0.95rem; font-weight: 600;
    text-decoration: none !important; transition: all 0.2s;
    border: 2px solid transparent;
}
.doc-doc-button-primary { background: var(--doc-rust); color: #fff !important; border-color: var(--doc-rust); }
.doc-doc-button-primary:hover { background: var(--doc-gold); border-color: var(--doc-gold); color: var(--on-accent) !important; }
.doc-doc-button-secondary { background: transparent; color: var(--doc-gold) !important; border-color: var(--doc-border); }
.doc-doc-button-secondary:hover { background: rgba(var(--fg-rgb), 0.2); }
.doc-doc-button-danger { background: rgba(var(--danger-rgb), 0.9); color: #fff !important; border-color: var(--danger); }
.doc-doc-button-danger:hover { background: var(--danger); }

/* --- Key / value table --- */
.doc-keyvalue {
    margin: 1.1rem 0; border: 1px solid var(--doc-border);
    border-radius: 8px; overflow: hidden;
}
.doc-kv-row { display: flex; border-bottom: 1px solid rgba(var(--fg-rgb), 0.4); }
.doc-kv-row:last-child { border-bottom: none; }
.doc-kv-row:nth-child(odd) { background: rgba(0, 0, 0, 0.15); }
.doc-kv-label {
    flex: 0 0 34%; padding: 0.6rem 0.9rem;
    font-family: var(--display); color: var(--doc-gold);
    border-right: 1px solid rgba(var(--fg-rgb), 0.4);
}
.doc-kv-value { flex: 1; padding: 0.6rem 0.9rem; min-width: 0; }

/* --- Gallery --- */
.doc-gallery { display: grid; gap: 0.8rem; margin: 1.2rem 0; }
.doc-gallery-2 { grid-template-columns: repeat(2, 1fr); }
.doc-gallery-3 { grid-template-columns: repeat(3, 1fr); }
.doc-gallery-4 { grid-template-columns: repeat(4, 1fr); }
.doc-gallery figure { margin: 0; }
.doc-gallery img {
    width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
    border-radius: 6px; border: 1px solid var(--doc-border);
}
.doc-gallery figcaption {
    font-size: 0.78rem; color: rgba(255, 255, 255, 0.5);
    text-align: center; margin-top: 0.3rem; font-style: italic;
}

@media (max-width: 900px) {
    .doc-page { flex-direction: column; }
    .doc-sidebar { width: auto; position: static; max-height: none; }
    .doc-card { padding: 1.4rem 1.2rem; }
    .doc-columns-2, .doc-columns-3 { grid-template-columns: 1fr; }
    .doc-gallery-3, .doc-gallery-4 { grid-template-columns: repeat(2, 1fr); }
    .doc-kv-row { flex-direction: column; }
    .doc-kv-label { flex: none; border-right: none; border-bottom: 1px solid rgba(var(--fg-rgb), 0.4); }
}

/* ============================================================
   Print — documents get printed for briefings, so make it work
   ============================================================ */
@media print {
    body.docs-body { background: #fff !important; color: #000; }
    .navbar, .nav-container, footer, .doc-sidebar, .doc-toolbar, .ed-bar { display: none !important; }
    .doc-page { display: block; padding: 0; max-width: none; }
    .doc-card {
        background: none !important; border: none !important;
        box-shadow: none !important; padding: 0; color: #000;
    }
    .doc-content, .doc-content * { color: #000 !important; }
    .doc-header h1, .doc-content h1, .doc-content h2, .doc-content h3 { color: #000 !important; }
    .doc-content a { color: #000 !important; text-decoration: underline; }
    .doc-callout { border: 1px solid #666 !important; background: #f4f4f4 !important; }
    .doc-code { background: #f4f4f4 !important; border: 1px solid #999 !important; }
    .doc-code code { color: #000 !important; }
    .doc-details { border: 1px solid #999 !important; }
    .doc-details > div { display: block !important; }
    .doc-pagebreak { break-after: page; page-break-after: always; border: none; }
    .doc-pagebreak::after { display: none; }
    .doc-embed-frame { border: 1px solid #999 !important; }
    .doc-content th, .doc-content td { border: 1px solid #666 !important; }
    .doc-content h1, .doc-content h2, .doc-content h3 { break-after: avoid; page-break-after: avoid; }
    .doc-content table, .doc-content figure, .doc-callout { break-inside: avoid; page-break-inside: avoid; }
}
