/* citefinder — library catalog card look. The preview card is the one bold element; everything else stays quiet. */
:root {
  --bg: #EDF1F7;
  --surface: #F8FAFD;
  --ink: #1B2A4A;
  --muted: #5A6785;
  --line: #CCD6E6;
  --card: #FFFFFF;
  --card-rule: #CFDCF0;
  --red: #C0392B;
  --focus: #2F6FDE;
  --ok: #2E7D4F;
  --warn: #A66300;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --type: "American Typewriter", "Courier Prime", "Courier New", ui-monospace, monospace;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --lh: 1.6rem;
  color-scheme: light dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1628;
    --surface: #142039;
    --ink: #E3E9F5;
    --muted: #9AA8C4;
    --line: #2A3A5C;
    --card: #1A2643;
    --card-rule: #2C3D63;
    --red: #E0675C;
    --focus: #7FA8FF;
    --ok: #6CC793;
    --warn: #E3A64A;
  }
}
*, *::before, *::after { box-sizing: inherit; }
html { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-underline-offset: 2px; }
code { font: 0.9em var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-weight: normal; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Masthead */
.masthead { max-width: 1180px; margin: 0 auto; padding: 2.5rem 1.25rem 1rem; }
.brand {
  margin: 0;
  font: 700 clamp(2rem, 5vw, 2.8rem)/1 var(--type);
  letter-spacing: -0.01em;
}
.tagline { margin: 0.6rem 0 0; max-width: 34rem; color: var(--muted); font-size: 1.05rem; }

/* Layout */
.layout {
  max-width: 1180px; margin: 0 auto; padding: 0.5rem 1.25rem 2rem;
  display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr) 420px; align-items: start; }
  .card-col { position: sticky; top: calc(1rem + env(safe-area-inset-top, 0px)); }
}
.flow { display: grid; gap: 1.25rem; min-width: 0; }

/* Steps: a real sequence, so they are numbered */
.step { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1.25rem; min-width: 0; }
.step h2 { margin: 0 0 0.9rem; font-size: 1.15rem; display: flex; align-items: center; gap: 0.6rem; }
.step .n {
  display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  border: 1.5px solid var(--ink); font: 700 0.85rem/1 var(--type);
}
.lede { margin: -0.3rem 0 1rem; color: var(--muted); max-width: 60ch; }

/* Controls */
input, select, button { font: inherit; color: inherit; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], select {
  width: 100%; min-width: 0; padding: 0.55rem 0.7rem;
  border: 1px solid var(--line); border-radius: 4px; background: var(--card);
}
button {
  padding: 0.55rem 0.95rem; border-radius: 4px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; white-space: nowrap;
}
button:hover:not(:disabled) { border-color: var(--ink); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--ink); color: var(--card); border-color: var(--ink); font-weight: 600; }
button.quiet { background: transparent; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; padding-inline: 0.2rem; }
button.small { padding: 0.15rem 0.4rem; font-size: 0.85rem; }
.repo-form { display: flex; gap: 0.5rem; }
.repo-form input { font-family: var(--mono); }
@media (max-width: 520px) { .repo-form { flex-direction: column; } }
.form-error { color: var(--red); margin: 0.6rem 0 0; }

/* Settings */
.settings { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 0.8rem; }
.settings summary { cursor: pointer; font-weight: 600; }
.summary-note { font-weight: normal; color: var(--muted); font-size: 0.9rem; margin-left: 0.3rem; }
.hint { color: var(--muted); font-size: 0.92rem; max-width: 62ch; }
.provider-settings { display: grid; gap: 0.75rem; margin: 0.8rem 0 1rem; }
.prov { display: grid; gap: 0.35rem; padding-bottom: 0.75rem; border-bottom: 1px dashed var(--line); }
.prov-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.prov-head label { font-weight: 600; }
.prov-req { font-size: 0.82rem; color: var(--muted); }
.prov-stored { font-size: 0.82rem; color: var(--ok); }
.prov-hint { font-size: 0.85rem; color: var(--muted); margin: 0; }
.token-row { display: flex; gap: 0.4rem; }
.token-row input { font-family: var(--mono); }
.field-row { display: grid; gap: 0.3rem; margin-bottom: 0.8rem; }
.field-row label { font-size: 0.92rem; font-weight: 600; }

/* Provider status */
.provider-status { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.provider-status:empty { display: none; }
.pstat { font-size: 0.85rem; padding: 0.2rem 0.55rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.pstat[data-state="ok"] { border-color: var(--ok); }
.pstat[data-state="error"] { border-color: var(--red); color: var(--red); }
.pstat[data-state="skipped"] { color: var(--muted); border-style: dashed; }
.pstat[data-state="running"] { color: var(--muted); }

/* Candidates */
.candidates { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.cand {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.75rem; align-items: start;
  padding: 0.85rem; border: 1px solid var(--line); border-radius: 4px; background: var(--card); cursor: pointer;
}
.cand:hover { border-color: var(--ink); }
.cand[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--red); }
.cand input { margin-top: 0.3rem; accent-color: var(--red); }
.cand-title { font-weight: 600; overflow-wrap: anywhere; }
.cand-authors { color: var(--muted); font-size: 0.92rem; }
.cand-meta { font-size: 0.85rem; color: var(--muted); margin-top: 0.2rem; overflow-wrap: anywhere; }
.cand-meta code { color: var(--ink); }
.signals { list-style: none; margin: 0.45rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.signals li { font-size: 0.8rem; padding: 0.1rem 0.45rem; border-radius: 3px; background: var(--bg); }
.score { font: 700 1.05rem/1 var(--type); text-align: right; min-width: 3rem; }
.score small { display: block; font: 0.72rem var(--sans); color: var(--muted); margin-top: 0.25rem; }
.empty { color: var(--muted); }

/* Editor */
.editor-grid { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.editor-grid .wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 4px; margin: 1rem 0 0; padding: 0.8rem 1rem 1rem; min-width: 0; }
legend { font-weight: 600; padding: 0 0.3rem; }
.choice { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.choice label { display: flex; gap: 0.4rem; align-items: center; font-weight: normal; }
.choice input { accent-color: var(--red); }
.authors { display: grid; gap: 0.6rem; }
.author {
  display: grid; gap: 0.4rem; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) auto;
  align-items: end; padding-bottom: 0.6rem; border-bottom: 1px dashed var(--line);
}
.author label { font-size: 0.8rem; color: var(--muted); display: grid; gap: 0.15rem; }
.author .actions { display: flex; gap: 0.2rem; }
.orcid-results { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.orcid-results button { width: 100%; text-align: left; white-space: normal; font-size: 0.88rem; }
.add-author { margin-top: 0.6rem; }
.note { font-size: 0.88rem; color: var(--muted); }

/* The card: a library catalog card with ruled lines, red heading rule and rod hole */
.card {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 3px;
  padding: 0 0 2.6rem; box-shadow: 0 1px 0 var(--line), 0 10px 24px -18px rgba(27, 42, 74, 0.6);
}
.card-tabs { display: flex; border-bottom: 2px solid var(--red); padding: 0.4rem 0.5rem 0; gap: 0.2rem; }
.tab {
  border: 0; background: transparent; padding: 0.45rem 0.7rem; border-radius: 3px 3px 0 0;
  font: 0.9rem var(--type); color: var(--muted);
}
.tab[aria-selected="true"] { color: var(--ink); font-weight: 700; background: var(--bg); }
.card-body {
  margin: 0; padding: 0.4rem 1.1rem; min-height: calc(var(--lh) * 12);
  max-height: 60vh; overflow: auto;
  font: 0.84rem/var(--lh) var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--lh) - 1px), var(--card-rule) calc(var(--lh) - 1px), var(--card-rule) var(--lh));
  background-position: 0 0.4rem;
  background-attachment: local;
}
.card-note { margin: 0.5rem 1.1rem 0; font-size: 0.82rem; color: var(--muted); }
.checks { list-style: none; margin: 0.6rem 1.1rem 0; padding: 0; font-size: 0.88rem; display: grid; gap: 0.25rem; }
.checks li::before { content: "\2713"; color: var(--ok); margin-right: 0.45rem; font-weight: 700; }
.checks li.err { color: var(--red); }
.checks li.err::before { content: "\2715"; color: var(--red); }
.checks li.warn::before { content: "!"; color: var(--warn); }
.card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.9rem 1.1rem 0; }
.punch {
  position: absolute; left: 50%; bottom: 0.8rem; width: 0.9rem; height: 0.9rem; transform: translateX(-50%);
  border-radius: 50%; background: var(--bg); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Fine print */
.fineprint { max-width: 1180px; margin: 0 auto; padding: 1rem 1.25rem 2.5rem; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); }
.fineprint p { margin: 0.35rem 0; max-width: 80ch; }
.fineprint code { color: var(--ink); overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
