/* Stránka Návody a skladby — na celou výšku okna, dva sloupce: strom a detail.
   Soubor se načítá na všech stránkách, proto je každé pravidlo pod .guides. */

body:has(.guides) #app { height: 100dvh; display: flex; flex-direction: column; }
body:has(.guides) main { flex: 1; min-height: 0; max-width: none; margin: 0; padding: 0; width: 100%; }

.guides {
    --line: #e7eaef;
    --soft: #f3f5f8;
    --ink-2: #3b4654;
    --accent-soft: #eaf0fe;
    height: 100%;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    background: var(--panel);
}
.guides button { background: none; color: inherit; padding: 0; border-radius: 8px; font: inherit; }
.guides svg {
    width: 16px; height: 16px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.guides a { color: inherit; text-decoration: none; }
.guides :is(a, button, input, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --- Strom --- */

.guides .guides-tree {
    border-right: 1px solid var(--line);
    background: #fafbfc;
    padding: 14px 10px 24px;
    overflow-y: auto;
}
.guides .tree-search {
    position: sticky; top: -14px; z-index: 1;
    margin: -14px -10px 8px; padding: 14px 10px 10px;
    background: #fafbfc;
}
.guides .tree-search svg { position: absolute; left: 21px; top: 24px; color: var(--muted); }
.guides .tree-search input {
    width: 100%; padding: 8px 10px 8px 32px;
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--panel); color: var(--text); font: inherit; font-size: 13px;
}
.guides .tree-search input::placeholder { color: var(--muted); }
.guides .tree-note { margin: 8px; color: var(--muted); font-size: 13px; }

.guides .tree, .guides .tree ul { list-style: none; margin: 0; padding: 0; }
.guides .g-row { display: flex; align-items: center; gap: 2px; border-radius: 8px; padding-right: 8px; }
.guides .g-row:hover { background: var(--soft); }
.guides .g-row.active { background: var(--accent-soft); }
.guides .g-row a {
    flex: 1; min-width: 0; padding: 7px 4px;
    font-size: 13px; font-weight: 550;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.guides .g-row .n, .guides .tabs .n {
    flex: none; min-width: 22px; padding: 0 6px; border-radius: 999px;
    font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
    color: var(--muted); background: #e9edf2;
}
.guides .twist { flex: none; width: 24px; height: 24px; display: grid; place-items: center; color: var(--muted); }
.guides button.twist { cursor: pointer; }
.guides button.twist:hover:not(:disabled) { color: var(--text); background: #e3e8ef; }
.guides button.twist svg { transition: transform .12s; }
.guides button.twist.open svg { transform: rotate(90deg); }

.guides .tree ul { margin: 2px 0 6px 12px; padding-left: 13px; border-left: 1px solid var(--line); }
.guides .tree ul a {
    display: block; padding: 5px 8px; border-radius: 6px;
    font-size: 12.5px; color: var(--ink-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.guides .tree ul a:hover { background: var(--soft); }
.guides .tree ul a.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }

/* --- Detail --- */

.guides .guides-detail { overflow-y: auto; padding: 32px 40px 64px; }
.guides .guides-detail > * { max-width: 940px; margin-left: auto; margin-right: auto; }
.guides .back-to-tree { display: none; }

.guides .detail-head { margin-bottom: 24px; }
.guides .eyebrow {
    font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 6px;
}
.guides .detail-head h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.01em; margin: 0 0 8px; text-wrap: balance; }
.guides .lead { margin: 0 0 12px; max-width: 70ch; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.guides .crumb, .guides .back-to-tree {
    align-items: center; gap: 4px; margin: 0 0 10px -3px;
    font-size: 13px; color: var(--muted);
}
.guides .crumb { display: inline-flex; }
.guides .crumb:hover, .guides .back-to-tree:hover { color: var(--accent); }
.guides .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.guides .chip {
    display: inline-block; padding: 0 9px; border-radius: 999px;
    font-size: 12px; font-weight: 550; line-height: 22px; white-space: nowrap;
    color: var(--ink-2); background: var(--soft);
}
.guides .chip.function { color: #3730a3; background: #eef2ff; }

.guides .tabs { display: flex; gap: 20px; margin-top: 16px; border-bottom: 1px solid var(--line); }
.guides .tabs button {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 0 !important; margin-bottom: -1px; border-radius: 0 !important;
    border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 550; color: var(--muted);
}
.guides .tabs button:hover { color: var(--text); }
.guides .tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

/* Text návodu */
.guides .guide .md { max-width: 78ch; }
.guides .guide .md h1, .guides .guide .md h2 { font-size: 17px; margin: 1.7em 0 .5em; }
.guides .guide .md h2:first-child { margin-top: 0; }
.guides .guide .md h3 { font-size: 15px; margin: 1.4em 0 .4em; }
.guides .guide .md table { display: block; overflow-x: auto; margin: .8em 0 1.1em; }
.guides .guide .md th { background: var(--soft); white-space: nowrap; }
.guides .guide .md th, .guides .guide .md td { vertical-align: top; border: 1px solid var(--line); padding: 7px 10px; }
.guides .guide .md blockquote { margin: .8em 0; padding: 2px 14px; border-left: 3px solid var(--line); color: var(--ink-2); }
.guides .guide .md a { color: var(--accent); }

/* Seznamy karet: návody na úvodu, skladby v návodu */
.guides .guide-cards, .guides .composition-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.guides .guide-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.guides .guide-cards a, .guides .composition-list a {
    display: flex; flex-direction: column; gap: 4px; height: 100%;
    padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
}
.guides .guide-cards a:hover, .guides .composition-list a:hover { border-color: #a9bce6; background: #fafbfd; }
.guides .guide-cards .name, .guides .composition-list .name { font-size: 13.5px; font-weight: 600; }
.guides .guide-cards .desc, .guides .composition-list .desc { font-size: 12.5px; line-height: 1.5; color: var(--muted); }

/* --- Skladba --- */

.guides .hint { margin: 0 0 20px; font-size: 13px; color: var(--muted); }
.guides .layers { list-style: none; margin: 0; padding: 0; }
.guides .layer { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; padding-bottom: 14px; }
/* Svislá linka spojuje čísla vrstev do jednoho sloupce konstrukce. */
.guides .layer:not(:last-child)::before {
    content: ""; position: absolute; left: 13.5px; top: 30px; bottom: 0; width: 1px; background: var(--line);
}
.guides .layer > .num {
    width: 28px; height: 28px; margin-top: 10px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums;
    color: var(--ink-2); background: var(--soft); border: 1px solid var(--line);
}
.guides .layer-body { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px 14px; min-width: 0; }
.guides .layer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.guides .layer-head h2 { font-size: 15px; margin: 0 4px 0 0; }

.guides .choice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; }
.guides .choice-label { flex: none; min-width: 84px; font-size: 12px; color: var(--muted); }
.guides .pills { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.guides .pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px;
    font-size: 12.5px; line-height: 18px; text-align: left; color: var(--ink-2); background: var(--panel);
}
.guides button.pill { cursor: pointer; }
.guides button.pill:hover { border-color: #a9bce6; }
.guides .pill.active { border-color: #a9bce6; background: var(--accent-soft); color: var(--text); font-weight: 600; }
.guides .pill.value { font-variant-numeric: tabular-nums; }
.guides .pill .default { font-size: 10.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.guides .choice select {
    max-width: min(100%, 460px); padding: 5px 8px;
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--panel); color: var(--text); font: inherit; font-size: 13px;
}
.guides .choice .muted { font-size: 12px; }
.guides .variant-desc { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.guides .no-items { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }

.guides .layer .table-wrap { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; }
.guides .layer table { font-size: 13px; min-width: 560px; }
.guides .layer th {
    padding: 6px 10px; background: var(--soft); border-bottom: 1px solid var(--line);
    font-size: 11.5px; white-space: nowrap;
}
.guides .layer td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.45; }
.guides .layer tr:last-child td { border-bottom: 0; }
.guides .layer .code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; white-space: nowrap; }
.guides .layer td.num { font-variant-numeric: tabular-nums; font-weight: 550; }
.guides .layer .unit { white-space: nowrap; color: var(--ink-2); }
.guides .type {
    display: inline-block; padding: 0 6px; border-radius: 4px;
    font-size: 10.5px; font-weight: 700; line-height: 18px; letter-spacing: .03em;
    color: var(--ink-2); background: var(--soft);
}
.guides .type.mat { color: #0f6b46; background: #e6f6ee; }
.guides .layer .tag {
    display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px;
    font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap;
    color: var(--accent); background: var(--accent-soft);
}
.guides .layer .tag.warn { color: #9a5b00; background: #fdf3e1; }
.guides .layer td.num .tag { margin-left: 0; }

/* Úzké okno: jeden sloupec, strom a detail se střídají podle toho, jestli je něco vybrané. */
@media (max-width: 900px) {
    .guides { grid-template-columns: minmax(0, 1fr); }
    .guides.has-selection .guides-tree { display: none; }
    .guides:not(.has-selection) .guides-detail { display: none; }
    .guides .guides-tree { border-right: 0; }
    .guides .guides-detail { padding: 20px 16px 48px; }
    .guides .back-to-tree { display: inline-flex; }
    .guides .layer { grid-template-columns: minmax(0, 1fr); }
    .guides .layer > .num, .guides .layer::before { display: none; }
}
