/* The demo's frame: a small AE-like window around the real panel. Textue's own dark palette
   (src/panel/panel.css), suggestive of AE without copying Adobe's UI. */
:root {
  --bg: #0b0c0f;
  --win: #1c1c1f;
  --well: #131315;
  --raised: #2c2c2f;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #f5f5f7;
  --dim: #8e8e93;
  --faint: #6e6e73;
  --sel: rgba(255, 255, 255, 0.09);
  --accent: #b9dcf5;
  --on-accent: #0b1a26;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
/* A class that sets `display` outbids the UA's [hidden] rule, and .settings does. panel.css carries
   the same line for the same reason. */
[hidden] { display: none !important; }

.demo { position: relative; max-width: 1060px; margin: 0 auto; padding: 16px; }

.win { background: var(--win); border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.win-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--well); border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; background: var(--win); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; }
.tab .dot { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.tc { font-family: var(--mono); font-size: 12px; color: var(--accent); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }

/* The comp's time strip, between the viewer and the layers, like the top of AE's timeline. */
.ruler { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-top: 1px solid var(--line); background: var(--well); }
.ruler .tc { flex: none; width: 76px; }
.track { position: relative; flex: 1; height: 100%; cursor: ew-resize; touch-action: none; }
.ticks { position: absolute; left: 0; right: 0; bottom: 0; height: 9px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.28) 0 1px, transparent 1px calc(100% / var(--frames, 24) * 6)) bottom / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, rgba(255,255,255,0.12) 0 1px, transparent 1px calc(100% / var(--frames, 24))) bottom / 100% 5px no-repeat; }
.head { position: absolute; top: 5px; bottom: 0; left: 0; width: 0; pointer-events: none; }
.head::before { content: ""; position: absolute; left: -5px; top: 0; width: 11px; height: 9px; background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); }
.head i { position: absolute; left: 0; top: 8px; bottom: 0; width: 1px; background: var(--accent); }
.ruler.off .track { cursor: default; }
.ruler.off .ticks, .ruler.off .head { opacity: 0.35; }
.play { width: 26px; height: 22px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--win); cursor: pointer; }
.play svg { width: 12px; height: 12px; fill: var(--text); }
.play .i-pause, .play.on .i-play { display: none; }
.play.on .i-pause { display: block; }
.play:hover:not(:disabled) { background: var(--raised); }
.play:disabled { opacity: 0.35; cursor: default; }

/* The comp on the left, the panel docked down the right, the way it sits in AE. */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 400px; align-items: stretch; }
.left { min-width: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; }

.viewer { flex: 1; min-height: 240px; display: grid; place-items: center; background:
  linear-gradient(0deg, rgba(255,255,255,0.02), rgba(255,255,255,0.02)),
  repeating-conic-gradient(#181819 0% 25%, #141416 0% 50%) 50% / 22px 22px; }
/* Framed like the preview renders (480x270, "studio.tue" centered at about 75% of the width,
   top at 37%), so a render playing over layer 1 lands exactly where layer 1 is drawn. */
.frame { position: relative; width: min(94%, 430px); aspect-ratio: 16 / 9; background: #0f0f11; border: 1px solid var(--line); border-radius: 4px; text-align: center; container-type: inline-size; }
.frame .t1 { position: absolute; left: 0; right: 0; top: 33%; font-size: 13.2cqw; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.frame .sub { position: absolute; left: 6%; right: 6%; bottom: 7%; display: flex; flex-direction: column; gap: 2px; }
.frame .t2 { font-size: max(10px, 3cqw); color: var(--dim); }
.frame .lyr { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: opacity 0.15s, transform 0.15s; }
.frame .lyr.on { text-shadow: 0 0 22px rgba(185, 220, 245, 0.35); }
.frame .lyr.off { opacity: 0.35; }
/* After Apply on the sample-text layer: AE's own render of that preset plays in its place. */
.frame .lyr.played { visibility: hidden; }
.frame .render { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.viewer { position: relative; padding-bottom: 26px; }
.caption { position: absolute; left: 12px; right: 12px; bottom: 8px; margin: 0; text-align: center; font-size: 11.5px; color: var(--dim); }

.tl { border-top: 1px solid var(--line); }
.tl-head, .row { display: grid; grid-template-columns: 26px minmax(120px, 1.5fr) minmax(0, 1.2fr); align-items: center; gap: 10px; padding: 0 12px; }
.tl-head { height: 28px; font-size: 11px; color: var(--faint); border-bottom: 1px solid var(--line); }
.rows { list-style: none; margin: 0; padding: 0; }
.row { height: 34px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; transition: background 0.12s; }
.row:hover { background: rgba(255, 255, 255, 0.03); }
.row.sel { background: var(--sel); }
.row.sel:hover { background: rgba(255, 255, 255, 0.11); }
.row.locked { cursor: not-allowed; }
.row.locked > span { opacity: 0.5; }
.row > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.c-num { color: var(--faint); font-family: var(--mono); font-size: 11px; }
.c-fx { color: var(--dim); font-size: 12px; }
.c-fx b { color: var(--accent); font-weight: 500; }
.kind { color: var(--faint); font-size: 11px; margin-left: 6px; }
.c-name { display: flex; align-items: center; min-width: 0; }
/* The pencil: edit a text layer's text. Quiet until the row is hovered; always shown on touch. */
.pencil { flex: none; margin-left: 6px; width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--faint); cursor: pointer; opacity: 0; transition: opacity 0.12s, color 0.12s; }
.pencil svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.row:hover .pencil, .row.sel .pencil, .pencil:focus-visible { opacity: 1; }
.pencil:hover:not(.off) { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.pencil.off { cursor: not-allowed; }
@media (pointer: coarse) { .pencil { opacity: 1; } }
.edit { min-width: 0; flex: 1; font: inherit; color: var(--text); background: var(--well); border: 1px solid var(--accent); border-radius: 4px; padding: 3px 6px; outline: none; }

/* The panel itself. Tall, because its grid and its bar need the room. */
.dock { display: block; width: 100%; height: 620px; border: 0; background: var(--well); }

.under { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 4px 0; }
.hint { margin: 0; color: var(--dim); font-size: 12.5px; max-width: 62ch; }
.hint.warn { color: var(--accent); }
.actions { display: flex; gap: 8px; }
.actions button { background: var(--raised); border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 12px; cursor: pointer; transition: background 0.12s, opacity 0.12s; }
.actions button:hover:not(:disabled) { background: #36363a; }
.actions button:disabled { opacity: 0.4; cursor: default; }
kbd { font: 11px var(--mono); color: var(--faint); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; margin-left: 4px; }

.note { margin: 14px 4px 0; color: var(--faint); font-size: 12px; }

/* The settings window, which is a separate extension in AE. */
.settings { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: grid; place-items: center; padding: 20px; z-index: 10; }
.settings-win { width: min(100%, 460px); height: min(100%, 620px); background: var(--well); border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6); }
.settings-win iframe { display: block; width: 100%; height: 100%; border: 0; }

@media (max-width: 900px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .left { border-right: 0; border-bottom: 1px solid var(--line); }
  /* Short enough that the panel's own auto page size lands on 2 x 2, so a phone shows the cards,
     the pager and Apply without losing the comp above. 560 here gives 6 and pushes Apply off screen. */
  .dock { height: 470px; }
  .viewer { min-height: 180px; }
}
