/*
 * Demos editoriales (Bloque 9, DEC-52). Una sola interfaz para todos los pasos:
 * un ticket con filas que pasan de «Hoy» a «Con la herramienta» una detrás de otra.
 * Una sola superficie (el ticket), filetes de 1 px, cobalto solo en la acción principal.
 */
:root {
  --canvas: #F3F3EF;
  --paper: #FAF9F5;
  --line: #D6D3CC;
  --ink: #141413;
  --body: #3D3D3A;
  --muted: #5F5E58;
  --accent: #3657D6;
  --accent-hover: #2844B4;
  --fail: #8A4306;
  --wash: #F1EDE4;
  /* DEC-55: la misma letra sin remates que la web. */
  --serif: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button { font: inherit; color: inherit; }

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  font-size: 14px;
}
.bar a { color: var(--ink); text-decoration: none; }
.bar a:hover { text-decoration: underline; text-underline-offset: 4px; }
.bar span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.scene {
  display: grid;
  gap: 18px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 20px 40px;
}

.when { margin: 0 0 6px; font-size: 14px; font-weight: 500; color: var(--fail); }
.is-tool .when { color: var(--ink); }
.title {
  margin: 0;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.context { margin: 10px 0 0; font-family: var(--serif); font-size: 17px; line-height: 1.45; color: var(--body); text-wrap: pretty; }

/* El ticket: la única superficie */
.ticket {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px 18px;
}
.ticket-head { margin: 0; font-size: 15px; font-weight: 600; }
.ticket-sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.ticket-sub:empty { display: none; }

/* La fila: qué · resultado, y debajo, a todo el ancho, el detalle (p. ej. la suma) */
.orders { list-style: none; margin: 10px 0 0; padding: 0; }
.order {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  transition: background-color 1.2s var(--ease);
}
.order-what { font-size: 15px; min-width: 0; }
.order-what small { display: block; font-size: 13px; color: var(--muted); }
.order-result {
  max-width: 44vw;
  text-align: right;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.3s var(--ease);
}
.order-result small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.order-result.fails { color: var(--fail); }
.order-detail {
  grid-column: 1 / -1;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--body);
  font-variant-numeric: tabular-nums;
  transition: opacity 0.3s var(--ease);
}
.order-detail[hidden] { display: none; }
.is-today .order-detail { color: var(--muted); }
.flash { background: var(--wash) !important; transition: none !important; }
.swap { opacity: 0; }

/* Entrada de las filas al llegar a cada paso */
.order.enter { animation: order-in 0.5s var(--ease) both; }
@keyframes order-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.outcome { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 500; }
.is-today .outcome { color: var(--fail); }

.team { margin: 0; font-family: var(--serif); font-size: 17px; line-height: 1.45; color: var(--body); }
.team strong { color: var(--ink); font-weight: 600; }

.actions { display: grid; gap: 12px; justify-items: start; }
.go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.go:hover { background: var(--accent-hover); }
.back,
.aside {
  padding: 6px 0;
  border: 0;
  background: none;
  font-size: 15px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.aside:hover, .back:hover { color: var(--accent); }
.fine { margin: 0; font-size: 13px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .order, .order-result, .order-detail { transition: none; }
}

/* En el móvil: titular → ticket → botón → explicación → «Tu equipo»; el botón no queda detrás del texto */
.context-after { display: none; margin: 0; }
@media (max-width: 899px) {
  .scene > .story { order: 1; }
  .scene > .ticket { order: 2; }
  .scene > .actions { order: 3; }
  .scene > .context-after { order: 4; display: block; }
  .scene > .team { order: 5; }
  .story .context { display: none; }
}

@media (min-width: 900px) {
  .bar { padding: 22px 40px; }
  .scene {
    grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
    grid-template-areas: 'story ticket' 'team ticket' 'actions ticket';
    grid-template-rows: auto auto 1fr;
    column-gap: 72px;
    row-gap: 24px;
    padding: 56px 40px 64px;
    align-items: start;
  }
  .story { grid-area: story; }
  .ticket { grid-area: ticket; padding: 22px 26px 24px; }
  .team { grid-area: team; font-size: 18px; }
  .actions { grid-area: actions; }
  .title { font-size: 42px; }
  .context { font-size: 19px; }
  .go { width: auto; }
  .order-result { max-width: 260px; }
}
