/* Page layout and the banner look. Components come from defuss-shadcn (vendor/ui.css); this file only
   places them and adds the hero, format colors, byte map and docs grid. */

html { scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--foreground); font-family: var(--font-sans); }
[hidden] { display: none !important; } /* components set display, which would beat the attribute */
[id] { scroll-margin-top: 5rem; }
.page { max-width: 72rem; margin-inline: auto; padding-inline: 1rem; box-sizing: border-box; }
.section { padding-block: 3.5rem; }
.section > h2 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem); letter-spacing: -0.02em; margin: 0 0 0.5rem; }
.section > .lead { color: var(--muted-foreground); margin: 0 0 1.75rem; max-width: 46rem; }
.gradient-text { background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
img, svg { max-width: 100%; }

/* header */
.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px); background: color-mix(in oklch, var(--background) 82%, transparent); border-bottom: 1px solid var(--border); }
.topbar .page { display: flex; align-items: center; gap: 1rem; height: 3.75rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.1rem; color: inherit; text-decoration: none; letter-spacing: -0.02em; }
.brand img { width: 30px; height: 30px; }
.topnav { display: flex; gap: 0.25rem; margin-left: auto; flex-wrap: wrap; }
.topnav a { color: var(--muted-foreground); text-decoration: none; padding: 0.4rem 0.7rem; border-radius: var(--radius-md, 0.5rem); font-size: 0.925rem; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--foreground); background: var(--muted); }
@media (max-width: 34rem) { .topnav a.optional { display: none; } }

/* hero: the README banner */
.hero { position: relative; overflow: hidden; color: #f8fafc; border-radius: 1.5rem; margin-top: 1.5rem;
  background: radial-gradient(60rem 30rem at 85% -10%, rgba(124, 58, 237, 0.35), transparent 60%), linear-gradient(135deg, var(--hero-from), var(--hero-to));
  padding: clamp(1.75rem, 1rem + 4vw, 4rem); box-shadow: 0 30px 80px -40px rgba(76, 29, 149, 0.6); }
.hero-grid { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); align-items: center; position: relative; }
@media (min-width: 60rem) { .hero-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }
.hero h1 { display: flex; align-items: center; gap: 1rem; font-size: clamp(2.4rem, 1.6rem + 3.5vw, 4.25rem); line-height: 1; letter-spacing: -0.04em; margin: 0 0 1rem; }
.hero h1 img { width: clamp(3rem, 2rem + 3vw, 5rem); height: auto; }
.hero .tagline { font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.35rem); color: #cbd5e1; margin: 0 0 1.5rem; max-width: 36rem; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.hero .btn[data-variant="ghost"] { color: #e2e8f0; }
.btn.brand-btn { background: var(--brand-gradient); color: #fff; border: 0; }
.facts-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid #334155; font-family: var(--font-mono); font-size: 0.85rem; color: #94a3b8; }
.facts-row b { color: #f8fafc; }
.wave { position: absolute; right: -1rem; top: 0; bottom: 0; display: flex; align-items: center; gap: 10px; opacity: 0.22; pointer-events: none; }
.wave span { width: 10px; border-radius: 5px; background: linear-gradient(var(--brand-from), #a855f7); }
.hero-code { background: rgba(15, 23, 42, 0.75); border: 1px solid #334155; border-radius: 1rem; padding: 1.25rem; font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.7; color: #e2e8f0; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
/* code examples (lib/code-block.tsx): colors from lib/highlight.ts on the dark block, copy button top right */
.code-block { position: relative; }
.install-tabs { max-width: 40rem; }
.code-keyword { color: #c4b5fd; } .code-string { color: #6ee7b7; } .code-comment { color: #94a3b8; font-style: italic; }
.copy-btn { position: absolute; top: 0.6rem; right: 0.6rem; font: 500 0.75rem/1 var(--font-sans); color: #cbd5e1; background: rgba(148, 163, 184, 0.14); border: 1px solid rgba(148, 163, 184, 0.3); border-radius: 0.45rem; padding: 0.4rem 0.6rem; cursor: pointer; }
.copy-btn:hover, .copy-btn:focus-visible { color: #fff; background: rgba(148, 163, 184, 0.28); }
.copy-btn[data-copied] { color: #6ee7b7; border-color: rgba(110, 231, 183, 0.5); }

/* format chips and cards */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { --c: var(--fmt-mpeg); display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.85rem; border-radius: 999px; font-weight: 600; font-size: 0.875rem;
  border: 1px solid var(--c); background: color-mix(in oklch, var(--c) 18%, transparent); color: color-mix(in oklch, var(--c) 55%, white); }
.fmt-mpeg { --c: var(--fmt-mpeg); } .fmt-mp4 { --c: var(--fmt-mp4); } .fmt-flac { --c: var(--fmt-flac); }
.fmt-ogg { --c: var(--fmt-ogg); } .fmt-aiff { --c: var(--fmt-aiff); } .fmt-riff { --c: var(--fmt-riff); }
.format-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.format-card { border-top: 4px solid var(--c); }
.format-card .card-title { display: flex; align-items: center; gap: 0.5rem; }
.format-card .card-title::before { content: ""; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--c); }
.format-card code { font-size: 0.82em; }
.diagram { border-radius: 1.25rem; overflow: hidden; box-shadow: 0 20px 60px -40px rgba(15, 23, 42, 0.8); border: 1px solid var(--border); }
.diagram svg { display: block; width: 100%; height: auto; }
/* light mode: the pale "header" segments become solid but muted, so their white text stays readable */
:root:not(.dark) .diagram [fill-opacity="0.35"] { fill-opacity: 1; filter: saturate(0.55) brightness(0.8); }
.diagram-narrow { display: none; }
@media (max-width: 40rem) {
  .diagram-wide { display: none; }
  .diagram-narrow { display: grid; gap: 0.75rem; }
}
/* how it works on a phone: the boxes one under the other, an arrow between them */
.diagram-step svg { display: block; height: auto; margin-inline: auto; border-radius: 0.75rem; }
.diagram-step + .diagram-step:not(:has(.diagram-lane))::before { content: "↓"; display: block; text-align: center; color: var(--muted-foreground); margin: -0.4rem 0 0.35rem; }
.diagram-lane { font-size: 0.8rem; letter-spacing: 0.15em; text-transform: uppercase; margin: 0.75rem 0 0.5rem; color: var(--brand-to); }
/* where the tags live on a phone: each file as a list of regions, styled like the playground's byte map */
.diagram-note { font-size: 0.85rem; color: var(--muted-foreground); margin: 0; }
.format-strip { border: 1px solid var(--border); border-radius: 0.9rem; padding: 0.85rem; background: var(--card); }
.format-strip h3 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.format-strip small { font: 0.75rem var(--font-mono); color: var(--muted-foreground); margin-left: 0.4rem; }
.region-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.region-list li > span { display: block; padding: 0.45rem 0.65rem; border-radius: 0.45rem; font: 600 0.8rem var(--font-mono); }
.region-list .k-tag > span { background: var(--c); color: #fff; }
.region-list .k-header > span { background: color-mix(in oklch, var(--c) 45%, #1e293b); color: #fff; }
.region-list .k-free > span { border: 1.5px dashed var(--c); color: var(--muted-foreground); font-weight: 400; }
.region-list .k-audio > span { background: repeating-linear-gradient(45deg, var(--dg-hatch) 0 6px, var(--dg-hatch-stripe) 6px 9px); color: var(--muted-foreground); font-weight: 400; }
.region-list .k-container { border: 1.5px solid var(--c); border-radius: 0.55rem; padding: 0 4px 4px; }
.region-list .k-container > span { padding-inline: 0.25rem; color: var(--c); font-weight: 600; }

/* playground */
.play-grid { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 60rem) { .play-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } }
.play-grid > * { min-width: 0; }
.play-grid:has(> #empty[hidden]) { grid-template-columns: minmax(0, 1fr); }
.cover-box { margin: 0; display: grid; gap: 0.5rem; justify-items: start; }
/* the picture at its own aspect ratio, at most the card's width; tiny pictures (icons) grow to 3rem */
.cover { display: block; width: auto; height: auto; min-height: 3rem; object-fit: contain; border-radius: var(--radius); border: 1px solid var(--border); background: var(--muted); }
/* enlarged tiny pictures stay sharp pixels; photos, scaled down, keep smooth scaling */
.cover.tiny { image-rendering: pixelated; }
.cover-info { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; font-size: 0.8rem; color: var(--muted-foreground); }
.cover-nav { display: inline-flex; align-items: center; gap: 0.4rem; font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; margin: 0; font-size: 0.9rem; }
.facts dt { color: var(--muted-foreground); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.fields { display: grid; gap: 1rem; }
@media (min-width: 36rem) { .fields { grid-template-columns: 1fr 1fr; } .fields .wide { grid-column: 1 / -1; } }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.edit-group { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 0.5rem; justify-items: start; }
.edit-group legend { padding: 0; }
.edit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; width: 100%; }
.edit-list:empty { display: none; }
/* one box per comment or picture, so its fields read as one item */
.edit-row { display: grid; grid-template-columns: 3rem 1fr auto; gap: 0.5rem; align-items: start; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: color-mix(in oklch, var(--muted) 50%, var(--card)); }
.edit-row.comment-row { grid-template-columns: 1fr auto; }
.edit-row-fields { display: grid; gap: 0.5rem; min-width: 0; }
.picture-info { font-size: 0.8rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.thumb { width: 3rem; height: 3rem; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); background: var(--muted); }
.card-footer { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }

/* for nerds: byte map, structure, hex */
.byte-map { display: flex; height: 2.75rem; border-radius: 0.6rem; overflow: hidden; gap: 2px; background: var(--border); }
.byte-map button { all: unset; box-sizing: border-box; min-width: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; overflow: hidden;
  font: 600 0.72rem var(--font-mono); color: #fff; white-space: nowrap; padding-inline: 4px; }
.byte-map button:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.byte-map button[aria-pressed="true"] { box-shadow: inset 0 0 0 3px #fff; }
.byte-map .k-tag, .legend i.k-tag { background: var(--c); }
.byte-map .k-header, .legend i.k-header { background: color-mix(in oklch, var(--c) 40%, #1e293b); }
.byte-map .k-free, .legend i.k-free { background: repeating-linear-gradient(90deg, transparent 0 4px, color-mix(in oklch, var(--c) 45%, transparent) 4px 6px), var(--muted); color: var(--muted-foreground); }
.byte-map .k-audio, .legend i.k-audio { background: repeating-linear-gradient(45deg, #1e293b 0 6px, #273449 6px 9px); color: #94a3b8; }
.byte-map .k-other, .legend i.k-other { background: #475569; }
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: 0.8rem; color: var(--muted-foreground); margin-top: 0.6rem; }
.legend i { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 3px; vertical-align: -1px; margin-right: 0.35rem; }
.hex { font: 0.78rem/1.55 var(--font-mono); background: #0f172a; color: #cbd5e1; border-radius: 0.6rem; padding: 0.9rem; overflow-x: auto; margin: 0; white-space: pre; }
.hex .off { color: #64748b; } .hex .asc { color: #6ee7b7; }
.dump { max-height: 26rem; overflow: auto; margin: 0; font: 0.75rem/1.5 var(--font-mono); background: #0f172a; color: #e2e8f0; border-radius: 0.6rem; padding: 0.9rem; }
.table-scroll { overflow-x: auto; }
.mono { font-family: var(--font-mono); font-size: 0.85em; }

/* docs */
.docs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-block: 2rem; }
.docs > * { min-width: 0; }
@media (min-width: 60rem) { .docs { grid-template-columns: 15rem minmax(0, 1fr); } .docs > nav { position: sticky; top: 4.75rem; align-self: start; max-height: calc(100dvh - 6rem); overflow: auto; } }
.docs-nav a { display: block; padding: 0.3rem 0.6rem; border-radius: 0.4rem; color: var(--muted-foreground); text-decoration: none; font-size: 0.9rem; border-left: 2px solid transparent; }
.docs-nav a:hover { color: var(--foreground); }
.docs-nav a[aria-current="location"] { color: var(--foreground); border-left-color: var(--brand-to); background: var(--muted); }
.docs-nav h3 { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-foreground); margin: 1.25rem 0 0.4rem 0.6rem; }
.prose { line-height: 1.7; }
.prose h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); letter-spacing: -0.03em; margin: 0 0 0.5rem; }
.prose h2 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 3rem 0 0.75rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.prose h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
.prose pre, .code-block pre:not(.hero-code) { background: #0f172a; color: #e2e8f0; padding: 1rem 1.1rem; border-radius: 0.75rem; overflow-x: auto; font: 0.85rem/1.6 var(--font-mono); }
/* room for the copy button; after the rule above, which sets the padding */
.code-block pre.hero-code, .code-block pre:not(.hero-code) { padding-right: 4.5rem; }
.prose :not(pre) > code { font: 0.85em var(--font-mono); background: var(--muted); padding: 0.1em 0.35em; border-radius: 0.3rem; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.9rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { color: var(--muted-foreground); font-weight: 600; }
.prose blockquote { margin: 1.25rem 0; padding: 0.75rem 1rem; border-left: 4px solid var(--brand-to); background: var(--muted); border-radius: 0 0.6rem 0.6rem 0; }
.prose blockquote p { margin: 0; }
.filter { max-width: 22rem; margin-block: 0.75rem; }
.prose a { color: var(--primary); text-underline-offset: 3px; }
.docs-hero { margin-top: 0; padding: clamp(1.5rem, 1rem + 2vw, 2.5rem); }
.docs-hero h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3rem); margin: 0 0 0.75rem; display: flex; align-items: center; gap: 0.75rem; color: #f8fafc; }
.docs-hero .tagline { margin-bottom: 1.25rem; }
.docs-hero .facts-row a { color: #c4b5fd; }
.docs-hero + h2 { border-top: 0; }

/* footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 4rem; padding-block: 2rem; color: var(--muted-foreground); font-size: 0.875rem; }
.site-footer .page { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.site-footer a { color: inherit; }
.site-footer .build { font-family: var(--font-mono); font-size: 0.8rem; }

/* 404 */
.not-found { min-height: 70vh; display: grid; place-items: center; text-align: center; }
