/* Section 2, the product (ADR 0239, HOMEPAGE-PLAN.md): the Aunara workspace as it is, a sample the reader
   drives. Its sizes and colours are read from the app itself (services/frontend), so it looks like the
   product, not like a picture of one. product.mjs plays it. */
.product {
  --app-ink: #19372d;
  --app-muted: #5f6e63;
  --app-soft: #28483a;
  --app-line: #c7d1c2;
  --app-line-soft: #dce3d8;
  --app-ground: #fbfcf8;
  --app-rail: #f0f3eb;
  --app-bubble: #eef1ea;
  --app-review: #c4891a;
  --app-lime: #cbe442;
  padding-block: var(--space-9) var(--space-8);
}

.product-head {
  margin-bottom: var(--space-6);
}

.product-head p {
  max-width: 34em;
  margin-top: var(--space-3);
  color: var(--muted);
  font-size: var(--text-lead);
}

/* ── The app's window ─────────────────────────────────────────────────────────────────────── */
.app {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) minmax(0, 0fr);
  height: min(680px, 82svh);
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: 18px;
  background: var(--app-ground);
  box-shadow: 0 2px 4px rgba(25, 55, 45, .04), 0 24px 60px -12px rgba(25, 55, 45, .18);
  color: var(--app-ink);
  font: 400 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  text-align: left;
  transition: grid-template-columns .6s cubic-bezier(.2, .7, .2, 1);
}

.app.is-open {
  grid-template-columns: 60px minmax(0, 1fr) minmax(0, .92fr);
}

.app svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.app button {
  font: inherit;
  cursor: pointer;
}

.app-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
  background: var(--app-rail);
}

.app-rail .aunara-mark,
.app-rail .aunara-mark svg {
  display: block;
  width: 30px;
  height: 30px;
  color: var(--app-ink);
  stroke: none;
}

.app-rail .app-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--app-line);
  border-radius: 50%;
  background: #fff;
}

.app-rail .app-icon svg {
  width: 14px;
  height: 14px;
}

.app-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-top: auto;
  border-radius: 50%;
  background: var(--app-ink);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.app-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
}

.app-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  font-size: 14px;
  font-weight: 500;
}

.app-top svg {
  color: var(--app-muted);
}

/* ── The conversation ─────────────────────────────────────────────────────────────────────── */
.app-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 8px max(24px, calc((100% - 640px) / 2)) 16px;
  scrollbar-width: none;
}

.app-thread > * {
  animation: app-in .45s cubic-bezier(.2, .7, .2, 1) both;
}

.app-hello {
  margin-top: auto;
}

.app-you {
  align-self: flex-end;
  max-width: 85%;
  padding: 9px 16px;
  border-radius: 16px;
  background: var(--app-bubble);
}

.app-steps {
  color: var(--app-muted);
  font-size: 13px;
}

.app-steps summary {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  font-size: 13px;
  list-style: none;
  cursor: default;
}

.app-steps summary::-webkit-details-marker {
  display: none;
}

.app-steps summary svg {
  width: 13px;
  height: 13px;
  transition: rotate .3s;
}

.app-steps[open] summary svg {
  rotate: 90deg;
}

.app-steps ol {
  display: grid;
  gap: 4px;
  margin: 6px 0 0 19px;
  padding: 0;
  list-style: none;
}

.app-steps li {
  display: flex;
  gap: 8px;
  align-items: center;
  animation: app-in .35s both;
}

.app-steps li svg {
  width: 13px;
  height: 13px;
  color: #5c7a14;
}

.app-working {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--app-lime);
  box-shadow: 0 0 0 0 rgba(203, 228, 66, .7);
  animation: app-pulse 1.2s infinite;
}

.app-say {
  font-size: 15px;
  line-height: 1.7;
}

.app-say span {
  opacity: 0;
  transition: opacity .25s;
}

.app-say span.is-on {
  opacity: 1;
}

/* A thing Aunara prepared, as its card in the conversation. */
.app-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--app-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(25, 55, 45, .05);
}

.app-card-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--app-rail);
  color: var(--app-soft);
}

.app-card-body {
  flex: 1;
  min-width: 0;
}

.app-card h3 {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
}

.app-card dl {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin: 2px 0 0;
  color: var(--app-muted);
  font-size: 13px;
}

.app-card dt {
  display: inline;
}

.app-card dd {
  display: inline;
  margin: 0 0 0 4px;
  color: var(--app-soft);
}

.app-status {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--app-muted);
  font-size: 12px;
  font-weight: 400;
}

.app-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--app-review);
}

.app-status.is-done::before {
  background: #5c7a14;
}

.app-status.is-books::before {
  background: var(--app-soft);
}

.app-open {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--app-ink);
  border-radius: 8px;
  background: var(--app-ink);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

.app-note {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--app-muted);
  font-size: 13px;
}

.app-note svg {
  width: 14px;
  height: 14px;
  color: #5c7a14;
}

/* ── The composer and its suggestions ─────────────────────────────────────────────────────── */
.app-compose {
  padding: 0 max(24px, calc((100% - 640px) / 2)) 14px;
}

.app-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.app-chip {
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid var(--app-line-soft);
  border-radius: 999px;
  background: #fff;
  color: var(--app-soft);
  font-size: 13px;
  transition: border-color .3s, box-shadow .3s, opacity .3s;
}

.app-chip:hover:not(:disabled),
.app-chip.is-next {
  border-color: #9fb84a;
  box-shadow: 0 0 0 3px rgba(203, 228, 66, .28);
}

.app-chip:disabled {
  cursor: default;
  opacity: .5;
}

.app-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  min-height: 90px;
  padding: 10px 10px 8px;
  border: 1px solid var(--app-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(25, 55, 45, .05), 0 6px 20px rgba(25, 55, 45, .04);
}

.app-input {
  grid-column: 1 / -1;
  align-self: start;
  min-height: 24px;
  padding: 0 6px;
  color: var(--app-ink);
}

.app-input:empty::before {
  content: "Message Aunara…";
  color: #8a978d;
}

.app-input.is-typing::after {
  content: "";
  display: inline-block;
  width: 1.5px;
  height: 1.1em;
  margin-left: 1px;
  background: var(--app-ink);
  vertical-align: -.15em;
  animation: app-caret 1s steps(1) infinite;
}

.app-attach {
  padding: 6px;
  color: var(--app-muted);
}

.app-send {
  grid-column: 3;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--app-ink);
  color: #fff;
  transition: scale .2s;
}

.app-send.is-pressed {
  scale: .88;
}

.app-fine {
  margin-top: 6px;
  color: var(--app-muted);
  font-size: 12px;
  text-align: center;
}

/* ── The document canvas beside the conversation ─────────────────────────────────────────── */
.app-canvas {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border-left: 1px solid var(--app-line-soft);
  background: #fff;
}

.app-canvas-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 22px 12px;
  border-bottom: 1px solid var(--app-line-soft);
}

.app-canvas-head h2 {
  margin-top: 2px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.01em;
}

.app-close[hidden] {
  display: none;
}

.app-close {
  padding: 4px;
  border: 0;
  background: none;
  color: var(--app-muted);
}

.app-doc {
  overflow-y: auto;
  padding: 18px 22px 22px;
  scrollbar-width: none;
}

.app-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 0 0 20px;
}

.app-fields dt {
  color: var(--app-muted);
  font-size: 12px;
}

.app-fields dd {
  margin: 1px 0 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.app-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.app-lines thead {
  background: none;
}

.app-lines th {
  padding: 0 0 8px;
  border-bottom: 1px solid var(--app-line-soft);
  color: var(--app-muted);
  font-size: 12px;
  font-weight: 400;
  text-align: right;
}

.app-lines td {
  padding: 10px 0;
  border-bottom: 1px solid var(--app-line-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.app-lines :is(th, td):first-child {
  text-align: left;
}

/* What Aunara writes is lime while it is prepared, and settles into ink. */
.app-w {
  transition: background-color .8s, box-shadow .8s, opacity .4s;
}

.app-w.is-off {
  opacity: 0;
}

.app-w.is-lit {
  background-color: rgba(203, 228, 66, .22);
  box-shadow: inset 2px 0 var(--app-lime);
}

.app-total {
  margin-top: 18px;
}

.app-total small {
  display: block;
  color: var(--app-muted);
  font-size: 12px;
}

.app-total strong {
  display: block;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.025em;
}

.app-bars {
  display: grid;
  gap: 12px;
  margin-bottom: 8px;
}

.app-bar {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.app-bar i {
  display: block;
  height: 10px;
  border-radius: 99px;
  background: var(--app-ink);
  transform-origin: left;
  transition: scale 1s cubic-bezier(.2, .7, .2, 1);
}

.app-bar.is-off i {
  scale: 0 1;
}

.app-bar span:last-child {
  font-variant-numeric: tabular-nums;
}

.app-doc-note {
  margin-top: 6px;
  color: var(--app-muted);
  font-size: 12px;
}

.app-approve {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  margin-top: 22px;
  padding: 8px 18px;
  border: 1px solid var(--app-ink);
  border-radius: 10px;
  background: var(--app-ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  animation: app-ask 2.2s ease-in-out infinite;
}

.app-approve:disabled,
.app-approve.is-done {
  border-color: var(--app-line-soft);
  background: var(--app-rail);
  color: var(--app-soft);
  cursor: default;
  animation: none;
}

.app-approve svg {
  width: 15px;
  height: 15px;
}

@keyframes app-in {
  from { opacity: 0; translate: 0 8px; }
}

@keyframes app-pulse {
  70% { box-shadow: 0 0 0 7px rgba(203, 228, 66, 0); }
  100% { box-shadow: 0 0 0 0 rgba(203, 228, 66, 0); }
}

@keyframes app-caret {
  50% { opacity: 0; }
}

@keyframes app-ask {
  50% { box-shadow: 0 0 0 5px rgba(203, 228, 66, .45); }
}

.product-note {
  margin-top: var(--space-3);
  color: var(--muted);
  font-size: var(--text-xs);
}

html[data-motion=off] .app *,
html[data-motion=off] .app {
  animation: none !important;
  transition: none !important;
}

/* ── A phone: the conversation alone, and the document over it as a sheet ───────────────── */
@media (max-width: 760px) {
  .app,
  .app.is-open {
    grid-template-columns: minmax(0, 1fr);
    height: min(640px, 84svh);
  }

  .app-rail {
    display: none;
  }

  .app-top {
    padding: 12px 16px;
  }

  .app-thread,
  .app-compose {
    padding-inline: 14px;
  }

  .app-card {
    flex-wrap: wrap;
  }

  .app-canvas {
    position: absolute;
    inset: 18% 0 0;
    border-left: 0;
    border-top: 1px solid var(--app-line-soft);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(25, 55, 45, .18);
    translate: 0 102%;
    transition: translate .55s cubic-bezier(.2, .7, .2, 1);
  }

  .app.is-open .app-canvas {
    translate: 0 0;
  }

  /* Without scripting a phone shows the conversation, which already says what was sent. */
  .product:not([data-ready]) .app-canvas {
    display: none;
  }
}

.app-chip[hidden] {
  display: none;
}

.app-fields .is-wide {
  grid-column: 1 / -1;
}
