.patch-doc .g-lead {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.7;
    color: #4a3b2c;
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e3d3ae;
}

.patch-doc h2 {
    font-size: 1.25rem;
    font-weight: 900;
    line-height: 1.4;
    color: #231f1e;
    margin-top: 2.25rem;
    margin-bottom: 1rem;
}

.patch-doc h2:first-of-type {
    margin-top: 0.5rem;
}

/* The number is drawn by a counter rather than the list marker, so a
   step keeps its number even when its text wraps past the gutter. */
.patch-doc .g-steps {
    display: grid;
    gap: 1.75rem;
    padding-left: 0;
    list-style: none;
    counter-reset: g-step;
}

.patch-doc .g-step {
    counter-increment: g-step;
    display: grid;
    grid-template-columns: 1.9rem minmax(0, 1fr);
    column-gap: 0.75rem;
    /* No row gap: every block inside a step carries its own top margin,
       and a gap here would be added on top of those. */
    row-gap: 0;
}

/*
 * The badge sits in row 1 of column 1 and spans nothing. Spanning it
 * down the step (`grid-row: 1 / span 99`) forced the grid to create 99
 * rows, and each empty row still collected the row gap — which showed
 * up as nearly 400px of blank space under every picture.
 */
.patch-doc .g-step::before {
    content: counter(g-step);
    grid-column: 1;
    grid-row: 1;
    display: grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 999px;
    background: #efdcb2;
    color: #7c350d;
    font-size: 0.85rem;
    font-weight: 900;
    align-self: start;
}

.patch-doc .g-step > * {
    grid-column: 2;
}

.patch-doc .g-step-text {
    font-weight: 700;
    line-height: 1.65;
    color: #3a3025;
    align-self: center;
    min-height: 1.9rem;
    display: flex;
    align-items: center;
}

.patch-doc .g-notes {
    margin-top: 0.6rem;
    display: grid;
    gap: 0.35rem;
    padding-left: 0;
    list-style: none;
}

.patch-doc .g-notes li {
    position: relative;
    padding-left: 1.1rem;
    font-weight: 600;
    line-height: 1.6;
    color: #5b4a37;
}

.patch-doc .g-notes li::before {
    content: '';
    position: absolute;
    left: 0.15rem;
    top: 0.62em;
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 999px;
    background: #c98341;
}

/* A list that is a reference rather than a sequence: no numbers, and no
   gutter reserved for them either. */
.patch-doc .g-steps-plain {
    gap: 1.25rem;
}

.patch-doc .g-steps-plain .g-step {
    grid-template-columns: minmax(0, 1fr);
}

.patch-doc .g-steps-plain .g-step::before {
    content: none;
}

.patch-doc .g-steps-plain .g-step > * {
    grid-column: 1;
}

.patch-doc .g-steps-plain .g-step-text {
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9c4411;
    min-height: 0;
    margin-bottom: 0.15rem;
}

/* Routes run two across on a wide screen. Thirteen of them stacked one
   per row made the page mostly scrolling. */
.patch-doc .g-routes {
    margin-top: 0.55rem;
    display: grid;
    gap: 0.5rem;
    padding-left: 0;
    list-style: none;
}

@media (min-width: 900px) {
    .patch-doc .g-routes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.patch-doc .g-route {
    border-radius: 0.8rem;
    border: 1px solid #ddcaa4;
    background: linear-gradient(180deg, #fdf7e6, #faf3df);
    padding: 0.6rem 0.8rem 0.65rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.patch-doc .g-route:hover {
    border-color: #e0c48d;
    box-shadow: 0 10px 22px -16px rgba(35, 31, 30, 0.6);
}

.patch-doc .g-route-name {
    display: block;
    font-weight: 900;
    font-size: 0.95rem;
    color: #231f1e;
    margin-bottom: 0.3rem;
}

.patch-doc .g-route-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.patch-doc .g-stop {
    border-radius: 0.4rem;
    background: #f6ecd2;
    padding: 0.1rem 0.45rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #8a3c0f;
}

/* The last stop is where you arrive, so it is the one worth spotting. */
.patch-doc .g-stop:last-child {
    background: #efdcb2;
    color: #7c350d;
}

.patch-doc .g-arrow {
    color: #c2ad8a;
    font-size: 0.8rem;
    font-weight: 900;
}

/*
 * A town's exits as a route map: one line down the left, a node per
 * branch, and the nests that branch reaches listed beside it. The town
 * itself is the heading above, so it is not repeated on every line.
 */
.patch-doc .g-map {
    position: relative;
    margin-top: 0.6rem;
    margin-left: 0.35rem;
    padding-left: 1.35rem;
    display: grid;
    gap: 1.1rem;
    list-style: none;
}

.patch-doc .g-map::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55rem;
    bottom: 0.55rem;
    width: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, #cba25f, #e0c48d);
}

.patch-doc .g-branch {
    position: relative;
}

/* The node sits on the line, not beside it. */
.patch-doc .g-branch::before {
    content: '';
    position: absolute;
    left: -1.68rem;
    top: 0.42rem;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    background: #fdf7e6;
    border: 2px solid #b8521a;
}

.patch-doc .g-branch-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.45rem;
}

.patch-doc .g-nests {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-left: 0;
    list-style: none;
}

/* The nests are what a reader came looking for, so they are the solid
   thing on the line and the stops leading there are the quiet chips. */
.patch-doc .g-nest {
    border-radius: 0.6rem;
    border: 1px solid #efdcb2;
    background: #fdf7e6;
    padding: 0.35rem 0.7rem;
    font-size: 0.92rem;
    font-weight: 900;
    color: #231f1e;
    box-shadow: 0 6px 14px -12px rgba(35, 31, 30, 0.8);
}

.patch-doc .g-figure {
    margin-top: 0.85rem;
}

/*
 * Natural size, shrinking only when the picture is wider than the
 * column. `width: 100%` blew the narrow crops up — a 376px screenshot
 * stretched to 916px is 2.4x, which is why some pages looked soft and
 * pixelated. A narrow picture is centred so it reads as deliberate
 * rather than stranded at the left of an empty column.
 */
.patch-doc .g-figure img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
    border-radius: 0.75rem;
    border: 1px solid #dcc9a1;
    background: #2b241d;
}

.patch-doc .g-figure figcaption {
    margin-top: 0.45rem;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.55;
    color: #6f5e49;
}

/* Named things with a line about each. One per row rather than a grid:
   the descriptions are sentences, and a two-column grid of sentences
   reads as a wall. */
.patch-doc .g-cards {
    margin-top: 0.7rem;
    display: grid;
    gap: 0.5rem;
    padding-left: 0;
    list-style: none;
}

.patch-doc .g-card {
    border-radius: 0.75rem;
    border: 1px solid #dcc9a1;
    background: #f8efd8;
    padding: 0.7rem 0.9rem;
}

.patch-doc .g-cards-iconed {
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
}

.patch-doc .g-cards-iconed .g-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.7rem;
}

.patch-doc .g-card-icon {
    flex: none;
    width: 3.2rem;
    height: 3.2rem;
    object-fit: cover;
    border-radius: 0.5rem;
    background: #2b241d;
}

.patch-doc .g-card-body {
    min-width: 0;
}

.patch-doc .g-card-name {
    display: block;
    font-weight: 900;
    color: #231f1e;
}

.patch-doc .g-card-desc {
    display: block;
    margin-top: 0.2rem;
    font-weight: 600;
    line-height: 1.6;
    color: #5b4a37;
}

.patch-doc .g-card-tag {
    display: inline-block;
    margin-top: 0.45rem;
    border-radius: 0.4rem;
    background: #efdcb2;
    padding: 0.1rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 800;
    color: #7c350d;
}

/* Scrolls inside its own box. The page itself must never scroll
   sideways, and this table is six columns of numbers. */
.patch-doc .g-table {
    margin-top: 0.8rem;
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid #dcc9a1;
}

.patch-doc .g-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.patch-doc .g-table th {
    position: sticky;
    top: 0;
    background: #e3d3ae;
    padding: 0.55rem 0.7rem;
    text-align: left;
    font-weight: 900;
    color: #2b241d;
    white-space: nowrap;
}

.patch-doc .g-table td {
    padding: 0.5rem 0.7rem;
    border-top: 1px solid #e3d3ae;
    font-weight: 600;
    color: #4a3b2c;
    white-space: nowrap;
}

.patch-doc .g-table tbody tr:nth-child(even) {
    background: #f8efd8;
}

.patch-doc .g-table-note {
    margin-top: 0.5rem;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.6;
    color: #6f5e49;
}

.patch-doc .g-note {
    margin-top: 0.8rem;
    border-radius: 0.75rem;
    border: 1px solid #e0c48d;
    border-left-width: 0.25rem;
    background: #f5ead0;
    padding: 0.8rem 1rem;
}

.patch-doc .g-note-title {
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9c4411;
    margin-bottom: 0.3rem;
}

.patch-doc .g-note p:last-child {
    font-weight: 600;
    line-height: 1.65;
    color: #4a3b2c;
}