/* fileformats.org: the site stylesheet.
 *
 * Written for the stylesheet.org markup: semantic HTML, a few layout and component classes,
 * no IDs. The base is silver. Each file category has a small stylesheet of its own
 * (/audio/audio.css and so on), loaded after this one, that sets --accent for every page in
 * that category. General pages keep the graphite accent set here.
 *
 *   1. RESET
 *   2. TOKENS        silver base, the eight category colours, type and space
 *   3. LAYOUT        row, column, stretch, grid, flow, sidebar
 *   4. ELEMENTS      semantic tags styled directly
 *   5. SITE CHROME   header bars, breadcrumb, side menu, footer
 *   6. COMPONENTS    panel, card, chip, buttons, status, tabset, accordion, blocks …
 *   7. CODE          highlighting, the hex language
 *   8. DROP          the overlay shown while a file is dragged over a page
 */

/* ============================================================
   1. RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; overflow-x: hidden; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg, video { max-width: 100%; height: auto; display: block; }

/* ============================================================
   2. TOKENS
   ============================================================ */
:root {
  /* the eight category colours: each is dark enough to carry white text */
  --c-audio: #7c3aed;
  --c-video: #c8102e;
  --c-images: #0f7f49;
  --c-3d: #c2410c;
  --c-documents: #1d4ed8;
  --c-data: #0e7490;
  --c-code: #9a6006;
  --c-system: #be185d;

  /* accent: graphite on general pages, replaced by a category stylesheet */
  --accent: #4b5563;
  --accent-hover: color-mix(in srgb, var(--accent), #000 22%);
  --accent-fg: #ffffff;
  --accent-line: color-mix(in srgb, var(--accent) 45%, #c9ced5);
  --accent-tint: color-mix(in srgb, var(--accent) 12%, #ffffff);
  --accent-wash: color-mix(in srgb, var(--accent) 5%, #ffffff);

  /* silver */
  --bg: #eceef1;
  --surface: #ffffff;
  --surface-soft: #f4f5f7;
  --silver-hi: #f6f7f9;
  --silver-lo: #d2d7dd;
  --silver-edge: #a8afb8;
  --nav-2: color-mix(in srgb, var(--accent) 9%, #e2e5e9);
  --fg: #1e242c;
  --heading: #11161c;
  --muted: #5a6370;
  --border: #d6dae0;
  --border-strong: #bcc3cc;

  /* code */
  --code-bg: #1f252d;
  --code-fg: #e4e8ee;
  --hl-tag: #7cc4ff;
  --hl-attr: #f0c66b;
  --hl-value: #8fe0a0;
  --hl-comment: #8c949e;
  --hl-kw: #cbb6f5;
  --hl-fn: #7fd6e0;
  --hl-num: #f0a98a;

  /* status */
  --ok-fg: #04603e; --ok-bg: #e9fbf2; --ok-bd: #a6e9c8;
  --err-fg: #ad1b14; --err-bg: #fdf0ef; --err-bd: #f6c9c6;
  --info-fg: #2f4ad6; --info-bg: #eef1ff; --info-bd: #c5cefb;
  --warn-fg: #9a5a05; --warn-bg: #fff4d6; --warn-bd: #f3df9a;

  /* type */
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* space and shape */
  --gap: 16px;
  --sep-1: 34px;
  --sep-2: 24px;
  --sep-3: 16px;
  --pad: 28px;
  --maxw: 1160px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 40, 0.06), 0 1px 3px rgba(20, 30, 40, 0.08);
  --shadow-md: 0 6px 14px -4px rgba(20, 30, 40, 0.16), 0 2px 6px -2px rgba(20, 30, 40, 0.08);
}

/* ============================================================
   3. LAYOUT
   ============================================================ */
.row, .column { display: flex; gap: var(--gap); }
.row { flex-direction: row; }
.column { flex-direction: column; }
.row > *, .column > * { flex: 0 0 auto; min-width: 0; min-height: 0; }
.stretch { flex: 1 1 0; min-width: 0; min-height: 0; }
.stretch-2 { flex-grow: 2; }
.stretch-3 { flex-grow: 3; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.flow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

/* sidebar: a side menu beside the page content; it scrolls with the page */
.sidebar { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 36px; align-items: start; }
@media (max-width: 820px) { .sidebar { grid-template-columns: minmax(0, 1fr); gap: 22px; } }

/* ============================================================
   4. ELEMENTS
   ============================================================ */
body {
  background: linear-gradient(180deg, #f5f6f8 0, var(--bg) 520px);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
}

h1, h2, h3, h4, h5, h6 { color: var(--heading); font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.4rem); letter-spacing: -0.025em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }
h4 { font-size: 1rem; letter-spacing: 0; }
h5, h6 { font-size: 0.9rem; letter-spacing: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
strong { font-weight: 650; color: var(--heading); }
small { color: var(--muted); font-size: 0.875em; }
ul, ol { padding-left: 1.4em; }
li { margin: 4px 0; }
li::marker { color: var(--accent); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; }
dt { font-weight: 600; color: var(--heading); }
hr { border: 0; border-top: 1px solid var(--border-strong); }
blockquote { padding: 10px 18px; border-left: 3px solid var(--accent); background: var(--accent-wash); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
figure { display: flex; flex-direction: column; gap: 6px; }
figcaption { color: var(--muted); font-size: 0.9em; text-align: center; }

/* links in running text carry an underline at rest */
main :is(p, li, td, th, dd, figcaption, blockquote):not(nav *) a:not(.button):not(.card):not(.chip) { text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 2px; }
main :is(p, li, td, th, dd, figcaption, blockquote):not(nav *) a:not(.button):not(.card):not(.chip):hover { text-decoration-color: currentColor; }

/* a title that is a literal name or field, in the code font at its own size */
.mono { font-family: var(--mono); letter-spacing: normal; }

/* the heading group on a format's overview: the extension, then the full name */
hgroup { display: flex; flex-direction: column; gap: 4px; }
hgroup > h1 { font-family: var(--mono); letter-spacing: -0.01em; color: var(--accent); }
hgroup > p { font-size: 1.2rem; font-weight: 600; color: var(--heading); }

/* main: one column of content, centred */
main { flex: 1 0 auto; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 26px var(--pad) 64px; }
main > h1 + p, article > h1 + p, hgroup + p { max-width: 75ch; font-size: 1.1rem; color: var(--muted); }

/* the flow: one gap between pieces of content, a larger step above each subsection */
:is(main, article, section) > * + * { margin-top: var(--gap); }
:is(main, article) > section { margin-top: var(--sep-1); }
section > section { margin-top: var(--sep-2); }
section section > section { margin-top: var(--sep-3); }
section { display: flex; flex-direction: column; }
:is(main, article) > section > h2 { padding-bottom: 7px; border-bottom: 2px solid var(--accent-line); }

/* tables */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; font-size: 0.95rem; }
caption { text-align: left; padding: 8px 0; font-weight: 600; color: var(--muted); }
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
thead th { font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--accent-wash); border-bottom: 1px solid var(--border-strong); }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover { background: var(--accent-wash); }
tbody th[scope="rowgroup"] { font-weight: 700; color: var(--heading); background: var(--accent-tint); border-bottom: 1px solid var(--border-strong); }
tbody tr:has(> th[scope="rowgroup"]):hover { background: none; }
td:first-child code { white-space: nowrap; }
@media (max-width: 700px) { table { display: block; overflow-x: auto; } }

/* forms */
form { display: grid; gap: 15px; }
fieldset { padding: 16px; display: grid; gap: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
legend { font-weight: 600; padding: 0 6px; color: var(--heading); }
label > p { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; color: var(--heading); }
input, select, textarea { width: 100%; padding: 9px 12px; font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
textarea { min-height: 120px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; margin-right: 7px; accent-color: var(--accent); }
.row > :is(input, select, textarea) { flex-shrink: 1; }

/* buttons */
button, input[type="submit"], input[type="reset"], input[type="button"], a.button, label.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: auto; padding: 9px 18px; font: inherit; font-weight: 600; line-height: 1.4;
  cursor: pointer; text-align: center; text-decoration: none;
  background: var(--accent); color: var(--accent-fg);
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); transition: background 0.15s, box-shadow 0.15s;
}
button:hover, input[type="submit"]:hover, input[type="button"]:hover, a.button:hover, label.button:hover {
  background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); text-decoration: none; box-shadow: var(--shadow-md);
}
.button.secondary, button.secondary, input[type="reset"] { background: var(--surface); color: var(--fg); border-color: var(--border-strong); box-shadow: none; }
.button.secondary:hover, button.secondary:hover, input[type="reset"]:hover { background: var(--surface-soft); color: var(--heading); border-color: var(--silver-edge); }
.button.ghost, button.ghost { background: transparent; color: var(--accent); border-color: transparent; box-shadow: none; }
.button.ghost:hover, button.ghost:hover { background: var(--accent-tint); color: var(--accent-hover); }
.button.small, button.small { padding: 5px 12px; font-size: 0.9rem; }
.button.large, button.large { padding: 12px 24px; font-size: 1.05rem; }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* progress and meter */
progress, meter { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 12px; border: 0; border-radius: var(--radius-pill); background: var(--surface-soft); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-soft); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
meter::-webkit-meter-bar { background: var(--surface-soft); border: 0; height: 12px; }
meter::-webkit-meter-optimum-value { background: var(--ok-fg); }

/* ============================================================
   5. SITE CHROME
   ============================================================ */
/* header: stacked bars, the first always silver */
header { background: linear-gradient(180deg, var(--silver-hi), var(--silver-lo)); border-bottom: 1px solid var(--silver-edge); box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(20, 30, 40, 0.12); }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
nav > a, nav > span { font-weight: 700; color: var(--heading); }
nav > a:hover { text-decoration: none; }
nav > ul { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
nav > ul > li { margin: 0; }
nav ul a { display: block; padding: 6px 12px; border-radius: 7px; white-space: nowrap; color: var(--fg); font-size: 0.94rem; font-weight: 500; text-decoration: none; }
nav ul a:hover { background: rgba(0, 0, 0, 0.07); color: var(--heading); text-decoration: none; }
nav a[aria-current] { background: var(--accent); color: var(--accent-fg); }
nav a[aria-current]:hover { background: var(--accent-hover); color: var(--accent-fg); }

header > nav { padding: 11px var(--pad); }
header > nav:first-of-type > a { display: inline-flex; align-items: center; gap: 10px; font-size: 1.2rem; letter-spacing: -0.02em; }
header > nav:first-of-type > a img { width: 30px; height: 30px; }
header > nav:first-of-type > ul { margin-left: auto; gap: 6px; }

/* the category buttons: each one in its own colour, on every page */
header > nav:first-of-type ul a {
  --item: var(--accent);
  color: color-mix(in srgb, var(--item), #000 12%);
  background: color-mix(in srgb, var(--item) 9%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--item) 32%, #ffffff);
  font-weight: 600;
}
header > nav:first-of-type ul a:hover { background: color-mix(in srgb, var(--item) 18%, #ffffff); color: color-mix(in srgb, var(--item), #000 25%); }
header > nav:first-of-type ul a[aria-current],
header > nav:first-of-type ul a[aria-current]:hover { background: var(--item); border-color: color-mix(in srgb, var(--item), #000 15%); color: #fff; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18); }
header > nav:first-of-type a[href="/audio/"] { --item: var(--c-audio); }
header > nav:first-of-type a[href="/video/"] { --item: var(--c-video); }
header > nav:first-of-type a[href="/images/"] { --item: var(--c-images); }
header > nav:first-of-type a[href="/3d/"] { --item: var(--c-3d); }
header > nav:first-of-type a[href="/documents/"] { --item: var(--c-documents); }
header > nav:first-of-type a[href="/data/"] { --item: var(--c-data); }
header > nav:first-of-type a[href="/code/"] { --item: var(--c-code); }
header > nav:first-of-type a[href="/system/"] { --item: var(--c-system); }

/* the second bar: silver on general pages, a wash of the accent inside a category */
header > nav ~ nav { padding-top: 7px; padding-bottom: 7px; background: var(--nav-2); border-top: 1px solid var(--silver-edge); }
header > nav ~ nav > span { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-hover); }
header > nav ~ nav ul a { font-size: 0.9rem; padding: 5px 11px; }

/* breadcrumb */
nav[aria-label="Breadcrumb"] ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 0.9rem; }
nav[aria-label="Breadcrumb"] li { margin: 0; }
nav[aria-label="Breadcrumb"] li + li::before { content: "/"; margin-right: 6px; color: var(--muted); }
nav[aria-label="Breadcrumb"] a { color: var(--muted); text-decoration: none; }
nav[aria-label="Breadcrumb"] a:hover { color: var(--accent); text-decoration: underline; }
nav[aria-label="Breadcrumb"] [aria-current] { color: var(--heading); font-weight: 600; }

/* side menu: a format's pages, two levels, scrolling with the page */
.sidebar > nav { display: block; padding: 8px; background: var(--surface); border: 1px solid var(--border-strong); border-top: 3px solid var(--accent); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.sidebar > nav > span { display: block; padding: 4px 10px 6px; font-family: var(--mono); font-size: 0.85rem; color: var(--accent); }
.sidebar > nav ul { display: block; margin: 0; padding: 0; list-style: none; }
.sidebar > nav li { margin: 1px 0; }
.sidebar > nav ul a { padding: 6px 10px; border-radius: 6px; white-space: normal; font-size: 0.93rem; line-height: 1.35; }
.sidebar > nav ul a:hover { background: var(--accent-wash); color: var(--accent-hover); }
.sidebar > nav ul a[aria-current],
.sidebar > nav ul a[aria-current]:hover { background: var(--accent-tint); color: var(--accent-hover); font-weight: 650; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar > nav ul ul { margin: 0 0 6px 12px; padding-left: 6px; border-left: 1px solid var(--border-strong); }
.sidebar > nav ul ul a { font-size: 0.87rem; padding: 4px 10px; }

/* footer */
footer { flex-shrink: 0; background: linear-gradient(180deg, var(--silver-hi), var(--silver-lo)); border-top: 1px solid var(--silver-edge); color: var(--muted); font-size: 0.92rem; }
footer > .row { width: 100%; padding: 18px var(--pad); align-items: center; flex-wrap: wrap; column-gap: 22px; row-gap: 8px; }
footer a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--silver-edge); text-underline-offset: 2px; }
footer a:hover { color: var(--heading); }

/* ============================================================
   6. COMPONENTS
   ============================================================ */
.panel { display: block; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.panel .panel { background: var(--surface-soft); box-shadow: none; }

.card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.12s ease; }
.card > * + * { margin-top: 0; }
.card .card { background: var(--surface-soft); box-shadow: none; }
a.card { color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
a.card h3 { color: var(--accent); }
.stretch-link { position: relative; }
.stretch-link :is(h1, h2, h3, h4, h5, h6) a::after { content: ""; position: absolute; inset: 0; }
.stretch-link a:not(:is(h1, h2, h3, h4, h5, h6) a), .stretch-link button { position: relative; z-index: 1; }
.stretch-link:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; font-size: 0.85rem; font-weight: 600; line-height: 1.5; color: var(--fg); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); }
a.chip, button.chip { cursor: pointer; text-decoration: none; }
a.chip:hover, button.chip:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-hover); text-decoration: none; }
.chip.accent { background: var(--accent-tint); border-color: transparent; color: var(--accent-hover); }

.status { display: block; padding: 11px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-weight: 500; }
.status.success { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-fg); }
.status.error { background: var(--err-bg); border-color: var(--err-bd); color: var(--err-fg); }
.status.info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info-fg); }
.status.warning { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-fg); }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border-strong); }

/* tabset: radios in labels, the element after each label is its content */
.tabset { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding: 8px; background: var(--surface-soft); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.tabset > label { order: 1; position: relative; display: inline-flex; align-items: center; padding: 7px 15px; cursor: pointer; font-weight: 600; color: var(--fg); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.tabset > label:hover { border-color: var(--accent); color: var(--accent-hover); }
.tabset > label:has(input:checked) { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.tabset > label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabset > label > input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip: rect(0 0 0 0); overflow: hidden; }
.tabset > label:has(input) + * { order: 2; flex: 0 0 auto; width: calc(100% + 16px); margin: 0 -8px -8px; padding: 20px; background: var(--surface); border-top: 1px solid var(--border-strong); border-radius: 0 0 var(--radius) var(--radius); }
.tabset > label:has(input) + * > * + * { margin-top: var(--gap); }
.tabset > label:has(input:not(:checked)) + * { display: none; }

/* accordion: native details */
.accordion { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.accordion > details + details { border-top: 1px solid var(--border-strong); }
.accordion > details > summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-weight: 600; color: var(--heading); cursor: pointer; list-style: none; }
.accordion > details > summary:hover { background: var(--accent-wash); }
.accordion > details > summary::-webkit-details-marker { display: none; }
.accordion > details > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.accordion > details[open] > summary { background: var(--accent-wash); border-bottom: 1px solid var(--border); }
.accordion > details[open] > summary::after { content: "▴"; }
.accordion > details > :not(summary) { padding: 12px 16px 0; }
.accordion > details > :last-child:not(summary) { padding-bottom: 14px; }

/* steps, empty, tooltip */
.steps { display: flex; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { flex: 1; position: relative; text-align: center; color: var(--muted); font-size: 0.9rem; counter-increment: step; }
.steps li::before { content: counter(step); position: relative; z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; margin: 0 auto 7px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-strong); color: var(--fg); font-weight: 600; }
.steps li::after { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px; background: var(--border-strong); }
.steps li:first-child::after { display: none; }
.steps li[aria-current] { color: var(--heading); font-weight: 600; }
.steps li[aria-current]::before { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.empty { text-align: center; padding: 36px 24px; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.tooltip { position: relative; }
.tooltip::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 5px 9px; font-size: 0.8rem; color: #fff; background: var(--heading); border-radius: var(--radius-sm); opacity: 0; pointer-events: none; transition: opacity 0.15s; }
.tooltip:hover::after, .tooltip:focus-visible::after { opacity: 1; }

/* blocks: a map of a file's layout, one box per block, nested blocks indented.
   Each item is an offset, the block's name and what it holds, then its size. */
ol.blocks { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; list-style: none; font-size: 0.93rem; }
ol.blocks li { display: grid; grid-template-columns: 9ch minmax(0, 1fr) auto; gap: 4px 14px; align-items: baseline; margin: 0; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border-strong); border-left: 4px solid var(--accent); border-radius: 6px; }
ol.blocks li > code:first-child { background: none; border: 0; padding: 0; color: var(--muted); font-size: 0.85rem; }
ol.blocks li > small { text-align: right; white-space: nowrap; }
ol.blocks ol.blocks { grid-column: 1 / -1; margin-top: 4px; }
ol.blocks ol.blocks li { background: var(--accent-wash); border-left-color: var(--accent-line); }

/* the drop panel on the home page */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 34px 24px; text-align: center; background: var(--surface); border: 2px dashed var(--silver-edge); border-radius: var(--radius); }
.dropzone > strong { font-size: 1.2rem; }
.dropzone input[type="file"] { display: none; }

/* ============================================================
   7. CODE
   ============================================================ */
code { font-family: var(--mono); font-size: 0.88em; background: var(--accent-wash); border: 1px solid var(--border); padding: 0.08em 0.38em; border-radius: 5px; }
pre { position: relative; background: var(--code-bg); color: var(--code-fg); border-radius: var(--radius-sm); padding: 16px 18px; overflow-x: auto; font-size: 0.85rem; line-height: 1.6; box-shadow: var(--shadow-sm); }
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
figure:has(> pre) { width: 100%; }
pre > code[class] { display: block; padding-top: 14px; }
pre > code[class]::before { position: absolute; top: 0; right: 0; padding: 3px 11px; font-family: var(--font); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--code-fg); background: rgba(255, 255, 255, 0.07); border-left: 1px solid rgba(255, 255, 255, 0.14); border-bottom: 1px solid rgba(255, 255, 255, 0.14); border-radius: 0 var(--radius-sm) 0 var(--radius-sm); }
pre > code.html::before { content: "html"; }
pre > code.css::before { content: "css"; }
pre > code.js::before { content: "javascript"; }
pre > code.c::before { content: "c"; }
pre > code.text::before { content: "text"; }
pre > code.hex::before { content: "hex"; }
pre code .tag { color: var(--hl-tag); }
pre code .attr { color: var(--hl-attr); }
pre code .value { color: var(--hl-value); }
pre code .comment { color: var(--hl-comment); }
pre code .kw { color: var(--hl-kw); }
pre code .fn { color: var(--hl-fn); }
pre code .num { color: var(--hl-num); }
/* hex dumps: offsets dim, a marked run of bytes picked out */
pre code.hex .offset { color: var(--hl-comment); }
pre code.hex .mark { color: #fff; background: color-mix(in srgb, var(--accent) 70%, transparent); border-radius: 3px; }
pre code.hex .ascii { color: var(--hl-value); }

/* ============================================================
   8. DROP
   ============================================================ */
.drop-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(24, 30, 38, 0.55); backdrop-filter: blur(2px); pointer-events: none; }
.drop-overlay > div { padding: 34px 48px; border: 3px dashed #fff; border-radius: 18px; color: #fff; font-size: 1.4rem; font-weight: 700; text-align: center; background: rgba(0, 0, 0, 0.25); }
.drop-overlay small { display: block; margin-top: 6px; color: rgba(255, 255, 255, 0.8); font-size: 0.95rem; font-weight: 500; }
