/* Runway v1 — the Design Doc §5 "DESIGN" bar, whole and nothing more:
 * readable type, real h2/h3 section headers, a legible table, a visible
 * caveats callout. Polish belongs to a later /design-review, not this file. */

:root {
  --ink: #1c2127;
  --muted: #5b6570;
  --line: #d8dde3;
  --accent: #0b57d0;
  --callout-bg: #fff7e0;
  --callout-edge: #d97706;
  --error: #b3261e;
  --error-bg: #fdeceb;
  --row-selected: #eef4ff;
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  max-width: 68rem;
  padding: 2.25rem 1.25rem 4rem;
  font: 16px/1.55 system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #ffffff;
}

h1 { font-size: 1.9rem; margin: 0 0 0.4rem; }
h2 {
  font-size: 1.3rem;
  margin: 0 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}
h3 { font-size: 1.02rem; margin: 0 0 0.4rem; }

.tagline { color: var(--muted); max-width: 46rem; margin: 0; }

main section { margin-top: 2.5rem; }

a { color: var(--accent); }

code {
  font: 0.88em/1.4 ui-monospace, Consolas, "Courier New", monospace;
  background: #f2f4f6;
  padding: 0.08em 0.3em;
  border-radius: 4px;
}

/* ---- form fields ---- */

.field { margin: 1.1rem 0; }

label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.req { font-weight: 400; color: var(--muted); }
.opt { font-weight: 400; color: var(--muted); }

select,
input[type="url"],
input[type="text"],
textarea {
  font: inherit;
  color: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

select { min-width: 14rem; }
input[type="url"],
input[type="text"] { width: 100%; max-width: 34rem; }
textarea { width: 100%; resize: vertical; }

/* Role typeahead combobox (v2) */
.combobox { position: relative; max-width: 34rem; }
#role-listbox {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 20;
  margin: 0; padding: 0.25rem 0; list-style: none;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  max-height: 16rem; overflow-y: auto;
}
#role-listbox li { padding: 0.45rem 0.65rem; cursor: pointer; }
#role-listbox li[aria-selected="true"],
#role-listbox li:hover { background: var(--row-selected); }
#role-listbox li .ro-hint { color: var(--muted); font-size: 0.85rem; }
#role-listbox .ro-empty { color: var(--muted); cursor: default; }

.hint { font-size: 0.88rem; color: var(--muted); margin: 0.4rem 0 0; }
.muted { color: var(--muted); }
.error { color: var(--error); }

/* ---- callouts ---- */

.callout {
  border-left: 4px solid var(--callout-edge);
  background: var(--callout-bg);
  border-radius: 0 6px 6px 0;
  padding: 0.8rem 1.1rem;
  margin: 1rem 0 1.25rem;
}

.callout ul { margin: 0; padding-left: 1.2rem; }
.callout li { margin: 0.3rem 0; }

.error-callout {
  border-left-color: var(--error);
  background: var(--error-bg);
}
.error-callout p:first-child { margin-top: 0; font-weight: 600; }

/* Author's personal asides inside FAQ answers — distinct from the yellow callout. */
p.tip {
  border-left: 4px solid var(--accent);
  background: var(--row-selected);
  border-radius: 0 6px 6px 0;
  padding: 0.7rem 1.1rem;
  margin: 1rem 0 1.25rem;
}
p.tip::before {
  content: "Personal tip";
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---- shortlist table ---- */

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  /* Capped so a long shortlist never pushes "Generate prompt" far down the
   * page — the table scrolls internally instead of the whole page. */
  max-height: 26rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table { border-collapse: collapse; width: 100%; font-size: 0.94rem; }

th, td {
  padding: 0.5rem 0.7rem;
  text-align: left;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  border-top: 0;
  background: #f4f6f8;
  white-space: nowrap;
  /* Stays visible while the body scrolls inside the capped-height wrapper. */
  position: sticky;
  top: 0;
  z-index: 1;
}

thead th[data-sort-key] { cursor: pointer; user-select: none; }
thead th[data-sort-key]:hover { background: #e9edf2; }
thead th[data-sort-key]::after { content: " ↕"; opacity: 0.35; font-size: 0.85em; }
thead th[data-sort-key].sorted-asc::after { content: " ▲"; opacity: 1; }
thead th[data-sort-key].sorted-desc::after { content: " ▼"; opacity: 1; }

th.num, td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
th.center, td.center { text-align: center; }

tbody tr:hover { background: #f8fafc; }
tbody tr.selected { background: var(--row-selected); }

td input[type="checkbox"] { width: 1.05rem; height: 1.05rem; }

.funnel { font-size: 0.92rem; margin: 0.9rem 0 0.2rem; }

/* ---- prompt section ---- */

button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

#load-error button, #copy-btn { margin-top: 0.6rem; }

#prompt-box { margin-top: 1.1rem; }

#prompt-output {
  min-height: 18rem;
  font: 0.84rem/1.45 ui-monospace, Consolas, "Courier New", monospace;
}

/* ---- footer ---- */

footer {
  margin-top: 3.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--muted);
}


/* FAQ (the rationale layer). Collapsed by default so it is available to a reader
   deciding whether to trust the output without taxing one who just wants a prompt.
   Hover is gated so touch devices do not fire it on tap. */
.topnav { margin: .6rem 0 0; font-size: .95rem; }
.topnav a { text-decoration: none; font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .topnav a:hover { text-decoration: underline; } }

#section-faq details {
  border-top: 1px solid var(--line, #e0e0e0);
  padding: .55rem 0;
}
#section-faq details:last-of-type { border-bottom: 1px solid var(--line, #e0e0e0); }
#section-faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: .25rem 0;
  border-radius: 4px;
}
@media (hover: hover) and (pointer: fine) {
  #section-faq summary:hover { text-decoration: underline; }
}
#section-faq summary:focus-visible {
  outline: 2px solid #2b5c8a;
  outline-offset: 2px;
}
#section-faq details p { margin: .5rem 0; }

/* One reading measure for every paragraph on the page — the intro, the answers
   inside each toggle, and the About section all wrap at the same width. */
#section-faq p,
#section-about p { max-width: 68ch; }

/* About / connect — sits below the FAQ so a reader who got all the way through
   the reasoning has somewhere to reply to it. */
#section-about { margin-top: 2.5rem; }

.connect {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}
.connect li { margin: .4rem 0; }
.connect a { font-weight: 600; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .connect a:hover { text-decoration: underline; } }
