/* ANAD document portal theme, version 2.0, 2026-11-12.
   Styled after the article pages of IEEE Xplore (colours, type and layout only; no IEEE names or marks).
   Values read from https://ieeexplore.ieee.org/abstract/document/10849561 on 12 November 2026:
   text #333, links #069, header #14303e, top bar #000, gold #e4a42c, metric boxes #dbe6eb, rules #ddd,
   label green #060, red #b10f10, active contents item #17445a. Font: Helvetica Neue, falling back to Arial.
   build_portal.py copies this file to docs/theme.css. */

:root {
  --bg: #ffffff; --page: #f3fafe; --ink: #333333; --muted: #666666; --line: #dddddd; --soft: #f5f5f5;
  --link: #006699; --link-hover: #00415f; --head: #14303e; --topbar: #000101; --gold: #e4a42c;
  --metric: #dbe6eb; --label: #006600; --red: #b10f10; --active: #17445a; --code: #f4f4f4;
  --fig-edge: #8a8a8a; --primary: #006699; --coral: #b10f10; --zebra: #eef3f6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161b1f; --page: #11161a; --ink: #e3e6e8; --muted: #a3abb1; --line: #333b42; --soft: #1d2429;
    --link: #5fb3dd; --link-hover: #8ccbea; --head: #0f2430; --topbar: #000000; --gold: #e4a42c;
    --metric: #1c3442; --label: #6cc36c; --red: #ff6b5e; --active: #8ccbea; --code: #222a30;
    --fig-edge: #8d969d; --primary: #5fb3dd; --coral: #ff6b5e; --zebra: #1b242a;
  }
}
:root[data-theme="dark"] {
  --bg: #161b1f; --page: #11161a; --ink: #e3e6e8; --muted: #a3abb1; --line: #333b42; --soft: #1d2429;
  --link: #5fb3dd; --link-hover: #8ccbea; --head: #0f2430; --topbar: #000000; --gold: #e4a42c;
  --metric: #1c3442; --label: #6cc36c; --red: #ff6b5e; --active: #8ccbea; --code: #222a30;
  --fig-edge: #8d969d; --primary: #5fb3dd; --coral: #ff6b5e; --zebra: #1b242a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 "Helvetica Neue", Helvetica, Arial, sans-serif; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); }
code { font-family: Menlo, Consolas, monospace; font-size: .86em; background: var(--code); padding: 1px 5px; border-radius: 3px; }

/* ---------- top bar and header ---------- */
.topbar { background: var(--topbar); color: #fff; font-size: 14px; }
.topbar .wrap, .header .wrap, .titlebar .wrap, .layout, footer.doc-footer { max-width: 1280px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.topbar .wrap { display: flex; gap: 20px; flex-wrap: wrap; padding-top: 4px; padding-bottom: 4px; }
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { text-decoration: underline; color: #fff; }
.header { background: var(--head); color: #fff; }
.header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.header .brand { font-size: 24px; font-weight: 700; color: #fff; text-decoration: none; letter-spacing: -0.01em; }
.header .brand em { font-weight: 400; }
.header .brand:hover { color: #fff; }
.header nav { display: flex; gap: 10px; flex-wrap: wrap; }
.header nav a { color: #fff; text-decoration: none; padding: 7px 18px; border-radius: 2px; font-size: 16px; }
.header nav a.primary { background: var(--link); }
.header nav a:hover { background: rgba(255, 255, 255, .12); }
.header nav a.primary:hover { background: #00557f; }
.header .rule { height: 3px; background: var(--gold); }

/* ---------- title area ---------- */
.titlebar { background: var(--bg); border-bottom: 1px solid var(--line); }
.titlebar .wrap { padding-top: 14px; padding-bottom: 18px; }
.crumbs { font-size: 15px; margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; color: var(--ink); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.titlebar h1 { font-size: 32px; line-height: 1.19; font-weight: 700; margin: 0 0 8px; max-width: 30em; }
.titlebar .subtitle { font-size: 20px; color: var(--ink); margin: 0 0 12px; max-width: 46em; }
.titlebar .label { color: var(--label); font-weight: 700; font-size: 18px; }
.titlebar .meta { font-size: 16px; margin: 4px 0; }
.titlebar .actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.btn { display: inline-block; font-size: 16px; padding: 6px 12px; border: 1px solid var(--link); border-radius: 4px; color: var(--link); text-decoration: none; background: var(--bg); }
.btn:hover { background: var(--zebra); text-decoration: none; }
.btn.flag { background: var(--red); border-color: var(--red); color: #fff; cursor: default; }
.metrics { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.metric { background: var(--metric); color: var(--link); padding: 6px 10px; min-width: 96px; line-height: 1.3; text-decoration: none; }
.metric b { display: block; font-size: 21.6px; }
a.metric:hover { text-decoration: underline; }

/* ---------- three-column body ---------- */
.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr) 260px; gap: 36px; }
.layout.two { grid-template-columns: minmax(0, 1fr) 280px; }
.layout > main { padding: 24px 0 56px; min-width: 0; max-width: 820px; }

/* left: document sections */
.toc { padding: 24px 0; font-size: 15px; }
.toc .inner { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.toc .label { font-size: 18px; color: var(--ink); margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc > .inner > ol > li { border-bottom: 1px solid var(--line); padding: 6px 0; }
.toc a { text-decoration: none; display: block; padding: 3px 0; line-height: 1.35; }
.toc a:hover { text-decoration: underline; }
.toc li.current > a { color: var(--active); font-weight: 700; }
.toc ol ol { padding-left: 14px; }
.toc ol ol a { font-size: 14px; color: var(--muted); }
.toc ol ol a:hover { color: var(--link); }
.toc .more { padding-top: 10px; display: grid; gap: 4px; }

/* right: related box */
.aside { padding: 24px 0; }
.aside .box { border-top: 4px solid var(--link); background: var(--bg); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); padding: 0 12px 12px 16px; position: sticky; top: 12px; }
.aside h2 { font-size: 18px; font-weight: 500; margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.aside ul { list-style: none; padding: 0; margin: 0; }
.aside li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.aside li a { display: block; font-size: 16px; line-height: 1.4; text-decoration: none; margin-bottom: 2px; }
.aside li a:hover { text-decoration: underline; }
.aside .all { display: block; text-align: right; font-weight: 700; padding-top: 10px; text-decoration: none; }

/* ---------- text ---------- */
main { font-size: 17px; line-height: 1.75; }
main h2 { font-size: 24px; font-weight: 700; margin: 36px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); scroll-margin-top: 12px; line-height: 1.3; }
main > h2:first-child { margin-top: 0; }
main h2 .kicker { display: block; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
main h3 { font-size: 19px; font-weight: 700; font-style: italic; margin: 28px 0 6px; scroll-margin-top: 12px; }
main h2#abstract { font-size: 15px; font-style: normal; border: 0; padding: 0; margin-bottom: 4px; }
main h2#abstract + p, main h2#abstract + p + p, main h2#abstract + p + p + p { font-size: 18px; line-height: 1.67; }
p { margin: 0 0 14px; }
ol li, ul li { margin: 4px 0; }
blockquote { margin: 16px 0; padding: 4px 18px; border-left: 3px solid var(--line); color: var(--muted); }

.table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.5; }
th, td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--line); }
th { background: var(--metric); color: var(--ink); font-weight: 700; }
tbody tr:nth-child(even) td { background: var(--zebra); }
tr:last-child td { border-bottom: 0; }

figure.fig { margin: 22px 0; border: 1px solid var(--line); border-radius: 4px; padding: 14px; background: var(--bg); }
figure.fig svg { width: 100%; height: auto; display: block; max-width: 760px; margin: 0 auto; }
figure.fig figcaption { font-size: 15px; line-height: 1.5; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
figure.fig figcaption b { margin-right: 4px; }

nav.pager { display: flex; justify-content: space-between; gap: 14px; margin: 44px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 16px; }
nav.pager a { text-decoration: none; max-width: 48%; }
nav.pager a:hover { text-decoration: underline; }
nav.pager .dir { display: block; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
nav.pager .next { text-align: right; margin-left: auto; }

/* ---------- portal home: result list ---------- */
.results { list-style: none; padding: 0; margin: 0; }
.result { padding: 18px 0; border-bottom: 1px solid var(--line); }
.result h3 { font-style: normal; font-size: 20px; margin: 4px 0; }
.result h3 a { text-decoration: none; }
.result h3 a:hover { text-decoration: underline; }
.result .who { font-size: 15px; margin: 2px 0; }
.result .desc { font-size: 15px; color: var(--muted); margin: 2px 0 8px; }
.result .snippet { font-size: 16px; margin: 8px 0; }
.result .sections { font-size: 15px; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; list-style: none; margin: 8px 0 0; }
.tag { display: inline-block; font-size: 13px; font-weight: 700; padding: 1px 8px; border-radius: 2px; background: var(--metric); color: var(--link); margin-right: 6px; }
.tag.red { background: var(--red); color: #fff; }

/* ---------- related-documents register ---------- */
.reg-group { margin-top: 26px; }
.kind { white-space: nowrap; }
td .path { font-family: Menlo, Consolas, monospace; font-size: 13px; color: var(--muted); }
.note { font-size: 15px; color: var(--muted); }

/* ---------- footer ---------- */
.foot-band { background: var(--head); color: #fff; margin-top: 20px; }
footer.doc-footer { padding-top: 18px; padding-bottom: 22px; }
footer.doc-footer dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0; font-size: 14px; }
footer.doc-footer dt { font-weight: 700; }
footer.doc-footer dd { margin: 0; color: #d8e1e6; }
footer.doc-footer a { color: #fff; }
footer.doc-footer code { background: rgba(255, 255, 255, .1); color: #fff; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 210px minmax(0, 1fr); }
  .layout .aside { grid-column: 2; padding-top: 0; }
  .aside .box { position: static; }
}
@media (max-width: 820px) {
  .layout, .layout.two { grid-template-columns: 1fr; gap: 0; }
  .layout .aside { grid-column: 1; }
  .toc { padding-bottom: 0; }
  .toc .inner { position: static; max-height: none; }
  .toc ol ol { display: none; }
  .toc li.current ol { display: block; }
  .titlebar h1 { font-size: 26px; }
  .titlebar .subtitle { font-size: 18px; }
  main { font-size: 16px; }
  nav.pager { flex-direction: column; }
  nav.pager a { max-width: none; }
}
