/* AlterSeeK-Path web interface: the system font, one accent color. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1b1d22;
  --muted: #5d626c;
  --line: #e3e1db;
  --accent: #1f4f8f;
  --accent-ink: #ffffff;
  --accent-soft: #e8eef7;
  --stop: #9b2c2c;
  --stop-soft: #fbeeee;
  --code-bg: #f3f2ee;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 10px;
  --wrap: 1080px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171b; --surface: #1d2025; --ink: #e8e6e1; --muted: #a2a6ae; --line: #30343b;
    --accent: #8fb3e8; --accent-ink: #10151d; --accent-soft: #223149;
    --stop: #f0a3a3; --stop-soft: #3a2323; --code-bg: #262a30;
  }
}
:root[data-theme="dark"] {
  --bg: #15171b; --surface: #1d2025; --ink: #e8e6e1; --muted: #a2a6ae; --line: #30343b;
  --accent: #8fb3e8; --accent-ink: #10151d; --accent-soft: #223149;
  --stop: #f0a3a3; --stop-soft: #3a2323; --code-bg: #262a30;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: 18px; line-height: 1.55; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Links inside text must not rely on color alone (WCAG 1.4.1). */
main p a:not(.button), .site-footer p a { text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible, pre:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
code, pre { font-family: var(--mono); font-size: 0.86em; }
h1, h2 { font-weight: 700; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1400px; }

/* header and footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 60px; flex-wrap: wrap; }
.wordmark { font-size: 1.35rem; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.wordmark span { color: var(--accent); }
.wordmark:hover { text-decoration: none; }
nav { display: flex; gap: 22px; }
nav a { color: var(--muted); }
nav a:hover { color: var(--accent); text-decoration: none; }

.site-footer { margin-top: 72px; border-top: 1px solid var(--line); background: var(--surface);
  font-size: 0.88rem; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; padding-top: 28px; padding-bottom: 36px; }
.footer-grid p { margin: 0; }
.footer-head { font-weight: 700; color: var(--ink); margin-bottom: 6px !important; }

/* landing */
.intro { padding: 56px 0 28px; max-width: 760px; }
.lede { font-size: 1.12rem; color: var(--muted); margin: 14px 0 0; }
.plates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
.plate { margin: 0; }
.plate a { display: block; }
.plate img { aspect-ratio: 4 / 3; object-fit: contain; }
.plate img, .band-card img { display: block; width: 100%; height: auto; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); }
.band-card > a { display: block; margin-top: 16px; }
/* rotatable Brillouin zone: white like the pictures beside it */
.bz-box { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.bz-stage { position: relative; aspect-ratio: 4 / 3; }
/* 3D results: square frames, so tall zones are not shrunk to fit a wide frame */
.plates.square .bz-stage, .plates.square .plate img { aspect-ratio: 1; }
.bz-viewer { position: absolute; inset: 0; }
.bz-overlay { position: absolute; inset: 0; pointer-events: none; color: #111; font-family: 'STIX Two Text', STIXGeneral, 'Times New Roman', Times, serif; font-variant-numeric: lining-nums; }
.bz-overlay p { margin: 0; }
.bz-legend { position: absolute; top: 5%; right: 6%; padding: 1px 8px; border: 1px solid #ccc; border-radius: 3px; background: rgba(255,255,255,.85); font-size: 0.85rem; }
.bz-legend > span { display: block; }
.bz-key { -webkit-text-stroke: 0.5px #000; font-style: normal; }
.bz-dot { display: inline-block; width: 0.62em; height: 0.62em; border-radius: 50%; background: currentColor; vertical-align: -0.02em; }
.bz-label .bar { text-decoration: overline; }
/* x^{a}_{b}: the two scripts stacked on the same symbol, as mathtext sets them; the column aligns on the superscript, so it is raised */
.bz-label .ss { display: inline-flex; flex-direction: column; vertical-align: 0.32em; line-height: 1; font-size: 0.72em; }
.bz-label .ss sup, .bz-label .ss sub { font-size: 1em; vertical-align: baseline; line-height: 1.05; }
.bz-label sub, .bz-label sup { font-size: 0.72em; }
.bz-heads { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bz-label { position: absolute; transform: translate(-50%, -50%); font-weight: 700; font-size: 1rem; line-height: 1; white-space: nowrap; }
.bz-box .viewer-bar { background: var(--surface); }
.bz-picture { font-size: 0.82rem; padding: 2px 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--bg); }
figcaption { color: var(--muted); font-size: 0.92rem; margin-top: 8px; text-align: center; }

/* examples: picture cards, each opening a ready result page */
.examples { margin: 40px 0 0; }
.examples h2 { margin-bottom: 14px; }
.example-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.example-card { display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.example-card:hover { text-decoration: none; border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08); transform: translateY(-2px); }
.example-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain;
  background: #fff; border-bottom: 1px solid var(--line); padding: 8px; }
.example-name { font-weight: 700; font-size: 1.1rem; padding: 12px 16px 0; }
.example-note { color: var(--muted); font-size: 0.9rem; padding: 2px 16px 14px; }

/* cards and forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 28px; margin: 20px 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.meta { color: var(--muted); font-size: 0.92rem; margin: 6px 0 0; }
.muted { color: var(--muted); font-weight: 400; }
.badge { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 12px;
  font-size: 0.9rem; font-weight: 700; }
.note { color: var(--muted); margin: 0 0 16px; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field.grow { flex: 1 1 260px; }
.field.axis { flex: 0 1 240px; }
.field-row { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
label, legend { font-weight: 700; font-size: 0.95rem; }
legend { margin-bottom: 6px; padding: 0; }
.hint { margin: 0; color: var(--muted); font-size: 0.85rem; }
input[type="text"], input[type="number"], select {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 42px; }
input[type="text"]#moments { font-family: var(--mono); font-size: 0.95rem; }
input:focus-visible, select:focus-visible, button:focus-visible, .drop:focus-within {
  outline: 2px solid var(--accent); outline-offset: 2px; }

.drop { display: flex; align-items: center; justify-content: center; min-height: 96px; padding: 16px;
  border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--bg);
  font-weight: 400; color: var(--muted); cursor: pointer; text-align: center; position: relative; }
.drop:hover, .drop.dragging { border-color: var(--accent); color: var(--accent); }
.drop.has-file { border-style: solid; color: var(--ink); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { font-weight: 400; padding: 8px 16px; cursor: pointer; min-height: 42px;
  display: flex; align-items: center; background: var(--bg); }
.segmented input:checked + label { background: var(--accent); color: var(--accent-ink); }
.segmented input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: -2px; }

.actions { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
button, .button { font: inherit; font-weight: 700; font-size: 1rem; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 9px 20px;
  cursor: pointer; display: inline-block; }
.button:hover { text-decoration: none; filter: brightness(1.08); }
button:hover { filter: brightness(1.08); }
button[disabled] { opacity: 0.6; cursor: progress; }
.button.secondary { background: transparent; color: var(--accent); }
.downloads { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }
.busy { color: var(--muted); font-size: 0.95rem; }
.busy::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px;
  vertical-align: -2px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* result page */
.crumbs { margin: 28px 0 0; color: var(--muted); font-size: 0.95rem; }
.crumbs span { margin: 0 6px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 18px 0 0; }
.facts dt { color: var(--muted); font-size: 0.92rem; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts code { background: none; padding: 0; white-space: pre-wrap; }
.facts.stacked { grid-template-columns: 1fr; gap: 0; }
.facts.stacked dt { margin-top: 6px; }
.facts.stacked code { font-size: 0.8rem; }

/* structure viewer */
.viewer-box { margin: 14px 0 6px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.viewer { position: relative; width: 100%; height: 300px; background: var(--surface); }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 10px; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); }
.spin-key i { display: inline-block; width: 12px; height: 4px; margin: 0 4px 0 8px; vertical-align: middle; border-radius: 2px; }
.spin-key i:first-child { margin-left: 0; }
.spin-key .up { background: #d62728; }
.spin-key .down { background: #1f5bd6; }
.view-buttons { display: flex; gap: 4px; }
.view-buttons button { font-size: 0.82rem; padding: 2px 9px; font-weight: 400; background: var(--bg);
  color: var(--ink); border-color: var(--line); }

/* text files: listed in the side column, read in a wide dialog */
.file-list { list-style: none; margin: 10px 0 0; padding: 0; }
.file-list li { display: flex; align-items: baseline; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.file-list li:first-child { border-top: 0; }
.file-list span { flex: 1; font-family: var(--mono); font-size: 0.9rem; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 400; cursor: pointer; }
button.link:hover { text-decoration: underline; filter: none; }
.text-dialog { width: min(1100px, 94vw); max-height: 88vh; padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.text-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.dialog-head form { margin: 0; }
.dialog-actions { display: flex; align-items: center; gap: 18px; }
.button.small { font-size: 0.88rem; padding: 4px 14px; }
.text-dialog pre { margin: 0; padding: 16px 20px; overflow: auto; max-height: calc(88vh - 64px);
  font-size: 0.82rem; line-height: 1.45; background: var(--code-bg); white-space: pre-wrap; overflow-wrap: anywhere; }

/* result page: structure across the top, settings left, path and figures right */
.structure-card { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 28px; align-items: start; }
.structure-card:not(:has(.viewer-box)) { grid-template-columns: 1fr; }
.structure-card .viewer-box { margin: 0; }
.structure-card .viewer { height: 320px; }
.facts.compact { grid-template-columns: max-content minmax(0, 1fr); gap: 4px 18px; margin-top: 14px; }
.facts.compact dt { font-size: 0.88rem; }
.facts.compact code { font-size: 0.82rem; }

.job-grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 0 24px; align-items: start; }
.job-side .card, .job-main .card { margin-top: 20px; }
.job-side .card { padding: 20px 22px; }
.job-side .ops { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 14px 0 8px; }
.job-side .op { display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.job-side .op-no { grid-row: auto; flex: none; }
.job-side .op-name { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.matrices { margin: 0 0 18px; font-size: 0.92rem; }
.matrix-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 10px; }
.matrix-list > div { display: flex; align-items: center; gap: 8px; }
.op-no.small { width: 22px; height: 22px; font-size: 0.75rem; }
.facts.stacked dt { font-size: 0.85rem; }
.placeholder { display: grid; place-items: center; min-height: 320px; color: var(--muted);
  text-align: center; border-style: dashed; }
.placeholder p { margin: 0; }

.ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 18px 0 22px; }
.op { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  gap: 4px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
  font-weight: 400; cursor: pointer; background: var(--bg); }
.op input { position: absolute; opacity: 0; pointer-events: none; }
.op:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.op:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.op-no { grid-row: span 2; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); background: var(--surface); }
.op:has(input:checked) .op-no { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.op-name { font-weight: 700; }
.matrix { display: inline-grid; grid-template-columns: repeat(3, auto); gap: 0 12px; justify-self: start;
  font-family: var(--mono); font-size: 0.82rem; color: var(--muted); padding: 2px 8px;
  border-left: 1px solid var(--muted); border-right: 1px solid var(--muted); }
.matrix span { text-align: right; }

.stop { border-color: var(--stop); background: var(--stop-soft); }
.stop h2 { color: var(--stop); }
pre.message { white-space: pre-wrap; margin: 12px 0 16px; font-size: 0.9rem; line-height: 1.5; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--accent); }
pre.log { background: var(--code-bg); border-radius: 8px; padding: 14px; max-height: 360px;
  overflow: auto; font-size: 0.8rem; line-height: 1.45; margin: 10px 0 0; }
.result { scroll-margin-top: 16px; }

@media (max-width: 1000px) {
  .job-grid, .structure-card { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 17px; }
  .card { padding: 18px; }
  .footer-grid, .plates, .example-grid { grid-template-columns: 1fr; gap: 16px; }
  .placeholder { min-height: 120px; }
  .intro { padding-top: 36px; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
}
