/* The docs (DocsController): an index of topics as lettered parts on a sheet,
   and a page per topic told in figures first, the fine print folded away.
   Signed-in page, so: the condensed caps heading and the beige part cards
   (fonts from home.css), plain white cards for the rest. */

.docs-lead { max-width: 40rem; margin: -0.25rem 0 1.5rem; color: var(--muted); font-size: 1.05rem; }

/* ───────────── Index ───────────── */

/* The way a project goes, in three boxes */
.docs-flow { list-style: none; margin: 0 0 1.75rem; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) 2.5rem minmax(0, 1fr) 2.5rem minmax(0, 1fr); align-items: stretch; }
.docs-flow__step { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.docs-flow__step svg { width: 100%; height: auto; max-height: 5.5rem; }
.docs-flow__step strong { display: block; }
.docs-flow__step span { color: var(--muted); font-size: 0.88rem; line-height: 1.35; }
.docs-flow__link { display: grid; place-items: center; color: var(--muted); }

/* Topics as parts on a sheet, lettered as the cut list does */
.docs-sheet { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px; border: 1px solid #6f6455; background: #fbf9f5; }
.docs-part { position: relative; display: flex; flex-direction: column; padding: 1.9rem 1.1rem 1rem; border: 1.25px solid var(--ink); background: #e8d3a6; color: var(--ink); text-decoration: none; transition: background 0.12s; }
.docs-part:hover, .docs-part:focus-visible { background: #efdcb4; }
.docs-part__size { position: absolute; top: 0.5rem; left: 0; right: 0; text-align: center; font: 500 0.72rem "IBM Plex Mono", var(--mono); color: #5b5146; }
.docs-part__thumb { width: 100%; height: auto; max-height: 6.5rem; margin-bottom: 0.6rem; }
.docs-part h2 { margin: 0 0 0.35rem; font-family: "Archivo", var(--font); font-stretch: 80%; font-weight: 800; font-size: 1.35rem; line-height: 1; text-transform: uppercase; }
.docs-part p { margin: 0; padding-right: 2.2rem; font-size: 0.86rem; color: #3d352d; }
.docs-part__mark { position: absolute; right: 0.8rem; bottom: 0.1rem; font-family: "Archivo", var(--font); font-weight: 900; font-size: 3rem; line-height: 1; color: #8a4418; opacity: 0.25; pointer-events: none; }
/* The shortcuts, the odd one out: the dashed offcut */
.docs-part--offcut { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 1.25rem; padding: 0.9rem 1.25rem; border: 1px dashed #a89b88; background: #f7f3ec; }
.docs-part--offcut:hover, .docs-part--offcut:focus-visible { background: #f1ebdf; }
.docs-part--offcut .docs-part__thumb { flex: none; width: 9rem; margin: 0; }
.docs-part--offcut h2 { color: var(--ink); }
.docs-part--offcut p { padding-right: 0; }

/* ───────────── A topic ───────────── */

.docs-layout { display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); gap: 2rem; align-items: start; }
.docs-nav { position: sticky; top: 1rem; padding: 0.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.docs-nav a { display: block; padding: 0.35rem 0.6rem; border-radius: 4px; color: var(--ink); text-decoration: none; font-size: 0.9rem; }
.docs-nav a:hover { background: var(--bg); }
.docs-nav a[aria-current="page"] { background: var(--bg); font-weight: 600; box-shadow: inset 3px 0 var(--accent); }
.docs-nav__all { margin-bottom: 0.25rem; padding-bottom: 0.5rem !important; border-bottom: 1px solid var(--line); border-radius: 0 !important; color: var(--muted) !important; }
.docs-article { min-width: 0; max-width: 52rem; }
.docs-article > h2 { margin: 2rem 0 0.75rem; font-size: 1.15rem; }
.docs-article p { max-width: 42rem; }
.docs-article .docs-lead { margin-top: 0; }

/* Figures: cards with a drawing over a caption */
.doc-cards, .doc-steps { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.75rem; }
.doc-card { display: flex; flex-direction: column; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.doc-card svg { display: block; width: 100%; height: auto; background: #fbf9f5; border-bottom: 1px solid var(--line); }
.doc-card__text { padding: 0.65rem 0.85rem 0.8rem; font-size: 0.9rem; line-height: 1.4; }
.doc-card__text > strong:first-child { display: block; margin-bottom: 0.1rem; }
.doc-card__text--prose > strong:first-child { display: inline !important; }
.doc-card__text p { margin: 0; color: var(--muted); }
.doc-card__text p + p { margin-top: 0.35rem; }
.doc-card--wide { grid-column: 1 / -1; }
.docs-article > .doc-card { margin-bottom: 1.5rem; }
.doc-split { display: flex; align-items: center; gap: 1.5rem; padding: 0.75rem 1rem; background: #fbf9f5; border-bottom: 1px solid var(--line); }
.doc-split svg { flex: 0 0 58%; width: 58%; border: 0; }
.doc-legend { list-style: none; margin: 0; padding: 0; font-size: 0.88rem; }
.doc-legend li { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.doc-legend i { flex: none; width: 1.6rem; height: 1rem; border: 1.25px solid var(--ink); background: #e8d3a6; }
.doc-legend .doc-legend__saw { height: 0; border-width: 1.25px 0 0; border-style: dashed; border-color: #c2391b; background: none; }
.doc-legend .doc-legend__waste { border-color: #6f6455; background: #cfc5b6; }
.doc-legend .doc-legend__offcut { border-style: dashed; border-color: #a89b88; background: #f7f3ec; }
/* Four of them make two rows of two, not three and an orphan */
.doc-cards:has(> :nth-child(4):last-child), .doc-steps:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.doc-steps { counter-reset: step; }
.doc-steps > li { counter-increment: step; display: flex; }
.doc-steps > li > .doc-card { flex: 1; }
.doc-steps .doc-card__text > strong:first-child::before { content: counter(step); display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; margin-right: 0.45rem; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 0.78rem; font-weight: 600; vertical-align: 0.05em; }

/* A short list of things with a mark each: tips, the options of a choice */
.doc-list { list-style: none; margin: 0 0 1.5rem; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.doc-list > li { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1rem; align-items: baseline; padding: 0.6rem 1rem; font-size: 0.92rem; }
.doc-list--wide > li { grid-template-columns: 14rem minmax(0, 1fr); }
.doc-list > li + li { border-top: 1px solid var(--line); }
.doc-list > li > :first-child { font-weight: 600; }
.doc-list p { margin: 0; }

/* A tip, the way a woodworker pencils a note on the drawing */
.doc-note { margin: 0 0 1.5rem; padding: 0.7rem 1rem; border: 1px dashed #a89b88; border-radius: var(--radius); background: #f7f3ec; font-size: 0.92rem; }
.doc-note > :first-child { margin-top: 0; }
.doc-note > :last-child { margin-bottom: 0; }

/* The fine print, folded away */
.doc-more { margin: 0 0 0.75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.doc-more > summary { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1rem; cursor: pointer; list-style: none; font-weight: 600; }
.doc-more > summary::-webkit-details-marker { display: none; }
.doc-more > summary::after { content: ""; flex: none; width: 0.5rem; height: 0.5rem; margin: 0 0.25rem 0.2rem auto; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s; }
.doc-more[open] > summary::after { margin-bottom: 0; transform: rotate(-135deg); }
.doc-more > summary span { font-weight: 400; color: var(--muted); font-size: 0.88rem; }
.doc-more__body { padding: 0 1rem 0.75rem; border-top: 1px solid var(--line); font-size: 0.92rem; }
.doc-more__body p, .doc-more__body ul, .doc-more__body ol, .doc-more__body table { max-width: 42rem; }
.doc-more__body ol, .doc-more__body ul { padding-left: 1.2rem; }
.doc-more__body li { margin-bottom: 0.35rem; }
.doc-more__body .help-keys { max-width: none; }
.doc-more__body .help-keys td:first-child { white-space: normal; }

.doc-pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.doc-pager a { display: block; padding: 0.6rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; }
.doc-pager a:hover { border-color: var(--accent); }
.doc-pager small { display: block; color: var(--muted); }
.doc-pager__next { margin-left: auto; text-align: right; }

/* ───────────── Figures: the cut list's drawing language ───────────── */

.f-front { fill: #e8d3a6; stroke: var(--ink); stroke-width: 1.25; }
.f-top { fill: #f3e6c4; stroke: var(--ink); stroke-width: 1.25; stroke-linejoin: round; }
.f-side { fill: #d2b57c; stroke: var(--ink); stroke-width: 1.25; stroke-linejoin: round; }
.f-flat { fill: #f3e6c4; stroke: var(--ink); stroke-width: 1.25; stroke-linejoin: round; }
.f-fill { fill: #e8d3a6; stroke: var(--ink); stroke-width: 1.25; }
.f-waste { fill: #cfc5b6; stroke: #6f6455; stroke-width: 1; }
.f-stock { fill: #fbf9f5; stroke: #6f6455; stroke-width: 1.25; }
.f-offcut { fill: #f7f3ec; stroke: #a89b88; stroke-width: 1; stroke-dasharray: 4 3; }
.f-line { fill: none; stroke: var(--ink); stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.f-fine { fill: none; stroke: #6f6455; stroke-width: 0.75; }
.f-ghost { fill: none; stroke: #a89b88; stroke-width: 1.25; stroke-dasharray: 4 3; }
.f-wall { fill: #cfc5b6; stroke: #6f6455; stroke-width: 1; }
.f-red { fill: none; stroke: #c0302b; stroke-width: 1.5; stroke-linecap: round; }
.f-green { fill: none; stroke: #2e8a40; stroke-width: 1.5; stroke-linecap: round; }
.f-blue { fill: none; stroke: #2a5fc0; stroke-width: 1.5; stroke-linecap: round; }
.f-sel { fill: rgba(42, 95, 192, 0.1); stroke: #2a5fc0; stroke-width: 1.25; }
.f-cross { fill: rgba(46, 138, 64, 0.1); stroke: #2e8a40; stroke-width: 1.25; stroke-dasharray: 4 3; }
.f-saw { fill: none; stroke: #c2391b; stroke-width: 1.25; stroke-dasharray: 5 3; }
.f-guide { fill: none; stroke: #2a5fc0; stroke-width: 1; stroke-dasharray: 5 3; }
.f-dim line { stroke: #b5652b; stroke-width: 1; }
.f-dim text { fill: #8a4418; font: 500 9px "IBM Plex Mono", var(--mono); stroke: none; }
.f-text { fill: #5b5146; font: 500 9px "IBM Plex Mono", var(--mono); }
.f-letter { fill: #8a4418; font: 800 13px "Archivo", var(--font); }
.f-dot { fill: var(--ink); }
.f-dot--end { fill: #2e8a40; }
.f-dot--mid { fill: #1b9aaa; }
.f-dot--edge { fill: #c2391b; }
.f-dot--face { fill: #2a5fc0; }
.f-dot--grid { fill: #8a8175; }
.f-pointer { fill: var(--ink); stroke: #fbf9f5; stroke-width: 1; stroke-linejoin: round; }
.f-key { fill: #fbf9f5; stroke: var(--ink); stroke-width: 1.25; }
.f-keytxt { fill: var(--ink); font: 600 11px "IBM Plex Mono", var(--mono); text-anchor: middle; }

/* ───────────── The shortcuts page ───────────── */

.keys-group { margin: 0 0 1.5rem; }
.keys-group h2 { font-size: 1.05rem; }
.keys-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.5rem; }
.keys-grid li { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 0.88rem; line-height: 1.3; }
.keys-grid .keys { flex: none; display: flex; flex-wrap: wrap; gap: 0.2rem; width: 6.6rem; justify-content: flex-end; }
.keys-grid .keys kbd { padding: 0.25rem 0.55rem; font-size: 0.9rem; font-weight: 600; box-shadow: 0 1px 0 rgba(43, 38, 32, 0.12); }
.keys-grid .keys--sep { align-self: center; color: var(--muted); font-size: 0.8rem; }
.keys-grid b { display: block; font-weight: 600; }
.keys-grid span { color: var(--muted); }
.keys-note { color: var(--muted); font-size: 0.9rem; }

/* The editor's Help dialog: the same keys, in a narrower column */
.help__body .keys-grid { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.help__more { margin: 1rem 0 0; }

@media (max-width: 900px) {
  .docs-sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .docs-nav { position: static; display: flex; flex-wrap: wrap; gap: 0.15rem; }
  .docs-nav a { padding: 0.3rem 0.5rem; }
  .docs-nav__all { flex: 1 0 100%; border-bottom: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .docs-flow { grid-template-columns: minmax(0, 1fr); }
  .docs-flow__link { padding: 0.2rem 0; transform: rotate(90deg); }
  .docs-sheet { grid-template-columns: minmax(0, 1fr); }
  .docs-part--offcut { flex-direction: column; align-items: flex-start; }
  .doc-list > li, .doc-list--wide > li { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .doc-split { flex-direction: column; align-items: flex-start; }
  .doc-split svg { flex: none; width: 100%; }
}
