/* SQL dialect comparison (/sql-dialects, /sql-dialects/{slug}). Page rules only;
   tokens, buttons and the shared tools-* primitives (crumbs, CTA, "Related on
   SQLly") come from tokens.css, site.css and tools.css. Everything here is
   scoped under .dl so nothing leaks into other reference pages. */

/* ---------- Full-width frame ---------- */
.dl .wrap { max-width: none; padding: 0 clamp(16px, 2vw, 32px); }
.dl :is(h1, h2, h3) { text-wrap: balance; }
.dl p { text-wrap: pretty; }
.dl [id] { scroll-margin-top: 92px; }
.dl code, .dl kbd { font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace; }

.dl-head { padding-bottom: clamp(20px, 3vw, 32px); }
.dl-head .lede { max-width: 60ch; }
.dl-facts { margin: 14px 0 0; color: var(--muted); font-size: .95rem; }
.dl-facts a { font-weight: 600; }
.dl-num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--heading); }

.dl-sr {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Side column + main column ---------- */
.dl-layout {
    display: grid;
    grid-template-columns: minmax(200px, 250px) minmax(0, 1fr);
    gap: clamp(24px, 3vw, 56px);
    align-items: start;
    padding-top: 8px;
    padding-bottom: clamp(48px, 6vw, 80px);
}
.dl-side {
    position: sticky; top: 94px;
    max-height: calc(100vh - 110px); overflow-y: auto;
    padding: 4px 4px 12px 0;
    scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.dl-main { min-width: 0; }
.dl-side-title {
    margin: 0 0 8px; font-size: .78rem; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted);
}
.dl-side-list, .dl-side-list ul { list-style: none; margin: 0; padding: 0; }
.dl-side-list ul { margin: 2px 0 6px 12px; padding-left: 10px; border-left: 1px solid var(--line); }
.dl-side-list a {
    display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
    padding: 7px 10px; border-radius: 10px; color: var(--ink); font-size: .95rem;
    min-height: 36px; box-sizing: border-box;
}
.dl-side-list ul a { font-size: .9rem; color: var(--muted); padding: 5px 10px; min-height: 32px; }
.dl-side-list a:hover { background: var(--blue-soft); color: var(--blue-on-soft); text-decoration: none; }
.dl-side-list a[aria-current="true"] { background: var(--blue-soft); color: var(--blue-on-soft); font-weight: 600; }
.dl-count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }
.dl-side-list a.is-empty { opacity: .5; }

/* ---------- Hub filter ---------- */
.dl-filter { margin-bottom: 22px; }
.dl-filter label { display: block; font-weight: 600; font-size: .9rem; color: var(--heading); margin-bottom: 6px; }
.dl-filter input { width: 100%; min-height: 44px; }
.dl-filter input::placeholder { color: var(--muted); opacity: 1; }
.dl-hint { margin: 8px 0 0; font-size: .82rem; color: var(--muted); }
.dl-hint kbd {
    font-size: .76rem; padding: 1px 6px; border: 1px solid var(--line);
    border-radius: 4px; background: var(--card); color: var(--ink);
}
.dl-status { margin: 6px 0 0; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.2em; }

/* ---------- Hub index ---------- */
.dl-cat { padding: 0 0 clamp(36px, 4vw, 56px); }
.dl-cat + .dl-cat { padding-top: clamp(28px, 3vw, 40px); border-top: 1px solid var(--line); }
.dl-cat-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin-bottom: 18px; }
.dl-cat-head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0; }
.dl-cat-head p { margin: 0; color: var(--muted); max-width: 72ch; }

.dl-index {
    list-style: none; margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    column-gap: clamp(20px, 2vw, 32px);
}
.dl-index li { border-top: 1px solid var(--line); }
.dl-index a {
    display: block; height: 100%; box-sizing: border-box;
    padding: 14px 10px 16px; margin: 0 -10px; border-radius: 12px;
    color: var(--ink); transition: background-color .16s ease-out;
}
.dl-index a:hover { background: var(--card); text-decoration: none; }
.dl-index a:hover h3 { color: var(--link); }
.dl-index h3 { font-size: 1.08rem; line-height: 1.25; margin: 0 0 6px; transition: color .16s ease-out; }
.dl-index p { margin: 0; color: var(--muted); font-size: .94rem; line-height: 1.5; }

.dl-empty { padding: 24px 0 48px; max-width: 72ch; }
.dl-empty h2 { font-size: 1.5rem; margin: 0 0 8px; }
.dl-empty p { color: var(--muted); margin: 0 0 18px; }

/* ---------- Operation page: summary row ---------- */
.dl-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
    gap: clamp(18px, 2vw, 28px);
    margin-bottom: clamp(36px, 4vw, 56px);
}
.dl-summary section { padding: 0; }
.dl-summary h2 { font-size: 1.35rem; margin: 0 0 10px; }
.dl-summary p { margin: 0; max-width: 72ch; line-height: 1.65; }
.dl-verdict {
    background: var(--blue-soft); border-radius: var(--radius);
    padding: clamp(20px, 2.4vw, 28px) !important;
}
.dl-verdict h2 { color: var(--blue-on-soft); }
.dl-verdict p { color: var(--ink); }
.dl-differ { padding: clamp(20px, 2.4vw, 28px) 0 !important; }
.dl-differ p { color: var(--muted); }

/* ---------- Operation page: sections ---------- */
.dl-sec { padding: 0 0 clamp(36px, 4vw, 56px); }
.dl-sec + .dl-sec { padding-top: clamp(28px, 3vw, 40px); border-top: 1px solid var(--line); }
.dl-sec > h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0 0 18px; }

/* Five engines side by side: as many columns as fit, five on a wide screen. */
.dl-engines {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: 16px;
}
.dl-engine {
    display: flex; flex-direction: column; gap: 10px; min-width: 0;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    padding: 14px 16px 16px;
}
.dl-engine-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
.dl-engine-head h3 { font-size: 1.1rem; margin: 0; }
.dl-copy {
    font: 600 .82rem/1 "Inter", system-ui, sans-serif;
    color: var(--heading); background: transparent;
    border: 1px solid var(--line); border-radius: 999px;
    padding: 0 14px; min-height: 36px; min-width: 64px; cursor: pointer;
    transition: border-color .16s ease-out, background-color .16s ease-out;
}
.dl-copy:hover { border-color: var(--blue-bright); }
.dl-copy.is-done { background: var(--green-soft); color: var(--green-on-soft); border-color: transparent; }
.dl-code {
    margin: 0; padding: 12px 14px;
    background: var(--cream); border: 1px solid var(--line); border-radius: 10px;
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
    font-size: .84rem; line-height: 1.55; color: var(--ink);
    font-variant-ligatures: none; tab-size: 4;
    /* Long one-line statements wrap inside the column; multi-line SQL keeps its shape. */
    white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: auto;
    scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.dl-code:focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 2px; }
.dl-code code { font-size: inherit; }
.dl-note { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }

/* FAQ: side by side when there is room, each answer at a readable measure. */
.dl-faq {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
    gap: 8px clamp(20px, 2.4vw, 40px);
}
.dl-faq-item { border-top: 1px solid var(--line); padding-top: 14px; }
.dl-faq-item h3 { font-size: 1.12rem; line-height: 1.3; margin: 0 0 8px; }
.dl-faq-item p { margin: 0 0 12px; color: var(--muted); max-width: 72ch; }

/* Previous / next within the group. */
.dl-pager {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: 16px; padding-top: clamp(24px, 3vw, 36px); border-top: 1px solid var(--line);
}
.dl-pager a {
    display: flex; flex-direction: column; gap: 4px;
    padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px;
    background: var(--card); color: var(--ink);
    transition: border-color .16s ease-out;
}
.dl-pager a:hover { border-color: var(--blue-bright); text-decoration: none; }
.dl-pager-next { text-align: right; grid-column: -2 / -1; }
.dl-pager-dir { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dl-pager-title { font-weight: 600; color: var(--heading); }

/* ---------- Shared blocks, widened for this section ---------- */
.dl .tools-xref {
    max-width: none; display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    column-gap: clamp(20px, 2vw, 32px);
}
.dl .tools-xref li:last-child { border-bottom: 1px solid var(--line); }
.dl .tools-xref-also { max-width: 72ch; }
.dl-cta p { text-wrap: pretty; }

/* ---------- Narrow screens: side column folds above the content ---------- */
@media (max-width: 960px) {
    .dl-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .dl-side { position: static; max-height: none; overflow: visible; padding: 0; }
    .dl-side-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
    .dl-side-list > li { flex: none; }
    .dl-side-list ul { display: none; }
    .dl-side-list a { border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; min-height: 44px; align-items: center; background: var(--card); }
    .dl-toc .dl-side-list ul { display: flex; gap: 6px; margin: 0; padding: 0; border: 0; }
    .dl-toc .dl-side-list > li:has(> ul) { display: contents; }
    .dl-toc .dl-side-list ul li { flex: none; }
    .dl-toc .dl-side-list ul a { color: var(--ink); font-size: .95rem; padding: 8px 14px; min-height: 44px; }
    .dl-pager-next { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .dl-index a, .dl-index h3, .dl-copy, .dl-pager a { transition: none; }
}
