/* Doc mode (docs/arc42-008-crosscutting/user-documentation.md). */
#doc-pane { display: none; }
body.doc-mode #doc-pane { display: flex; }
@media (min-width: 768px) {
    /* Beside the page: the page gives the pane its room. */
    body.doc-mode #content-wrapper { padding-right: var(--doc-width, 420px); }
    #doc-pane { width: var(--doc-width, 420px); }
}
@media (max-width: 767px) {
    /* Over the page on a phone. */
    #doc-pane { width: 100%; }
    #doc-pane [data-doc-divider] { display: none; }
}
body.doc-resizing { cursor: col-resize; user-select: none; }
#doc-pane [data-doc-divider] { touch-action: none; }

/* A document, as the rest of the interface writes. */
.user-doc { color: #374151; font-family: var(--jengu-font-serif); font-size: 0.875rem; line-height: 1.6; }
.user-doc h1 { font-size: 1.25rem; font-weight: 600; color: #111827; margin: 0 0 1rem; }
.user-doc h2 { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
               color: #6b7280; margin: 1.75rem 0 0.75rem; }
.user-doc h3 { font-size: 0.95rem; font-weight: 600; color: #111827; margin: 1.5rem 0 0.4rem;
               scroll-margin-top: 1rem; }
.user-doc p, .user-doc ul, .user-doc ol, .user-doc table { margin: 0 0 0.75rem; }
.user-doc ul { list-style: disc; padding-left: 1.25rem; }
.user-doc ol { list-style: decimal; padding-left: 1.25rem; }
.user-doc a { color: rgb(var(--jengu-primary-600)); text-decoration: underline; text-underline-offset: 2px; }
.user-doc a[data-doc-link] { text-decoration-style: dotted; }
.user-doc code { font-size: 0.8em; background: #f3f4f6; border-radius: 0.25rem; padding: 0.05rem 0.3rem; }
.user-doc table { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
.user-doc th, .user-doc td { border-top: 1px solid #f3f4f6; padding: 0.35rem 0.5rem; text-align: left; vertical-align: top; }
.user-doc strong { color: #111827; }

/* Help icons are drawn on their part's corner in doc mode (keys.js), never in the page. */
.doc-help { display: none !important; }

/* Marks over the page: the guide's ? and the keys, on the top-right corner of what they mark. */
#ui-marks { position: fixed; inset: 0; pointer-events: none; z-index: 42; }  /* over the sidebar (40), under modals */
.ui-mark { position: fixed; display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem;
           height: 1.25rem; padding: 0 0.3rem; border-radius: 0.375rem; font-size: 0.7rem; font-weight: 700;
           line-height: 1; white-space: nowrap; }
.ui-mark-help { pointer-events: auto; cursor: pointer; border-radius: 9999px; background: #fbbf24; color: #fff;
                border: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.ui-mark-help:hover { background: #f59e0b; }
/* A page's key where it acts: quiet, half transparent, read when looked for; lit in the shell's teal while Alt is held. */
.ui-mark-key { font-family: var(--jengu-font-mono, ui-monospace, monospace); font-size: 0.625rem; font-weight: 600;
               min-width: 1rem; height: 1rem; padding: 0 0.25rem; border-radius: 0.25rem;
               background: rgba(255, 255, 255, 0.75); color: #6b7280; border: 1px solid rgba(148, 163, 184, 0.55);
               transition: background-color 0.1s, color 0.1s; }
body.keys-bright .ui-mark-key, .ui-mark-jump {
               background: rgb(var(--jengu-primary-700, 19 78 94)); color: #fff; border: 1px solid #0b3540;
               box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25); }
.ui-mark-jump { font-family: var(--jengu-font-mono, ui-monospace, monospace); font-size: 0.7rem; }

/* The cheat sheet: a small card in the corner, half transparent, never taking a key. */
#keys-sheet { position: fixed; right: 1rem; bottom: 2.25rem; z-index: 45; width: 17rem; padding: 0.7rem 0.85rem;
              border-radius: 0.75rem; background: rgba(15, 47, 56, 0.84); color: #e2f3f7; font-size: 0.78rem;
              box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22); transition: background-color 0.15s; }
#keys-sheet:hover { background: rgb(15, 47, 56); }
#keys-sheet[hidden], #keys-sheet [hidden] { display: none; }
.keys-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.35rem;
                   font-size: 0.66rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #9cc7d2; }
.keys-sheet-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.15rem 0; }
#keys-sheet kbd { font-family: var(--jengu-font-mono, ui-monospace, monospace); font-size: 0.68rem; font-weight: 600;
                  display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem;
                  padding: 0 0.3rem; border-radius: 0.3rem; background: rgba(255, 255, 255, 0.12); color: #e2f3f7;
                  border: 1px solid rgba(226, 243, 247, 0.25); }
body.keys-sheet [data-ui=keys-toggle] { background: #fff; color: rgb(var(--jengu-primary-700, 19 78 94)); }

/* The page's keys, listed in the pane's keyboard tab on ?. */
#keys-pane kbd, .keys-row kbd { font-family: var(--jengu-font-mono, ui-monospace, monospace); font-size: 0.7rem;
           font-weight: 600; display: inline-flex; align-items: center; justify-content: center; min-width: 1.35rem;
           height: 1.35rem; padding: 0 0.35rem; border-radius: 0.35rem; background: #fff; color: #1f2937;
           border: 1px solid #cbd5e1; box-shadow: 0 1px 0 #94a3b8; }
.keys-group { margin: 1.1rem 0 0.4rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em;
              text-transform: uppercase; color: #6b7280; }
.keys-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.2rem 0;
            font-size: 0.8rem; color: #374151; }

/* What a link or a help icon leads to, lit up for a moment. */
@keyframes doc-flash {
    0%, 60% { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.9); background-color: rgba(254, 243, 199, 0.7); }
    100%    { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0); background-color: transparent; }
}
.doc-flash { animation: doc-flash 2.4s ease-out; border-radius: 0.375rem; }

/* Terms: they explain themselves on hover always; doc mode underlines them. */
[data-term] { cursor: help; }
body.doc-mode [data-term] { text-decoration: underline dotted #b45309; text-underline-offset: 3px; }
#term-tip { display: none; position: fixed; z-index: 60; max-width: 20rem; padding: 0.5rem 0.75rem;
            border-radius: 0.5rem; background: #111827; color: #f9fafb; font-size: 0.8rem; line-height: 1.45;
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2); pointer-events: none; }
#term-tip strong { display: block; margin-bottom: 0.15rem; font-weight: 600; }

/* A section about an element not on the page now: kept, dimmed, said so. */
.user-doc .doc-absent { opacity: 0.5; }
.user-doc .doc-absent-note { font-size: 0.75rem; font-style: italic; color: #6b7280; margin: -0.2rem 0 0.4rem; }

/* A ticked row (ui/table): lit, and marked on its left edge, whatever its own accent. */
tr[data-ticked="true"] { background-color: rgba(15, 92, 115, 0.07) !important; }
tr[data-ticked="true"] > td:first-child { box-shadow: inset 4px 0 0 rgb(var(--jengu-primary-600)); }

/* Going anywhere (G): what the next key does, bottom left. */
#ui-jump { position: fixed; left: 1rem; bottom: 1rem; z-index: 60; padding: 0.55rem 0.85rem; border-radius: 0.6rem;
           background: #0f2f38; color: #e2f3f7; font-size: 0.8rem; box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28); }
#ui-jump[hidden] { display: none; }

/* Anything by name (Ctrl+K): a palette over the page. */
#ui-palette { position: fixed; inset: 0; z-index: 70; background: rgba(15, 23, 42, 0.35); display: flex;
              justify-content: center; align-items: flex-start; padding-top: 12vh; }
.ui-palette-card { width: min(42rem, calc(100vw - 2rem)); background: #fff; border-radius: 0.875rem; overflow: hidden;
                   box-shadow: 0 24px 64px rgba(15, 23, 42, 0.35); }
.ui-palette-input { width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px solid #e5e7eb; padding: 1rem 1.1rem;
                    font-size: 1.05rem; outline: none; }
.ui-palette-list { max-height: 60vh; overflow-y: auto; padding: 0.4rem 0 0.6rem; }
.ui-palette-group { padding: 0.5rem 1.1rem 0.25rem; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em;
                    text-transform: uppercase; color: #6b7280; }
.ui-palette-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.55rem 1.1rem;
                   font-size: 0.875rem; cursor: pointer; }
.ui-palette-item[aria-selected="true"] { background: rgba(15, 92, 115, 0.08); box-shadow: inset 3px 0 0 rgb(var(--jengu-primary-600)); }
.ui-palette-keys { display: inline-flex; gap: 0.25rem; flex: none; }
.ui-palette-keys kbd { font-family: var(--jengu-font-mono, ui-monospace, monospace); font-size: 0.68rem; font-weight: 600;
                       min-width: 1.3rem; height: 1.3rem; padding: 0 0.35rem; border-radius: 0.3rem; display: inline-flex;
                       align-items: center; justify-content: center; background: #fff; color: #1f2937;
                       border: 1px solid #cbd5e1; box-shadow: 0 1px 0 #94a3b8; }

/* The section switcher (Alt+X): the page's sections, the one chosen lit, as ⌘Tab lists applications. */
#ui-switcher { position: fixed; top: 35vh; left: 50%; transform: translateX(-50%); z-index: 70; min-width: 16rem;
               padding: 0.5rem; border-radius: 0.875rem; background: rgba(15, 47, 56, 0.92); color: #e2f3f7;
               box-shadow: 0 24px 64px rgba(15, 23, 42, 0.35); font-size: 0.9rem; }
.ui-switcher-item { padding: 0.55rem 0.9rem; border-radius: 0.5rem; }
.ui-switcher-item[aria-selected="true"] { background: #fff; color: rgb(var(--jengu-primary-700, 19 78 94)); font-weight: 600; }

/* Where the keys are within a section: a tile, a button, a link focused from the keyboard says so. */
[data-zone] a:focus-visible, [data-zone] button:focus-visible {
    outline: 2px solid rgb(var(--jengu-primary-600)); outline-offset: 2px; border-radius: 0.5rem; }
