/* ==========================================================================
   Documentation wiki (/documentation)
   "The Cutting Table" - dashed cut-lines as the structural divider motif,
   keyboard shortcuts as notched fabric-swatch keycaps, screenshots framed
   as pattern pieces with a grainline caption. Markdown authors write plain
   tables/blockquotes/ordered-lists/images; everything below is what turns
   that into the look - see DocumentationRepository for the one
   DOM post-process step (image-wrapping + heading ids) this still needs
   beyond CSS alone.
   ========================================================================== */

.doc-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1.1rem;
}

.doc-breadcrumb a {
    color: var(--text-muted);
}

.doc-breadcrumb a:hover {
    color: var(--accent-400);
}

.doc-breadcrumb-arrow {
    color: var(--chalk-500);
    font-size: 0.7rem;
}

.doc-breadcrumb-current {
    color: var(--text-primary);
}

.doc-tabs {
    display: flex;
    gap: 0.4rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 2rem;
}

.doc-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem 0.75rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
}

.doc-tab:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.doc-tab-dot {
    width: 7px;
    height: 7px;
    border-radius: 1px;
    transform: rotate(45deg);
    background: var(--text-muted);
}

.doc-tab.active {
    color: var(--text-primary);
    border-color: var(--accent-500);
}

.doc-tab.active .doc-tab-dot {
    background: var(--accent-500);
}

.doc-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 200px;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 991.98px) {
    .doc-layout {
        grid-template-columns: 200px minmax(0, 1fr);
    }

    .doc-rail {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .doc-layout {
        grid-template-columns: 1fr;
    }

    .doc-sidebar {
        border-left: none;
        border-top: 1px dashed var(--border-strong);
        padding-left: 0;
        padding-top: 1rem;
    }
}

.doc-sidebar {
    position: sticky;
    top: 5.5rem;
    border-left: 1px dashed var(--border-strong);
    padding-left: 1.1rem;
}

.doc-sidebar-label {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.doc-sidebar nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.doc-sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.38rem 0.5rem;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.86rem;
    text-decoration: none;
}

.doc-sidebar nav a:hover {
    color: var(--text-primary);
    background: var(--surface-1);
}

.doc-notch {
    width: 6px;
    height: 6px;
    border: 1px solid var(--border-strong);
    transform: rotate(45deg);
    flex: none;
}

.doc-sidebar nav a.current {
    color: var(--text-primary);
    font-weight: 600;
    background: var(--surface-1);
}

.doc-sidebar nav a.current .doc-notch {
    background: var(--accent-500);
    border-color: var(--accent-500);
}

.doc-content h1 {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.doc-content h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 2.4rem 0 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px dashed var(--border-strong);
}

.doc-content h2:first-of-type {
    margin-top: 1.8rem;
}

.doc-content p {
    color: var(--text-muted);
}

.doc-content > p:first-of-type {
    font-size: 0.98rem;
    max-width: 62ch;
}

/* Shortcut reference tables - plain Markdown tables, restyled as
   separated row "cards" via border-collapse: separate + border-spacing,
   with rounded outer corners simulated on the first/last cell of each
   row (a real border-radius on <tr> itself isn't reliable across
   browsers under table layout). */
.doc-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
    margin: 1.5rem 0;
    font-size: 0.88rem;
}

.doc-content thead th {
    text-align: left;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0 0.9rem 0.4rem;
    border: none;
    background: transparent;
}

.doc-content tbody tr {
    background: var(--surface-1);
}

.doc-content tbody td {
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.65rem 0.9rem;
    vertical-align: middle;
    color: var(--text-primary);
}

.doc-content tbody td:first-child {
    border-left: 1px solid var(--border-subtle);
    border-radius: 8px 0 0 8px;
    white-space: nowrap;
}

.doc-content tbody td:last-child {
    border-right: 1px solid var(--border-subtle);
    border-radius: 0 8px 8px 0;
}

/* Keycaps - an inline code span (`` `Ctrl` ``) inside the wiki becomes a
   small dashed "fabric swatch" with one notched corner, standing in for
   a cut pattern-piece corner. Code spans outside table cells (e.g. in
   body prose) get the same treatment for consistency. */
.doc-content code {
    font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 0.82em;
    font-weight: 600;
    color: var(--chalk-400);
    background: var(--surface-2);
    border: 1px dashed rgba(var(--chalk-rgb), 0.55);
    border-radius: 5px;
    padding: 0.2rem 0.5rem;
    position: relative;
    white-space: nowrap;
}

.doc-content code::after {
    content: '';
    position: absolute;
    top: -1px;
    right: -1px;
    width: 6px;
    height: 6px;
    background: var(--surface-1);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
    border-top: 1px dashed rgba(var(--chalk-rgb), 0.55);
    border-right: 1px dashed rgba(var(--chalk-rgb), 0.55);
}

/* Tips - a plain Markdown blockquote becomes the chalk-dashed callout,
   no special syntax required. */
.doc-content blockquote {
    display: flex;
    gap: 0.85rem;
    margin: 2rem 0;
    padding: 1rem 1.1rem;
    border: 1px dashed rgba(var(--chalk-rgb), 0.55);
    border-left: 1px dashed rgba(var(--chalk-rgb), 0.55);
    border-radius: 10px;
    background: rgba(var(--chalk-rgb), 0.06);
}

.doc-content blockquote::before {
    content: '!';
    flex: none;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    border: 1.5px solid var(--chalk-500);
    color: var(--chalk-500);
    display: grid;
    place-items: center;
    font-family: ui-monospace, monospace;
    font-size: 0.78rem;
    font-weight: 700;
    margin-top: 0.1rem;
}

.doc-content blockquote p {
    margin: 0;
    color: var(--text-primary);
}

/* Sequential workflows (Getting Started pages) - a plain Markdown
   ordered list becomes numbered step cards. Only used where the content
   genuinely is a sequence; reference pages use tables/blockquotes above
   instead, never numbered lists just for decoration. */
.doc-content ol {
    list-style: none;
    counter-reset: doc-step;
    margin: 1.5rem 0 2rem;
    padding: 0;
}

.doc-content ol > li {
    counter-increment: doc-step;
    position: relative;
    padding: 1.1rem 0 1.1rem 3.4rem;
    border-top: 1px dashed var(--border-subtle);
}

.doc-content ol > li:first-child {
    border-top: none;
    padding-top: 0;
}

/* Positioned rather than a grid column: a "tight" list (no blank lines
   between items) puts raw text and inline elements straight inside <li>,
   and as grid items each <code> keycap became its own cell, squeezed into
   the counter column narrower than its text. */
.doc-content ol > li::before {
    content: counter(doc-step);
    position: absolute;
    top: 1.1rem;
    left: 0;
    font-family: ui-monospace, 'SF Mono', monospace;
    font-size: 0.78rem;
    color: var(--accent-400);
    border: 1px solid rgba(var(--accent-rgb), 0.45);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
}

.doc-content ol > li:first-child::before {
    top: 0;
}

/* Markdown authoring note: write an ordered list "loose" (a blank line
   between every item) when a step has a bold title line plus a
   description - CommonMark then wraps each item's content in <p>, and
   the rules below style the first one as the title. A "tight" list
   still lays out fine, just as plain text. See
   documentation/unfolder/01-getting-started.md for the pattern to copy. */
.doc-content ol > li > p {
    margin: 0;
}

.doc-content ol > li > p:first-child {
    font-weight: 700;
    font-size: 0.96rem;
    color: var(--text-primary);
}

.doc-content ol > li > p:not(:first-child) {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 0.3rem;
}

/* Screenshots - every <img> the Markdown author writes gets wrapped by
   DocumentationRepository into this pattern-piece frame: a dashed
   outline, a notch cut into the top edge, and a small-caps "Fig. N"
   caption below (built from the image's own alt text). */
.doc-piece-frame {
    position: relative;
    margin: 2rem 0 0.6rem;
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    padding: 3px;
    line-height: 0;
}

.doc-piece-notch {
    position: absolute;
    top: -1px;
    left: 28px;
    width: 20px;
    height: 11px;
    background: var(--surface-0);
    border-left: 1px dashed var(--border-strong);
    border-right: 1px dashed var(--border-strong);
    border-radius: 0 0 6px 6px;
}

.doc-piece-frame img {
    display: block;
    width: 100%;
    border-radius: 8px;
}

.doc-piece-caption {
    font-size: 0.76rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0.6rem 0 0;
    font-variant-caps: small-caps;
}

.doc-rail {
    position: sticky;
    top: 5.5rem;
}

.doc-rail-label {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.7rem;
}

.doc-rail ul {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px dashed var(--border-strong);
}

.doc-rail li a {
    display: block;
    padding: 0.3rem 0 0.3rem 0.85rem;
    margin-left: -1px;
    border-left: 2px solid transparent;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
}

.doc-rail li a:hover {
    color: var(--text-primary);
}

.doc-page-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.4rem;
    border-top: 1px dashed var(--border-strong);
}

.doc-page-nav a {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-width: 48%;
    text-decoration: none;
}

.doc-page-nav a:hover {
    color: var(--accent-400);
}

.doc-page-nav a.next {
    text-align: right;
    align-items: flex-end;
    margin-left: auto;
}

.doc-page-nav-label {
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
