/* ==========================================================================
   Bota — the generation canvas.
   --------------------------------------------------------------------------
   A brief on the left, the site it produces on the right, and three briefs to
   choose between. Two things are worth knowing about how it works:

   * The switch is three radio buttons and a `:has()` rule. No script operates
     it, so it works from the first paint and keeps working if the module
     never loads. A browser without `:has()` shows the first brief complete,
     with chips that do nothing — which is a page, not a hole.
   * The assembly is a CSS animation with `both` fill, so it plays on load
     with no script at all. The module's only job is to *replay* it when the
     brief changes or the visitor asks for it again.
   ========================================================================== */

.canvas {
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-window);
  overflow: hidden;
}

/* ── Head ─────────────────────────────────────────────────────────────────── */
.canvas__head {
  display: flex;
  align-items: center;
  gap: var(--s3) var(--s4);
  flex-wrap: wrap;
  padding: var(--s3) clamp(14px, 1.6vw, 20px);
  background: var(--background-sunken);
  border-bottom: 1px solid var(--rule);
}

.canvas__label {
  flex: none;
}

.canvas__briefs {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
}

.canvas__replay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--faint);
  font-size: var(--t-xs);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-crisp),
    border-color var(--dur-fast) var(--ease-crisp);
}

.canvas__replay svg {
  width: 13px;
  height: 13px;
}

.canvas__replay:hover {
  color: var(--foreground);
  border-color: var(--rule-strong);
}

/* Nothing to replay without a module to replay it. */
html:not(.js) .canvas__replay {
  display: none;
}

/* ── Body ─────────────────────────────────────────────────────────────────── */
.canvas__body {
  display: grid;
  grid-template-columns: minmax(0, 3.7fr) minmax(0, 8.3fr);
}

.canvas__plan {
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 2.1vw, 30px);
  border-right: 1px solid var(--rule);
}

.canvas__brief {
  font-size: var(--t-sm);
  line-height: 1.5;
  letter-spacing: -0.012em;
  color: var(--foreground);
  margin-bottom: var(--s5);
  text-wrap: pretty;
}

/* ── The plan ─────────────────────────────────────────────────────────────
   Six stages, which are the six a real generation goes through. A log, not a
   glowing neural network: decoration pretending to be explanation is exactly
   the thing this page is arguing against.
   ------------------------------------------------------------------------ */
.plan {
  display: grid;
  gap: 1px;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  border-left: 1px solid var(--rule);
  padding-left: var(--s5);
}

.plan li {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding-block: 5px;
  color: var(--muted-foreground);
  animation: plan-step 620ms var(--ease-out) both;
  animation-delay: calc(var(--o) * 250ms);
}

.plan__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand);
  flex: none;
  animation: plan-dot 900ms var(--ease-out) both;
  animation-delay: calc(var(--o) * 250ms);
}

@keyframes plan-step {
  0% { opacity: 0.32; color: var(--faint); }
  30% { opacity: 1; }
  100% { opacity: 1; color: var(--muted-foreground); }
}

@keyframes plan-dot {
  0% { transform: scale(0.7); background: var(--rule-strong); }
  22% { transform: scale(1.9); background: var(--brand); }
  100% { transform: scale(1); background: var(--brand); }
}

.canvas__foot {
  margin-top: auto;
  padding-top: var(--s5);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  animation: canvas-fade 500ms var(--ease-out) 1.5s both;
}

/* ── Stage ────────────────────────────────────────────────────────────────── */
.canvas__stage {
  display: flex;
  flex-direction: column;
  padding: clamp(14px, 1.8vw, 26px);
  background: var(--background-sunken);
}

.canvas__frame {
  display: flex;
  flex-direction: column;
  /* Tall enough for the deepest of the three compositions to finish its last
     band. A preview that crops a line of type in half reads as a bug, not as
     a crop. */
  aspect-ratio: 16 / 10.3;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.canvas__bar {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: 7px 11px;
  background: var(--background-sunken);
  border-bottom: 1px solid var(--rule);
  flex: none;
}

.canvas__dots {
  display: flex;
  gap: 5px;
}

.canvas__dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
}

.canvas__url {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.canvas__view {
  flex: 1;
  min-height: 0;
}

/* The canvas shows the *top* of a page inside a preview pane, so its
   compositions are set a step smaller than the finished plates in 01 —
   the same relationship a workspace preview has to the real thing. Each
   variant still keeps its own display scale relative to the others. */
.canvas__view .site {
  --s-pad: 3.6cqw;
  --s-gap: 2.7cqw;
  --display-size: 4.9cqw;
  --display-lh: 1.06;
}

.canvas__view .site--photo {
  --display-size: 6cqw;
  --display-lh: 1;
}

/* Inside the fixed-height preview the gallery takes the slack instead of
   carrying its own ratio — a flex item with an aspect-ratio would otherwise
   be shrunk to a strip by whatever space is left. */
.canvas__view .site__grid {
  aspect-ratio: auto;
  flex: 1;
  min-height: 0;
}

.canvas__view .site--product {
  --display-size: 4.7cqw;
}

/* Bands assemble in document order. `both` fill is what lets this run with no
   script; the module only restarts it. */
.band {
  animation: band-in 620ms var(--ease-out) both;
  animation-delay: calc(0.75s + var(--o) * 300ms);
}

@keyframes band-in {
  0% { opacity: 0; transform: translateY(9px) scaleY(0.985); }
  100% { opacity: 1; transform: none; }
}

.canvas__status {
  display: flex;
  align-items: center;
  gap: var(--s4);
  margin-top: var(--s4);
}

.canvas__meter {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: var(--rule-strong);
  overflow: hidden;
}

.canvas__meter i {
  display: block;
  height: 100%;
  background: var(--brand);
  transform-origin: left;
  animation: meter 2.15s var(--ease-inout) both;
}

@keyframes meter {
  from { transform: scaleX(0.02); }
  to { transform: scaleX(1); }
}

.canvas__state {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  white-space: nowrap;
  animation: canvas-fade 460ms var(--ease-out) 2.05s both;
}

@keyframes canvas-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ══════════════════ Which brief is showing ══════════════════
   Default is the first one, so the fallback for a browser without `:has()`
   is a complete canvas rather than an empty one.
   ═══════════════════════════════════════════════════════════ */
.canvas [data-for="photo"],
.canvas [data-for="product"] {
  display: none;
}

.canvas:has(#brief-photo:checked) [data-for="clinic"],
.canvas:has(#brief-product:checked) [data-for="clinic"] {
  display: none;
}

.canvas:has(#brief-photo:checked) .canvas__brief[data-for="photo"],
.canvas:has(#brief-product:checked) .canvas__brief[data-for="product"] {
  display: block;
}

.canvas:has(#brief-photo:checked) .canvas__recipe[data-for="photo"],
.canvas:has(#brief-product:checked) .canvas__recipe[data-for="product"] {
  display: inline;
}

.canvas:has(#brief-photo:checked) .site[data-for="photo"],
.canvas:has(#brief-product:checked) .site[data-for="product"] {
  display: flex;
}

/* ── Responsive ───────────────────────────────────────────────────────────
   Below the two-column threshold the preview leads and the plan follows it,
   because on a phone the plan is the caption and the site is the picture.
   ------------------------------------------------------------------------ */
@media (max-width: 1000px) {
  .canvas__body {
    grid-template-columns: 1fr;
  }

  .canvas__plan {
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--rule);
  }

  .canvas__frame {
    aspect-ratio: 16 / 11;
  }
}

@media (max-width: 720px) {
  .canvas__head {
    padding-inline: var(--s4);
  }

  .canvas__label {
    display: none;
  }

  .canvas__frame {
    aspect-ratio: 4 / 3.6;
  }

  .canvas__state {
    font-size: 10px;
    letter-spacing: 0.05em;
  }
}
