/* DNS database — Sapienza CFD group. Plain CSS, no build step. */
:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --surface-2: #f3f1ed;
  --text: #1d1f23;
  --muted: #5d6169;
  --border: #e2ded7;
  --accent: #8c1d32;        /* Sapienza red */
  --accent-soft: #f6e8eb;
  --link: #8c1d32;
  --code-bg: #f3f1ed;
  --note-bg: #fff8e6;
  --note-border: #e8c76a;
  --cat-incompressible: #2f6690;
  --cat-heat: #c0562b;
  --cat-compressible: #6a4c93;
  --cat-multiphase: #2a8c82;
  --cat-code: #5d6169;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --radius: 10px;
  --maxw: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --surface: #1c1f23; --surface-2: #24282d; --text: #e6e6e6; --muted: #a3a8b0;
    --border: #33383f; --accent: #e0788a; --accent-soft: #3a2228; --link: #ef93a3; --code-bg: #24282d;
    --note-bg: #2e2816; --note-border: #8a7330;
    --cat-incompressible: #6fa8d6; --cat-heat: #e98b5e; --cat-compressible: #a98bd6; --cat-multiphase: #5cc2b6; --cat-code: #a3a8b0;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a; --surface: #1c1f23; --surface-2: #24282d; --text: #e6e6e6; --muted: #a3a8b0;
  --border: #33383f; --accent: #e0788a; --accent-soft: #3a2228; --link: #ef93a3; --code-bg: #24282d;
  --note-bg: #2e2816; --note-border: #8a7330;
  --cat-incompressible: #6fa8d6; --cat-heat: #e98b5e; --cat-compressible: #a98bd6; --cat-multiphase: #5cc2b6; --cat-code: #a3a8b0;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; height: auto; }
code, pre, .mono { font-family: var(--mono); font-size: .9em; }
code { background: var(--code-bg); padding: .1em .35em; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); margin: .2em 0 .3em; }
h2 { font-size: 1.35rem; margin: 2.2rem 0 .8rem; padding-top: .4rem; }
h3 { font-size: 1.08rem; margin: 1.4rem 0 .5rem; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* top bar */
.topbar { border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; gap: 1rem; min-height: 56px; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 650; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; flex: none; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; line-height: 1.2; }
.topnav { margin-left: auto; display: flex; gap: 1.1rem; font-size: .95rem; align-items: center; }
.topnav a { color: var(--muted); }
.topnav a:hover, .topnav a.active { color: var(--text); text-decoration: none; }
.theme-btn { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 2px 8px; cursor: pointer; font: inherit; font-size: .85rem; }
@media (max-width: 640px) { .topnav .hide-sm { display: none; } .brand small { display: none; } }

/* hero */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); background: #0e1116; color: #f2f2f2; }
.hero .bgimg { position: absolute; inset: 0; background-size: cover; background-position: center right; opacity: .85; }
.hero .shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,12,16,.88) 0%, rgba(10,12,16,.55) 45%, rgba(10,12,16,.05) 100%); }
.hero .wrap { position: relative; padding-top: 3.2rem; padding-bottom: 3rem; }
.hero h1 { color: #fff; white-space: nowrap; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
@media (max-width: 720px) { .hero h1 { white-space: normal; } }
.hero p { max-width: 62ch; color: #d9dbe0; font-size: 1.05rem; }
.hero .stats { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 1.6rem; }
.hero .stat b { display: block; font-size: 1.6rem; color: #fff; font-variant-numeric: tabular-nums; }
.hero .stat span { color: #b8bcc4; font-size: .85rem; }
.hero .credit { position: absolute; right: 12px; bottom: 8px; font-size: .72rem; color: #aab; max-width: 50ch; text-align: right; }
@media (max-width: 640px) { .hero .credit { display: none; } }

/* filters */
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1.6rem 0 1.2rem; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: .3rem .8rem; border-radius: 999px; cursor: pointer; font: inherit; font-size: .9rem; display: inline-flex; align-items: center; gap: .4rem; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
.search { margin-left: auto; min-width: 220px; flex: 0 1 300px; padding: .45rem .8rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
@media (max-width: 640px) { .search { margin-left: 0; flex: 1 1 100%; } }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease; color: var(--text); }
.card[hidden] { display: none; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.card .thumb { aspect-ratio: 16/9; background: var(--surface-2) center/cover no-repeat; }
.card .body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card h3 { margin: 0; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }
.card .meta { margin-top: auto; padding-top: .5rem; display: flex; gap: .5rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); align-items: center; }
.badge { display: inline-block; font-size: .74rem; font-weight: 600; letter-spacing: .02em; padding: .1rem .5rem; border-radius: 4px; color: #fff; text-transform: uppercase; }
.badge.incompressible { background: var(--cat-incompressible); }
.badge.heat { background: var(--cat-heat); }
.badge.compressible { background: var(--cat-compressible); }
.badge.multiphase { background: var(--cat-multiphase); }
.badge.code { background: var(--cat-code); }
.badge.new { background: var(--accent); }
.empty { color: var(--muted); padding: 2rem 0; display: none; }

/* sections and prose */
.section { margin: 2.4rem 0; }
.prose p { max-width: 75ch; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.lead { font-size: 1.08rem; color: var(--muted); margin-top: 0; }
.crumbs { font-size: .88rem; color: var(--muted); margin-top: 1.4rem; }
.crumbs a { color: var(--muted); }
.metarow { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; color: var(--muted); font-size: .92rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.2rem 0 .4rem; }
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: .2rem .55rem; font-size: .82rem; }

figure { margin: 0; }
figure img, figure video { display: block; border-radius: 8px; border: 1px solid var(--border); background: #000; }
figcaption { font-size: .86rem; color: var(--muted); margin-top: .5rem; line-height: 1.45; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.4rem; }

/* tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: .45rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.file { min-width: 18ch; max-width: 34ch; }
td.file a { font-family: var(--mono); font-size: .86rem; word-break: break-all; }

details.group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: .9rem 0; box-shadow: var(--shadow); }
details.group > summary { cursor: pointer; padding: .8rem 1.1rem; font-weight: 600; list-style: none; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.group[open] > summary::before { transform: rotate(90deg); }
details.group > summary .count { color: var(--muted); font-weight: 400; font-size: .88rem; }
details.group .inner { padding: 0 1.1rem 1.1rem; }
details.group .inner > p { margin: .4rem 0 .8rem; }
details.cols > summary { cursor: pointer; color: var(--link); margin: .6rem 0; font-size: .92rem; }

.note { background: var(--note-bg); border-left: 3px solid var(--note-border); padding: .55rem .9rem; border-radius: 6px; font-size: .9rem; margin: .7rem 0; }
.note b { font-weight: 600; }

/* citation */
.cite { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1.1rem; margin: .8rem 0; }
.cite pre { background: var(--code-bg); padding: .7rem .9rem; border-radius: 6px; overflow-x: auto; font-size: .8rem; margin: .7rem 0 0; display: none; white-space: pre; }
.cite.show pre { display: block; }
.cite .row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }

/* explorer */
.explorer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 520px; }
@media (max-width: 900px) { .explorer { grid-template-columns: 1fr; } }
.explorer .controls { border-right: 1px solid var(--border); padding: 1rem; display: flex; flex-direction: column; gap: .9rem; font-size: .9rem; max-height: 720px; overflow-y: auto; }
@media (max-width: 900px) { .explorer .controls { border-right: 0; border-bottom: 1px solid var(--border); max-height: none; } }
.explorer label.ctl { display: block; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .3rem; }
.explorer select { width: 100%; padding: .35rem .5rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: .9rem; }
.explorer .checks { display: flex; flex-direction: column; gap: .15rem; max-height: 190px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: .35rem .5rem; background: var(--bg); }
.explorer .checks label { display: flex; gap: .45rem; align-items: baseline; cursor: pointer; font-size: .88rem; }
.explorer .row { display: flex; gap: .9rem; flex-wrap: wrap; align-items: center; }
.explorer .presets { display: flex; flex-wrap: wrap; gap: .35rem; }
.explorer .plotarea { padding: .5rem; min-width: 0; display: flex; flex-direction: column; }
.explorer .plot { flex: 1; min-height: 480px; }
.explorer .status { font-size: .82rem; color: var(--muted); padding: 0 .6rem .4rem; min-height: 1.3em; }
.explorer .help { font-size: .8rem; color: var(--muted); }
.series-list { display: flex; flex-direction: column; gap: .3rem; }
.series-list .s { display: flex; gap: .4rem; align-items: center; font-size: .82rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .25rem .4rem; }
.series-list .s span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.series-list .s button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; }

footer { border-top: 1px solid var(--border); margin-top: 4rem; padding: 2rem 0 3rem; color: var(--muted); font-size: .88rem; background: var(--surface); }
footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
footer h4 { margin: 0 0 .4rem; color: var(--text); font-size: .92rem; }
footer p { margin: .2rem 0; }
.cc { display: inline-flex; gap: .35rem; align-items: center; }
.toc { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .9rem; margin: .4rem 0 0; padding: 0; list-style: none; }
.visually-hidden { position: absolute !important; clip: rect(1px,1px,1px,1px); width: 1px; height: 1px; overflow: hidden; }

/* grid-stretching calculator */
.calc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .calc { grid-template-columns: 1fr; } }
.calc-in { padding: 1rem; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: .6rem; font-size: .88rem; }
@media (max-width: 900px) { .calc-in { border-right: 0; border-bottom: 1px solid var(--border); } }
.calc-in label { display: flex; flex-direction: column; gap: .2rem; color: var(--muted); font-weight: 600; }
.calc-in input, .calc-in select { padding: .35rem .5rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-weight: 400; }
.calc-out { padding: .5rem 1rem 1rem; min-width: 0; }
