/* LatentLab website. Colours from the logo: navy #1F3864, orange #D9741A. */
:root {
  --navy: #1F3864;
  --navy-2: #2c4c80;
  --orange: #D9741A;
  --orange-soft: #fbeee2;
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5d6878;
  --line: #dfe4ea;
  --ok: #2e7d4f;
  --ok-soft: #e7f4ec;
  --bad: #b3261e;
  --bad-soft: #fbeaea;
  --warn: #8a5a00;
  --warn-soft: #fff5dc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --navy: #9fb7e3; --navy-2: #c3d3f0; --orange: #f0954a; --orange-soft: #3a2a1c;
    --bg: #11151c; --bg-alt: #171c25; --card: #1b212b; --text: #e6e9ee; --muted: #a2abb8;
    --line: #2c3442; --ok: #6fcf97; --ok-soft: #173326; --bad: #f28b82; --bad-soft: #3b1d1b;
    --warn: #f3c969; --warn-soft: #3a3016; --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.65 var(--font); }
img { max-width: 100%; height: auto; }
a { color: var(--navy-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--orange); }
h1, h2, h3 { line-height: 1.25; color: var(--navy); margin: 1.4em 0 .5em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.12rem; }
p { margin: .5em 0 1em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.mono { font-family: var(--mono); }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; flex: 0 0 auto; }
.brand img { height: 40px; width: auto; display: block; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--bg-alt); color: var(--navy); }
.nav a.active { color: var(--navy); background: var(--orange-soft); }
.lang { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px !important; font-size: .85rem; }
@media (max-width: 760px) {
  .site-header { position: static; }
  .site-header .wrap { padding-top: 10px; padding-bottom: 8px; gap: 6px; }
  .nav { margin-left: 0; gap: 2px; }
  .nav a { padding: 4px 8px; font-size: .95rem; }
  .brand img { height: 34px; }
}

/* hero */
.hero { background: linear-gradient(180deg, var(--bg-alt), var(--bg)); border-bottom: 1px solid var(--line); }
.hero .wrap { padding-top: 40px; padding-bottom: 36px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 36px; align-items: center; }
.hero-logo { max-width: 460px; width: 100%; }
.hero h1 { margin-top: .6em; }
.hero .lead { font-size: 1.12rem; color: var(--text); }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: 1fr; gap: 20px; padding-top: 24px; } }

/* sections and cards */
section { padding: 8px 0 24px; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
a.card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--orange); transform: translateY(-1px); }
.card .more { color: var(--orange); font-weight: 600; }
.stat { text-align: center; padding: 14px 8px; }
.stat b { display: block; font-size: 1.9rem; color: var(--navy); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .9rem; }
.tag { display: inline-block; font-size: .78rem; padding: 1px 8px; border-radius: 999px; background: var(--orange-soft); color: var(--orange); font-weight: 600; margin-right: 6px; vertical-align: 1px; }
.tag.navy { background: var(--bg-alt); color: var(--navy); border: 1px solid var(--line); }

figure { margin: 16px 0; }
figure img { border-radius: 8px; border: 1px solid var(--line); background: #fff; }
figcaption { font-size: .88rem; color: var(--muted); margin-top: 6px; }

/* news */
.news { list-style: none; padding: 0; margin: 0; }
.news li { display: grid; grid-template-columns: 96px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.news time { color: var(--orange); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .news li { grid-template-columns: 1fr; gap: 2px; } }

/* publications */
.pubs { list-style: none; padding: 0; margin: 0; counter-reset: pub; }
.pubs li { padding: 10px 0 10px 0; border-bottom: 1px solid var(--line); }
.pubs .title { font-weight: 600; }
.pubs .venue { font-style: italic; }
.pubs .me { font-weight: 700; color: var(--navy); }
.year-head { margin: 22px 0 4px; color: var(--orange); font-size: 1.05rem; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 6px; }
.filters button { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 4px 14px; cursor: pointer; font: inherit; font-size: .9rem; }
.filters button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
@media (prefers-color-scheme: dark) { .filters button.on { color: #11151c; } }
input[type=search] { font: inherit; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); min-width: 0; width: 260px; max-width: 100%; }

/* featured papers with a figure */
.papers { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.paper { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.paper .pfig { background: #fff; height: 190px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); padding: 8px; }
.paper .pfig img { max-height: 100%; max-width: 100%; width: auto; border: 0; border-radius: 0; object-fit: contain; }
.paper .pbody { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.paper .ptitle { font-weight: 700; color: var(--navy); line-height: 1.35; }
.paper .ptitle a { color: inherit; text-decoration: none; }
.paper .ptitle a:hover { color: var(--orange); }
.paper .pvenue { font-size: .86rem; color: var(--orange); font-weight: 600; }
.paper .psum { font-size: .9rem; }
.paper .pauth { font-size: .82rem; color: var(--muted); margin-top: auto; }

/* people */
.person { display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: start; }
.avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: var(--bg-alt); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: var(--navy); font-weight: 700; }
.person h3 { margin: 2px 0 2px; }
.person .role { color: var(--muted); font-size: .9rem; }
.person ul { margin: 6px 0 0; padding-left: 18px; font-size: .93rem; }
.pi { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
@media (max-width: 720px) { .pi { grid-template-columns: 1fr; } }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 4px 0 4px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* demo pages */
.notice { border: 1px solid var(--line); border-left: 4px solid var(--orange); background: var(--orange-soft); border-radius: 8px; padding: 12px 16px; margin: 14px 0; }
.notice.privacy { border-left-color: var(--navy); background: var(--bg-alt); }
.notice b { color: var(--navy); }
.how { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; overflow-x: auto; }
.how svg { display: block; width: 100%; min-width: 640px; height: auto; }
.io { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 10px; }
@media (max-width: 720px) { .io { grid-template-columns: 1fr; } }
.io h4 { margin: 0 0 4px; color: var(--navy); }
.io ul { margin: 0; padding-left: 18px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 18px 0; box-shadow: var(--shadow); }
.panel h2 { margin-top: 0; font-size: 1.2rem; }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--orange); background: var(--orange-soft); }
.drop input[type=file] { display: none; }
.drop .hint { color: var(--muted); font-size: .9rem; }
.drop.filled { border-style: solid; border-color: var(--navy-2); }
.files { list-style: none; padding: 0; margin: 8px 0 0; text-align: left; font-size: .9rem; }
.files li { padding: 3px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.files .fname { font-family: var(--mono); word-break: break-all; }
.files .phi { color: var(--bad); font-weight: 600; }
.files .okk { color: var(--ok); }
.field { margin: 10px 0; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field input[type=number] { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; width: 160px; background: var(--card); color: var(--text); }
.confirm { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; padding: 10px 12px; border-radius: 8px; background: var(--bg-alt); }
.confirm input { margin-top: 5px; width: 18px; height: 18px; flex: 0 0 auto; }
.btn { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 10px 22px; background: var(--navy); color: #fff; cursor: pointer; }
.btn:hover { background: var(--orange); }
.btn:disabled { opacity: .45; cursor: not-allowed; background: var(--navy); }
.btn.secondary { background: transparent; color: var(--navy); border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .btn { color: #11151c; } .btn.secondary { color: var(--navy); } }
.queue-line { font-size: .92rem; color: var(--muted); margin: 8px 0 0; }
.progress-block { margin: 12px 0; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; margin-bottom: 4px; flex-wrap: wrap; }
.bar { height: 12px; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--navy), var(--orange)); transition: width .3s; }
.bar.indeterminate > i { width: 30%; animation: slide 1.4s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
.status-box { border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.status-box.err { background: var(--bad-soft); color: var(--bad); }
.status-box.info { background: var(--bg-alt); }
.result-big { font-size: 2.1rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.verdict { display: inline-block; padding: 4px 14px; border-radius: 999px; font-weight: 700; }
.verdict.yes { background: var(--ok-soft); color: var(--ok); }
.verdict.no { background: var(--bad-soft); color: var(--bad); }
.verdict.neutral { background: var(--bg-alt); color: var(--navy); }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumbs figure { margin: 0; text-align: center; }
.thumbs img { height: 170px; width: auto; background: #000; }
.overlay { position: relative; display: inline-block; line-height: 0; }
.overlay img { height: 170px; width: auto; }
.overlay img + img { position: absolute; left: 0; top: 0; border-color: transparent; background: transparent; }
.viewer { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.viewer canvas { width: 100%; background: #000; border-radius: 6px; image-rendering: pixelated; }
.viewer input[type=range] { width: 100%; }
@media (max-width: 620px) { .viewer { grid-template-columns: 1fr; } }
.chart { width: 100%; max-width: 560px; height: auto; }

/* how-it-works figures (inline SVG, follows the theme) */
.fig text { fill: var(--text); font: 13px var(--font); }
.fig .h { font-weight: 700; fill: var(--navy); font-size: 14px; }
.fig .s { font-size: 11.5px; fill: var(--muted); }
.fig .box { fill: var(--card); stroke: var(--line); stroke-width: 1.2; }
.fig .in { fill: var(--card); stroke: var(--navy-2); stroke-width: 1.6; }
.fig .model { fill: var(--bg-alt); stroke: var(--navy-2); stroke-width: 1.2; }
.fig .out { fill: var(--orange-soft); stroke: var(--orange); stroke-width: 1.8; }
.fig .ar { stroke: var(--muted); stroke-width: 1.8; fill: none; }
.fig .arh { fill: var(--muted); }
.fig .img { fill: #111; }
.fig .tissue { fill: #c9ced6; }
.fig .les { fill: var(--orange); }
.fig .lab { font-size: 10.5px; fill: var(--orange); font-weight: 700; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-alt); margin-top: 36px; font-size: .9rem; color: var(--muted); }
.site-footer .wrap { display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; padding-top: 18px; padding-bottom: 22px; }
.counter b { color: var(--navy); font-variant-numeric: tabular-nums; }
