/* DOLEN demo + homepage product sections. Extends site.css tokens. The task ticket is the one bold element. */
:root {
  --color-success: #1C7A4A;        /* verified completion only */
  --color-success-surface: #E2F2E9;
  --color-attention: #A3361F;      /* needs human review */
  --color-attention-surface: #FBE8E3;
  --wide: 1120px;
  --radius: 14px;
}
.wide { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding-inline: var(--gutter); }
[hidden] { display: none !important; } /* author display rules must never defeat the hidden attribute */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* intro */
.app-intro { padding-block: 24px 28px; max-width: 760px; }
.app-intro h1 { font-size: clamp(2rem, 7vw, 3rem); }
.app-intro .lede { margin-top: 12px; font-size: 1.12rem; color: var(--color-text-secondary); text-wrap: pretty; }
.demo-flag {
  display: inline-flex; gap: 8px; align-items: flex-start; margin-top: 18px;
  background: var(--color-warning-surface); color: var(--color-warning-text);
  border-radius: 10px; padding: 8px 14px; font-size: 0.95rem; font-weight: 600;
}
.demo-flag::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--color-warning); flex: none; margin-top: 0.55em; }

/* layout */
.app-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.app-grid > *, .field, select { min-width: 0; }
@media (min-width: 960px) { .app-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px; } .compose { position: sticky; top: 16px; } }
.panel h2 { font-size: 1.2rem; display: flex; align-items: center; gap: 10px; }
.step-n {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--color-text); color: var(--color-on-primary); font-size: 0.85rem; font-weight: 700; line-height: 1;
}

/* compose */
.compose { background: var(--color-surface-muted); border-radius: var(--radius); padding: 20px; }
.compose .hint { margin-top: 8px; color: var(--color-text-secondary); font-size: 0.98rem; }
.compose .fine { color: var(--color-text-secondary); } /* slate fails contrast on Mist (site token rule) */
#demo-form { margin-top: 18px; display: grid; gap: 16px; }
.field-row { display: grid; gap: 16px; }
@media (min-width: 520px) { .field-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; }
select, .field input {
  font: inherit; font-weight: 400; min-height: 48px; padding: 0 14px; width: 100%;
  border: 1px solid #C9D1D8; border-radius: 10px; background: var(--color-surface); color: var(--color-text);
}
select:focus-visible, .field input:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 1px; }
.choice { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.choice legend { font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; padding: 0; width: 100%; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--color-surface); border: 1px solid #C9D1D8; font-size: 0.97rem;
}
.choice input:checked + span { background: var(--color-text); color: var(--color-on-primary); border-color: var(--color-text); }
.choice input:focus-visible + span { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.97rem; color: var(--color-text-secondary); cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 0.25em; accent-color: var(--color-text); flex: none; }
.compose .btn, .gate .btn, .review .btn { width: 100%; }
.btn:disabled { background: #9AA5AF; cursor: not-allowed; }
.error { color: var(--color-attention); font-weight: 600; font-size: 0.95rem; min-height: 0; }
.error:empty { display: none; }
.fine { font-size: 0.88rem; color: var(--color-text-muted); }
.btn-quiet {
  font: inherit; font-weight: 600; min-height: 48px; padding: 0 18px; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--color-text); border: 1px solid #C9D1D8;
}
.btn-quiet:hover { border-color: var(--color-text-muted); }
button.btn { border: 0; font-family: inherit; cursor: pointer; }

/* empty state */
.empty { border: 2px dashed #C9D1D8; border-radius: var(--radius); padding: 40px 24px; text-align: center; color: var(--color-text-secondary); }
.empty-title { font-weight: 700; color: var(--color-text); font-size: 1.1rem; margin-bottom: 6px; }

/* the ticket */
.ticket { background: var(--color-surface); border: 1px solid var(--color-text); border-radius: var(--radius); box-shadow: 0 1px 0 var(--color-text); }
.t-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--color-border); }
.t-id { font-family: var(--font-latin); font-weight: 700; letter-spacing: 0.02em; direction: ltr; unicode-bidi: isolate; }
.badge { font-size: 0.9rem; font-weight: 700; border-radius: 999px; padding: 5px 12px; background: var(--color-surface-muted); color: var(--color-text); transition: background-color .3s, color .3s; }
.badge[data-state='booking_in_progress'], .badge[data-state='booked'], .badge[data-state='courier_assigned'], .badge[data-state='picked_up'] { background: #E3EAFB; color: #1F3D91; }
.badge[data-state='delivered'] { background: var(--color-success-surface); color: var(--color-success); }
.badge[data-state='attention'] { background: var(--color-attention-surface); color: var(--color-attention); }
.badge[data-state='cancelled'] { background: #ECEEF0; color: var(--color-text-muted); }
.t-sec { padding: 18px 20px; border-bottom: 1px solid var(--color-border); }
.t-sec h3 { font-size: 1.05rem; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.t-sec h3:focus { outline: none; }
.kv { margin: 0; display: grid; gap: 8px; }
.kv div { display: grid; grid-template-columns: 7.5em 1fr; gap: 12px; }
.kv dt { color: var(--color-text-muted); }
.kv dd { margin: 0; font-weight: 600; }
.checks { list-style: none; padding: 0; margin: 14px 0 8px; display: grid; gap: 6px; }
.checks li { display: flex; gap: 8px; align-items: center; color: var(--color-text-secondary); }
.checks li::before { content: ''; width: 16px; height: 16px; flex: none; border-radius: 50%; background: var(--color-success); }
.checks li { position: relative; }
.checks li::after { content: ''; position: absolute; inset-inline-start: 5px; top: 50%; width: 6px; height: 3.5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-65%) rotate(-45deg); }
.quote { width: 100%; border-collapse: collapse; }
.quote th { text-align: start; font-weight: 400; color: var(--color-text-secondary); padding: 6px 0; }
.quote td { text-align: end; font-weight: 600; padding: 6px 0; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
html[dir='rtl'] .quote td { direction: rtl; }
.quote .total th, .quote .total td { border-top: 1px solid var(--color-border); padding-top: 10px; font-weight: 700; color: var(--color-text); font-size: 1.08rem; }
.quote + .fine { margin-top: 8px; }

/* approval gate: the human decision */
.gate { background: #F3F6FC; }
.gate > p { color: var(--color-text-secondary); }
.code-show { margin: 10px 0 4px; }
.code-show span { display: inline-block; font-family: var(--font-latin); font-size: 1.9rem; font-weight: 700; letter-spacing: 0.35em; padding: 6px 4px 6px 14px; border: 1px dashed var(--color-primary); border-radius: 10px; background: var(--color-surface); color: var(--color-primary-active); }
.gate-form { display: grid; gap: 12px; margin-top: 12px; }
.gate-form input { font-family: var(--font-latin); letter-spacing: 0.3em; font-size: 1.2rem; max-width: 12ch; text-align: center; direction: ltr; }
.actions { display: grid; gap: 10px; }
@media (min-width: 520px) { .actions { grid-template-columns: 1fr auto; } }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding-inline-start: 34px; padding-bottom: 16px; color: var(--color-text-muted); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: 4px; top: 0.35em; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #B5BFC8; background: var(--color-surface); box-sizing: border-box; }
.timeline li::after { content: ''; position: absolute; inset-inline-start: 10px; top: 1.45em; bottom: 0.1em; width: 2px; background: var(--color-border); }
.timeline li:last-child::after { display: none; }
.timeline li[data-state='done'] { color: var(--color-text); }
.timeline li[data-state='done']::before { background: var(--color-text); border-color: var(--color-text); }
.timeline li[data-state='done']::after { background: var(--color-text); }
.timeline li[data-state='current'] { color: var(--color-text); font-weight: 700; }
.timeline li[data-state='current']::before { border-color: var(--color-primary); background: var(--color-primary); box-shadow: 0 0 0 4px #DCE5FA; animation: pulse 1.2s ease-in-out infinite; }
.timeline li[data-state='blocked'] { color: var(--color-attention); font-weight: 700; }
.timeline li[data-state='blocked']::before { border-color: var(--color-attention); background: var(--color-attention); }
.timeline li[data-state='skipped'] { text-decoration: line-through; }
.tl-note { display: block; font-weight: 400; font-size: 0.9rem; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px #DCE5FA; } }
.review { margin-top: 16px; border-inline-start: 4px solid var(--color-attention); background: var(--color-attention-surface); border-radius: 10px; padding: 14px 16px; display: grid; gap: 8px; }
.review-title { font-weight: 700; color: var(--color-attention); }

/* completion */
.proof { background: var(--color-success-surface); }
.proof h3 { color: var(--color-success); }
.proof .step-n { background: var(--color-success); }
.proof p + p { margin-top: 6px; }
.json:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.json { margin: 8px 0 0; padding: 12px 14px; background: var(--color-text); color: #E9EDF1; border-radius: 10px; font-size: 0.85rem; line-height: 1.5; overflow-x: auto; text-align: left; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* audit */
.audit { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 0.93rem; }
.audit li { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px; }
.audit time { grid-row: span 2; font-family: var(--font-latin); font-variant-numeric: tabular-nums; color: var(--color-text-muted); direction: ltr; unicode-bidi: isolate; font-size: 0.85rem; padding-top: 0.15em; }
.a-actor { font-weight: 700; }
.a-text { color: var(--color-text-secondary); }
.t-foot { padding: 14px 20px; display: flex; justify-content: flex-end; }

/* what's real */
.truth { margin-top: 48px; padding-block: 40px 8px; border-top: 1px solid var(--color-border); max-width: 760px; }
.truth h2 { font-size: 1.35rem; }
.cta-row { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.text-link { font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.app-page .foot { margin-top: 40px; }
.noscript { padding-block: 16px; color: var(--color-attention); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .timeline li[data-state='current']::before { animation: none; }
  .badge { transition: none; }
}

/* lifecycle strip: Request → … → Complete */
.lifecycle { list-style: none; margin: 0; padding: 12px 20px; display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--color-border); background: #FBFBF9; }
.lifecycle li { font-size: 0.82rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; color: var(--color-text-muted); background: transparent; border: 1px solid var(--color-border); }
.lifecycle li[data-state='done'] { color: var(--color-text); border-color: transparent; background: var(--color-surface-muted); }
.lifecycle li[data-state='current'] { color: var(--color-on-primary); background: var(--color-primary); border-color: var(--color-primary); }
.lifecycle li[data-state='stopped'] { color: var(--color-text-muted); text-decoration: line-through; }
/* DOLEN's plan */
.plan { margin: 0; padding-inline-start: 1.4em; display: grid; gap: 6px; color: var(--color-text-secondary); }
.plan li::marker { color: var(--color-text); font-weight: 700; }
html[lang='ar'] .plan { list-style: arabic-indic; }
.plan + .fine { margin-top: 10px; }
.done-msg { font-weight: 600; color: var(--color-text); margin-bottom: 6px; }
