:root {
  color-scheme: light;
  --primary: #1d1d9e;
  --background: #fff;
  --surface: #f6f7f9;
  --foreground: #1c1e21;
  --muted: #606770;
  --border: #dadde1;
  font: 16px/1.65 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  scroll-padding-top: 5rem;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #58cdd5;
  --background: #1b1b1d;
  --surface: #242526;
  --foreground: #e3e3e3;
  --muted: #b5b5bb;
  --border: #414145;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--foreground); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
button { cursor: pointer; }
button, summary, a, input { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: -6rem; left: 1rem; z-index: 10; background: var(--background); padding: .6rem 1rem; }
.skip-link:focus { top: .5rem; }
.site-header { height: 64px; position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1.5rem; padding: 0 1.5rem; background: var(--background); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; }
.brand img { max-width: 140px; object-fit: contain; }

.header-link { color: var(--foreground); font-weight: 500; }
.theme-toggle, .icon-button { border: 1px solid var(--border); border-radius: .4rem; background: var(--surface); color: var(--foreground); padding: .3rem .65rem; }
.theme-toggle { margin-left: auto; font-size: .85rem; }
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; min-height: calc(100vh - 240px); }
.sidebar { border-right: 1px solid var(--border); padding: 1.5rem 1rem; position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; }
.nav-group { margin-bottom: 1rem; }
.nav-group summary { font-weight: 700; cursor: pointer; padding: .3rem .4rem; }
.nav-group ul { list-style: none; margin: .3rem 0; padding-left: .8rem; }
.nav-group summary a { color: inherit; }
.nav-group li a { display: block; border-radius: .3rem; color: var(--muted); padding: .3rem .6rem; line-height: 1.45; }
.nav-group li a:hover { background: var(--surface); text-decoration: none; }
.nav-group li a[aria-current="page"] { color: var(--primary); background: var(--surface); font-weight: 600; }
main { min-width: 0; padding: 2.25rem 3rem 4rem; max-width: 1050px; width: 100%; margin: 0 auto; }
h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; }
h1 { font-size: 2.5rem; margin: 0 0 1.5rem; letter-spacing: -.035em; }
h2 { font-size: 1.8rem; margin-top: 2.5rem; }
h3 { font-size: 1.35rem; margin-top: 2rem; }
h1 a, h2 a, h3 a, h4 a { color: inherit; }
p { margin: 1rem 0; }
article img { max-width: 100%; }
article ul, article ol { padding-left: 1.5rem; }
code { font: .875em/1.6 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
:not(pre) > code { background: var(--surface); padding: .15rem .3rem; border-radius: .25rem; overflow-wrap: anywhere; }
pre { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: .5rem; padding: 1rem; overflow: auto; line-height: 1.6; }
/* Zola sets an inline dual scheme; the explicit site toggle must take priority. */
pre { color-scheme: inherit !important; }
pre code { display: block; width: max-content; min-width: 100%; }
.giallo-l { display: inline-block; min-height: 1lh; width: 100%; }
.giallo-ln { display: inline-block; user-select: none; margin-right: .4em; padding: .4em; min-width: 3ch; text-align: right; opacity: .8; }
table { border-collapse: collapse; display: block; max-width: 100%; overflow: auto; margin: 1.5rem 0; font-size: .95rem; }
th, td { border: 1px solid var(--border); padding: .65rem .85rem; text-align: left; min-width: 90px; }
th, tbody tr:nth-child(even) { background: var(--surface); }
blockquote { margin-left: 0; border-left: 4px solid var(--primary); background: var(--surface); padding: .2rem 1rem; }
.toc { position: sticky; top: 88px; align-self: start; border-left: 1px solid var(--border); padding: 0 1rem; margin-top: 2.5rem; max-height: calc(100vh - 110px); overflow: auto; font-size: .8rem; }
.toc ul { padding-left: .85rem; list-style: none; }
.toc > ul { padding-left: 0; }
.toc a { display: block; color: var(--muted); padding: .2rem 0; }
.code-examples { margin: 1.5rem 0; }
.example-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; border-bottom: 1px solid var(--border); }
.example-controls [role="tablist"] { display: flex; flex-wrap: wrap; gap: .25rem; }
.example-controls [role="tab"] { background: transparent; color: var(--muted); border: 0; border-bottom: 3px solid transparent; padding: .65rem .8rem; font-weight: 600; }
.example-controls [aria-selected="true"] { border-bottom-color: var(--primary); color: var(--primary); }
.stream-toggle { display: flex; align-items: center; gap: .4rem; padding: .5rem; font-size: .9rem; cursor: pointer; }
.stream-toggle input { accent-color: var(--primary); width: 1rem; height: 1rem; }
.enhanced .example-label { display: none; }
.content-tabs { margin: 1.5rem 0; }
.content-tabs.enhanced > [data-content-panel] > p:first-child { display: none; }
.copy-code { position: sticky; float: right; right: 0; bottom: 0; padding: .15rem .5rem; border: 1px solid var(--border); border-radius: .25rem; background: var(--background); color: var(--muted); font-size: .75rem; }
.page-navigation { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; }
.page-navigation a { border: 1px solid var(--border); border-radius: .5rem; padding: 1rem; flex: 1; }
.category-pages { list-style: none; padding: 0; }
.category-pages li { border: 1px solid var(--border); padding: 1rem; border-radius: .5rem; margin: 1rem 0; }
.site-footer { background: #303846; color: #eee; padding: 2rem max(2rem, 8vw); display: flex; flex-wrap: wrap; gap: 4rem; }
.site-footer div { display: grid; gap: .5rem; }
.site-footer a { color: #eee; }
.site-footer p { flex-basis: 100%; margin: 0; text-align: center; font-size: .9rem; }
:root[data-sidebar-hidden="true"] .sidebar { display: none; }
:root[data-sidebar-hidden="true"] .layout { grid-template-columns: minmax(0, 1fr) 220px; }
@media (max-width: 1200px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
  :root[data-sidebar-hidden="true"] .layout { grid-template-columns: minmax(0, 1fr); }
  main { padding: 2rem; }
}
@media (max-width: 800px) {
  .site-header { padding: 0 1rem; gap: .75rem; }
  .header-link { display: none; }
  .layout { display: block; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  main { padding: 1.5rem 1rem 3rem; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  .site-footer { gap: 2rem; }
}
