/* ==========================================================================
   dravecz.hu – the style of the site. A multi-file package that also runs offline.
   Tokens: the palette of borondns.com main.css (dark is the base, light follows the
   system setting). Fonts: IBM Plex Sans / Mono, Source Serif 4 – system fonts take
   their place when they are not installed.
   ========================================================================== */
/* The colors come from the --a11y-* variables of the accessibility panel (a11y-brand-vars block: brand.json = the
   borondns.com palette). The site's own tokens build on them; the finer shades (text-2/3, bg-2/3, decorative border)
   are set here per theme and fall back to the base colors in high contrast. */
:root {
  --bg: var(--a11y-bg, #F3F6FA); --bg-2: #E9EEF4; --bg-3: #EEF2F7; --bg-4: var(--a11y-surface, #FFFFFF);
  --border: #C8D2DC; --border-2: var(--a11y-border, #7C8894);
  --text-1: var(--a11y-text, #1B222A); --text-2: #30383E; --text-3: #46525C;
  --text-6: var(--a11y-muted, #59636C); --text-8: var(--a11y-muted, #59636C);
  --accent: var(--a11y-link, #1D5A96); --accent-h: #174B7E;
  --accent-strong: var(--a11y-accent, #1D5A96); --on-accent: var(--a11y-on-accent, #FFFFFF);
  --accent-soft: rgba(29, 90, 150, 0.10);
  --sans: 'IBM Plex Sans', system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --serif: 'Source Serif 4', Georgia, 'Noto Serif', serif;
  --measure: 46rem;       /* width of running text */
}
html[data-a11y-theme="dark"] {
  --bg-2: #08090B; --bg-3: #0D1014; --border: #151A1F;
  --text-2: #B7C0C9; --text-3: #A3ACB5; --accent-h: #7AB0E2;
  --accent-soft: rgba(92, 155, 214, 0.14);
}
/* until the script of the panel has run (or without JS): the dark theme of the system */
@media (prefers-color-scheme: dark) {
  html:not([data-a11y-theme]) {
    --a11y-bg: #090B0E; --a11y-surface: #111419; --a11y-text: #E4EAF0; --a11y-muted: #7F8992;
    --a11y-accent: #3166A0; --a11y-on-accent: #FFFFFF; --a11y-link: #5C9BD6; --a11y-border: #5A6673; --a11y-focus: #7AB0E2;
    --bg-2: #08090B; --bg-3: #0D1014; --border: #151A1F;
    --text-2: #B7C0C9; --text-3: #A3ACB5; --accent-h: #7AB0E2;
    --accent-soft: rgba(92, 155, 214, 0.14);
    color-scheme: dark;
  }
}
/* high contrast: every shade falls back to the base colors */
html[data-a11y-contrast="1"] {
  --bg-2: var(--a11y-bg); --bg-3: var(--a11y-surface); --border: var(--a11y-border);
  --text-2: var(--a11y-text); --text-3: var(--a11y-text); --accent-h: var(--a11y-link);
  --accent-soft: transparent;
}
/* AAA: the paler shades are above 7:1 too */
html[data-a11y-level="AAA"] { --text-3: var(--a11y-muted); --accent-h: var(--a11y-link); }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text-1);
  font-family: var(--serif); font-size: 1.0625rem; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  container-type: inline-size;   /* the breakpoints are container queries: they follow the font size set on the panel */
}
header, nav, footer, button, input, .tile, .row, .badge, .tag, .meta, .kicker, .piece-meta, .notice { font-family: var(--sans); }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-h); }
button { font: inherit; color: inherit; }
.sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------- container: centered or full width ----------
   The width comes from the .a11y-container rule of the panel (--a11y-max-width, brand.json);
   the button in the header switches the same setting. */
.wrap { width: 100%; margin-inline: auto; padding-inline: 1.25rem; }
html[data-a11y-layout="full"] .wrap { padding-inline: 1.5rem; }
@container (min-width: 64rem) { html[data-a11y-layout="full"] .wrap { padding-inline: 2.25rem; } }
.measure { max-width: var(--measure); }

/* ---------- header: row 1 = logo, name, search, tools; row 2 = the menu ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem;
  padding-block: 0.6rem 0;
}
.brand { display: inline-flex; align-items: center; color: var(--accent); line-height: 0; text-decoration: none; flex: none; }
.brand:hover { color: var(--accent-h); }
.brand svg { height: 1.55rem; width: auto; fill: currentColor; }
.brand.custom img { height: 1.75rem; width: auto; max-width: 14rem; display: block; object-fit: contain; }
.brand .brand-text { font-family: var(--a11y-brand-font, var(--sans)); font-weight: 600; font-size: 1.25rem; letter-spacing: 0.04em; line-height: 1.2; text-transform: uppercase; }
.site-name {
  font-family: var(--mono); font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em;
  text-decoration: none; color: var(--text-1); flex: none;
  padding-inline-start: 1rem; border-inline-start: 1px solid var(--border-2); line-height: 1.2;
}
.site-name .tld { color: var(--accent); }
.site-name:hover { color: var(--text-1); }
/* On a wide screen the wrapper of the search and the menu "disappears": its two children take their places in the
   header – the search in row 1 before the tools, the menu on a row of its own. As many menu items fit as the width
   allows; the rest wrap to a further line. */
.site-menu { display: contents; }
.search { order: 2; display: flex; align-items: center; margin-inline-start: auto; position: relative; flex: 0 1 16rem; min-width: 8rem; }
.search input {
  width: 100%; padding: 0.45rem 2.1rem 0.45rem 0.7rem;
  border: 1px solid var(--border-2); border-radius: 0.5rem; background: var(--bg-4); color: var(--text-1);
  font-size: 0.95rem;
}
.search input::placeholder { color: var(--text-6); }
.search input:focus { border-color: var(--accent); }
.search button {
  position: absolute; right: 0.2rem; top: 50%; transform: translateY(-50%);
  width: 1.9rem; height: 1.9rem; border: 0; background: transparent; color: var(--text-3); border-radius: 0.35rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.search button:hover { color: var(--accent); background: var(--accent-soft); }
.search svg { width: 1.05rem; height: 1.05rem; }
.site-tools { order: 3; display: flex; align-items: center; gap: 0.6rem; flex: none; }
.site-nav {
  order: 10; flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 0.1rem 0.25rem;
  margin-inline: -0.5rem; padding-block: 0.3rem 0.4rem; border-top: 1px solid var(--border);
}
.site-nav a {
  color: var(--text-2); text-decoration: none; padding: 0.4rem 0.5rem; border-radius: 0.35rem;
  white-space: nowrap; font-weight: 500; font-size: 0.95rem;
}
.site-nav a:hover { color: var(--text-1); background: var(--bg-4); }
.site-nav a[aria-current] { color: var(--accent); background: var(--accent-soft); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-width: 2.4rem; height: 2.4rem; padding: 0 0.55rem; cursor: pointer;
  border: 1px solid var(--border-2); border-radius: 0.5rem; background: var(--bg-4); color: var(--text-2);
}
.icon-btn:hover { color: var(--text-1); border-color: var(--text-6); }
.icon-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.icon-btn svg { width: 1.15rem; height: 1.15rem; flex: none; }
/* icon of the width switch: "spread" in the centered state, "center" at full width */
html[data-a11y-layout="full"] .width-btn .ico-expand { display: none; }
html:not([data-a11y-layout="full"]) .width-btn .ico-center { display: none; }
.menu-btn { display: none; order: 4; }
.menu-btn .lbl { font-size: 0.9rem; font-weight: 600; }
/* the i18n runtime puts the language switch into .site-tools; a small alignment to the buttons */
.site-tools .i18n-switch { margin-inline-start: 0; height: 2.4rem; border-radius: 0.5rem; }

/* folded (narrow) header: the search and the menu open under the Menu button */
@container (max-width: 56rem) {
  .header-inner { padding-block: 0.5rem; }
  .site-tools { margin-inline-start: auto; }
  .menu-btn { display: inline-flex; }
  .site-menu {
    display: none; order: 5; flex: 1 1 100%; flex-direction: column; align-items: stretch; gap: 0.5rem;
    padding: 0.6rem 0 0.25rem; border-top: 1px solid var(--border);
  }
  .site-menu.open { display: flex; }
  .search { order: 0; margin: 0; flex: none; min-width: 0; }
  .search input { padding-block: 0.6rem; font-size: 1rem; }
  .site-nav { order: 1; flex: none; flex-direction: column; flex-wrap: nowrap; gap: 0.1rem; margin: 0; padding: 0; border-top: 0; }
  .site-nav a { padding: 0.65rem 0.6rem; font-size: 1.05rem; white-space: normal; }
}
@container (max-width: 40rem) {
  .site-name { display: none; }
  .width-btn { display: none; }               /* on a narrow screen switching the width makes no sense */
  .menu-btn .lbl { display: none; }
}

/* ---------- body ---------- */
main { overflow-wrap: anywhere; position: relative; flex: 1 0 auto; padding-block: 2rem 3.5rem; }
main:focus, main h1:focus { outline: none; }   /* focus is moved here by script after a view change; these are not controls */
.view[hidden] { display: none; }
#site-loading { position: absolute; inset-block-start: 2rem; margin: 0; max-width: calc(100% - 2.5rem); color: var(--text-2); }
html[data-site-loading] main .view { visibility: hidden; }   /* until site.js has drawn the page */
h1 { font-size: 2rem; line-height: 1.2; font-weight: 500; margin: 0 0 0.75rem; }
h2 { font-size: 1.5rem; line-height: 1.25; font-weight: 500; margin: 0 0 0.75rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 0.35rem; }
p { margin: 0 0 1rem; }
.lead { color: var(--text-2); font-size: 1.125rem; }
.lead p { margin: 0 0 0.75rem; }
.lead p:last-child { margin-bottom: 1rem; }
.lead ul, .lead dl { margin: 0 0 1rem; }   /* the lead may hold the same markup as any page text (lists, data rows) */
.lead h3 { margin-top: 1rem; }
.kicker { color: var(--text-6); font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; margin: 0 0 0.35rem; }
.section-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin: 2rem 0 1rem; }
.section-head h2 { margin: 0; }
.section-head h2 a { color: var(--text-1); text-decoration: none; }
.section-head h2 a:hover { color: var(--accent); text-decoration: underline; }
html[data-a11y-contrast="1"] .section-head h2 a, html[data-a11y-level="AAA"] .section-head h2 a { text-decoration: underline; }
.section-head .more { margin-inline-start: auto; font-family: var(--sans); font-size: 0.95rem; }
.note { color: var(--text-6); font-size: 0.9rem; font-family: var(--sans); }

/* ---------- tiles (featured pieces) ---------- */
.tiles { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr)); margin: 0; padding: 0; list-style: none; }
.tile {
  min-width: 0;
  display: flex; flex-direction: column; gap: 0.6rem; margin: 0;
  background: var(--bg-4); border: 1px solid var(--border); border-radius: 0.6rem; padding: 1.25rem 1.35rem 1.15rem;
  transition: border-color 0.15s, transform 0.15s;
}
.tile:hover { border-color: var(--accent); }
.tile.lead-tile { grid-column: span 2; background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--bg-4); }
@container (max-width: 40rem) { .tile.lead-tile { grid-column: span 1; } .tiles { grid-template-columns: minmax(0, 1fr); } }
.tile .head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.tile h3 { font-family: var(--serif); font-size: 1.3rem; font-weight: 500; line-height: 1.3; margin: 0; }
.tile.lead-tile h3 { font-size: 1.7rem; }
.tile h3 a { color: var(--text-1); text-decoration: none; }
.tile h3 a:hover { color: var(--accent); text-decoration: underline; }
/* in high contrast and at level AAA the title links are underlined too (1.4.1) */
html[data-a11y-contrast="1"] :is(.tile, .row) h3 a, html[data-a11y-level="AAA"] :is(.tile, .row) h3 a { text-decoration: underline; }
.tile .excerpt { margin: 0; color: var(--text-2); font-size: 1rem; }
.tile.lead-tile .excerpt { font-size: 1.0625rem; }
.tile .meta { margin-top: auto; padding-top: 0.5rem; }
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.15rem 0.5rem; border-radius: 0.3rem; line-height: 1.5; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent);
}
.badge.field { background: transparent; border: 1px solid var(--border-2); color: var(--text-3); text-transform: none; letter-spacing: 0; font-weight: 500; }
a.badge.field { text-decoration: none; }
a.badge.field:hover { color: var(--text-1); border-color: var(--text-3); }
.badge.kind { background: transparent; border: 1px dashed var(--border-2); color: var(--text-3); }
/* tags: small links that open the list of the pieces carrying the tag */
.tags { display: inline-flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; }
a.tag { font-size: 0.85rem; color: var(--text-3); text-decoration: none; white-space: nowrap; }
a.tag::before { content: "#"; opacity: 0.7; }
a.tag:hover { color: var(--accent); text-decoration: underline; }
html[data-a11y-contrast="1"] a.tag, html[data-a11y-level="AAA"] a.tag { text-decoration: underline; }
.meta { color: var(--text-6); font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.3rem 0.5rem; align-items: center; }
.meta .sep::before { content: "·"; }
.meta .only { color: var(--text-3); font-style: italic; }

/* ---------- lists (contents, section lists, search, errata, archive) ---------- */
.rows { list-style: none; margin: 0 0 1.5rem; padding: 0; border-top: 1px solid var(--border); }
.row { display: grid; grid-template-columns: 9rem 1fr; gap: 0.25rem 1.25rem; padding: 0.9rem 0; border-bottom: 1px solid var(--border); }
.row .when { color: var(--text-6); font-size: 0.9rem; padding-top: 0.2rem; }
.row h3 { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; margin: 0 0 0.2rem; line-height: 1.3; }
.row h3 a { color: var(--text-1); text-decoration: none; }
.row h3 a:hover { color: var(--accent); text-decoration: underline; }
.row .excerpt { margin: 0 0 0.35rem; color: var(--text-2); font-size: 0.98rem; }
.row .of { margin: 0 0 0.35rem; font-size: 0.9rem; color: var(--text-3); }
.row .revs { margin: 0.2rem 0 0; padding: 0; list-style: none; font-size: 0.92rem; }
.row .revs li { margin: 0.15rem 0; }
@container (max-width: 40rem) { .row { grid-template-columns: 1fr; } }
.empty { color: var(--text-3); font-family: var(--sans); padding: 1.5rem 0; }
mark { background: var(--accent-soft); color: inherit; border-radius: 0.15rem; padding: 0 0.1em; }

/* ---------- one piece in a frame (content/pieces/*.js) ---------- */
.piece-meta { margin-bottom: 0.9rem; }
.piece-meta:focus { outline: none; }
.piece-meta .meta { margin: 0.25rem 0; }
.piece-meta .more { font-size: 0.9rem; color: var(--text-3); margin: 0.25rem 0 0; }
.piece-meta .more a { white-space: nowrap; }
.piece-meta .more .lbl { font-weight: 600; }
.crumbs { margin: 0 0 0.5rem; font-family: var(--sans); font-size: 0.95rem; }
.crumbs a::before { content: "‹ "; }
.notice {
  border: 1px solid var(--border-2); border-inline-start: 0.3rem solid var(--accent-strong); border-radius: 0.5rem;
  background: var(--bg-4); padding: 0.6rem 0.9rem; margin: 0.5rem 0 0.75rem; font-size: 0.95rem; max-width: var(--measure);
}
.notice p { margin: 0; }
.piece-frame { display: block; width: 100%; border: 0; min-height: 24rem; background: transparent; color-scheme: light dark; }
.piece-frame--viewport { border: 1px solid var(--border); border-radius: 0.6rem; }
.placeholder { border: 1px dashed var(--border-2); border-radius: 0.6rem; padding: 1.5rem; max-width: var(--measure); }
.placeholder h1 { margin-bottom: 0.5rem; }
.placeholder p { margin: 0; color: var(--text-3); font-family: var(--sans); }
/* the static summary of an entry page: what a visitor without JavaScript (and a search engine) sees */
.entry-static { max-width: var(--measure); }

/* ---------- the pages of the footer (from the content/*.js text files) ---------- */
#view-legal { margin-inline: auto; }
.legal h1 { margin-bottom: 1.25rem; }
.legal h2 { margin-top: 1.75rem; }
.legal ul { padding-inline-start: 1.25rem; }
.legal p:has(> em:only-child) { color: var(--text-6); font-size: 0.9rem; }   /* e.g. "Last updated: …" */
dl.company { margin: 0 0 1rem; }
dl.company dt { font-weight: 600; }
dl.company dd { margin: 0 0 0.35rem; }

/* ---------- footer ---------- */
.site-footer { background: var(--bg-2); border-top: 1px solid var(--border); padding: 1.75rem 0 2rem; font-size: 0.9375rem; }
.footer-nav ul { list-style: none; margin: 0 0 1.25rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; }
.footer-nav a { color: var(--text-3); }
.footer-nav a:hover { color: var(--text-1); }
.footer-nav a[aria-current="page"] { color: var(--accent); }
.footer-legal { display: flex; gap: 1.25rem 1.5rem; align-items: flex-start; flex-wrap: wrap; padding-top: 1.25rem; border-top: 1px solid var(--border); color: var(--text-8); }
.footer-legal p { margin: 0 0 0.3rem; }
.footer-legal .brand svg { height: 2.75rem; margin: -0.6rem 0 0 -0.35rem; }
.cc {
  display: inline-block; font-weight: 600; letter-spacing: 0.04em; font-family: var(--mono);
  border: 1px solid var(--border-2); border-radius: 0.2rem; padding: 0.05rem 0.4rem; line-height: 1.4;
  text-decoration: none; color: var(--text-3);
}
.cc:hover { color: var(--text-1); border-color: var(--text-3); }
.footer-legal .top { margin-inline-start: auto; }
