/* "Every canvas" layer on top of the lavender theme: a sticky section nav, and sections set
   apart as alternating bands that each open with a canvas ruler, a connector, and a
   numbered heading. */
:root { --nav-h: 60px; --band: #f4f1fb; --ruler: #c9bde3; --violet: #59318a; }

/* Sticky nav */
.site-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; height: var(--nav-h); padding: 0 max(24px, calc((100% - 1150px) / 2)); border-bottom: 1px solid #e3dcef; background: #fffefdd9; -webkit-backdrop-filter: blur(12px) saturate(1.3); backdrop-filter: blur(12px) saturate(1.3); }
.site-nav-brand { display: flex; flex: none; align-items: center; gap: 10px; color: #25304a; font: 700 16px/1 var(--display-font); letter-spacing: -.03em; text-decoration: none; }
.site-nav-brand img { width: 26px; height: 26px; object-fit: contain; }
.site-nav-brand em { font-style: normal; color: #5a58b6; }
.site-nav-links { display: flex; flex: 1; justify-content: flex-end; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.site-nav-links::-webkit-scrollbar { display: none; }
.site-nav-links a { flex: none; padding: 7px 12px; border-radius: 999px; color: #56627b; font: 600 13px/1 var(--display-font); text-decoration: none; white-space: nowrap; transition: color .18s, background .18s; }
.site-nav-links a:hover { background: #f1ecf8; color: var(--violet); }
.site-nav-links a[aria-current] { background: var(--violet); color: #fff; }
.site-nav-progress { position: absolute; bottom: -1px; left: 0; width: 100%; height: 2px; background: linear-gradient(90deg, #4557b8, #7950aa 60%, #a25f83); transform: scaleX(var(--progress, 0)); transform-origin: left; pointer-events: none; }
.section-block { scroll-margin-top: calc(var(--nav-h) + 4px); }

.site-hero { padding-top: 96px; padding-bottom: 84px; }

/* Sections: alternating bands, a ruler along the top edge, and a numbered heading. */
main { counter-reset: section; }
main > .section-block { padding-top: 78px; padding-bottom: 78px; border-top: 1px solid #e6dff1; }
main > .section-block:nth-child(even) { background-color: var(--band); }
main > .teaser-block { padding-top: 56px; border-top: 0; }
main > .section-block:not(.teaser-block) { counter-increment: section; }
main > .section-block > * { position: relative; z-index: 1; }

h2 { display: flex; align-items: center; gap: 16px; padding: 0; margin-bottom: 26px; }
h2::before { content: counter(section, decimal-leading-zero); position: relative; top: auto; left: auto; display: grid; flex: none; place-items: center; width: 50px; height: 38px; border: 1.5px solid var(--violet); border-radius: 4px; background: #fff; color: var(--violet); font: 700 15px/1 var(--display-font); letter-spacing: 0; box-shadow: 0 3px 0 #e3dced; transition: none; }
h2:hover::before { transform: none; }
h2::after { position: relative; top: auto; bottom: auto; left: auto; flex: 1; min-width: 32px; width: auto; height: 7px; margin-left: 4px; transform: translateY(2px); }
.teaser-block h2::before { content: none; }

/* The ruler and the page-as-flowchart connector are background layers, so the section's
   ::before / ::after stay free for the original margin routes in theme.css. The connector
   leaves a port on the ruler and arrives, with an arrowhead, at the number badge; its layers
   are positioned from the content box, whose left edge is the badge's left edge. */
main { --pad-top: 78px; --badge-w: 50px; --wire: #ab99d6; }
main > .section-block:not(.teaser-block) {
  --x: calc(var(--badge-w) / 2 - 6px);
  background-image:
    repeating-linear-gradient(90deg, var(--ruler) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(90deg, var(--ruler) 0 1px, transparent 1px 16px),
    radial-gradient(circle at 6px 5px, #fff 0 2.6px, var(--wire) 2.7px 4px, transparent 4.2px),
    repeating-linear-gradient(to bottom, var(--wire) 0 5px, transparent 5px 9px),
    linear-gradient(to bottom left, var(--wire) 50%, transparent 50%),
    linear-gradient(to bottom right, var(--wire) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-origin: padding-box, padding-box, content-box, content-box, content-box, content-box;
  background-size: 100% 9px, 100% 4px, 12px 10px, 1.5px calc(var(--pad-top) - 21px), 6px 7px, 6px 7px;
  background-position: 0 0, 0 0, var(--x) calc(-1 * var(--pad-top)), calc(var(--x) + 5.25px) calc(11px - var(--pad-top)), var(--x) -9px, calc(var(--x) + 6px) -9px;
}

/* Style transfer: keep the side arrows clear of the images (phones move them above). */
.style-carousel .style-gallery { padding: 0 56px; }
@media (max-width: 640px) { .style-carousel .style-gallery { padding: 0; } }

/* Panels sit on white inside the tinted bands so the figures stay crisp. */
main > .section-block:nth-child(even) .showcase-frame::before,
main > .section-block:nth-child(even) .table-block,
main > .section-block:nth-child(even) .method-player { background-color: #fff; }

.site-nav-toggle { display: none; }
@media (max-width: 800px) {
  /* Hamburger: the links drop down as a panel under the bar. */
  .site-nav { justify-content: space-between; }
  .site-nav-toggle { display: grid; flex: none; place-content: center; gap: 4px; width: 40px; height: 40px; padding: 0; border: 1px solid #e3dcef; border-radius: 10px; background: #fff; }
  .site-nav-toggle span { display: block; width: 18px; height: 2px; border-radius: 1px; background: #3e3a5c; transition: transform .2s, opacity .2s; }
  .site-nav.is-open .site-nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .site-nav.is-open .site-nav-toggle span:nth-child(2) { opacity: 0; }
  .site-nav.is-open .site-nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .site-nav-links { position: absolute; top: 100%; right: 0; left: 0; display: none; flex-direction: column; gap: 2px; padding: 10px 16px 14px; overflow: visible; border-bottom: 1px solid #e3dcef; background: #fffefd; box-shadow: 0 14px 28px -18px #2b1a4a59; }
  .site-nav.is-open .site-nav-links { display: flex; }
  .site-nav-links a { padding: 12px 14px; border-radius: 10px; font-size: 15px; }
  .site-hero { padding-top: 64px; padding-bottom: 56px; }
  main > .section-block { padding-top: 60px; padding-bottom: 60px; }
  main { --pad-top: 60px; }
}
/* Phones: the routed flowchart lines behind the hero title compete with the text, so only the
   soft color glows stay. */
@media (max-width: 640px) {
  .intro-region::after { display: none; }
}
@media (max-width: 480px) {
  :root { --nav-h: 54px; }
  .site-nav { padding: 0 12px; }
  main > .section-block { padding-top: 48px; padding-bottom: 48px; }
  main { --pad-top: 48px; --badge-w: 42px; }
  h2 { gap: 12px; }
  h2::before { width: 42px; height: 32px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .site-nav-links a, .site-nav-toggle span { transition: none; }
}
