/* Owned by the base block: the components every block's pages use. The app's own styles go in
   app.css, which is loaded after this file. */
:root {
    --fg: #1f2328;
    --muted: #59636e;
    --bg: #ffffff;
    --surface: #f6f8fa;
    --accent: #c0392b;
    --border: #d1d9e0;
    --ok: #1a7f37;
    --radius: 6px;
    --density: 1;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --fg: #e6edf3;
        --muted: #9198a1;
        --bg: #0d1117;
        --surface: #151b23;
        --accent: #ff6b5b;
        --border: #3d444d;
        --ok: #3fb950;
    }
}

* { box-sizing: border-box; }
/* hidden means hidden, whatever display a class gives (scripts reveal what only they can drive) */
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.5 system-ui, sans-serif; color: var(--fg); background: var(--bg); }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
code { background: var(--surface); padding: 0 .25em; border-radius: 4px; }
.muted { color: var(--muted); }

.site-header {
    display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center;
    padding: .75rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface);
}
.brand { font-weight: 700; text-decoration: none; }
.site-nav { display: flex; gap: 1rem; flex: 1; }
.site-nav a { text-decoration: none; color: var(--fg); }
.site-nav a.current { color: var(--accent); font-weight: 600; }
.account { display: flex; gap: .75rem; align-items: center; }
main { max-width: 60rem; margin: 0 auto; padding: calc(1rem * var(--density)); }

.banner { padding: .5rem .75rem; margin-bottom: 1rem; border: 1px solid var(--accent); border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-radius: var(--radius); display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.flash { padding: .5rem .75rem; border: 1px solid var(--border); border-left: 4px solid var(--ok); background: var(--surface); border-radius: var(--radius); }
.flash.error { border-left-color: var(--accent); }
.flash p { margin: .25rem 0; }

form.stack { display: grid; gap: .75rem; max-width: 26rem; }
form.inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
label { display: grid; gap: .25rem; font-weight: 600; }
input, select { font: inherit; padding: .4rem .5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--fg); }
button, .button {
    font: inherit; cursor: pointer; padding: .4rem .9rem; border-radius: var(--radius);
    border: 1px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none;
}
button.secondary { background: transparent; color: var(--accent); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: calc(.45rem * var(--density)) .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.badge { display: inline-block; padding: 0 .5rem; border-radius: 999px; border: 1px solid var(--border); font-size: .85rem; }
.badge.done { color: var(--ok); border-color: var(--ok); }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: calc(1rem * var(--density)); margin: calc(1rem * var(--density)) 0; background: var(--surface); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.account .locale select { padding: .1rem .3rem; font-size: .85rem; border-radius: var(--radius); }

/* differences (base Diff): <del>/<ins> carry the meaning, the colours only help */
.diff { font-variant-numeric: tabular-nums; }
.diff del, .diff ins { text-decoration: none; }
.diff .del, .diff del { background: rgba(207, 34, 46, .12); }
.diff .ins, .diff ins { background: rgba(26, 127, 55, .14); }
.diff .sign { width: 1.5em; text-align: center; color: var(--muted); user-select: none; }
pre.diff { padding: .5rem 0; overflow-x: auto; }
pre.diff > span, pre.diff > del, pre.diff > ins { display: block; padding: 0 .5rem; }
details.ref-diff > summary { cursor: pointer; }

/* step-by-step forms: one fieldset per step, top to bottom */
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem 1rem .75rem; margin: 0; }
legend { font-weight: 600; padding: 0 .25rem; }
.inline-check { display: inline-flex; gap: .3rem; align-items: center; margin-right: 1rem; }
fieldset textarea { width: 100%; }

/* Faces (Blocks\Base\Contracts\Faces, <x-face>): one record drawn as a chip, row, card, lane header
   or tile. A tint comes with an ink that reads on it (Palette: WCAG AA). */
.face { display: flex; gap: calc(.6rem * var(--density)); align-items: center; min-width: 0; color: inherit; text-decoration: none; border-radius: var(--radius); }
.face-image-right { flex-direction: row-reverse; }
.face-tinted { background: var(--face-tint); color: var(--face-ink); }
.face-text { display: flex; flex-direction: column; min-width: 0; }
.face-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.face-subtitle { font-size: .9em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.face-meta, .face-number { font-size: .8em; opacity: .8; }
.face-image { flex: none; object-fit: contain; border-radius: calc(var(--radius) / 2); background: var(--bg); }
.face-chip { display: inline-flex; padding: .1rem .55rem; border-radius: 999px; border: 1px solid var(--border); font-size: .9em; }
.face-chip.face-tinted { border-color: transparent; }
.face-row { padding: calc(.4rem * var(--density)) 0; border-bottom: 1px solid var(--border); }
.face-row .face-image { width: 3rem; height: 3rem; }
.face-card { flex-direction: column; align-items: stretch; padding: calc(.75rem * var(--density)); border: 1px solid var(--border); background: var(--surface); }
/* after .face-card's own background: a tinted card takes the tint and its ink together */
.face-card.face-tinted { background: var(--face-tint); color: var(--face-ink); border-color: transparent; }
.face-card .face-image { width: 100%; height: 9rem; }
.face-tile { position: relative; flex-direction: column; align-items: stretch; overflow: hidden; border: 1px solid var(--border); }
.face-tile .face-image { width: 100%; aspect-ratio: 1; height: auto; border-radius: 0; }
.face-tile .face-text { padding: calc(.4rem * var(--density)) calc(.6rem * var(--density)); }
.face-lane-header { padding: .2rem .4rem; height: 100%; font-size: .9em; }
.face-lane-header .face-image { width: 1.75rem; height: 1.75rem; }
.face-lane-header .face-title { font-weight: 500; white-space: nowrap; }
.faces { list-style: none; padding: 0; margin: 0; display: grid; gap: calc(.75rem * var(--density)); grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); }

/* staging areas (<x-staged>): important settings, grayed out until "confirm it's you" */
.staged-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.staged-fields.inline { display: inline; }
.staged-fields[disabled] { opacity: .55; filter: grayscale(.6); }
.staged-fields[disabled] :is(input, select, textarea, button) { cursor: not-allowed; }
.staged-unlock { border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: .5rem .75rem; margin-bottom: .75rem; background: var(--surface); }
.staged-unlock form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
