/*
 * web/landing/shells/DemoFrame.css - the generic product chrome (web/landing/shells/DemoFrame.js
 * documents the markup). The page links it (web/landing.html, once, before every section
 * sheet), so a section's sheet never imports it and its rules always come after these.
 *
 * Generic only: the bar, the door pill, the slots stacked with the stage first, the
 * toolbar, the status line and the drawer. No variant rules live here: a section lays out
 * and dresses its own variant in sections/<id>.css, scoped by [data-beat]. The frame is a
 * size container, so a section's rules can follow the frame's width rather than the page's.
 *
 * Tokens are web/landing.css's. Dark aubergine surfaces, the one violet accent for the
 * primary control and focus, serif nowhere (headings are the section's), mono for the
 * technical labels: the door, the drawer's row names, its code and the status line.
 */

.demo-frame {
  container: demo-frame / inline-size;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
}

/* ── The bar: the product's name and the door ─────────────────────────── */

.demo-frame-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 12px 8px 14px;
  border-bottom: 1px solid var(--line);
  border-radius: 15px 15px 0 0;
  background: var(--panel-2);
}

.demo-frame-lights {
  display: inline-flex;
  gap: 6px;
  flex: none;
}

.demo-frame-lights i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line);
}

.demo-frame-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
}

.demo-frame-door {
  margin-left: auto;
  flex: none;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text);
}

.demo-frame-door[hidden],
.demo-frame-door-line[hidden] { display: none; }

/* ── The body: named slots ────────────────────────────────────────────── */

.demo-frame-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "stage" "main" "aside";
  gap: 14px;
  padding: 14px;
}

.demo-frame-slot { min-width: 0; }
.demo-frame-slot:empty,
.demo-frame-slot[hidden] { display: none; }
.demo-frame-slot[data-slot="stage"] { grid-area: stage; }
.demo-frame-slot[data-slot="main"] { grid-area: main; }
.demo-frame-slot[data-slot="aside"] { grid-area: aside; }

@container demo-frame (min-width: 640px) {
  .demo-frame-body {
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, 1fr);
    grid-template-areas: "main stage" "aside aside";
    gap: 16px;
    padding: 16px;
  }
}

/* ── The foot: the toolbar and the status line ─────────────────────────── */

.demo-frame-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.demo-frame-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px; /* the controls arrive with the module: no jump when they do */
}

.demo-frame-toolbar :is(button, a) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color .12s, filter .12s;
}

.demo-frame-toolbar :is(button, a):hover { border-color: var(--muted); }
.demo-frame-toolbar :is(button, a)[hidden] { display: none; }
.demo-frame-toolbar button:disabled { opacity: .6; cursor: default; }

/* The one control the beat is about: the accent, once per frame. */
.demo-frame-toolbar .demo-frame-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.demo-frame-toolbar .demo-frame-primary:hover { border-color: var(--accent); filter: brightness(1.08); }

/* A switch (aria-pressed): its dot is lit while it is on. */
.demo-frame-toolbar [aria-pressed]::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
  transition: background .15s;
}

.demo-frame-toolbar [aria-pressed="true"]::before { background: var(--accent); }

.demo-frame-status {
  margin: 0;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── The drawer: "How this runs" ──────────────────────────────────────── */

.demo-frame-drawer { border-top: 1px solid var(--line); }

.demo-frame-drawer > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  padding: 11px 14px 12px 34px;
  position: relative;
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  border-radius: 0 0 15px 15px;
}

.demo-frame-drawer > summary::-webkit-details-marker { display: none; }

.demo-frame-drawer > summary::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 17px;
  border: 4.5px solid transparent;
  border-left: 6px solid var(--muted);
  border-right: 0;
  transition: transform .15s;
}

.demo-frame-drawer[open] > summary::before { transform: rotate(90deg); }
.demo-frame-drawer[open] > summary { border-radius: 0; }

.demo-frame-drawer-title { font-weight: 600; }
.demo-frame-door-line { color: var(--muted); }

.demo-frame-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px 18px;
  margin: 0;
  padding: 2px 14px 16px;
}

.demo-frame-row { display: contents; }
/* A row whose value its module fills is hidden until it is filled (and with no script). */
.demo-frame-row[hidden],
.demo-frame-row:has(> dd:empty) { display: none; }

.demo-frame-rows dt {
  padding-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.demo-frame-rows dd {
  margin: 0;
  min-width: 0;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

@container demo-frame (min-width: 560px) {
  .demo-frame-rows { grid-template-columns: max-content minmax(0, 1fr); }
  .demo-frame-rows dd { padding-top: 6px; }
}

.demo-frame-code {
  margin: 0;
  padding: 9px 11px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}

.demo-frame-code + .demo-frame-code,
.demo-frame-code + .demo-frame-note,
.demo-frame-note + .demo-frame-code { margin-top: 6px; }

.demo-frame-note {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.demo-frame-mono {
  font-family: var(--mono);
  font-size: 12px;
}
