/* elements.css - the rest of the HTML vocabulary: text, quotes, lists, tables, embedded content. Plain elements only.
   Author: a2@clacks-bridge.org. Generated/edited with Claude. Copyright: clacks-bridge.org. License: MIT
   Together with base.css this styles every element of the "drop-in minimal CSS" showcase; no class names. */

/* ---------------------------------------------------------------- headings h4..h6 (h1..h3 are in base.css)
   Plain headings in sentence case, so they cannot be mistaken for the uppercase labels h2 and h3, and no larger than
   them (a sentence-case line at body size looks wider than a small uppercase label): all three are small, h4 in the
   strong colour, h5 in the text colour, h6 muted. */
h4 { margin: var(--gap) 0 var(--gap-s); font-size: var(--fs-small); color: var(--strong); }
h5 { margin: var(--gap) 0 var(--gap-s); font-size: var(--fs-small); color: var(--text); }
h6 { margin: var(--gap) 0 var(--gap-s); font-size: var(--fs-small); color: var(--muted); }

/* ---------------------------------------------------------------- quotes */
blockquote { margin: 0 0 var(--gap-s); padding: 0.2rem 0 0.2rem var(--gap); border-left: 3px solid var(--line); }
blockquote > p { margin-bottom: var(--gap-s); }
blockquote > cite { display: block; margin-bottom: var(--gap-s); }
blockquote > cite::before { content: "\2014\00a0"; }
q { quotes: "\201C" "\201D" "\2018" "\2019"; }
cite, dfn, em, i, var { font-style: italic; }
cite { color: var(--muted); }
dfn { color: var(--strong); }

/* ---------------------------------------------------------------- inline text */
u { text-decoration: underline; text-underline-offset: 2px; }
s, del { text-decoration: line-through; }
sub, sup { position: relative; font-size: 0.75em; line-height: 0; vertical-align: baseline; }
sup { top: -0.45em; }
sub { bottom: -0.25em; }
abbr[title] { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
mark { padding: 0 0.2em; color: var(--text); background: var(--select); border-radius: 0.15em; }
var, samp { font-family: var(--font-mono); font-size: 0.9em; }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; background: var(--surface); }
samp { padding: 0 0.3em; background: var(--panel); border-radius: 0.2rem; }
time { white-space: nowrap; }

/* ---------------------------------------------------------------- lists */
/* nested lists: the indent alone shows the level; every level has the same marker (browsers: circle, then square) */
ul { list-style-type: disc; }
ul ul, ol ol, ul ol, ol ul { margin: 0.15rem 0 0; }
dl:not([data-grid]) dd { margin: 0 0 var(--gap-s) 1rem; }

/* ---------------------------------------------------------------- tables */
caption { caption-side: top; padding: 0.3rem 0; text-align: left; color: var(--muted); font-size: var(--fs-small); }
tfoot th, tfoot td { color: var(--strong); background: var(--panel); border-top: 1px solid var(--border); }
tfoot th { letter-spacing: 0.04em; }
table code { white-space: nowrap; }   /* a file name or an attribute in a table cell is not broken in the middle */

/* ---------------------------------------------------------------- embedded content */
img, svg, canvas, video, iframe { max-width: 100%; }
img, video { height: auto; border-radius: var(--radius); }
svg { color: var(--hi); }
canvas { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
video { display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--surface); border: 1px solid var(--line); }
audio { display: block; width: 100%; }
iframe { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
figure { margin: 0 0 var(--gap); }
figure > img, figure > a > img { display: block; }
figcaption { margin-top: 0.3rem; }
progress, meter { display: block; width: 100%; max-width: 20rem; height: 1rem; accent-color: var(--hi); }

/* ---------------------------------------------------------------- footers inside sections, articles and details */
:is(section, article, details) > footer { margin-top: var(--gap-s); text-align: right; color: var(--muted);
    font-size: var(--fs-small); }

/* ---------------------------------------------------------------- math (MathML) */
math { font-size: 1.15em; }

/* ---------------------------------------------------------------- hgroup, address, dialog */
/* hgroup: a heading with its subtitle (a <p> after the heading). The subtitle looks like its heading, a little smaller
   (never below 0.8rem): the colour of the heading, but sentence case (a sentence in capitals is hard to read). A little
   room between the two lines. */
hgroup { margin: 0 0 var(--gap); }
hgroup > :is(h1, h2, h3, h4, h5, h6) { margin-bottom: 0; }
hgroup > p { margin: var(--gap-s) 0 0; color: var(--strong);
    font-size: max(0.8rem, var(--sub, calc(var(--fs-small) * 0.94))); }
hgroup:has(> h1) { --sub: calc(var(--fs-title) * 0.75); }
hgroup:has(> h2) > p { color: var(--label); }
hgroup:has(> h5) > p { color: var(--text); }
hgroup:has(> h6) > p { color: var(--muted); }
/* address: contact details, set upright (browsers default to italics) */
address { margin: 0 0 var(--gap-s); font-style: normal; }
address a { white-space: nowrap; }
/* dialog: a frame like every other, opened with showModal() (js/dialog.js: <button data-open="#id">) */
dialog { width: min(32rem, calc(100vw - 2rem)); margin: auto; padding: var(--pad); color: var(--text); }
dialog::backdrop { background: color-mix(in srgb, var(--bg) 75%, transparent); backdrop-filter: blur(2px); }
dialog > form[method=dialog] { margin: var(--gap) 0 0; }
dialog > form[method=dialog] > p:last-child { margin-bottom: 0; text-align: right; }

/* data: a value the page shows as text (js/keypad.js can change it from a button); the digits line up */
data { font-variant-numeric: tabular-nums; }

/* a list item that holds only a <small> is small as a whole: the number or bullet has the size of its text */
li:has(> small:only-child) { font-size: var(--fs-small); color: var(--muted); }
