/* AgOrchestra site. Palette and layout carried over from the owner's drawing site. */
:root {
  --bg: #f2f4f6; --surface: #ffffff; --ink: #1c2430; --muted: #5b6875; --line: #d6dde3;
  --accent: #1f6f78; --accent-ink: #ffffff; --accent-soft: #e1eff0; --done: #2f7a4b; --warn: #9a5b12;
  --paper: #ffffff; --star: #9a6a00;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161b; --surface: #1a2028; --ink: #e6eaee; --muted: #9aa6b2; --line: #2c3540;
    --accent: #5fb3ba; --accent-ink: #0e1a1c; --accent-soft: #1d3336; --done: #6cc08e; --warn: #e0a457;
    --paper: #f4f5f7; --star: #e0b04a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161b; --surface: #1a2028; --ink: #e6eaee; --muted: #9aa6b2; --line: #2c3540;
  --accent: #5fb3ba; --accent-ink: #0e1a1c; --accent-soft: #1d3336; --done: #6cc08e; --warn: #e0a457;
  --paper: #f4f5f7; --star: #e0b04a;
  color-scheme: dark;
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-inline: 16px; padding-block: 20px 64px; overflow-wrap: anywhere;
}
[hidden] { display: none !important; }   /* grid/flex rules below must not un-hide things */
.wrap { max-width: 1100px; margin: 0 auto; display: grid; gap: 18px; }
.wrap .wrap { margin: 0; width: 100%; }   /* nested sections use the full width */
.wrap * { min-width: 0; }
h1 { font: 600 30px/1.15 Georgia, "DejaVu Serif", serif; margin: 0; text-wrap: balance; }
h2 { font: 600 20px/1.3 Georgia, "DejaVu Serif", serif; margin: 0; text-wrap: balance; }
p { margin: 0; max-width: 70ch; }
a { color: var(--accent); }
.hint { font-size: 14px; color: var(--muted); }

.titleline { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 18px; flex-wrap: wrap; }
.brand { font: 600 22px/1.15 Georgia, "DejaVu Serif", serif; text-decoration: none; color: var(--ink); }
.trail { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 15px; }
.trail a { font-weight: 700; text-decoration: none; }
.trail a:hover, .trail a:focus-visible { text-decoration: underline; }
.trail .sep, .trail .here { color: var(--muted); }
.kids-h { margin-top: 4px; }

/* the answer code (until logins exist) */
#codebar { background: var(--surface); border: 1.5px dashed var(--warn); border-radius: 10px; padding: 12px 14px;
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
#codebar input { font: 15px ui-monospace, "SF Mono", Menlo, monospace; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 17rem; max-width: 100%; }

/* a page's own text */
.spec { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; display: grid; gap: 10px; }
.spec h3 { font: 600 17px/1.3 Georgia, "DejaVu Serif", serif; margin: 6px 0 0; }
.spec ul, .spec ol { margin: 0; padding-left: 22px; display: grid; gap: 4px; max-width: 70ch; }
.spec code, .spec pre { font: 14px/1.5 ui-monospace, "SF Mono", Menlo, monospace; }
.spec code { background: var(--accent-soft); padding: 0 4px; border-radius: 4px; }
.spec pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; overflow-x: auto; white-space: pre; }
.spec .tablewrap { overflow-x: auto; }
.spec table { border-collapse: collapse; font-size: 15px; }
.spec th, .spec td { text-align: left; padding: 5px 14px 5px 0; border-bottom: 1px solid var(--line); }
.spec .note { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; }
.spec .warn { color: var(--warn); font-weight: 700; }

/* the menu, and each page's children, as cards */
.menu { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.card { display: grid; gap: 10px; align-content: start; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.card:hover, .card:focus-visible { border-color: var(--accent); }
.card .thumb { background: var(--paper); border-radius: 6px; height: 150px; display: grid; place-items: center; overflow: hidden; padding: 6px; }
.card .thumb svg { max-width: 100%; max-height: 138px; width: auto; height: auto; }
.card .thumb .hint { color: #5b6875; text-align: center; padding: 0 8px; }
.card .state { font-size: 13px; color: var(--muted); }
.card .state.new { color: var(--warn); font-weight: 700; }
.card .state.open { color: var(--star); font-weight: 700; }

/* a page's drawing */
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 14px; min-height: 40px; }
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, textarea:focus-visible, .card:focus-visible, .viewer:focus-visible, .tile:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.send { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn[disabled] { opacity: .5; cursor: default; }
.zoomnum { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); min-width: 4ch; }
.viewer { background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  max-height: min(78vh, 900px); overflow: auto; -webkit-overflow-scrolling: touch; }
.viewer #p-img svg { display: block; max-width: none; height: auto; }

/* the answer */
.answer { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 12px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.tile { font: inherit; text-align: left; cursor: pointer; display: grid; gap: 4px; align-content: start;
  color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tile:hover { border-color: var(--accent); }
.tile[aria-pressed="true"] { border: 2.5px solid var(--accent); padding: 9px 11px; background: var(--accent-soft); }
.tile .t-label { font-weight: 700; }
.tile .t-rec { font-size: 12px; font-weight: 700; color: var(--star); }
.tile .t-detail { font-size: 14px; color: var(--muted); }
label { font-size: 14px; color: var(--muted); }
textarea { width: 100%; box-sizing: border-box; min-height: 110px; resize: vertical;
  font: inherit; font-size: 16px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.saved { font-size: 14px; color: var(--muted); min-height: 1.3em; }
.saved.err { color: var(--warn); }

/* the history */
.history { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 10px; }
.h-item { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 4px; }
.h-item:first-of-type { border-top: 0; padding-top: 0; }
.h-who { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.h-item.agent .h-who { color: var(--accent); }
.h-text { white-space: pre-wrap; }
.empty { color: var(--muted); }
.readonly .opts, .readonly #send, .readonly textarea { pointer-events: none; opacity: .6; }

@media (max-width: 560px) {
  body { font-size: 17px; padding-block: 14px 48px; }
  h1 { font-size: 25px; }
  .opts .btn { flex: 1 1 40%; }
  .viewer { max-height: 70vh; }
}
@media (prefers-reduced-motion: no-preference) { .btn, .card, .tile { transition: background .12s, border-color .12s; } }
