/*
 * Quark 2 — Cal.com-inspired design system atop PicoCSS
 * ----------------------------------------------------
 * Principles (per DESIGN.md):
 *  - Monochrome palette; color is foreign.
 *  - Cal Sans for display, Inter for body.
 *  - Shadow-first depth: ring + soft + contact.
 *  - Generous whitespace; 80-96px between sections.
 */

/* ---------- Tokens ---------- */

:root,
:root[data-theme="light"] {
  --q2-bg: #fbfbfc; /* page canvas — whisper-soft gray */
  --q2-bg-elev: #ffffff; /* cards / content surface */
  --q2-bg-muted: #f2f2f4; /* recessed */
  --q2-bg-inverse: #111111;

  --q2-text: #242424;
  --q2-text-strong: #111111;
  --q2-text-muted: #898989;
  --q2-text-inverse: #ffffff;

  --q2-border-ring: rgba(34, 42, 53, 0.08);
  --q2-border-strong: rgba(34, 42, 53, 0.14);
  --q2-divider: rgba(34, 42, 53, 0.08);

  --q2-shadow-card:
    rgba(19, 19, 22, 0.7) 0 1px 5px -4px, rgba(34, 42, 53, 0.08) 0 0 0 1px,
    rgba(34, 42, 53, 0.05) 0 4px 8px 0;
  --q2-shadow-raised:
    rgba(19, 19, 22, 0.7) 0 1px 5px -4px, rgba(34, 42, 53, 0.1) 0 0 0 1px,
    rgba(34, 42, 53, 0.08) 0 12px 28px -8px;
  --q2-shadow-dropdown:
    rgba(19, 19, 22, 0.7) 0 1px 5px -4px, rgba(34, 42, 53, 0.1) 0 0 0 1px,
    rgba(34, 42, 53, 0.12) 0 16px 32px -12px;
  --q2-shadow-inset: inset 0 1px 1.9px rgba(0, 0, 0, 0.16);
  --q2-shadow-hl: inset 0 2px 0 rgba(255, 255, 255, 0.15);

  --q2-radius-xs: 4px;
  --q2-radius-sm: 6px;
  --q2-radius: 8px;
  --q2-radius-md: 12px;
  --q2-radius-lg: 16px;
  --q2-radius-pill: 9999px;

  --q2-nav-bg: rgba(255, 255, 255, 0.78);
  --q2-nav-border: rgba(34, 42, 53, 0.08);
  /* Header row height. Override this and `header-transparent` keeps lining the
   * hero up with it, since the overlay offset is derived from the same value. */
  --q2-header-height: 72px;

  /* Pico overrides */
  --pico-font-family-sans-serif:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --pico-font-family-display:
    "Cal Sans", "Inter", sans-serif;

  /* Forum Pro headings. Without this the forum falls back to the body font for
   * its own headings while the unclassed ones under them keep Cal Sans, so a
   * page title ends up lighter than the subheadings beneath it. Hand it the
   * display face and forum headings speak the same voice as the rest of Quark. */
  --forum-font-display: var(--pico-font-family-display);
  --pico-font-family-monospace:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --pico-font-size: 16px;
  --pico-line-height: 1.6;
  --pico-font-weight: 400;
  --pico-border-radius: var(--q2-radius);
  --pico-spacing: 1rem;
  --pico-background-color: var(--q2-bg);
  --pico-color: var(--q2-text);
  --pico-h1-color: var(--q2-text);
  --pico-h2-color: var(--q2-text);
  --pico-h3-color: var(--q2-text);
  --pico-h4-color: var(--q2-text);
  --pico-h5-color: var(--q2-text);
  --pico-h6-color: var(--q2-text);
  --pico-muted-color: var(--q2-text-muted);
  --pico-muted-border-color: var(--q2-divider);
  --pico-primary: var(--q2-text);
  --pico-primary-hover: #000000;
  --pico-primary-focus: var(--q2-focus-ring);
  --pico-primary-inverse: var(--q2-text-inverse);
  --pico-secondary: var(--q2-text-muted);
  --pico-secondary-hover: var(--q2-text);
  --pico-contrast: var(--q2-text);
  --pico-contrast-hover: #000000;
  --pico-contrast-inverse: var(--q2-text-inverse);
  --pico-card-background-color: var(--q2-bg-elev);
  --pico-card-border-color: transparent;
  --pico-card-box-shadow: var(--q2-shadow-card);
  --pico-card-sectioning-background-color: var(--q2-bg-muted);
  --pico-form-element-background-color: var(--q2-bg);
  --pico-form-element-border-color: rgba(34, 42, 53, 0.16);
  --pico-form-element-color: var(--q2-text);
  --pico-form-element-focus-color: var(--q2-focus-ring);
  /* Pico draws checked checkbox/radio fill from these — point them at the accent */
  --pico-primary-background: var(--q2-accent);
  --pico-primary-border: var(--q2-accent);
}

:root[data-theme="dark"] {
  --q2-bg: #08090b;
  --q2-bg-elev: #1d1f25; /* card surface — lifted for visibility */
  --q2-bg-muted: #2a2d34; /* recessed / hover state */
  --q2-bg-inverse: #f5f5f5;

  --q2-text: #f2f2f3;
  --q2-text-strong: #ffffff;
  --q2-text-muted: #9a9aa0;
  --q2-text-inverse: #111111;

  --q2-border-ring: rgba(255, 255, 255, 0.14);
  --q2-border-strong: rgba(255, 255, 255, 0.2);
  --q2-divider: rgba(255, 255, 255, 0.1);

  --q2-shadow-card:
    rgba(0, 0, 0, 0.85) 0 1px 5px -4px, rgba(255, 255, 255, 0.14) 0 0 0 1px,
    rgba(0, 0, 0, 0.55) 0 4px 12px 0;
  --q2-shadow-raised:
    rgba(0, 0, 0, 0.85) 0 1px 5px -4px, rgba(255, 255, 255, 0.14) 0 0 0 1px,
    rgba(0, 0, 0, 0.65) 0 14px 32px -8px;
  --q2-shadow-dropdown:
    rgba(0, 0, 0, 0.85) 0 1px 5px -4px, rgba(255, 255, 255, 0.14) 0 0 0 1px,
    rgba(0, 0, 0, 0.75) 0 16px 32px -12px;
  --q2-shadow-inset: inset 0 1px 1.9px rgba(0, 0, 0, 0.5);
  --q2-shadow-hl: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --q2-nav-bg: rgba(11, 11, 12, 0.78);
  --q2-nav-border: rgba(255, 255, 255, 0.06);

  --pico-background-color: var(--q2-bg);
  --pico-color: var(--q2-text);
  --pico-muted-color: var(--q2-text-muted);
  --pico-muted-border-color: var(--q2-divider);
  --pico-primary: var(--q2-text-strong);
  --pico-primary-hover: #ffffff;
  --pico-primary-inverse: var(--q2-text-inverse);
  --pico-contrast: var(--q2-text-strong);
  --pico-contrast-inverse: var(--q2-text-inverse);
  --pico-card-background-color: var(--q2-bg-elev);
  --pico-card-sectioning-background-color: var(--q2-bg-muted);
  --pico-form-element-background-color: var(--q2-bg-elev);
  --pico-form-element-border-color: rgba(255, 255, 255, 0.12);
  --pico-form-element-color: var(--q2-text);
  --pico-primary-background: var(--q2-accent);
  --pico-primary-border: var(--q2-accent);
}

/* ---------- Base ---------- */

html {
  background: var(--q2-bg);
  color-scheme: light dark;
}

/* Reset Pico's blanket <article> chrome — we style cards explicitly */
article {
  margin-bottom: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Pico styles `article > header` / `article > footer` as sectioning blocks
 * (negative margins, sectioning bg, border, top/bottom radii). Neutralize so
 * the card-header / card-footer behave as plain content slots. */
article > header,
article > footer,
.card > header,
.card > footer {
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

body {
  font-family: var(--pico-font-family-sans-serif);
  font-weight: 400;
  color: var(--q2-text);
  background-color: var(--q2-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.sticky-footer #page-wrapper {
  flex: 1 0 auto;
}
body.sticky-footer #footer {
  flex-shrink: 0;
}

/* ---------- Typography ---------- */

h1,
h2,
h3,
h4,
h5,
h6,
.display,
.h-display {
  font-family: var(--pico-font-family-display);
  color: var(--q2-text);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-top: 0;
  margin-bottom: 0.4em;
}

/* h1 — airy, display scale, lighter weight */
h1 {
  font-size: clamp(2.25rem, 5vw + 1rem, 3.75rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

/* h2 — confident, tighter, bolder, subtle accent bar */
h2 {
  font-size: clamp(1.5rem, 2.5vw + 0.5rem, 2.125rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--q2-text-strong);
  position: relative;
}
h2::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background: var(--q2-text-strong);
  margin-bottom: 0.7rem;
  opacity: 0.9;
}

/* h3 — workhorse section heads, medium weight */
h3 {
  font-size: clamp(1.25rem, 1.5vw + 0.5rem, 1.5rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

h4 {
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
}
h5 {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.2px;
}
h6 {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--q2-text-muted);
}

/* Headings that immediately follow another heading — don't double-space */
:is(h1, h2, h3) + :is(h1, h2, h3) {
  margin-top: 0.25em;
}

/* Generous top margin when headings follow body content — creates section rhythm */
:is(p, ul, ol, dl, blockquote, pre, table, figure, hr, iframe, .card) + h1 {
  margin-top: 1.75em;
}
:is(p, ul, ol, dl, blockquote, pre, table, figure, hr, iframe, .card) + h2 {
  margin-top: 1.65em;
}
:is(p, ul, ol, dl, blockquote, pre, table, figure, hr, iframe, .card) + h3 {
  margin-top: 1.55em;
}
:is(p, ul, ol, dl, blockquote, pre, table, figure, hr, iframe, .card) + h4 {
  margin-top: 1.45em;
}
:is(p, ul, ol, dl, blockquote, pre, table, figure, hr, iframe, .card)
  + :is(h5, h6) {
  margin-top: 1.35em;
}

/* Drop the accent bar when h2 acts as a subtitle (directly after h1) or is centered/hero */
h1 + h2::before,
.hero h2::before,
.text-center h2::before {
  display: none;
}
h1 + h2 {
  margin-top: -0.25em;
  color: var(--q2-accent);
}

p,
li {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--q2-text);
}
.lead {
  font-size: 1.125rem;
  font-weight: 300;
  color: var(--q2-text-muted);
  letter-spacing: -0.2px;
  line-height: 1.55;
}
.text-muted {
  color: var(--q2-text-muted);
}
.text-center {
  text-align: center;
}

a {
  color: var(--q2-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--q2-text-strong);
  text-decoration-thickness: 2px;
}

strong,
b {
  font-weight: 600;
  color: inherit;
}
code,
pre,
kbd,
samp {
  font-family: var(--pico-font-family-monospace);
  font-size: 0.9em;
}
pre {
  background: var(--q2-bg-muted);
  border-radius: var(--q2-radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--q2-shadow-card);
  overflow-x: auto;
}
code:not(pre code) {
  background: var(--q2-bg-muted);
  padding: 0.12em 0.35em;
  border-radius: var(--q2-radius-xs);
}

/* The PHP Debug Bar ships its own complete, always-dark UI. The classless
 * content rules above (color on p/li, link color, pre/code chrome) were
 * bleeding into it, rendering message text unreadable dark-on-dark in light
 * mode. Fence the bar off so its own styles apply. */
.phpdebugbar :is(p, li) {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}
.phpdebugbar a {
  color: inherit;
}
.phpdebugbar :is(pre, code) {
  background: none;
  box-shadow: none;
}

hr {
  border: 0;
  border-top: 1px solid var(--q2-divider);
  margin: 2.5rem 0;
}

blockquote {
  border-left: 2px solid var(--q2-text);
  margin: 1.75rem 0;
  padding: 0.25rem 1.25rem;
  color: var(--q2-text);
  font-family: var(--pico-font-family-display);
  font-size: 1.25rem;
  line-height: 1.4;
  letter-spacing: 0;
}
blockquote cite,
blockquote footer {
  display: block;
  font-family: var(--pico-font-family-sans-serif);
  font-size: 0.875rem;
  color: var(--q2-text-muted);
  margin-top: 0.5rem;
  letter-spacing: 0;
}

/* ---------- GitHub-style Markdown Alerts ---------- */
/* Emitted by the `github-markdown-alerts` plugin as:
 *   <div class="markdown-alert markdown-alert-{note|tip|important|warning|caution}">
 *     <p class="markdown-alert-title"><svg>…</svg> Note</p>
 *     <p>…body…</p>
 *   </div>
 */
.markdown-alert {
  --alert-accent: var(--q2-text);
  --alert-bg: color-mix(in oklab, var(--alert-accent) 6%, var(--q2-bg-elev));
  border-left: 4px solid var(--alert-accent);
  background: var(--alert-bg);
  border-radius: var(--q2-radius-sm);
  padding: 0.875rem 1.125rem;
  margin: 1.5rem 0;
  font-family: var(--pico-font-family-sans-serif);
  font-size: 1rem;
  font-style: normal;
  line-height: 1.55;
  letter-spacing: 0;
  color: var(--q2-text);
}
.markdown-alert > :first-child {
  margin-top: 0;
}
.markdown-alert > :last-child {
  margin-bottom: 0;
}

.markdown-alert .markdown-alert-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.375rem;
  font-family: var(--pico-font-family-sans-serif);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1;
  letter-spacing: 0;
  color: var(--alert-accent);
  text-transform: none;
}
.markdown-alert .markdown-alert-title svg,
.markdown-alert .markdown-alert-title .octicon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex: 0 0 auto;
}

.markdown-alert p {
  margin: 0 0 0.375rem;
}
.markdown-alert p:last-child {
  margin-bottom: 0;
}

/* Accent per alert type — matches GitHub's light-mode palette */
.markdown-alert-note {
  --alert-accent: #0969da;
}
.markdown-alert-tip {
  --alert-accent: #1a7f37;
}
.markdown-alert-important {
  --alert-accent: #8250df;
}
.markdown-alert-warning {
  --alert-accent: #9a6700;
}
.markdown-alert-caution {
  --alert-accent: #cf222e;
}

:root[data-theme="dark"] .markdown-alert-note {
  --alert-accent: #539bf5;
}
:root[data-theme="dark"] .markdown-alert-tip {
  --alert-accent: #57ab5a;
}
:root[data-theme="dark"] .markdown-alert-important {
  --alert-accent: #b083f0;
}
:root[data-theme="dark"] .markdown-alert-warning {
  --alert-accent: #c69026;
}
:root[data-theme="dark"] .markdown-alert-caution {
  --alert-accent: #e5534b;
}

/* ---------- Layout ---------- */

.container {
  max-width: 1200px;
  width: 100%;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}
.container-narrow {
  max-width: 880px;
  margin-inline: auto;
}

/* Default content column — white rounded "card" sitting on the gray canvas */
#body-wrapper > .container > .content-item {
  max-width: 960px;
  margin-inline: auto;
  background: var(--q2-bg-elev);
  border-radius: var(--q2-radius-lg);
  padding: clamp(1.75rem, 4vw, 3rem) clamp(1.5rem, 4vw, 3.25rem);
  box-shadow:
    rgba(19, 19, 22, 0.04) 0 1px 2px,
    rgba(19, 19, 22, 0.04) 0 8px 24px -8px;
}
#body-wrapper > .container > .content-item > :first-child {
  margin-top: 0;
}
#body-wrapper > .container > .content-item > :last-child {
  margin-bottom: 0;
}

:root[data-theme="dark"] #body-wrapper > .container > .content-item {
  box-shadow:
    rgba(0, 0, 0, 0.35) 0 1px 2px,
    rgba(0, 0, 0, 0.45) 0 10px 30px -10px,
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.section {
  padding-block: clamp(3rem, 8vw, 6rem);
  position: relative;
}
.section-tight {
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

#body-wrapper {
  padding-block: clamp(2.5rem, 5vw, 4rem);
  background: var(--q2-bg);
}

/* Simple column grid used by blog layout. Sidebar layout only kicks in when
 * the layout has actually rendered an <aside> (signalled via .has-sidebar
 * by partials/layout.html.twig) — otherwise the item column gets the full
 * container width. */
.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3rem);
}
@media (min-width: 960px) {
  .columns.has-sidebar {
    grid-template-columns: minmax(0, 2.5fr) minmax(0, 1fr);
  }
  .columns.has-sidebar.reverse {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr);
  }
}
.column {
  min-width: 0;
}

.extra-spacing > *:first-child {
  margin-top: 0;
}

/* ---------- Header / Navigation ---------- */

#header {
  position: relative;
  top: 0;
  z-index: 50;
  padding-block: 0;
  background: var(--q2-nav-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--q2-nav-border);
  transition:
    padding 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

/* header-fixed: sticky at the top of the viewport as the user scrolls */
body.header-fixed #header {
  position: sticky;
  top: 0;
}

/* header-transparent: sits over the hero until scrolled, then fills in.
 * Requires a hero/image behind it. Paired with `.scrolled` (set by site.js). */
body.header-transparent #header {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-color: transparent;
}

/* Clearing the background is not enough on its own: the sticky header still
 * occupies a row in normal flow, so what showed through was the page
 * background rather than the hero. Take it out of flow entirely, which is
 * where Quark 1 got the overlay from. Doing this with a negative margin
 * instead leaves the header's 1px border sitting above the hero, and shifts
 * the page by 12px when `header-animated` shrinks the navbar on scroll.
 * Guarded by :has() so pages with no hero keep their content clear of it. */
body.header-transparent:has(.hero, #blog-hero) #header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
}

body.header-transparent.scrolled #header {
  background: var(--q2-nav-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom-color: var(--q2-nav-border);
}

/* header-dark / header-light: pick the header's text colour while it is
 * transparent over a hero, where the theme's own text colour has nothing to
 * do with the imagery behind it. Restores the Quark 1 body classes. */
/* Only the bare top-level items: `> ul > li > a` deliberately leaves dropdown
 * submenu links alone, since those sit on their own panel background rather
 * than on the hero. */
body.header-dark:not(.scrolled) #header,
body.header-dark:not(.scrolled) #header .navbar-brand,
body.header-dark:not(.scrolled) #header .theme-toggle,
body.header-dark:not(.scrolled) #header .login-status-wrapper,
body.header-dark:not(.scrolled) #header .dropmenu > ul > li > a {
  color: #ffffff;
}
body.header-dark:not(.scrolled) #header .navbar-brand svg path {
  fill: #ffffff;
}
body.header-light:not(.scrolled) #header,
body.header-light:not(.scrolled) #header .navbar-brand,
body.header-light:not(.scrolled) #header .theme-toggle,
body.header-light:not(.scrolled) #header .login-status-wrapper,
body.header-light:not(.scrolled) #header .dropmenu > ul > li > a {
  color: #111111;
}
body.header-light:not(.scrolled) #header .navbar-brand svg path {
  fill: #111111;
}

/* The active pill and the hover chip draw their own background, so they keep
 * the theme's paired text colour instead of the over-hero one. Without this
 * the active item is white-on-white in dark mode, where the pill is light. */
body.header-dark:not(.scrolled) #header .dropmenu > ul > li > a.active,
body.header-light:not(.scrolled) #header .dropmenu > ul > li > a.active {
  color: var(--q2-text-inverse);
}
body.header-dark:not(.scrolled) #header .dropmenu > ul > li > a:hover:not(.active),
body.header-light:not(.scrolled) #header .dropmenu > ul > li > a:hover:not(.active) {
  color: var(--q2-text-strong);
}

#header .navbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: var(--q2-header-height);
  transition: min-height 0.2s ease;
}
.header-animated.scrolled #header .navbar {
  min-height: 60px;
}

.navbar-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.navbar-section.logo {
  flex: 0 0 auto;
}
.navbar-section.actions {
  margin-left: auto;
  gap: 0.75rem;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--q2-text-strong);
  text-decoration: none;
  font-family: var(--pico-font-family-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0;
}
.navbar-brand:hover {
  color: var(--q2-text-strong);
  text-decoration: none;
}
.navbar-brand img,
.navbar-brand svg {
  height: 28px;
  width: auto;
  display: block;
}
.navbar-brand svg,
.navbar-brand svg * {
  fill: var(--q2-text-strong);
}

/* Desktop nav */
.desktop-menu {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.25rem;
}

/* Reset Pico's nav-spawned rules for our dropmenu */
.dropmenu,
.dropmenu ul {
  display: block;
}
.dropmenu ul,
.dropmenu ul.navigation,
.dropmenu ul:first-of-type,
.dropmenu ul:last-of-type {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dropmenu > ul,
.dropmenu ul.navigation {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.dropmenu li {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
}
.dropmenu li::before {
  content: none !important;
}

.dropmenu a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin: 0; /* override Pico's negative margin on nav li a */
  padding: 0.5rem 0.9375rem;
  font-family: var(--pico-font-family-sans-serif);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--q2-text-strong);
  text-decoration: none;
  border-radius: var(--q2-radius-sm);
  letter-spacing: -0.1px;
  line-height: 1.35;
  transition:
    background 0.15s ease,
    color 0.15s ease;
  white-space: nowrap;
}
.dropmenu a:hover {
  background: var(--q2-bg-muted);
  color: var(--q2-text-strong);
  text-decoration: none;
}
.dropmenu a.active {
  color: var(--q2-text-inverse);
  background: var(--q2-text);
  font-weight: 600;
}
.dropmenu a.active:hover {
  background: var(--q2-text-strong);
  color: var(--q2-text-inverse);
}

/* Dropdown submenu — vertical stack (override Pico's nav ul flex rules) */
.dropmenu ul ul,
.dropmenu li > ul {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  min-width: 280px;
  max-width: 340px;
  margin: 0;
  padding: 0.375rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  background: var(--q2-bg-elev);
  border-radius: var(--q2-radius-md);
  box-shadow: var(--q2-shadow-dropdown);
  opacity: 0;
  transform: translateY(-4px);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    visibility 0.15s;
  z-index: 40;
}
.dropmenu li:hover > ul,
.dropmenu li:focus-within > ul,
.dropmenu li.open > ul {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

/* Invisible hover bridge so the cursor can cross the gap between the parent
 * menu item and the dropdown without losing :hover state. */
.dropmenu li > ul::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: -10px;
  height: 10px;
}
.dropmenu li li > ul::before {
  top: 0;
  inset-inline-start: -10px;
  inset-inline-end: auto;
  width: 10px;
  height: 100%;
}
.dropmenu li li.flip-x > ul::before {
  inset-inline-start: auto;
  inset-inline-end: -10px;
}

.dropmenu li > ul > li {
  display: block;
  width: 100%;
  align-self: stretch;
}
.dropmenu li > ul a {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.375rem 0.875rem;
  border-radius: var(--q2-radius-sm);
  white-space: normal;
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.4;
  letter-spacing: -0.1px;
}

/* Nested (third-level) dropdown opens to the side */
.dropmenu li li > ul {
  top: 0;
  inset-inline-start: calc(100% + 6px);
}

/* Edge flip. site.js adds `.flip-x` to any item whose panel would run past the
 * viewport edge, so the panel anchors to the opposite side instead. */
.dropmenu li.flip-x > ul {
  inset-inline-start: auto;
  inset-inline-end: 0;
}
.dropmenu li li.flip-x > ul {
  inset-inline-start: auto;
  inset-inline-end: calc(100% + 6px);
}

/* Belt-and-suspenders: anywhere `nav ul ul` inside dropmenu must be column */
nav .dropmenu ul ul,
nav .dropmenu li > ul {
  flex-direction: column !important;
  align-items: stretch !important;
  flex-wrap: nowrap !important;
}

/* Caret for parents */
.dropmenu li.has-children > a::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  display: inline-block;
  margin-left: 0.25rem;
  opacity: 0.6;
}
.dropmenu li li.has-children > a::after {
  transform: rotate(-45deg);
  margin-left: auto;
}
/* A flipped nested item opens the other way, so its caret points that way too. */
.dropmenu li li.has-children.flip-x > a::after {
  transform: rotate(135deg);
}

/* Theme toggle button — override Pico's button chrome entirely */
button.theme-toggle,
.theme-toggle {
  --size: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--size);
  height: var(--size);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--q2-radius-pill);
  background: transparent;
  color: var(--q2-text-strong);
  cursor: pointer;
  line-height: 0;
  font-size: 0;
  box-shadow: none;
  flex: 0 0 auto;
  transition: background 0.15s ease;
}
button.theme-toggle:hover {
  background: var(--q2-bg-muted);
}
.theme-toggle:hover {
  background: var(--q2-bg-muted);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--q2-focus-ring);
  outline-offset: 2px;
}
.theme-toggle .icon {
  width: 18px;
  height: 18px;
  display: none;
  font-size: 16px;
  line-height: 1;
}
:root[data-theme-preference="light"] .theme-toggle .icon-sun {
  display: block;
}
:root[data-theme-preference="dark"] .theme-toggle .icon-moon {
  display: block;
}
:root[data-theme-preference="auto"] .theme-toggle .icon-auto {
  display: block;
}

/* Mobile hamburger */
.mobile-menu {
  display: none;
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 70;
}
button.button_container,
.button_container {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--q2-radius-pill);
  background: var(--q2-bg-elev);
  color: var(--q2-text-strong);
  box-shadow: var(--q2-shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 0;
  line-height: 0;
}
button.button_container:hover {
  background: var(--q2-bg-muted);
}
button.button_container:focus-visible {
  outline: 2px solid var(--q2-focus-ring);
  outline-offset: 2px;
}
.button_container span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--q2-text-strong);
  border-radius: 2px;
  transition:
    transform 0.25s ease,
    opacity 0.2s ease;
}
.button_container.active .top {
  transform: translateY(6.5px) rotate(45deg);
}
.button_container.active .middle {
  opacity: 0;
}
.button_container.active .bottom {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* Mobile overlay */
.mobile-container {
  display: none;
}
.overlay {
  position: fixed;
  inset: 0;
  background: var(--q2-bg);
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding: 5rem 2rem 2rem;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow-y: auto;
}
.overlay.open {
  transform: translateX(0);
}
.overlay .mobile-logo {
  margin-bottom: 2rem;
}

/* Force a proper vertical tree — override Pico's nav ul/li inline-block rules */
.overlay .overlay-menu,
.overlay .overlay-menu ul {
  display: block;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}
.overlay .overlay-menu li {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
}
.overlay .overlay-menu li::before {
  content: none !important;
}
.overlay .overlay-menu > ul > li + li {
  margin-top: 0.125rem;
}
.overlay .overlay-menu a {
  display: block;
  width: 100%;
  margin: 0; /* kill Pico's negative nav a margin */
  padding: 0.625rem 0;
  font-family: var(--pico-font-family-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--q2-text-strong);
  text-decoration: none;
  letter-spacing: -0.01em;
  line-height: 1.25;
  border-radius: 0;
}
.overlay .overlay-menu a:hover {
  color: var(--q2-text-strong);
  text-decoration: none;
}

/* Nested children — smaller, lighter, indented */
.overlay .overlay-menu ul ul {
  padding-left: 1rem;
  margin: 0.125rem 0 0.5rem;
  border-left: 2px solid var(--q2-divider);
}
.overlay .overlay-menu ul ul a {
  font-size: 1rem;
  font-weight: 500;
  font-family: var(--pico-font-family-sans-serif);
  color: var(--q2-text-muted);
  letter-spacing: 0;
  padding: 0.5rem 0 0.5rem 0.75rem;
}

@media (max-width: 860px) {
  .desktop-menu {
    display: none;
  }
  .mobile-menu {
    display: block;
  }
  .mobile-container {
    display: block;
  }
  #header .navbar {
    min-height: 64px;
  }
  .navbar-section.actions {
    display: none;
  }
}

body.overlay-open {
  overflow: hidden;
}

/* ---------- Hero ---------- */

#blog-hero,
.modular-hero,
.hero {
  position: relative;
  padding-block: clamp(5rem, 12vw, 9rem);
  background-color: var(--q2-bg);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse at 20% 0%,
      color-mix(in oklab, var(--q2-text) 5%, transparent),
      transparent 60%
    ),
    radial-gradient(
      ellipse at 80% 100%,
      color-mix(in oklab, var(--q2-text) 4%, transparent),
      transparent 55%
    );
  pointer-events: none;
  z-index: -1;
}
.hero[style*="background-image"] {
  color: var(--q2-text-inverse);
  background-color: var(--q2-bg-inverse);
}
.hero[style*="background-image"] .image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0.55) 100%
  );
  z-index: -1;
}
.hero[style*="background-image"] h1,
.hero[style*="background-image"] h2,
.hero[style*="background-image"] h3,
.hero[style*="background-image"] p {
  color: #ffffff;
}

/* Hero modifier classes (hero_classes) — parity with Quark 1 (#18) */

/* Height presets */
.hero.hero-fullscreen {
  min-height: 100dvh;
}
.hero.hero-large {
  min-height: clamp(30rem, 60vh, 34rem);
}
.hero.hero-medium {
  min-height: clamp(24rem, 48vh, 27rem);
}
.hero.hero-small {
  min-height: 7rem;
}
.hero.hero-tiny {
  min-height: 5rem;
}

/* Foreground presets (theme-independent — for text over imagery) */
.hero.text-light h1,
.hero.text-light h2,
.hero.text-light h3 {
  color: #ffffff;
}
.hero.text-light p,
.hero.text-light .lead {
  color: color-mix(in oklab, #ffffff 78%, transparent);
}
.hero.text-dark h1,
.hero.text-dark h2,
.hero.text-dark h3 {
  color: var(--q2-text-strong, #111111);
}
.hero.text-dark p,
.hero.text-dark .lead {
  color: color-mix(in oklab, #242424 72%, transparent);
}

/* Close h1/h2 title pairing */
.title-h1h2 h1 {
  font-weight: 100;
  margin-bottom: 0;
  line-height: 1.1;
}
.title-h1h2 h1 strong,
.title-h1h2 h1 b {
  font-weight: 400;
}
.title-h1h2 h1 + h2 {
  margin-top: 0;
  margin-bottom: 3rem;
  line-height: 1.1;
  font-weight: 700;
}

/* Image-overlay tints — only meaningful on heroes with a background image */
.hero[style*="background-image"].overlay-light .image-overlay {
  background: color-mix(in oklab, #ffffff 40%, transparent);
}
.hero[style*="background-image"].overlay-light-gradient .image-overlay {
  background: linear-gradient(
    to bottom,
    color-mix(in oklab, #ffffff 50%, transparent),
    color-mix(in oklab, #ffffff 20%, transparent)
  );
}
.hero[style*="background-image"].overlay-dark .image-overlay {
  background: color-mix(in oklab, #000000 40%, transparent);
}
.hero[style*="background-image"].overlay-dark-gradient .image-overlay {
  background: linear-gradient(
    to bottom,
    color-mix(in oklab, #000000 50%, transparent),
    color-mix(in oklab, #000000 20%, transparent)
  );
}

.hero .container {
  position: relative;
  z-index: 1;
}
.hero h1 {
  margin-bottom: 1rem;
}
.hero p,
.hero .lead {
  color: var(--q2-text-muted);
  max-width: 48ch;
  margin-inline: auto;
}

#to-start {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--q2-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  animation: q2-bob 2.4s ease-in-out infinite;
  z-index: 2;
}
@keyframes q2-bob {
  0%,
  100% {
    transform: translate(-50%, 0);
  }
  50% {
    transform: translate(-50%, 6px);
  }
}

/* ---------- Buttons ---------- */

.btn,
button:not([role="button"]).btn,
a.btn,
[type="button"].btn,
[type="submit"].btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  font-family: var(--pico-font-family-sans-serif);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.1px;
  color: var(--q2-accent-contrast);
  background: var(--q2-accent);
  border: 0;
  border-radius: var(--q2-radius);
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--q2-shadow-hl);
  transition:
    opacity 0.15s ease,
    transform 0.05s ease,
    box-shadow 0.15s ease;
}
.btn:hover {
  opacity: 0.9;
  color: var(--q2-accent-contrast);
  text-decoration: none;
}
.btn:active {
  transform: translateY(0.5px);
}
.btn:focus-visible {
  outline: 2px solid var(--q2-focus-ring);
  outline-offset: 2px;
}

.btn.btn-ghost,
.btn.btn-outline {
  color: var(--q2-text-strong);
  background: var(--q2-bg-elev);
  box-shadow: var(--q2-shadow-card);
}
.btn.btn-ghost:hover,
.btn.btn-outline:hover {
  background: var(--q2-bg-muted);
  opacity: 1;
}

.btn.btn-pill {
  border-radius: var(--q2-radius-pill);
}
.btn.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}
.btn.btn-lg {
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
}

/* ---------- Cards ---------- */

.card {
  display: flex;
  flex-direction: column;
  background: var(--q2-bg-elev);
  border-radius: var(--q2-radius-md);
  box-shadow:
    rgba(19, 19, 22, 0.04) 0 1px 2px,
    rgba(19, 19, 22, 0.06) 0 8px 24px -8px;
  overflow: hidden;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
  break-inside: avoid;
}
.card:hover {
  box-shadow:
    rgba(19, 19, 22, 0.06) 0 1px 2px,
    rgba(19, 19, 22, 0.1) 0 14px 32px -8px;
  transform: translateY(-2px);
}
/* Dark mode — borderless too, just with deeper ambient shadow. */
:root[data-theme="dark"] .card {
  box-shadow:
    rgba(0, 0, 0, 0.4) 0 1px 2px,
    rgba(0, 0, 0, 0.55) 0 10px 28px -8px;
}
:root[data-theme="dark"] .card:hover {
  box-shadow:
    rgba(0, 0, 0, 0.5) 0 1px 2px,
    rgba(0, 0, 0, 0.65) 0 16px 36px -8px;
}

.card-image {
  display: block;
}
.card-image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.card-header {
  padding: 1.25rem 1.375rem 0.625rem;
}
.card-body {
  padding: 0 1.375rem 0.75rem;
  flex: 1;
}
.card-footer {
  padding: 0.5rem 1.375rem 1.25rem;
  margin-top: auto;
}

.card-subtitle {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--q2-text-muted);
}
.card-subtitle .blog-date i {
  font-size: 0.8125rem;
  margin-right: 0.25rem;
  opacity: 0.75;
}

.card-title {
  margin-top: 0.5rem;
}
.card-title :is(h1, h2, h3, h4, h5, h6) {
  margin: 0;
  font-family: var(--pico-font-family-display);
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--q2-text-strong);
}
.card-title :is(h1, h2)::before {
  display: none;
}
.card-title a {
  color: inherit;
  text-decoration: none;
}
.card-title a:hover {
  color: var(--q2-link);
  text-decoration: none;
}

/* Tone down any headings in the rendered summary — so markdown `# H1` inside
 * a summary doesn't blow up the card. */
.card-body :is(h1, h2, h3, h4, h5, h6) {
  margin: 0 0 0.25rem;
  font-family: var(--pico-font-family-sans-serif);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
  color: var(--q2-text);
}
.card-body :is(h1, h2)::before {
  display: none;
}
.card-body p {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--q2-text-muted);
}
.card-body p:last-child {
  margin-bottom: 0;
}
.card-body > :first-child {
  margin-top: 0;
}

/* Bricklayer (masonry) */
.bricklayer {
  display: block;
}
.bricklayer [data-bricklayer-column] {
  padding: 0 0.75rem;
}
.bricklayer .card {
  margin-bottom: 1.5rem;
}
@media (max-width: 720px) {
  .bricklayer [data-bricklayer-column] {
    padding: 0;
  }
}

/* ---------- Tags / Labels ---------- */

.tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}
.label {
  display: inline-flex;
  align-items: center;
  font-family: var(--pico-font-family-sans-serif);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0;
  padding: 0.25rem 0.625rem;
  border-radius: var(--q2-radius-pill);
  background: var(--q2-bg-muted);
  color: var(--q2-text-strong);
  text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--q2-border-ring);
}
.label:hover {
  background: var(--q2-bg);
  text-decoration: none;
  color: var(--q2-text-strong);
}
.label-primary {
  background: var(--q2-text);
  color: var(--q2-text-inverse);
  box-shadow: none;
}
.label-primary:hover {
  color: var(--q2-text-inverse);
  opacity: 0.9;
}

/* ---------- Forms ---------- */

.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-weight: 500;
  font-size: 0.9375rem;
  margin-bottom: 0.375rem;
  color: var(--q2-text-strong);
  letter-spacing: 0;
}
.form-input,
.form-select,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
textarea,
select {
  background: var(--q2-bg-elev);
  color: var(--q2-text);
  border: 1px solid rgba(34, 42, 53, 0.18);
  border-radius: var(--q2-radius);
  padding: 0.625rem 0.75rem;
  font-family: inherit;
  font-size: 0.9375rem;
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease;
  width: 100%;
}
:root[data-theme="dark"] .form-input,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] input[type="url"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="search"],
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select {
  border-color: rgba(255, 255, 255, 0.14);
}

.form-input:focus,
.form-select:focus,
textarea:focus,
select:focus,
input:focus {
  outline: none;
  border-color: transparent;
  box-shadow:
    0 0 0 2px var(--q2-focus-ring),
    0 0 0 3px var(--q2-bg);
}

.form-checkbox,
.form-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
}
.form-errors {
  color: #d12c2c;
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}

/* ---------- Login plugin (grav-plugin-login) ---------- */

/* login ships its own css/login.css that hardcodes a light panel (#fcfcfc bg,
 * #eee border, white delimiter fades) and, being a plugin asset, loads AFTER
 * theme.css. In dark mode that left the panel white while the fields/text inside
 * used the theme's dark tokens: unreadable. Scope the override to dark so it
 * out-specifies the plugin's plain #grav-login and leaves light mode (already
 * correct) alone. (quark2#14) */
:root[data-theme="dark"] #grav-login {
  background: var(--q2-bg-elev);
  border-color: var(--q2-border-ring);
  box-shadow: var(--q2-shadow-card);
  color: var(--q2-text);
}
:root[data-theme="dark"] #grav-login .delimiter::before {
  background-image: linear-gradient(to right, var(--q2-text-muted), var(--q2-bg-elev));
}
:root[data-theme="dark"] #grav-login .delimiter::after {
  background-image: linear-gradient(to left, var(--q2-text-muted), var(--q2-bg-elev));
}

/* ---------- Form plugin fields ---------- */

/* Tabs — defeat form plugin's box-around-active + forced span color, give proper underlined active state */
.form-tabs .tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--q2-divider);
}
.form-tabs .tabs-nav a.tab__link,
.form-tabs .tabs-nav .tab__link {
  flex: 0 0 auto;
  padding: 0.75rem 1.25rem;
  margin: 0 0 -1px 0;
  color: var(--q2-text-muted);
  background: transparent;
  font-weight: 500;
  font-size: 0.9375rem;
  text-align: center;
  text-decoration: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease;
}
.form-tabs .tabs-nav a.tab__link span,
.form-tabs .tabs-nav .tab__link span {
  color: inherit;
}
.form-tabs .tabs-nav a.tab__link:hover,
.form-tabs .tabs-nav .tab__link:hover {
  color: var(--q2-text-strong);
  text-decoration: none;
}
.form-tabs .tabs-nav a.tab__link.active,
.form-tabs .tabs-nav .tab__link.active {
  color: var(--q2-text-strong);
  border: 0;
  border-bottom: 2px solid var(--q2-accent);
  margin: 0 0 -1px 0;
}
.form-tabs .tabs-nav a.tab__link.active span,
.form-tabs .tabs-nav .tab__link.active span {
  color: var(--q2-text-strong);
}
.form-tabs .tabs-content .tab__content {
  display: none;
  padding-top: 1.5rem;
}
.form-tabs .tabs-content .tab__content.active {
  display: block;
}

/* Toggle (switch-toggle) — single segmented control, no inter-label margin */
.switch-toggle.switch-grav {
  display: inline-flex;
  align-items: stretch;
  background: var(--q2-bg-elev);
  border: 1px solid var(--q2-border-strong);
  border-radius: var(--q2-radius);
  overflow: hidden;
  line-height: 1;
}
.switch-toggle.switch-grav input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  margin: 0;
}
/* Neutralize Pico's `[type=radio]~label:not(:last-of-type)` 1em margin inside the toggle */
.switch-toggle.switch-grav input[type="radio"] ~ label:not(:last-of-type),
.switch-toggle.switch-grav input[type="checkbox"] ~ label:not(:last-of-type) {
  margin-inline-end: 0;
}
.switch-toggle.switch-grav label {
  margin: 0;
  padding: 0.625rem 1rem;
  line-height: 1.15;
  color: var(--q2-text-muted);
  background: transparent;
  cursor: pointer;
  user-select: none;
  font-size: 0.9375rem;
  white-space: nowrap;
  border-inline-start: 1px solid var(--q2-border-strong);
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.switch-toggle.switch-grav label:first-of-type {
  border-inline-start: 0;
}
.switch-toggle.switch-grav label:hover {
  color: var(--q2-text-strong);
}
/* Beat form plugin's `.switch-toggle input:checked+label { color:#fff; background:#999 }` */
.switch-toggle.switch-grav input[type="radio"]:checked + label,
.switch-toggle.switch-grav input[type="radio"].highlight:checked + label {
  background: var(--q2-accent);
  color: var(--q2-accent-contrast);
  border-inline-start-color: var(--q2-accent);
}
.switch-toggle.switch-grav input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--q2-focus-ring);
  outline-offset: 2px;
}

/* Submit / reset buttons — match .btn, never full-width.
 * Wrapper class varies by form (`buttons` default, `button-wrapper` in some blueprints). */
.form-wrapper .buttons,
.form-wrapper .button-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 1.75rem;
}
.form-wrapper .buttons button,
.form-wrapper .buttons input[type="submit"],
.form-wrapper .buttons input[type="reset"],
.form-wrapper .button-wrapper button,
.form-wrapper .button-wrapper input[type="submit"],
.form-wrapper .button-wrapper input[type="reset"] {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.1px;
  color: var(--q2-accent-contrast);
  background: var(--q2-accent);
  border: 0;
  border-radius: var(--q2-radius);
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--q2-shadow-hl);
  transition:
    opacity 0.15s ease,
    transform 0.05s ease;
}
.form-wrapper .buttons button:hover,
.form-wrapper .buttons input[type="submit"]:hover,
.form-wrapper .button-wrapper button:hover,
.form-wrapper .button-wrapper input[type="submit"]:hover {
  opacity: 0.9;
  color: var(--q2-accent-contrast);
}
.form-wrapper .buttons button:active,
.form-wrapper .button-wrapper button:active {
  transform: translateY(0.5px);
}
.form-wrapper .buttons button[type="reset"],
.form-wrapper .buttons input[type="reset"],
.form-wrapper .button-wrapper button[type="reset"],
.form-wrapper .button-wrapper input[type="reset"] {
  background: var(--q2-bg-elev);
  color: var(--q2-text);
  box-shadow: var(--q2-shadow-card);
}
.form-wrapper .buttons button[type="reset"]:hover,
.form-wrapper .button-wrapper button[type="reset"]:hover {
  background: var(--q2-bg-muted);
  color: var(--q2-text);
  opacity: 1;
}

/* Checkboxes & radios — accent-tinted, dark-mode-friendly, consistent sizing */
.form-wrapper input[type="checkbox"],
.form-wrapper input[type="radio"] {
  accent-color: var(--q2-accent);
  width: 1.25rem;
  height: 1.25rem;
  vertical-align: middle;
  margin-right: 0.5rem;
}
/* Force squares for checkboxes — Pico's 8px radius on a 17px input renders nearly circular */
.form-wrapper input[type="checkbox"] {
  border-radius: var(--q2-radius-xs);
}

/* `.checkboxes` group AND `.checkboxes.toggleable` (the field-enable toggle):
 * form plugin display:none's the native input and uses label::before for the box,
 * absolutely positioned at left:0 — that breaks when the label is empty (toggleable)
 * and forces every consumer to reserve 20px of padding. Flatten the pseudo to
 * static flow so it sits inline like a real checkbox glyph. */
.form-wrapper .checkboxes {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
}
.form-wrapper .checkboxes > label,
.form-wrapper .checkboxes.toggleable > label {
  position: static;
  margin: 0;
  padding: 0;
}
.form-wrapper .checkboxes label::before,
.form-wrapper .checkboxes.toggleable label::before {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0 0.5rem 0 0;
  padding: 0;
  vertical-align: middle;
  line-height: 1;
  font-size: 0.875rem;
  border: 1px solid var(--q2-border-strong);
  background: var(--q2-bg-elev);
  border-radius: var(--q2-radius-xs);
  color: var(--q2-text);
}
.form-wrapper .checkboxes input[type="checkbox"]:checked + label::before,
.form-wrapper
  .checkboxes.toggleable
  input[type="checkbox"]:checked
  + label::before {
  content: "";
  background-color: var(--q2-accent);
  background-image: var(--pico-icon-checkbox);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 64%;
  border-color: var(--q2-accent);
  color: transparent;
}

/* Basic captcha — strip the form plugin's hard-coded #ccc chrome and the
 * accent-button styling that bleeds onto the reload icon. Constrain the
 * image so the reload button stays visible. */
.form-wrapper .form-data.basic-captcha .form-input-wrapper {
  border-color: var(--q2-border-strong);
  border-radius: var(--q2-radius);
  background: var(--q2-bg-elev);
  align-items: stretch;
}
.form-wrapper .form-data.basic-captcha .form-input-prepend {
  background: var(--q2-bg-muted);
  color: var(--q2-text);
  align-items: center;
  padding: 0 0.25rem 0 0;
}
.form-wrapper .form-data.basic-captcha .form-input-prepend img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 130px;
  margin: 0;
  align-self: stretch;
  object-fit: cover;
}
.form-wrapper
  .form-data.basic-captcha
  .form-input-prepend
  .reload-captcha-button {
  background: transparent;
  color: var(--q2-text-muted);
  border: 0;
  border-radius: var(--q2-radius-sm);
  padding: 0.25rem 0.5rem;
  margin: 0;
  width: auto;
  height: auto;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}
.form-wrapper
  .form-data.basic-captcha
  .form-input-prepend
  .reload-captcha-button:hover {
  color: var(--q2-text-strong);
  background: var(--q2-bg-elev);
  opacity: 1;
}
.form-wrapper
  .form-data.basic-captcha
  .form-input-prepend
  .reload-captcha-button
  svg {
  width: 16px;
  height: 16px;
  margin: 0;
}
.form-wrapper .form-data.basic-captcha input.form-input {
  margin: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
}
.form-wrapper .form-data.basic-captcha input.form-input:focus {
  box-shadow: none;
}

/* Dropzone (default `file` field) — strip hardcoded white + #ccc dashed border for dark mode */
.form-wrapper .form-input-file.dropzone,
.form-wrapper .dropzone {
  background: var(--q2-bg-elev);
  border: 2px dashed var(--q2-border-strong);
  border-radius: var(--q2-radius);
  color: var(--q2-text-muted);
  padding: 1.25rem 0.5rem;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}
.form-wrapper .dropzone:hover {
  border-color: var(--q2-accent);
  color: var(--q2-text);
}
.form-wrapper .dropzone .dz-default.dz-message {
  color: var(--q2-text-muted);
}
/* Neutralize the dz-button — Pico styles it as a primary accent pill by default */
.form-wrapper .dropzone .dz-button,
.form-wrapper .dropzone .dz-default button {
  background: var(--q2-bg-muted);
  color: var(--q2-text);
  border: 1px solid var(--q2-border-ring);
  border-radius: var(--q2-radius);
  padding: 0.5rem 1rem;
  margin: 0;
  font-weight: 500;
  font-size: 0.9375rem;
  box-shadow: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.form-wrapper .dropzone .dz-button:hover,
.form-wrapper .dropzone .dz-default button:hover {
  background: var(--q2-bg-elev);
  color: var(--q2-text-strong);
  opacity: 1;
}
.form-wrapper .dropzone .dz-preview .dz-image {
  background: var(--q2-bg-muted);
}
.form-wrapper .dropzone .dz-preview .dz-remove {
  text-decoration: none;
  line-height: 1;
}
.form-wrapper .dropzone .dz-preview .dz-remove:hover {
  text-decoration: none;
}

/* Filepond — panels are filepond's own light-cream backgrounds; align to theme */
.form-wrapper .filepond--panel-root,
.form-wrapper .filepond--panel-top,
.form-wrapper .filepond--panel-center,
.form-wrapper .filepond--panel-bottom {
  background: var(--q2-bg-elev);
}
.form-wrapper .filepond--root {
  border: 1px solid var(--q2-border-strong);
  border-radius: var(--q2-radius);
  color: var(--q2-text);
}
.form-wrapper .filepond--drop-label {
  color: var(--q2-text-muted);
}
.form-wrapper .filepond--drop-label label {
  color: var(--q2-text-muted);
}
.form-wrapper .filepond--label-action {
  color: var(--q2-text-strong);
  text-decoration-color: var(--q2-text-muted);
}
.form-wrapper .filepond--credits {
  color: var(--q2-text-muted);
  opacity: 0.5;
}
.form-wrapper .filepond--file-action-button {
  background-color: rgba(0, 0, 0, 0.4);
  color: #ffffff;
}
.form-wrapper .filepond--item-panel {
  background: var(--q2-bg-muted);
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  border-radius: var(--q2-radius);
  background: var(--q2-bg-elev);
  color: var(--q2-text);
  box-shadow: var(--q2-shadow-card);
  margin-bottom: 1rem;
}
.toast-success,
.toast.success,
.toast.green {
  box-shadow:
    var(--q2-shadow-card),
    inset 3px 0 0 #059669;
}
.toast-error,
.toast.error,
.toast.red {
  box-shadow:
    var(--q2-shadow-card),
    inset 3px 0 0 #d12c2c;
}
.toast-warning,
.toast.warning,
.toast.yellow {
  box-shadow:
    var(--q2-shadow-card),
    inset 3px 0 0 #d97706;
}

/* ---------- Sidebar ---------- */

#sidebar {
  position: relative;
}
.sidebar-content {
  background: var(--q2-bg-elev);
  border-radius: var(--q2-radius-md);
  box-shadow:
    rgba(19, 19, 22, 0.04) 0 1px 2px,
    rgba(19, 19, 22, 0.06) 0 8px 24px -8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
:root[data-theme="dark"] .sidebar-content {
  box-shadow:
    rgba(0, 0, 0, 0.4) 0 1px 2px,
    rgba(0, 0, 0, 0.55) 0 10px 28px -8px;
}
.sidebar-content h4 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--q2-text-muted);
  margin: 0 0 0.75rem;
}
.sidebar-content .btn,
.sidebar-content .button {
  width: auto;
}
.sidebar-content ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-content ul.archives li,
.sidebar-content ul.menu li {
  margin: 0;
}
.sidebar-content ul.archives a,
.sidebar-content ul.menu a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.4375rem 0;
  color: var(--q2-text);
  text-decoration: none;
  line-height: 1.4;
}
.sidebar-content ul.archives a:hover,
.sidebar-content ul.menu a:hover {
  color: var(--q2-link);
  text-decoration: none;
}
.sidebar-content ul.archives a:hover .menu-text,
.sidebar-content ul.menu a:hover .menu-text {
  text-decoration: underline;
}

/* Count/score badge — perfect circle at one digit, pill when wider */
.sidebar-content .menu-score {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.625rem;
  height: 1.625rem;
  padding: 0 0.4375rem;
  border-radius: 9999px;
  background: var(--q2-text);
  color: var(--q2-text-inverse);
  font-family: var(--pico-font-family-sans-serif);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
}
.sidebar-content .menu-text {
  min-width: 0;
  font-size: 0.9375rem;
}

.syndicate .btn {
  margin-right: 0.375rem;
  margin-bottom: 0.375rem;
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0;
  margin: 0 0 1.5rem;
  color: var(--q2-text-muted);
  font-size: 0.875rem;
}
.breadcrumbs li + li::before {
  content: "›";
  margin-right: 0.375rem;
  opacity: 0.6;
}
.breadcrumbs a {
  color: var(--q2-text-muted);
  text-decoration: none;
}
.breadcrumbs a:hover {
  color: var(--q2-text-strong);
}

/* ---------- Blog ---------- */

.blog-listing .content-item {
  max-width: 760px;
  margin-inline: auto;
}

/* Blog page header (rendered when there's no hero image) */
.blog-page-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto clamp(2rem, 4vw, 3rem);
}
.blog-page-header h1 {
  margin: 0 0 0.5rem;
}
.blog-page-header .lead {
  margin: 0;
}
.blog-page-header .blog-page-intro {
  margin-top: 1rem;
  color: var(--q2-text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

/* Blog card grid — capped at 3 cols max so cards have room to breathe */
.blog-grid {
  display: grid;
  gap: clamp(1.25rem, 2vw, 1.75rem);
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}
@media (min-width: 560px) {
  .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1200px) {
  .blog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  /* When a sidebar is present, the cards live in the narrower main column,
   * so 2 cols is the most the space comfortably allows. */
  .columns.has-sidebar .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.blog-grid > .card {
  height: 100%;
  align-self: stretch;
}

/* If sidebar plugins render nothing, collapse the empty aside so it doesn't
 * take a column slot. Requires .has-sidebar to also be conditionally swapped
 * if sidebar widgets are all disabled — handled in layout.html.twig. */
.blog-listing .columns > aside:empty {
  display: none;
}
@media (min-width: 960px) {
  .blog-listing .columns.has-sidebar:has(> aside:empty) {
    grid-template-columns: minmax(0, 1fr);
  }
}
.content-title {
  margin-bottom: 2rem;
}
.content-title h1,
.content-title h2 {
  margin-bottom: 0.5rem;
}

.blog-date {
  font-size: 0.875rem;
  color: var(--q2-text-muted);
}
.blog-date i {
  margin-right: 0.375rem;
  opacity: 0.7;
}

.prev-next {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  margin-top: 3rem;
}
.prev-next .btn {
  flex: 1;
  max-width: 48%;
}

/* ---------- Modular: Features ---------- */

.modular-features {
  background: var(--q2-bg);
}
.modular-features .frame-box {
  max-width: 1100px;
  margin-inline: auto;
}
/* Column counts follow the `Layout` option in blueprints/modular/features.yaml:
 * small = 4 / 3 / 2 and standard = 3 / 2 / 1 across desktop / tablet / phone.
 * Fixed counts rather than auto-fit, so the chosen layout holds at every width
 * instead of the track minimum silently deciding it. */
.modular-features .columns {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 2.5rem;
}
.modular-features[data-layout="standard"] .columns {
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
  .modular-features .columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .modular-features[data-layout="standard"] .columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .modular-features .columns {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .modular-features[data-layout="standard"] .columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.modular-features .column {
  background: var(--q2-bg-elev);
  border-radius: var(--q2-radius-md);
  box-shadow: var(--q2-shadow-card);
  padding: 1.5rem 1.25rem;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}
.modular-features .column:hover {
  box-shadow: var(--q2-shadow-raised);
  transform: translateY(-2px);
}
.modular-features .feature-icon {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.modular-features .feature-icon i {
  font-size: 1.5rem;
  color: var(--q2-text-strong);
}
.modular-features h6 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0;
}
.modular-features .feature-content p {
  color: var(--q2-text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
  margin: 0;
}

/* ---------- Modular: Text ---------- */

.modular-text.bg-gray {
  background: var(--q2-bg-muted);
}
.modular-text .columns {
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}
@media (min-width: 860px) {
  .modular-text .columns {
    grid-template-columns: 1fr 1fr;
    gap: 3.5rem;
  }
  .modular-text .columns.align-left > div:first-child {
    order: 2;
  }
}
.modular-text img {
  border-radius: var(--q2-radius-md);
  box-shadow: var(--q2-shadow-card);
  width: 100%;
  height: auto;
}

/* ---------- Footer ---------- */

/* Override Pico classless body>footer max-width so we can go full-bleed */
body > footer,
body > header,
body > main {
  max-width: none;
  padding: 0;
  width: 100%;
}

#footer {
  border-top: 1px solid var(--q2-divider);
  padding-block: 2.5rem;
  background: var(--q2-bg);
  color: var(--q2-text-muted);
  font-size: 0.875rem;
  text-align: center;
}
#footer a {
  color: var(--q2-text);
  text-decoration: none;
  font-weight: 500;
}
#footer a:hover {
  text-decoration: underline;
}
#footer p {
  margin: 0;
}
.bg-gray {
  background: var(--q2-bg-muted);
}

/* ---------- Pulse / icons ---------- */
.pulse {
  animation: q2-pulse 1.8s ease-in-out infinite;
  display: inline-block;
}
@keyframes q2-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.7;
  }
}

.fa,
.fas,
.fa-solid,
.fa-regular,
.far,
.fa-brands,
.fab {
  display: inline-block;
  line-height: 1;
}

/* ---------- Error ---------- */
#error {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1rem;
}
#error h1 {
  font-size: clamp(3rem, 10vw, 6rem);
  margin-bottom: 0.5rem;
}
#error p {
  max-width: 52ch;
  margin-inline: auto;
  color: var(--q2-text-muted);
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.375rem;
  margin: 2rem 0 0;
  list-style: none;
  padding: 0;
}
.pagination li {
  list-style: none; /* override Pico's `ul li { list-style: square }` */
}
.pagination li a,
.pagination li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.625rem;
  border-radius: var(--q2-radius-sm);
  text-decoration: none;
  color: var(--q2-text);
  background: var(--q2-bg-elev);
  box-shadow: var(--q2-shadow-card);
  font-size: 0.875rem;
}
.pagination li.active a,
.pagination li.active span {
  background: var(--q2-text);
  color: var(--q2-text-inverse);
}

/* ---------- Scroll-top ---------- */
body.scrolled #header {
  box-shadow:
    0 1px 0 var(--q2-nav-border),
    0 8px 24px -12px rgba(0, 0, 0, 0.08);
}

/* ---------- Utilities ---------- */
.mt-1 {
  margin-top: 0.5rem;
}
.mt-2 {
  margin-top: 1rem;
}
.mb-2 {
  margin-bottom: 1rem;
}
.mr-10 {
  margin-right: 0.625rem;
}

img {
  max-width: 100%;
  height: auto;
}

/* Focus ring everywhere */
:focus-visible {
  outline: 2px solid var(--q2-focus-ring);
  outline-offset: 2px;
  border-radius: var(--q2-radius-xs);
}

/* Selection */
::selection {
  background: var(--q2-text);
  color: var(--q2-text-inverse);
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
