/* EOM live demo — Cloudflare Pages frontend */
:root {
  --fg: #111;
  --muted: #5a5a5a;
  --accent: #b8860b;
  --accent-dim: #d4af3733;
  --bg: #fafaf7;
  --card: #ffffff;
  --rule: #e0ddd5;
  --code-bg: #f3f1ec;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue",
               Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  font-size: 15px;
}
a { color: var(--accent); }
hr { border: none; border-top: 1px solid var(--rule); margin: 1em 0; }
code { background: var(--code-bg); padding: 0 0.3em; border-radius: 3px; font-size: 0.92em; }

/* hero */
.hero {
  padding: 1.5em 2em 1em;
  border-bottom: 2px solid var(--fg);
  background: linear-gradient(180deg, #fff 0%, var(--bg) 100%);
}
.hero h1 { margin: 0; font-family: Georgia, serif; font-size: 1.8em; }
.hero .tagline {
  margin: 0.4em 0;
  font-size: 1.05em;
  max-width: 60ch;
  color: var(--fg);
}
.hero .meta { color: var(--muted); font-size: 0.85em; margin: 0; }

main {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
}

/* sidebar */
.sidebar {
  padding: 1.5em 1.5em 2em;
  border-right: 1px solid var(--rule);
  background: var(--card);
  min-height: calc(100vh - 200px);
}
.sidebar h2 { margin: 0.5em 0 0.5em; font-size: 0.92em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.sidebar p.hint { margin: 0.4em 0 0.8em; color: var(--muted); font-size: 0.88em; }
.sidebar select {
  width: 100%;
  padding: 0.45em 0.6em;
  font-size: 0.92em;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
}
#sample-meta { margin-top: 0.6em; font-size: 0.85em; color: var(--muted); }

#apikey-form { display: flex; gap: 0.4em; align-items: center; }
#apikey-input {
  flex: 1;
  padding: 0.4em 0.5em;
  font-size: 0.85em;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  min-width: 0;
}
#apikey-save, button.link {
  padding: 0.4em 0.7em;
  font-size: 0.82em;
  background: var(--fg);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
button.link {
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
  padding: 0 0.3em;
}
#apikey-set {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.85em;
}
.apikey-status code { font-family: ui-monospace, monospace; }
.apikey-banner {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  padding: 0.5em 0.8em;
  border-radius: 4px;
  font-size: 0.9em;
  margin-bottom: 0.8em;
}

/* content area */
.content { padding: 1.5em 2em 2em; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); margin-bottom: 1em; }
.tab {
  padding: 0.6em 1em;
  border: none;
  background: transparent;
  font-size: 0.95em;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-family: inherit;
}
.tab:hover { color: var(--fg); }
.tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.panel { min-height: 400px; }
.panel .loading { color: var(--muted); font-style: italic; padding: 1em 0; }
.codepane {
  background: var(--code-bg);
  padding: 1em;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85em;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 70vh;
  overflow: auto;
}
.codepane.small { max-height: 240px; font-size: 0.78em; }

.controls {
  display: flex;
  align-items: center;
  gap: 1em;
  margin-bottom: 0.8em;
  flex-wrap: wrap;
}
.controls label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.9em;
  color: var(--muted);
}
.controls input[type=range] { width: 200px; }
.controls input[type=text] {
  padding: 0.4em 0.6em;
  font-size: 0.92em;
  border: 1px solid var(--rule);
  border-radius: 4px;
  min-width: 280px;
}
.controls button {
  padding: 0.5em 1em;
  background: var(--fg);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}
.controls button:disabled { opacity: 0.4; cursor: not-allowed; }

/* newspaper panel */
.newspaper-frame {
  width: 100%;
  height: 80vh;
  border: 1px solid var(--rule);
  background: white;
  border-radius: 4px;
}

/* harness panel */
#harness-out .badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  font-size: 0.85em;
  font-weight: 600;
}
#harness-out .pass { background: #2e7d32; color: #fff; }
#harness-out .fail { background: #b71c1c; color: #fff; }
#harness-out h3 { margin-top: 1em; font-size: 0.95em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
#harness-out table { border-collapse: collapse; }
#harness-out td, #harness-out th { padding: 0.3em 0.8em; font-size: 0.88em; border-bottom: 1px solid var(--rule); text-align: left; }
#harness-out ul.fail-list { padding-left: 1.2em; }
#harness-out ul.fail-list li { margin: 0.3em 0; }

/* ask panel */
.ask-controls { align-items: flex-start; }
.ask-controls label { flex-direction: column; align-items: flex-start; }
.ask-controls select, .ask-controls input[type=text] { min-width: 280px; }
.ref { background: var(--accent-dim); padding: 0.6em 1em; border-radius: 4px; font-size: 0.9em; margin-bottom: 0.8em; }
.ref strong { color: var(--accent); }

.askgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5em; }
.askcol {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1em 1.2em;
}
.askcol h3 { margin: 0 0 0.6em; font-size: 1em; }
.askcol .metrics {
  display: flex;
  gap: 1em;
  font-size: 0.85em;
  color: var(--muted);
  margin-bottom: 0.7em;
  flex-wrap: wrap;
}
.askcol .metrics .num {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--fg);
  font-weight: 600;
}
.askcol .answer {
  background: var(--code-bg);
  padding: 0.8em 1em;
  border-radius: 4px;
  white-space: pre-wrap;
  min-height: 80px;
  font-size: 0.92em;
}
.askcol details { margin-top: 0.8em; }
.askcol summary { cursor: pointer; font-size: 0.85em; color: var(--muted); }

.askheadline {
  margin-top: 1em;
  padding: 0.7em 1em;
  border-left: 4px solid var(--accent);
  background: var(--card);
  font-size: 0.95em;
}
.askheadline:empty { display: none; }

footer {
  margin-top: 3em;
  padding: 1em 2em 2em;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85em;
}
footer code { background: var(--code-bg); }

@media (max-width: 800px) {
  main { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--rule); min-height: auto; }
  .askgrid { grid-template-columns: 1fr; }
  .hero { padding: 1em; }
  .content { padding: 1em; }
}
