/* ==========================================================================
   Eleições — the preview page

   Presentation chrome. None of this ships with a template: it is the room the
   graphic is shown in, not part of the graphic. The tokens are the L-Bar's, so
   the two packages read as one house.
   ========================================================================== */

:root {
  --ui-bg:     #0B0D10;
  --ui-panel:  #14181D;
  --ui-line:   #242A31;
  --ui-text:   #E7ECF1;
  --ui-muted:  #8A95A1;
  --ui-accent: #C21D23;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}

/* --- title ---------------------------------------------------------------- */

header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--ui-line);
  flex: 0 0 auto;
}

/* The lockup is 3010 x 2816, so the box is sized to that ratio and the mask
   takes its colour from the text. */
.brand {
  inline-size: 58px;
  block-size: 54px;
  background: currentColor;
  -webkit-mask: url("../assets/astucemedia-logo.svg") left center / contain no-repeat;
  mask: url("../assets/astucemedia-logo.svg") left center / contain no-repeat;
  flex: 0 0 auto;
}

header h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0;
}

header .sub { margin: 0; color: var(--ui-muted); font-size: 13px; }
header .spacer { flex: 1; }

header .fmt {
  color: var(--ui-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: right;
  line-height: 1.5;
}

header .fmt a { color: var(--ui-muted); }
header .fmt a:hover { color: var(--ui-text); }

.dl {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-inline-start: 22px;
  padding: 9px 15px;
  border: 1px solid var(--ui-line);
  border-radius: 3px;
  color: var(--ui-text);
  text-decoration: none;
  white-space: nowrap;
}

.dl:hover { border-color: #39424D; background: #1B2128; }
.dl__label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.dl__meta  { font-size: 11px; color: var(--ui-muted); }

/* --- controls ------------------------------------------------------------- */

.controls {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 26px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-panel);
}

/* The data fields are generated from the manifest, so this one can be long. */
.fields {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 18px;
  padding: 12px 28px 14px;
  border-bottom: 1px solid var(--ui-line);
  background: #10141A;
}

.group { display: flex; align-items: center; gap: 8px; }

.group > .label,
.field > .label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ui-muted);
}

.field { display: flex; flex-direction: column; gap: 4px; }

.field input[type="text"],
.field input[type="number"] {
  background: #0f1115;
  color: var(--ui-text);
  border: 1px solid var(--ui-line);
  border-radius: 3px;
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
  min-width: 9ch;
}

.field input:focus { outline: 1px solid var(--ui-accent); border-color: var(--ui-accent); }
.field--wide input { min-width: 26ch; }

.seg { display: inline-flex; border: 1px solid var(--ui-line); border-radius: 3px; overflow: hidden; }

.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ui-muted);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 13px;
  cursor: pointer;
}

.seg button + button { border-inline-start: 1px solid var(--ui-line); }
.seg button[aria-pressed="true"] { background: #222932; color: var(--ui-text); }
.seg button:hover:not([aria-pressed="true"]) { color: var(--ui-text); }

.act {
  appearance: none;
  border: 1px solid var(--ui-line);
  border-radius: 3px;
  background: transparent;
  color: var(--ui-text);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 16px;
  cursor: pointer;
}

.act:hover { border-color: #39424D; background: #1B2128; }
.actions { display: flex; gap: 8px; flex: 0 0 auto; }

.scrub { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 200px; }
.scrub input[type="range"] { flex: 1; accent-color: var(--ui-accent); }
.scrub .t { color: var(--ui-muted); font-size: 12px; min-width: 8ch; text-align: right; }

/* --- stage ----------------------------------------------------------------
   The graphic takes a part of the screen, not all of it: at 1:1 it is wider
   than most laptops, and edge to edge there is nothing to read it against.
   -------------------------------------------------------------------------- */

main {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 28px;
  min-height: 0;
}

/* An iframe, so the graphic gets its own document. The chrome here sets a
   box-sizing reset, a body font and a pile of --ui-* tokens; sharing a document
   with that makes the preview a poor witness. In there, what you see is what a
   renderer page would show — and the graphic has to bring its own stylesheets,
   which is exactly what it does on `load`. */
.stage {
  width: 1920px;
  height: 1080px;
  border: 0;
  display: block;
  transform: scale(var(--scale, 0.5));
  transform-origin: top left;
  background: #000;
}

.stage-box {
  width: calc(1920px * var(--scale, 0.5));
  height: calc(1080px * var(--scale, 0.5));
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: 4px;
}

.status {
  padding: 0 28px 18px;
  color: var(--ui-muted);
  font-size: 12px;
}

.status b { color: var(--ui-text); font-weight: 400; }
