/* Demo page styles, shared by the datastar-attribute-* plugin demos.
   Tokens from zweiundeins.gmbh (20-tokens.css). */
@font-face { font-family: 'Newsreader Display'; src: url('fonts/newsreader-display.woff2') format('woff2'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url('fonts/hanken-grotesk.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('fonts/jetbrains-mono.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
    color-scheme: light dark;

    --brand: #005546;
    --brand-ink: #003d33;
    --accent: light-dark(#005546, #74d1ac);
    --tint: light-dark(#e6efeb, #12322b);
    --wash: light-dark(#f1f6f3, #0f2723);
    --paper: light-dark(#fbfaf7, #0b1714);
    --surface: light-dark(#ffffff, #10201c);
    --ink: light-dark(#13201d, #e4ece8);
    --muted: light-dark(#4d5a56, #a3b3ad);
    --line: light-dark(#dde3df, #24392f);
    --field: light-dark(#8a9a94, #4b6159);
    --signal: light-dark(#b4472b, #f08a6c);
    --button: light-dark(#005546, #1c7a63);
    --code-bg: light-dark(#0e1f1c, #07110f);
    --code-ink: #dbe7e2;

    --sans: 'Hanken Grotesk', system-ui, sans-serif;
    --display: 'Newsreader Display', Georgia, serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;

    --wrap: 72rem;
    --gutter: clamp(1rem, 4vw, 2rem);
    --radius: 6px;
    --step-1: 1.25rem;
    --step-2: 1.6rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1.5rem; }
@media (prefers-reduced-motion: no-preference) { html:focus-within { scroll-behavior: smooth; } }
body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font: 400 1.0625rem/1.6 var(--sans);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.15; letter-spacing: -.02em; font-weight: 600; text-wrap: balance; }
h1, h2 { font-family: var(--display); font-weight: 500; }
h1 { font-size: clamp(2.2rem, 1.4rem + 3.4vw, 3.6rem); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); margin-top: 1.75rem; }
h4 { font-size: 1rem; margin-top: 1.25rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
ul { margin: .5rem 0 1rem; padding-left: 1.4rem; }
li { margin-bottom: .25rem; }
li > ul { margin: .25rem 0; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: color-mix(in oklab, var(--accent) 30%, transparent); }
pre, code, kbd { font-family: var(--mono); font-variant-ligatures: none; }
:not(pre) > code { font-size: .86em; background: var(--tint); padding: .1em .35em; border-radius: 3px; overflow-wrap: anywhere; }
kbd {
    display: inline-block;
    font-size: .8em;
    line-height: 1.3;
    padding: .1em .45em;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink);
}

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

/* header */
.page-head { background: var(--wash); border-bottom: 1px solid var(--line); padding-block: clamp(2.5rem, 7vw, 4.5rem) clamp(2rem, 5vw, 3rem); }
.eyebrow {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 0 0 1.25rem;
    font: 600 .78rem/1.2 var(--sans);
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
}
.eyebrow::before { content: ''; inline-size: 2rem; block-size: 1px; background: currentColor; flex: none; }
.page-head h1 { font-family: var(--mono); font-weight: 500; letter-spacing: -.04em; font-size: clamp(2rem, 1.2rem + 3.6vw, 3.4rem); overflow-wrap: anywhere; }
.lead { font-size: var(--step-1); color: var(--muted); max-width: 40rem; margin-bottom: 1.75rem; }

/* buttons */
.btn-row, .actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.actions { margin-top: 1rem; }
.btn, .card button {
    display: inline-block;
    padding: .72rem 1.05rem;
    text-align: center;
    border-radius: var(--radius);
    border: 1px solid var(--button);
    background: var(--button);
    color: #fff;
    font: 600 .95rem/1.1 var(--sans);
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover, .card button:hover { background: var(--brand-ink); text-decoration: none; }
.btn-ghost, .card button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover, .card button.ghost:hover { background: transparent; border-color: var(--accent); }
.card button:disabled { opacity: .55; cursor: not-allowed; }

/* layout: sidebar and demo cards */
.layout { display: grid; gap: 2rem; padding-block: 2.5rem 4rem; }
@media (min-width: 62rem) {
    .layout { grid-template-columns: 17rem minmax(0, 1fr); align-items: start; gap: 2.5rem; }
    .sidebar { position: sticky; top: 1.5rem; max-height: calc(100dvh - 3rem); overflow-y: auto; }
}
.demos { display: grid; gap: 1.5rem; min-width: 0; }

.sidebar { display: grid; gap: .75rem; font-size: .92rem; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel > summary {
    cursor: pointer;
    list-style: none;
    padding: .75rem 2.25rem .75rem 1rem;
    position: relative;
    font: 600 .78rem/1.2 var(--sans);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent);
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after { content: '+'; position: absolute; right: 1rem; top: .55rem; font: 400 1.1rem/1 var(--mono); }
.panel[open] > summary::after { content: '\2212'; }
.panel-body { padding: 0 1rem 1rem; }
.panel-body > :last-child { margin-bottom: 0; }
.label { font: 500 .72rem/1.3 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: .75rem 0 .35rem; }
.label:first-child { margin-top: 0; }
.toc { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { margin: 0; }
.toc a { display: block; padding: .3rem 0 .3rem .75rem; border-left: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.toc a:hover { border-left-color: var(--accent); color: var(--accent); }
.signals { margin: 0; max-height: 24rem; overflow: auto; font-size: .72rem; }

/* demo card */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(1.1rem, 3vw, 1.75rem);
    min-width: 0;
}
.card > p:first-of-type, .card-intro { color: var(--muted); }
.card-num { display: block; margin-bottom: .6rem; font: 500 .8rem/1 var(--mono); color: var(--accent); }
.card h2 { margin-bottom: .4rem; }
.card h3 code, .card h2 code { font-size: .8em; }
.card hr { border: 0; border-top: 1px solid var(--line); margin: 1.75rem 0; }

/* code */
.code {
    margin: .75rem 0 1.25rem;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    background: var(--code-bg);
    color: var(--code-ink);
    border-radius: var(--radius);
    font: 400 .8rem/1.6 var(--mono);
    tab-size: 4;
}
.code code { background: none; padding: 0; font-size: inherit; color: inherit; }
.hl-keyword { color: #f0a77f; }
.hl-value { color: #a8dcb9; }
.hl-comment { color: #7d948d; font-style: italic; }
.hl-type, .hl-attribute { color: #8cc8f0; }
.hl-property { color: #e6d58e; }
.hl-variable { color: #d7b8f3; }
.hl-operator { color: #f0a77f; }
.sidebar .code { font-size: .7rem; padding: .7rem .8rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }

/* demo output */
.readout {
    margin: 1rem 0;
    padding: .9rem 1rem;
    background: var(--wash);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font: 400 .9rem/1.5 var(--mono);
    overflow-wrap: anywhere;
}
.counter {
    margin: 1rem 0;
    padding: .9rem 1rem;
    background: var(--wash);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-align: center;
    font: 500 2rem/1.2 var(--mono);
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.split { display: grid; gap: 1rem; }
@media (min-width: 36rem) { .split { grid-template-columns: 1fr 1fr; } }
.split .counter { margin-bottom: .35rem; }
.caption { text-align: center; color: var(--muted); font-size: .9rem; }
.fine { font-size: .9rem; color: var(--muted); }
.note {
    margin: 1.25rem 0 0;
    padding: 1rem 1.1rem;
    background: var(--wash);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    font-size: .92rem;
}
.note h4 { margin: 0 0 .4rem; }
.note ul { margin-bottom: 0; }
.note > :last-child { margin-bottom: 0; }

/* form controls */
.card input:not([type='checkbox'], [type='radio'], [type='range']), .card textarea {
    display: block;
    width: 100%;
    margin: .5rem 0;
    padding: .65rem .8rem;
    min-height: 2.75rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--field);
    border-radius: var(--radius);
    font: inherit;
}
.card textarea { resize: vertical; }
.card :is(input, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.card :is(input, textarea):disabled, .card :is(input, textarea):read-only:not([type]) { background: var(--wash); }
.card :is(input, textarea):disabled { color: var(--muted); cursor: not-allowed; }
input[type='checkbox'], input[type='range'] { accent-color: var(--button); }
input[type='checkbox'] { inline-size: 1.1rem; block-size: 1.1rem; margin: 0; }
.control-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: .75rem 0; }
.control-row > span:first-child { min-width: 11rem; font-weight: 600; }
.control-row input[type='range'] { flex: 1 1 10rem; }

dialog {
    max-width: 30rem;
    width: calc(100% - 2rem);
    padding: 1.75rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1.5rem 3rem rgb(0 0 0 / .25);
}
dialog::backdrop { background: rgb(5 20 17 / .55); }
dialog h3 { margin-top: 0; }

/* footer */
.page-foot { border-top: 1px solid var(--line); padding-block: 2.5rem; font-size: .92rem; color: var(--muted); }
.page-foot .wrap { display: grid; gap: 1rem; }
@media (min-width: 48rem) { .page-foot .wrap { grid-template-columns: 1fr auto; align-items: end; } }
.foot-links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.foot-links li { margin: 0; }
.foot-links a { color: var(--muted); display: inline-block; padding-block: .35rem; }
.foot-links a:hover { color: var(--accent); }
.page-foot p { margin: 0; }
.maintainer { font: 500 .8rem/1.5 var(--mono); }
.split:has(> .counter + .readout) { margin: 1rem 0; align-items: stretch; }
.split > .counter, .split > .readout { margin: 0; display: grid; place-items: center; }

/* header: intro on the left, install on the right */
.head-grid { display: grid; gap: 2rem; }
@media (min-width: 62rem) { .head-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 27rem); align-items: center; gap: 3.5rem; } }
.head-main { min-width: 0; }
.head-main > :last-child { margin-bottom: 0; }
.install {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 2px);
    padding: 1rem 1.1rem 1.15rem;
    box-shadow: 0 1.25rem 2.5rem -2rem color-mix(in oklab, var(--brand) 45%, transparent);
}
.install-title { margin: 0 0 .6rem; font: 600 .78rem/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.snippet + .snippet { margin-top: .9rem; }
.snippet-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .35rem; }
.snippet-head .label { margin: 0; }
.snippet .code {
    margin: 0;
    font-size: .74rem;
    line-height: 1.55;
    padding: .75rem .9rem;
    white-space: pre;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in oklab, var(--code-ink) 35%, transparent) transparent;
}
.copy {
    flex: none;
    padding: .28rem .55rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font: 500 .68rem/1 var(--mono);
    letter-spacing: .04em;
    cursor: pointer;
}
.copy:hover { border-color: var(--accent); color: var(--accent); }

/* left navigation: slim scrollbar in the accent colour */
.sidebar { scrollbar-width: thin; scrollbar-color: var(--accent) transparent; overscroll-behavior: contain; }
