/* Construction-site auto-tagging: interface styles.
 *
 * One accent colour, a single neutral ramp, and a 4px spacing scale. The
 * restraint is deliberate: the page's job is to make two models' answers easy
 * to compare, so anything that competes with the tag chips for attention is
 * working against it. */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #fbfbfa;
  --ink: #16181a;
  --ink-2: #4a4f55;
  --muted: #858b93;
  --line: #e3e4e1;
  --line-2: #d3d5d1;

  --accent: #2f6b4f;
  --accent-ink: #24543e;
  --accent-soft: #e8f1eb;
  --accent-line: #b9d4c5;

  --warn-bg: #fdf4e8;
  --warn-line: #e6cfa8;
  --warn-ink: #7d5620;
  --error: #b03f2b;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow: 0 1px 2px rgba(16, 20, 24, .04), 0 4px 12px rgba(16, 20, 24, .05);
  --shadow-lg: 0 2px 4px rgba(16, 20, 24, .05), 0 12px 32px rgba(16, 20, 24, .08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --surface: #1b1d20;
    --surface-2: #202327;
    --ink: #eceef0;
    --ink-2: #bcc1c7;
    --muted: #868d96;
    --line: #2c2f34;
    --line-2: #3a3e44;

    --accent: #6fb894;
    --accent-ink: #8ecdad;
    --accent-soft: #1d2f27;
    --accent-line: #2f4a3c;

    --warn-bg: #2c2418;
    --warn-line: #4d4029;
    --warn-ink: #dcb87f;
    --error: #e0715a;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .25);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 1.25rem 5rem;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

header, main, footer { max-width: 1080px; margin: 0 auto; }

/* ---------------------------------------------------------------- header */
header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}
h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -.02em;
  margin: 0 0 .5rem;
  font-weight: 650;
}
.sub {
  margin: 0;
  color: var(--ink-2);
  max-width: 60ch;
  font-size: .95rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: .2rem .7rem;
  font-size: .76rem;
  font-weight: 550;
  margin-bottom: .9rem;
}
.badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

/* ---------------------------------------------------------------- layout */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 1.25rem; }

.panel-title {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 650;
  color: var(--muted);
  margin: 0 0 .85rem;
}

/* ------------------------------------------------------------- drop zone */
.drop {
  position: relative;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r);
  min-height: 210px;
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
  background: var(--surface-2);
  transition: border-color .15s ease, background .15s ease;
}
.drop:hover, .drop:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.drop.dragging { border-color: var(--accent); background: var(--accent-soft); }
.drop-inner { text-align: center; padding: 1.75rem 1.25rem; }
.drop-inner p { margin: .3rem 0; }
.drop-icon {
  width: 38px; height: 38px; margin: 0 auto .6rem;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 1.1rem;
}
#preview { width: 100%; max-height: 320px; object-fit: contain; display: block; }
.drop.has-image { border-style: solid; border-color: var(--line); background: var(--surface); }
.drop.has-image .drop-inner { display: none; }

.hint { color: var(--muted); font-size: .83rem; }

/* -------------------------------------------------------------- examples */
.examples-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .75rem; margin-bottom: .7rem;
}
.shuffle {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--accent); font: inherit; font-size: .8rem; font-weight: 550;
  cursor: pointer;
}
.shuffle:hover { text-decoration: underline; }

.ex-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .5rem;
}
@media (max-width: 520px) { .ex-grid { grid-template-columns: repeat(3, 1fr); } }

.ex-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
  background: var(--surface-2);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.ex-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-thumb:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.ex-thumb.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* -------------------------------------------------------------- controls */
.field { display: block; margin-bottom: .85rem; }
/* Direct child only: the model picker nests its own spans inside the field,
 * and they must not inherit the label's weight and spacing. */
.field > span {
  display: block;
  font-size: .8rem;
  font-weight: 550;
  color: var(--ink-2);
  margin-bottom: .3rem;
}
select {
  width: 100%;
  font: inherit;
  font-size: .9rem;
  padding: .55rem .7rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* A dropdown that takes more than one answer. A native <select multiple>
 * renders as a permanently open list box and needs ctrl-click to add a second
 * choice, which nobody discovers, so this is a button plus a panel of
 * checkboxes wearing the same clothes as the selects beside it. */
.multi { position: relative; }
.multi-toggle {
  width: 100%;
  font: inherit;
  font-size: .9rem;
  text-align: left;
  padding: .55rem 1.9rem .55rem .7rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.multi-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.multi.open .multi-toggle { border-color: var(--accent); }
.multi-toggle .none { color: var(--muted); }

.multi-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  padding: .25rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.multi-opt {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  padding: .5rem .55rem;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.multi-opt:hover { background: var(--surface-2); }
.multi-opt input { margin: .15rem 0 0; accent-color: var(--accent); flex: none; }
.multi-opt .opt-text { display: block; }
.multi-opt .opt-text b {
  display: block;
  font-size: .9rem;
  font-weight: 550;
  color: var(--ink);
}
.multi-opt .opt-text small {
  display: block;
  margin-top: .12rem;
  font-size: .78rem;
  line-height: 1.35;
  color: var(--muted);
}

button.primary {
  width: 100%;
  font: inherit;
  font-weight: 600;
  font-size: .93rem;
  padding: .7rem 1.1rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: filter .12s ease;
}
button.primary:hover:not(:disabled) { filter: brightness(1.1); }
button.primary:disabled { opacity: .45; cursor: not-allowed; }

.status {
  margin: .85rem 0 0;
  font-size: .87rem;
  color: var(--ink-2);
  display: flex; align-items: center; gap: .5rem;
}
.status.error { color: var(--error); }
.spinner {
  width: 13px; height: 13px; flex: none;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* --------------------------------------------------------------- results */
.results { display: grid; gap: 1.25rem; align-items: start; }
.results.compare { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .results.compare { grid-template-columns: 1fr; } }

.card-sub {
  margin: 0 0 .45rem;
  font-size: .78rem;
  line-height: 1.35;
  color: var(--muted);
}

/* The raw model output, folded into a glyph. It matters when you are checking
 * what the model actually emitted and is noise the rest of the time, so it
 * costs one character in the meta line until hovered or focused. */
.raw {
  position: relative;
  cursor: help;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 650;
  color: var(--muted);
  border-bottom: 1px dotted var(--line-2);
}
.raw:hover, .raw:focus-visible { color: var(--accent-ink); outline: none; }
.raw-pop {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  width: 300px;
  max-width: 78vw;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-3px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s;
}
.raw:hover .raw-pop, .raw:focus-visible .raw-pop, .raw:focus-within .raw-pop {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.raw-pop pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-weight: 400;
}
/* ------------------------------------------------------------- skeletons */
/* Shown while the request is in flight. Same card, same headings, so the real
 * answer lands in place instead of the panel jumping. */
.sk-line, .sk-pill {
  display: block;
  background: linear-gradient(90deg,
              var(--line) 25%, var(--surface-2) 50%, var(--line) 75%);
  background-size: 300% 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
.sk-line { height: 9px; margin-bottom: 1rem; }
.sk-head { height: 7px; margin-bottom: .5rem; }
.sk-group { margin-bottom: .9rem; }
.sk-group:last-child { margin-bottom: 0; }
.sk-pill { height: 26px; border-radius: 999px; }
.card.skeleton .tags { display: flex; flex-wrap: wrap; gap: .35rem; }

@keyframes sk-shimmer {
  from { background-position: 150% 0; }
  to   { background-position: -150% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sk-line, .sk-pill { animation-duration: 3s; }
}

.run-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: .76rem;
  line-height: 1.45;
  color: var(--muted);
}

.placeholder {
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  background: var(--surface-2);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.2rem;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 1rem;
  font-weight: 620;
  margin: 0 0 .2rem;
  letter-spacing: -.01em;
}
.card .meta {
  color: var(--muted);
  font-size: .8rem;
  margin: 0 0 1rem;
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
}
.meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); }

.facet { margin-bottom: .9rem; }
.facet:last-of-type { margin-bottom: 0; }
.facet-name {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: .35rem;
}
.tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .25rem .65rem;
  font-size: .82rem;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tag.only { border-color: var(--accent); font-weight: 650; }
.tag.invalid { background: var(--warn-bg); color: var(--warn-ink); }
.conf { opacity: .62; font-size: .76em; }

.empty { color: var(--muted); font-style: italic; font-size: .88rem; margin: 0; }

pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: .75rem;
  overflow-x: auto;
  font-size: .78rem;
  line-height: 1.5;
  margin: .6rem 0 0;
  color: var(--ink-2);
}

/* ---------------------------------------------------------------- footer */
footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem;
  align-items: center;
}
.muted { color: var(--muted); font-size: .8rem; }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: .25rem; margin-top: 1.5rem; }
.tab {
  background: none; border: none; margin: 0;
  padding: .6rem .9rem;
  border-bottom: 2px solid transparent;
  color: var(--muted); font: inherit; font-size: .93rem; font-weight: 550;
  cursor: pointer; border-radius: 0;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
header { padding-bottom: 0; border-bottom: 1px solid var(--line); }

/* ----------------------------------------------------------------- prose */
.prose { max-width: 68ch; margin: 0 auto; padding-top: .5rem; }
.prose h2 {
  font-size: 1.15rem; font-weight: 620; letter-spacing: -.01em;
  margin: 2.4rem 0 .6rem;
}
.prose h2:first-child { margin-top: .8rem; }
.prose p { margin: 0 0 .9rem; color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose em { font-style: italic; }

.steps { margin: 0 0 1rem; padding-left: 1.3rem; color: var(--ink-2); }
.steps li { margin-bottom: .45rem; }
.steps b { color: var(--ink); font-weight: 600; }

.callout {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r);
  padding: .95rem 1.1rem;
  margin: 1.4rem 0;
  font-size: .92rem;
  color: var(--ink-2);
}
.callout b { color: var(--accent-ink); display: block; margin-bottom: .25rem; }

/* --------------------------------------------------------------- figures */
.figure { margin: 1.5rem 0 1.8rem; }
.caption {
  font-size: .82rem; color: var(--muted); margin: .6rem 0 0;
  max-width: 62ch;
}
.chart { width: 100%; height: auto; display: block; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .bar-label text { fill: var(--ink-2); font-size: 12.5px; text-anchor: end; }
/* The 0.493 reference line falls just past the 0.450 bar, so its label and the
   dashed line share the same few pixels. A halo in the page colour keeps the
   number readable where the line crosses it, without moving either. */
.chart .bar-value text {
  fill: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  paint-order: stroke fill;
  stroke: var(--bg);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.chart .bar { fill: var(--accent); opacity: .55; }
.chart .bar.dim { opacity: .3; }
.chart .bar.strong { opacity: 1; }
.chart .ref { stroke: var(--warn-ink); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .ref-label { fill: var(--warn-ink); font-size: 11px; text-anchor: middle; }
.chart .series polyline { fill: none; stroke-width: 2; }
.chart .series text { font-size: 11.5px; font-weight: 600; }
/* Four series, each also labelled at the end of its own line, so identity
   never depends on colour alone. */
.chart .s1 polyline, .chart .s1 circle { stroke: #2f6b4f; fill: #2f6b4f; }
.chart .s1 text { fill: #2f6b4f; }
.chart .s2 polyline, .chart .s2 circle { stroke: #1f6f8b; fill: #1f6f8b; }
.chart .s2 text { fill: #1f6f8b; }
.chart .s3 polyline, .chart .s3 circle { stroke: #a4632a; fill: #a4632a; }
.chart .s3 text { fill: #a4632a; }
.chart .s4 polyline, .chart .s4 circle { stroke: #6b4fa8; fill: #6b4fa8; }
.chart .s4 text { fill: #6b4fa8; }
.chart .series polyline { fill: none; }
@media (prefers-color-scheme: dark) {
  .chart .s1 polyline, .chart .s1 circle { stroke: #6fb894; fill: #6fb894; }
  .chart .s1 text { fill: #6fb894; }
  .chart .s2 polyline, .chart .s2 circle { stroke: #6bb6d6; fill: #6bb6d6; }
  .chart .s2 text { fill: #6bb6d6; }
  .chart .s3 polyline, .chart .s3 circle { stroke: #d99a63; fill: #d99a63; }
  .chart .s3 text { fill: #d99a63; }
  .chart .s4 polyline, .chart .s4 circle { stroke: #a893d8; fill: #a893d8; }
  .chart .s4 text { fill: #a893d8; }
  .chart .series polyline { fill: none; }
}

/* --------------------------------------------------------- taxonomy card */
.tax { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
@media (max-width: 760px) { .tax { grid-template-columns: 1fr; } }
.tax-col {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: .8rem;
}
.tax-domain {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 650; color: var(--muted); margin-bottom: .55rem;
}
.tax-facet { margin-bottom: .55rem; }
.tax-facet:last-child { margin-bottom: 0; }
.tax-facet b {
  display: block; font-size: .84rem; font-weight: 600; color: var(--ink);
}
.tax-facet span {
  display: block; font-size: .76rem; color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.45;
}
.tax-facet.excl b::after {
  content: ""; display: inline-block; width: 5px; height: 5px;
  border-radius: 50%; background: var(--accent); margin-left: .4rem;
  vertical-align: middle;
}

/* One-line explainer under the model picker: says what "thesis" and "latest"
   are, so the choice is not two opaque words. */
.hint {
  display: block;
  margin-top: .45rem;
  font-size: .78rem;
  line-height: 1.45;
  opacity: .72;
}
.hint b { font-weight: 600; opacity: 1; }
