/* ===========================================================================
   Summit Docs — getting around (Phase 3)

   The page tree, the on-page contents, quick open and the search results.
   Every colour comes from a --ht-* token, so both themes work without a
   second stylesheet; there are no hard-coded colours here on purpose.

   summit-prose.css dresses page CONTENT. This file dresses everything
   around it.
   ========================================================================= */

/* --- The page tree -------------------------------------------------------- */

.summit-tree {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0.125rem 0;
    font-size: 0.875rem;
}

.summit-tree__empty {
    padding: 0.5rem 0.75rem;
    color: var(--ht-muted);
    font-size: 0.8125rem;
}

.summit-tree__row {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    padding-right: 0.5rem;
    border-radius: 6px;
    min-height: 2rem;
}

.summit-tree__row:hover {
    background: var(--ht-surface-2);
}

/* The page you are on. A left bar rather than a fill, so the tree still
   reads as a list of names and not as a list of buttons. */
.summit-tree__row--current {
    background: var(--ht-chip-bg);
    box-shadow: inset 2px 0 0 0 var(--ht-accent);
}

.summit-tree__row--current .summit-tree__title {
    color: var(--ht-accent);
    font-weight: 600;
}

.summit-tree__twisty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    color: var(--ht-muted);
    border-radius: 4px;
}

.summit-tree__twisty:hover {
    color: var(--ht-ink);
    background: var(--ht-surface-2);
}

/* A leaf keeps the twisty's width so titles line up down the level. */
.summit-tree__twisty--none {
    cursor: default;
}

.summit-tree__label {
    display: flex;
    align-items: center;
    /* Chrome's user-agent sheet gives <button> justify-content:center, and it
       wins whenever we do not say otherwise — which centred every page name
       in the tree. text-align:left cannot reach a flex item. */
    justify-content: flex-start;
    gap: 0.375rem;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.25rem 0.25rem 0.25rem 0.125rem;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
    color: var(--ht-ink);
    font: inherit;
    line-height: 1.35;
}

.summit-tree__title {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Draft / unpublished-edits as a dot. A column of chips in a tree of names
   reads as noise; a dot says "this one differs" and stays out of the way. */
.summit-tree__dot {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.summit-tree__dot--draft  { background: var(--ht-muted); }
.summit-tree__dot--edits  { background: var(--mud-palette-warning); }

.summit-tree__archived {
    flex: 0 0 auto;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ht-faint);
}

/* --- The tree's container ------------------------------------------------- */

.summit-sidebar {
    position: sticky;
    top: 1rem;
    align-self: flex-start;
    width: 100%;
    box-sizing: border-box;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 0.5rem 0.375rem;
    border: 1px solid var(--ht-line);
    border-radius: 10px;
    background: var(--ht-surface);
}

.summit-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
    padding: 0.125rem 0.125rem 0.5rem 0.5rem;
    border-bottom: 1px solid var(--ht-line);
    margin-bottom: 0.25rem;
}

/* The space's name, and the way back to it. Was the raw key in uppercase
   micro-type, which read as a stray tag rather than as a heading. */
.summit-sidebar__title {
    display: block;
    min-width: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--ht-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summit-sidebar__title:hover {
    color: var(--ht-accent);
}

/* The eyebrow over the list itself, so "Medoment" above reads as the space
   and not as the first page in it. */
.summit-sidebar__eyebrow {
    display: block;
    padding: 0.25rem 0.5rem 0.125rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ht-faint);
}

/* --- On-page contents ----------------------------------------------------- */

.summit-toc {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0.75rem 0.5rem;
    border-left: 1px solid var(--ht-line);
    font-size: 0.8125rem;
}

.summit-toc__title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ht-muted);
    padding: 0 0.5rem 0.375rem;
}

.summit-toc__link {
    padding: 0.1875rem 0.5rem;
    border-radius: 4px;
    color: var(--ht-muted);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summit-toc__link:hover {
    color: var(--ht-accent);
    background: var(--ht-surface-2);
}

.summit-toc__link--l2 {
    padding-left: 1.25rem;
    font-size: 0.78125rem;
}

/* Printing a page should not print its navigation. summit-print.css handles
   the content; this is the surrounding furniture. */
@media print {
    .summit-sidebar,
    .summit-toc,
    .summit-tree {
        display: none !important;
    }
}

/* --- Quick open ----------------------------------------------------------- */

.summit-quickopen__input {
    margin: 0;
}

.summit-quickopen__group {
    font-size: 0.6875rem !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ht-muted) !important;
    line-height: 1.6 !important;
    min-height: 0 !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.125rem !important;
}

.summit-quickopen__footer {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--ht-line);
}

/* --- Search results ------------------------------------------------------- */

.summit-hit {
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--ht-line);
}

.summit-hit:last-child {
    border-bottom: 0;
}

.summit-hit__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ht-accent);
    text-decoration: none;
}

.summit-hit__title:hover {
    text-decoration: underline;
}

.summit-hit__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.125rem;
    font-size: 0.75rem;
    color: var(--ht-muted);
}

.summit-hit__snippet {
    margin-top: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--ht-ink);
}

/* ts_headline wraps matches in <b>. Weight alone is easy to miss in a
   paragraph of prose, so the match also gets the accent colour. */
.summit-hit__snippet b {
    font-weight: 600;
    color: var(--ht-accent);
}

/* --- Tags ----------------------------------------------------------------- */

.summit-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

/* --- Phase 4: linked work ------------------------------------------------- */

.summit-link {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.3125rem 0.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    min-width: 0;
}

.summit-link:hover { background: var(--ht-surface-2); }

.summit-link__key {
    flex: 0 0 auto;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--ht-accent);
}

.summit-link__title {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--ht-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summit-link__status {
    flex: 0 0 auto;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ht-muted);
    background: var(--ht-chip-bg);
    border-radius: 999px;
    padding: 0.125rem 0.5rem;
}

/* Hidden until the row is hovered, so a list of links reads as a list and
   not as a row of delete buttons. Focus shows it too, or it is unreachable
   from the keyboard. */
.summit-link__remove { opacity: 0; transition: opacity 0.12s ease; }
.summit-link:hover .summit-link__remove,
.summit-link__remove:focus-visible { opacity: 1; }

/* --- Phase 4: comments ---------------------------------------------------- */

.summit-comment { font-size: 0.875rem; }

.summit-comment--reply {
    margin-left: 1.5rem;
    padding-left: 0.875rem;
    border-left: 2px solid var(--ht-line);
}

.summit-comment__head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.1875rem;
}

.summit-comment__who { font-weight: 600; color: var(--ht-ink); }

.summit-comment__when {
    font-size: 0.75rem;
    color: var(--ht-faint);
}

.summit-comment__remove { opacity: 0; transition: opacity 0.12s ease; }
.summit-comment:hover .summit-comment__remove,
.summit-comment__remove:focus-visible { opacity: 1; }

/* Preserves the line breaks somebody typed without letting anything else
   through — the body is rendered as text, never as markup. */
.summit-comment__body {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--ht-ink);
    line-height: 1.55;
}

.summit-comment__gone {
    color: var(--ht-faint);
    font-style: italic;
}
