/* AI Automate Hub — demo pages.
   Shared styles for /demos/. Loaded after style.css so it can extend it. */

:root {
  --d-bg: #111214;
  --d-panel: #17181B;
  --d-line: #2A2C31;
  --d-cream: #FBF8F3;
  --d-muted: #9A9DA6;
  --d-accent: #FF5C1A;
  --d-ok: #3FBF7F;
  --d-warn: #E8B23A;
  --d-bad: #E0574C;
}

.demos-body {
  background: var(--d-bg);
  color: var(--d-cream);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  line-height: 1.6;
}

.d-wrap { max-width: 1120px; margin: 0 auto; padding: 0 22px; }
.d-wrap--narrow { max-width: 860px; }

/* ── top bar ── */
.d-top {
  border-bottom: 1px solid var(--d-line);
  position: sticky; top: 0; z-index: 40;
  background: rgba(17, 18, 20, 0.92);
  backdrop-filter: blur(10px);
}
.d-top-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 22px; max-width: 1120px; margin: 0 auto;
}
.d-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--d-cream); font-weight: 600; font-size: 15px; }
/* Mobile: the brand is the "home" link, so it needs a full-height tap area. */
@media (hover: none) and (pointer: coarse) {
  .d-brand { min-height: 44px; }
}
.d-brand span.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--d-accent); display: inline-block; }
.d-nav { display: flex; gap: 20px; align-items: center; }
.d-nav a { color: var(--d-muted); text-decoration: none; font-size: 14px; }
.d-nav a:hover, .d-nav a.is-active { color: var(--d-cream); }
/* Mobile: header links need a real touch area, not a 21px line box. */
@media (hover: none) and (pointer: coarse) {
  .d-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
}

/* ── headings ── */
.d-hero { padding: 56px 0 34px; }
.d-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--d-accent); margin: 0 0 14px;
}
.d-h1 { font-size: clamp(28px, 4.6vw, 46px); line-height: 1.1; margin: 0 0 16px; letter-spacing: -0.02em; }
.d-h1 em { font-family: "Instrument Serif", Georgia, serif; font-style: italic; font-weight: 400; }
.d-lead { color: var(--d-muted); font-size: 17px; max-width: 66ch; margin: 0; }
.d-h2 { font-size: clamp(21px, 2.8vw, 27px); margin: 0 0 10px; letter-spacing: -0.01em; }
.d-sub { color: var(--d-muted); font-size: 15px; margin: 0 0 18px; }

/* ── cards ── */
.d-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 18px; padding: 8px 0 60px; }
.d-card {
  background: var(--d-panel); border: 1px solid var(--d-line); border-radius: 14px;
  padding: 22px; display: flex; flex-direction: column; gap: 12px;
  text-decoration: none; color: inherit;
  transition: border-color .18s ease, transform .18s ease;
}
.d-card:hover { border-color: #41454d; transform: translateY(-2px); }
.d-card h3 { margin: 0; font-size: 18px; }
.d-card p { margin: 0; color: var(--d-muted); font-size: 14.5px; }
.d-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; padding-top: 6px; }
.d-tag {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--d-line); color: var(--d-muted); letter-spacing: .02em;
}
.d-tag--live { border-color: rgba(63,191,127,.45); color: var(--d-ok); }
.d-tag--sim { border-color: rgba(232,178,58,.4); color: var(--d-warn); }

/* ── demo console ── */
.d-console {
  background: var(--d-panel); border: 1px solid var(--d-line); border-radius: 14px;
  overflow: hidden; margin-bottom: 26px;
}
.d-console-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--d-line);
  font-size: 13px; color: var(--d-muted);
}
.d-console-head strong { color: var(--d-cream); font-weight: 600; }
.d-console-body { padding: 20px; }

.d-label { display: block; font-size: 13px; color: var(--d-muted); margin: 0 0 7px; }
.d-textarea, .d-input {
  width: 100%; box-sizing: border-box;
  background: #0E0F11; color: var(--d-cream);
  border: 1px solid var(--d-line); border-radius: 10px;
  padding: 13px 14px; font-size: 14.5px; line-height: 1.55;
  font-family: inherit; resize: vertical;
  transition: border-color .15s ease;
}
.d-textarea:focus, .d-input:focus { outline: none; border-color: var(--d-accent); }
.d-textarea { min-height: 132px; }
.d-counter { font-size: 12px; color: var(--d-muted); text-align: right; margin-top: 6px; }

.d-samples { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.d-sample {
  background: transparent; border: 1px solid var(--d-line); color: var(--d-muted);
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px; cursor: pointer;
  font-family: inherit; transition: all .15s ease;
  /* Fingers are not mice: guarantee a 44px tap target without changing the
     pill look, by enforcing a minimum height and centring the label. */
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.d-sample:hover { border-color: var(--d-accent); color: var(--d-cream); }

/* Touch devices: 16px labels stay legible at arm's length and stop iOS from
   zooming the viewport on focus. */
@media (hover: none) and (pointer: coarse) {
  .d-sample { font-size: 14px; padding: 10px 16px; min-height: 46px; }
}

.d-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.d-btn {
  border: none; border-radius: 10px; padding: 13px 24px; font-size: 15px;
  font-weight: 600; cursor: pointer; font-family: inherit;
  background: var(--d-accent); color: #fff; transition: opacity .15s ease, transform .12s ease;
}
.d-btn:hover:not(:disabled) { opacity: .92; }
.d-btn:active:not(:disabled) { transform: scale(.99); }
.d-btn:disabled { opacity: .5; cursor: not-allowed; }
.d-btn--ghost { background: transparent; border: 1px solid var(--d-line); color: var(--d-muted); font-weight: 500; }
.d-btn--ghost:hover:not(:disabled) { border-color: #4a4e56; color: var(--d-cream); }

/* ── pipeline steps ── */
.d-steps { list-style: none; padding: 0; margin: 20px 0 0; }
.d-step {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 12px;
  align-items: start; padding: 11px 0; border-bottom: 1px dashed var(--d-line);
  font-size: 14px;
}
.d-step:last-child { border-bottom: none; }
.d-step-icon {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; margin-top: 2px;
  background: #24262B; color: var(--d-muted);
}
.d-step[data-s="ok"] .d-step-icon { background: rgba(63,191,127,.16); color: var(--d-ok); }
.d-step[data-s="live"] .d-step-icon { background: rgba(63,191,127,.16); color: var(--d-ok); }
.d-step[data-s="live"] .d-step-name::after {
  content: "live model call"; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--d-accent); border: 1px solid rgba(255,92,26,.4); border-radius: 999px;
  padding: 1px 7px; margin-left: 8px; vertical-align: 1px;
}
.d-step[data-s="failed"] .d-step-icon { background: rgba(224,87,76,.16); color: var(--d-bad); }
.d-step[data-s="warning"] .d-step-icon { background: rgba(232,178,58,.16); color: var(--d-warn); }
.d-step-name { color: var(--d-cream); }
.d-step-detail { color: var(--d-muted); font-size: 13px; margin-top: 2px; }
.d-step-ms { color: var(--d-muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── result panels ── */
.d-result { margin-top: 22px; }
.d-panel {
  background: #0E0F11; border: 1px solid var(--d-line); border-radius: 12px;
  padding: 18px; margin-bottom: 14px;
}
.d-panel-title {
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--d-muted); margin: 0 0 12px;
}
.d-kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14px; margin: 0; }
.d-kv dt { color: var(--d-muted); }
.d-kv dd { margin: 0; color: var(--d-cream); word-break: break-word; }
.d-kv dd.is-null { color: #5d6068; font-style: italic; }

.d-score-wrap { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.d-score { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.d-score-band {
  font-size: 13px; padding: 3px 11px; border-radius: 999px;
  border: 1px solid var(--d-line); color: var(--d-muted);
}
.d-score[data-band="A"] { color: var(--d-ok); }
.d-score[data-band="B"] { color: #7EC8E3; }
.d-score[data-band="C"] { color: var(--d-warn); }
.d-score[data-band="D"] { color: var(--d-bad); }

.d-breakdown { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.d-breakdown li {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 6px 0; border-bottom: 1px solid #1C1E22; color: var(--d-muted);
}
.d-breakdown li:last-child { border-bottom: none; }
.d-breakdown b { color: var(--d-cream); font-weight: 500; }
.d-breakdown .pts { font-variant-numeric: tabular-nums; white-space: nowrap; }

.d-alert {
  border-radius: 10px; padding: 13px 16px; font-size: 14px; margin-bottom: 14px;
  border: 1px solid; display: flex; gap: 10px; align-items: flex-start;
}
.d-alert--err { background: rgba(224,87,76,.08); border-color: rgba(224,87,76,.35); color: #F2A9A3; }
.d-alert--ok { background: rgba(63,191,127,.07); border-color: rgba(63,191,127,.32); color: #94DCB8; }
.d-alert--warn { background: rgba(232,178,58,.07); border-color: rgba(232,178,58,.32); color: #EFD08A; }
.d-alert--info { background: rgba(154,157,166,.07); border-color: rgba(154,157,166,.30); color: #C6C9D0; }

/* ── file upload ── */
.d-upload { margin: 14px 0 4px; }
.d-upload-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 18px; cursor: pointer;
  background: transparent; color: var(--d-cream);
  border: 1px dashed var(--d-line); border-radius: 10px;
  font-size: 14px; font-weight: 500;
}
.d-upload-btn:hover { border-color: var(--d-accent); color: var(--d-accent); }
.d-upload-btn:focus-within { outline: 2px solid var(--d-accent); outline-offset: 2px; }
.d-upload-btn input[type="file"] {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.d-upload-hint { display: block; margin-top: 8px; color: var(--d-muted); font-size: 12.5px; line-height: 1.5; }
.d-upload-file { margin: 6px 0 0; color: var(--d-ok); font-size: 13px; }

.d-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.d-table th, .d-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #1C1E22; }
.d-table th { color: var(--d-muted); font-weight: 500; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.d-table code { background: #191B1F; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

.d-reply {
  background: #12141A; border-left: 3px solid var(--d-accent);
  border-radius: 0 10px 10px 0; padding: 15px 17px; font-size: 14.5px; line-height: 1.62;
  white-space: pre-wrap; color: var(--d-cream);
}

.d-note {
  font-size: 13px; color: var(--d-muted); border-top: 1px solid var(--d-line);
  padding-top: 14px; margin-top: 18px;
}

/* ── content sections ── */
.d-section { padding: 30px 0; border-top: 1px solid var(--d-line); }
.d-section:first-of-type { border-top: none; }
.d-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.d-list { margin: 0; padding-left: 18px; color: var(--d-muted); font-size: 14.5px; }
.d-list li { margin-bottom: 7px; }
.d-list strong { color: var(--d-cream); font-weight: 500; }

.d-cta {
  background: linear-gradient(135deg, #1A1C21, #141518);
  border: 1px solid var(--d-line); border-radius: 14px;
  padding: 28px; margin: 34px 0 60px;
  display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.d-cta h3 { margin: 0 0 6px; font-size: 20px; }
.d-cta p { margin: 0; color: var(--d-muted); font-size: 14.5px; }

.d-foot { border-top: 1px solid var(--d-line); padding: 24px 0 44px; color: var(--d-muted); font-size: 13px; }
.d-foot a { color: var(--d-muted); }
/* Mobile: footer mail/site links are frequently tapped, give them a real target. */
@media (hover: none) and (pointer: coarse) {
  .d-foot a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ── spinner ── */
.d-spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.28); border-top-color: #fff;
  border-radius: 50%; animation: dspin .7s linear infinite;
  vertical-align: -2px; margin-right: 8px;
}
@keyframes dspin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .d-hero { padding: 36px 0 22px; }
  .d-cols { grid-template-columns: 1fr; gap: 18px; }
  .d-kv { grid-template-columns: 118px 1fr; }
  .d-console-body { padding: 15px; }
  .d-cta { padding: 20px; }
  .d-nav { gap: 13px; }
  .d-nav a { font-size: 13px; }
  .d-step { grid-template-columns: 22px 1fr; }
  .d-step-ms { grid-column: 2; }
}
