/*
 * Quark 2 — user customizations
 *
 * This file is safe to edit. It is loaded last so anything here overrides
 * theme.css without having to mark rules !important.
 */

/* ==========================================================================
   quark2-child — custom footer + background pattern/image
   ========================================================================== */

/* ---------- Custom footer ---------- */

.q2-child-footer-intro {
    margin-bottom: 1.5rem;
    font-weight: 500;
    color: var(--q2-text);
}

/* #footer sets text-align:center for the original one-line credit.
   Columns read better left-aligned, but stay centered on narrow screens
   where the grid collapses to a single column. */
.q2-child-footer-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: clamp(1.5rem, 4vw, 3rem);
    margin-bottom: 2rem;
    text-align: center;
}

@media (min-width: 600px) {
    .q2-child-footer-columns {
        text-align: left;
    }
}

/* Markdown links written on separate lines collapse into one paragraph.
   Give them room to breathe when they do sit inline. */
.q2-child-footer-column p a {
    margin-right: 0.75rem;
}

.q2-child-footer-column h4 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: var(--q2-text);
}

.q2-child-footer-column p,
.q2-child-footer-column ul {
    margin: 0;
    font-size: 0.9rem;
}

.q2-child-footer-column ul {
    list-style: none;
    padding: 0;
}

.q2-child-footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--q2-divider);
}

/* ---------- Background layer ----------
   Quark 2 paints four stacked opaque --q2-bg surfaces: html, body,
   #body-wrapper and #footer. The pattern goes on body (same element as
   its own background-color, so no covering), and the two inner wrappers
   are made transparent so it shows through. Scoped to body.q2-child-bg
   so nothing changes when no background is selected.

   Cards, heroes, nav panels and code blocks keep their own surfaces on
   purpose — text stays on solid backgrounds and remains readable. */

body.q2-child-bg #body-wrapper,
body.q2-child-bg #footer {
    background: transparent;
}

body.q2-child-bg {
    background-repeat: repeat;
    background-attachment: fixed;
}

/* --- The 24 patterns ---
   Each is drawn from a single --q2-pat ink colour, derived at render time
   via color-mix() from --q2-text or --q2-accent at a low percentage, so
   every pattern automatically stays in the site's palette and flips
   correctly in dark mode. --q2-pat-size is the tile size. */

body.q2-child-bg--pattern-01 { /* Dot Grid */
    background-image: radial-gradient(var(--q2-pat) 1.3px, transparent 1.6px);
    background-size: var(--q2-pat-size) var(--q2-pat-size);
}

body.q2-child-bg--pattern-02 { /* Offset Dot Grid */
    background-image: radial-gradient(var(--q2-pat) 1.3px, transparent 1.6px),
                      radial-gradient(var(--q2-pat) 1.3px, transparent 1.6px);
    background-size: var(--q2-pat-size) var(--q2-pat-size);
    background-position: 0 0, calc(var(--q2-pat-size) / 2) calc(var(--q2-pat-size) / 2);
}

body.q2-child-bg--pattern-03 { /* Fine Grid Lines */
    background-image: linear-gradient(var(--q2-pat) 1px, transparent 1px),
                      linear-gradient(90deg, var(--q2-pat) 1px, transparent 1px);
    background-size: var(--q2-pat-size) var(--q2-pat-size);
}

body.q2-child-bg--pattern-04 { /* Bold Grid Lines */
    background-image: linear-gradient(var(--q2-pat) 2px, transparent 2px),
                      linear-gradient(90deg, var(--q2-pat) 2px, transparent 2px);
    background-size: calc(var(--q2-pat-size) * 1.5) calc(var(--q2-pat-size) * 1.5);
}

body.q2-child-bg--pattern-05 { /* Diagonal Lines 45deg */
    background-image: repeating-linear-gradient(45deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 5));
}

body.q2-child-bg--pattern-06 { /* Diagonal Lines 135deg */
    background-image: repeating-linear-gradient(135deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 5));
}

body.q2-child-bg--pattern-07 { /* Crosshatch */
    background-image: repeating-linear-gradient(45deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 5)),
                      repeating-linear-gradient(135deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 5));
}

body.q2-child-bg--pattern-08 { /* Pinstripe Vertical */
    background-image: repeating-linear-gradient(90deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 4));
}

body.q2-child-bg--pattern-09 { /* Pinstripe Horizontal */
    background-image: repeating-linear-gradient(0deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 4));
}

body.q2-child-bg--pattern-10 { /* Dash Grid Vertical */
    background-image: linear-gradient(var(--q2-pat) 40%, transparent 40%);
    background-size: calc(var(--q2-pat-size) / 4) calc(var(--q2-pat-size) / 3);
}

body.q2-child-bg--pattern-11 { /* Dash Grid Horizontal */
    background-image: linear-gradient(90deg, var(--q2-pat) 40%, transparent 40%);
    background-size: calc(var(--q2-pat-size) / 3) calc(var(--q2-pat-size) / 4);
}

body.q2-child-bg--pattern-12 { /* Checkerboard */
    background-image: linear-gradient(45deg, var(--q2-pat) 25%, transparent 25%, transparent 75%, var(--q2-pat) 75%),
                      linear-gradient(45deg, var(--q2-pat) 25%, transparent 25%, transparent 75%, var(--q2-pat) 75%);
    background-size: var(--q2-pat-size) var(--q2-pat-size);
    background-position: 0 0, calc(var(--q2-pat-size) / 2) calc(var(--q2-pat-size) / 2);
}

body.q2-child-bg--pattern-13 { /* Diamond Lattice */
    background-image: linear-gradient(45deg, var(--q2-pat) 25%, transparent 25%, transparent 75%, var(--q2-pat) 75%),
                      linear-gradient(45deg, var(--q2-pat) 25%, transparent 25%, transparent 75%, var(--q2-pat) 75%);
    background-size: calc(var(--q2-pat-size) / 2) calc(var(--q2-pat-size) / 2);
    background-position: 0 0, calc(var(--q2-pat-size) / 4) calc(var(--q2-pat-size) / 4);
}

body.q2-child-bg--pattern-14 { /* Concentric Rings */
    background-image: repeating-radial-gradient(circle, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 5));
    background-size: calc(var(--q2-pat-size) * 2) calc(var(--q2-pat-size) * 2);
}

body.q2-child-bg--pattern-15 { /* Ripple Rings */
    background-image: repeating-radial-gradient(circle, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 2.5));
    background-size: calc(var(--q2-pat-size) * 3) calc(var(--q2-pat-size) * 3);
}

body.q2-child-bg--pattern-16 { /* Honeycomb Dots */
    background-image: radial-gradient(var(--q2-pat) 1.2px, transparent 1.5px),
                      radial-gradient(var(--q2-pat) 1.2px, transparent 1.5px);
    background-size: var(--q2-pat-size) calc(var(--q2-pat-size) * 0.87);
    background-position: 0 0, calc(var(--q2-pat-size) / 2) calc(var(--q2-pat-size) * 0.435);
}

body.q2-child-bg--pattern-17 { /* Confetti Dots */
    background-image: radial-gradient(var(--q2-pat) 1px, transparent 1.2px),
                      radial-gradient(var(--q2-pat) 0.6px, transparent 0.8px),
                      radial-gradient(var(--q2-pat) 1.6px, transparent 1.8px);
    background-size: var(--q2-pat-size) var(--q2-pat-size),
                     calc(var(--q2-pat-size) * 0.6) calc(var(--q2-pat-size) * 0.6),
                     calc(var(--q2-pat-size) * 1.4) calc(var(--q2-pat-size) * 1.4);
    background-position: 0 0,
                         calc(var(--q2-pat-size) * 0.3) calc(var(--q2-pat-size) * 0.7),
                         calc(var(--q2-pat-size) * 0.8) calc(var(--q2-pat-size) * 0.2);
}

body.q2-child-bg--pattern-18 { /* Sparse Stars */
    background-image: radial-gradient(var(--q2-pat) 1px, transparent 1.3px);
    background-size: calc(var(--q2-pat-size) * 2.5) calc(var(--q2-pat-size) * 2.5);
}

body.q2-child-bg--pattern-19 { /* Herringbone */
    background-image: repeating-linear-gradient(45deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 5)),
                      repeating-linear-gradient(135deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 5));
    background-size: var(--q2-pat-size) var(--q2-pat-size), var(--q2-pat-size) var(--q2-pat-size);
    background-position: 0 0, calc(var(--q2-pat-size) / 2) 0;
}

body.q2-child-bg--pattern-20 { /* Basket Weave */
    background-image: linear-gradient(90deg, var(--q2-pat) 1px, transparent 1px),
                      repeating-linear-gradient(45deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 6));
    background-size: var(--q2-pat-size) var(--q2-pat-size),
                     calc(var(--q2-pat-size) / 2) calc(var(--q2-pat-size) / 2);
}

body.q2-child-bg--pattern-21 { /* Bricks */
    background-image: linear-gradient(var(--q2-pat) 1px, transparent 1px),
                      linear-gradient(90deg, var(--q2-pat) 1px, transparent 1px);
    background-size: calc(var(--q2-pat-size) * 1.6) calc(var(--q2-pat-size) / 2);
    background-position: 0 0, calc(var(--q2-pat-size) * 0.8) calc(var(--q2-pat-size) / 4);
}

body.q2-child-bg--pattern-22 { /* Scallop Rows */
    background-image: radial-gradient(circle at 50% 0%,
                        transparent calc(var(--q2-pat-size) / 4 - 1px),
                        var(--q2-pat) calc(var(--q2-pat-size) / 4 - 1px) calc(var(--q2-pat-size) / 4),
                        transparent calc(var(--q2-pat-size) / 4));
    background-size: calc(var(--q2-pat-size) / 2) calc(var(--q2-pat-size) / 4);
}

body.q2-child-bg--pattern-23 { /* Triangle Mesh */
    background-image: repeating-linear-gradient(60deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 6)),
                      repeating-linear-gradient(-60deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 6)),
                      repeating-linear-gradient(0deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 6));
}

body.q2-child-bg--pattern-24 { /* Quatrefoil Dots */
    background-image: radial-gradient(var(--q2-pat) 1.4px, transparent 1.7px),
                      radial-gradient(var(--q2-pat) 1.4px, transparent 1.7px),
                      radial-gradient(var(--q2-pat) 1.4px, transparent 1.7px),
                      radial-gradient(var(--q2-pat) 1.4px, transparent 1.7px);
    background-size: var(--q2-pat-size) var(--q2-pat-size);
    background-position: 0 0,
                         calc(var(--q2-pat-size) * 0.25) calc(var(--q2-pat-size) * 0.25),
                         calc(var(--q2-pat-size) * -0.25) calc(var(--q2-pat-size) * 0.25),
                         calc(var(--q2-pat-size) * 0.25) calc(var(--q2-pat-size) * -0.25);
}

/* --- Patterns 25-32 ---
   Eight additional geometries not covered by 01-24. Same two
   variables, so intensity, scale and dark-mode behaviour are
   identical across all 32. */

body.q2-child-bg--pattern-25 { /* Graph Paper */
    background-image: linear-gradient(var(--q2-pat) 1px, transparent 1px),
                      linear-gradient(90deg, var(--q2-pat) 1px, transparent 1px),
                      linear-gradient(var(--q2-pat) 1px, transparent 1px),
                      linear-gradient(90deg, var(--q2-pat) 1px, transparent 1px);
    background-size: calc(var(--q2-pat-size) * 2) calc(var(--q2-pat-size) * 2), calc(var(--q2-pat-size) * 2) calc(var(--q2-pat-size) * 2), calc(var(--q2-pat-size) / 2.5) calc(var(--q2-pat-size) / 2.5), calc(var(--q2-pat-size) / 2.5) calc(var(--q2-pat-size) / 2.5);
}

body.q2-child-bg--pattern-26 { /* Isometric Grid */
    background-image: repeating-linear-gradient(30deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 5)),
                      repeating-linear-gradient(150deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 5)),
                      repeating-linear-gradient(90deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 5));
}

body.q2-child-bg--pattern-27 { /* Chevron Large */
    background-image: repeating-linear-gradient(45deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 3)),
                      repeating-linear-gradient(135deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 3));
    background-size: var(--q2-pat-size) var(--q2-pat-size), var(--q2-pat-size) var(--q2-pat-size);
    background-position: 0 0, calc(var(--q2-pat-size) / 2) 0;
}

body.q2-child-bg--pattern-28 { /* Tartan */
    background-image: repeating-linear-gradient(0deg, var(--q2-pat) 0 2px, transparent 2px calc(var(--q2-pat-size) / 2)),
                      repeating-linear-gradient(90deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 4));
}

body.q2-child-bg--pattern-29 { /* Argyle */
    background-image: repeating-linear-gradient(45deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 2)),
                      repeating-linear-gradient(135deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 2)),
                      repeating-linear-gradient(45deg, var(--q2-pat) 0 1px, transparent 1px calc(var(--q2-pat-size) / 8));
}

body.q2-child-bg--pattern-30 { /* Houndstooth */
    background-image: repeating-linear-gradient(45deg, var(--q2-pat) 0 2px, transparent 2px calc(var(--q2-pat-size) / 3)),
                      repeating-linear-gradient(-45deg, var(--q2-pat) 0 2px, transparent 2px calc(var(--q2-pat-size) / 3));
    background-size: calc(var(--q2-pat-size) / 1.5) calc(var(--q2-pat-size) / 1.5);
}

body.q2-child-bg--pattern-31 { /* Constellation */
    background-image: radial-gradient(var(--q2-pat) 1.4px, transparent 1.7px),
                      radial-gradient(var(--q2-pat) 0.8px, transparent 1.1px),
                      radial-gradient(var(--q2-pat) 1.1px, transparent 1.4px);
    background-size: calc(var(--q2-pat-size) * 2.4) calc(var(--q2-pat-size) * 2.4), calc(var(--q2-pat-size) * 1.3) calc(var(--q2-pat-size) * 1.7), calc(var(--q2-pat-size) * 3.1) calc(var(--q2-pat-size) * 2.2);
    background-position: 0 0, calc(var(--q2-pat-size) * 0.6) calc(var(--q2-pat-size) * 0.9), calc(var(--q2-pat-size) * 1.7) calc(var(--q2-pat-size) * 0.4);
}

body.q2-child-bg--pattern-32 { /* Fish Scale */
    background-image: radial-gradient(circle at 50% 0%,
                        transparent calc(calc(var(--q2-pat-size) / 3.5) - 1px),
                        var(--q2-pat) calc(calc(var(--q2-pat-size) / 3.5) - 1px) calc(var(--q2-pat-size) / 3.5),
                        transparent calc(var(--q2-pat-size) / 3.5));
    background-size: calc(var(--q2-pat-size) / 1.75) calc(var(--q2-pat-size) / 3.5);
}

/* ==========================================================================
   Tiles page type (templates/tiles.html.twig)
   Child pages rendered as image tiles. Reuses Quark 2's design tokens
   throughout so it inherits light/dark mode and accent colour for free.
   ========================================================================== */

.tiles-grid {
    display: grid;
    gap: clamp(1rem, 2vw, 1.5rem);
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    margin-block: 1.5rem;
}

@media (min-width: 560px) {
    .tiles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
    .tiles-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tiles-cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
    .tiles-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.tile {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--q2-divider);
    border-radius: var(--q2-radius, 8px);
    background: var(--q2-bg-elev, var(--q2-bg));
    text-decoration: none;
    color: inherit;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tile:hover,
.tile:focus-visible {
    transform: translateY(-2px);
    border-color: var(--q2-accent);
    box-shadow: 0 6px 20px rgb(0 0 0 / 0.10);
    text-decoration: none;
}

/* Aspect-ratio box. The Twig side crops the thumbnail to a matching
   ratio, so object-fit: cover has nothing to trim in the normal case
   and oddly-sized source images still fill the box cleanly. */
.tile-media {
    position: relative;
    overflow: hidden;
    background: var(--q2-bg-muted, var(--q2-bg));
}

.tiles-ratio-1-1  .tile-media { aspect-ratio: 1 / 1; }
.tiles-ratio-4-3  .tile-media { aspect-ratio: 4 / 3; }
.tiles-ratio-3-2  .tile-media { aspect-ratio: 3 / 2; }
.tiles-ratio-16-9 .tile-media { aspect-ratio: 16 / 9; }

.tile-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.tile:hover .tile-media img {
    transform: scale(1.04);
}

/* Placeholder for children with no image — first letter of the title on
   the muted surface, so the grid stays even instead of collapsing. */
.tile-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 600;
    color: var(--q2-text-muted);
    opacity: 0.35;
}

.tile-caption {
    padding: 0.9rem 1rem 1rem;
}

.tile-title {
    margin: 0;
    font-size: 1rem;
    line-height: 1.35;
    color: var(--q2-text);
}

.tile-date,
.tile-count {
    display: inline-block;
    margin-top: 0.35rem;
    margin-right: 0.6rem;
    font-size: 0.8rem;
    color: var(--q2-text-muted);
}

.tile-summary {
    margin: 0.5rem 0 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--q2-text-muted);
}

/* Line clamp keeps every tile the same height regardless of how much text
   a child page has, which is what stops the grid going ragged. Falls back
   gracefully: without -webkit-line-clamp support the text simply shows in
   full rather than breaking. */
.tiles-clamp-2 .tile-summary,
.tiles-clamp-3 .tile-summary,
.tiles-clamp-4 .tile-summary,
.tiles-clamp-5 .tile-summary {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tiles-clamp-2 .tile-summary { -webkit-line-clamp: 2; line-clamp: 2; }
.tiles-clamp-3 .tile-summary { -webkit-line-clamp: 3; line-clamp: 3; }
.tiles-clamp-4 .tile-summary { -webkit-line-clamp: 4; line-clamp: 4; }
.tiles-clamp-5 .tile-summary { -webkit-line-clamp: 5; line-clamp: 5; }

/* Titles clamp to two lines for the same reason. */
.tile-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

/* Push the caption to fill remaining height so cards bottom-align evenly. */
.tiles-caption-below .tile-caption {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

/* --- Overlay caption variant --- */

.tiles-caption-overlay .tile-caption {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 1.75rem 1rem 0.9rem;
    background: linear-gradient(to top, rgb(0 0 0 / 0.72), rgb(0 0 0 / 0));
}

.tiles-caption-overlay .tile-title,
.tiles-caption-overlay .tile-date,
.tiles-caption-overlay .tile-count,
.tiles-caption-overlay .tile-summary {
    color: #fff;
}

/* Overlay text sits on the image, so the tile itself needs no body
   padding and the media box defines the full tile height. */
.tiles-caption-overlay .tile {
    display: block;
}

.tiles-empty {
    color: var(--q2-text-muted);
    font-style: italic;
}

/* ==========================================================================
   Navigation wrapping
   Quark 2 already sets flex-wrap on the menu list, but .desktop-menu is a
   flex item with the default min-width:auto, so it refuses to shrink below
   its content width and the menu overflows the viewport instead of
   wrapping. min-width:0 is what actually lets the wrap happen.
   ========================================================================== */

#header .navbar {
    flex-wrap: wrap;
    row-gap: 0.5rem;
}

.navbar-section {
    min-width: 0;
}

.desktop-menu {
    min-width: 0;
    flex-wrap: wrap;
}

.dropmenu {
    min-width: 0;
    max-width: 100%;
}

.dropmenu > ul,
.dropmenu ul.navigation {
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 0.25rem;
}

/* Individual labels still never break mid-word — wrapping happens between
   items, which is what keeps the menu readable. */
.dropmenu > ul > li > a {
    white-space: nowrap;
}

/* With many top-level items the last dropdowns can open past the right
   edge of the viewport. Anchor the final two to their right edge instead. */
@media (min-width: 961px) {
    .dropmenu > ul > li:last-child > ul,
    .dropmenu > ul > li:nth-last-child(2) > ul {
        inset-inline-start: auto;
        inset-inline-end: 0;
    }
}

/* Submenus never exceed the viewport width on narrow desktop windows. */
.dropmenu ul ul {
    max-width: min(340px, calc(100vw - 2rem));
}

/* --- Long dropdowns: cap height and scroll ---------------------------------
   A year folder with 20+ posts produces a submenu taller than the viewport,
   and everything below the fold becomes unreachable (the panel is absolutely
   positioned, so the page itself can't scroll to it).

   The :not(:has(> li.has-children)) guard matters: overflow-y on a panel
   would clip any third-level flyout, since those are positioned OUTSIDE
   their parent panel. So only leaf panels scroll. Panels that contain
   further submenus are left alone — those are short in practice.
   (Quark 2 already relies on :has() elsewhere, so this is consistent.) */

.dropmenu ul ul:not(:has(> li.has-children)) {
    max-height: min(70vh, calc(100vh - 10rem));
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Slim scrollbar so it doesn't dominate a narrow panel. */
.dropmenu ul ul::-webkit-scrollbar {
    width: 8px;
}
.dropmenu ul ul::-webkit-scrollbar-thumb {
    background: var(--q2-text-muted);
    border-radius: 4px;
    opacity: 0.4;
}
.dropmenu ul ul::-webkit-scrollbar-track {
    background: transparent;
}
.dropmenu ul ul {
    scrollbar-width: thin;
}

/* Nested flyouts open at the top of their parent item, which can sit well
   down the screen — keep them inside the viewport too. */
.dropmenu li li > ul:not(:has(> li.has-children)) {
    max-height: min(60vh, calc(100vh - 8rem));
}

/* --- Dropdown hover reliability -------------------------------------------

   Two separate causes of submenus vanishing while travelling to them:

   1. DIAGONAL TRAVEL. Quark 2 opens/closes purely on :hover with no close
      delay. Moving diagonally from "2024" toward its flyout crosses sibling
      items ("2025"), so the parent loses :hover and the panel closes
      instantly. Fixed with a close-only delay: the delay lives on the base
      (closed) rule and is zeroed on the open rule, so opening stays
      instant while closing waits ~0.35s.

   2. CLIPPED HOVER BRIDGE — self-inflicted. Quark 2 bridges the 6px gap
      with `.dropmenu li li > ul::before`, which sits OUTSIDE the panel's
      own box. The overflow-y:auto added earlier for long menus clips it,
      so scrolling panels lost their bridge entirely. Restored by putting
      an equivalent bridge on the parent <li>, which has no overflow
      clipping (it is already position:relative). */

.dropmenu li > ul {
    transition:
        opacity 0.12s ease 0.12s,
        transform 0.12s ease 0.12s,
        visibility 0.12s 0.12s,
        /* pointer-events must be delayed too. Without this the panel goes
           click-through the instant the parent loses :hover, so the cursor
           passes straight through the still-visible panel and hover is
           never re-established - the delay above achieves nothing on its
           own. Discrete transitions; harmless where unsupported. */
        pointer-events 0s 0.12s;
}

.dropmenu li:hover > ul,
.dropmenu li:focus-within > ul,
.dropmenu li.open > ul {
    transition-delay: 0s;
}

/* Gap bridge anchored to the parent item rather than the panel, so it
   survives overflow clipping on scrollable panels. Only while hovering,
   so it never intercepts pointer events at rest. */
.dropmenu li li.has-children:hover::after {
    content: "";
    position: absolute;
    top: 0;
    inset-inline-start: 100%;
    width: 12px;
    /* Height must span the FLYOUT, not the parent item. The flyout is
       anchored to this item's top but is far taller (a busy year folder
       runs hundreds of pixels), so a bridge only as tall as the ~40px
       item leaves the diagonal path to lower entries uncovered - which is
       exactly the travel that was failing.

       This strip sits beyond the parent panel's right edge, i.e. in empty
       space, so making it tall does NOT block hovering sibling items. */
    height: min(75vh, 700px);
}

.dropmenu li li.has-children.flip-x:hover::after {
    inset-inline-start: auto;
    inset-inline-end: 100%;
}

/* Same reasoning one level up: the second-level panel hangs below its
   top-level item, so travelling down-left/right to it can leave the item
   before arriving. Widen that bridge vertically too. */
.dropmenu > ul > li.has-children:hover::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 100%;
    height: 14px;
}

/* Close instantly when moving to a SIBLING menu item.

   The close delay above exists so the cursor can travel to a panel without
   it vanishing. But it should not apply when you've plainly moved on: going
   from "Bikes" to "Routes" left the Bikes panel hanging behind the new one
   for the full delay.

   If any item in a list is hovered, every OTHER item in that same list
   drops its delay and closes immediately. Only the item you're actually
   heading away from (with nothing else hovered) keeps the grace period.
   Works at every level, including returning from a third-level flyout to
   a sibling in the second-level panel. */

.dropmenu ul:has(> li:hover) > li:not(:hover) > ul {
    transition-delay: 0s;
}

/* Same when focus (keyboard) moves to a sibling. */
.dropmenu ul:has(> li:focus-within) > li:not(:focus-within) > ul {
    transition-delay: 0s;
}

/* Close instantly when moving BETWEEN sibling items — the close delay is
   only wanted when leaving the menu altogether. Without this, switching
   from "2024" to "2025" leaves the old panel lingering behind the new one
   for the length of the delay.

   Reads as: inside any panel that currently has a hovered item, every
   OTHER item's flyout loses the delay and closes at once. Leaving the
   menu entirely means no item is hovered, so the rule stops applying and
   the delay is back — which is the behaviour that fixed the diagonal
   travel problem. Relies on :has(), consistent with the rest of the
   theme's baseline. */

.dropmenu ul:has(> li:hover) > li:not(:hover) > ul {
    transition-delay: 0s;
}
