/* Reel Exporter: dark theme, consistent with the viewer. */

:root {
  --bg: #0b0c0e;
  --panel: #16181c;
  --panel-2: #1f2228;
  --fg: #f2f4f7;
  --muted: #9aa2ad;
  --accent: #4c8dff;
  --error: #ff6b6b;
  --ok: #4cd07d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

#stage.dragover::after {
  content: "Drop to open";
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  background: rgba(76, 141, 255, 0.15);
  border: 3px dashed var(--accent);
  pointer-events: none;
  z-index: 20;
}

/* -------------------------------------------------------------------------- */
/* Header                                                                     */
/* -------------------------------------------------------------------------- */
#topbar .brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 0.25rem;
}
#topbar .brand-glyph {
  flex: none;
  display: block;
}
#topbar h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.tagline {
  margin: 0 0 1.25rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 40rem;
}

/* -------------------------------------------------------------------------- */
/* Panels                                                                     */
/* -------------------------------------------------------------------------- */
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 1.5rem;
}
#open-panel p {
  margin: 0.35rem 0;
  color: var(--muted);
  line-height: 1.5;
}
code {
  background: var(--panel-2);
  padding: 0.1em 0.4em;
  border-radius: 6px;
  color: var(--fg);
}
.hint {
  font-size: 0.9rem;
}

/* -------------------------------------------------------------------------- */
/* Buttons and inputs                                                         */
/* -------------------------------------------------------------------------- */
.button,
button {
  font: inherit;
  color: var(--fg);
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.button:hover,
button:hover {
  background: #262a31;
}
.button:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.button {
  display: inline-block;
  margin-top: 0.75rem;
  text-decoration: none;
}
.button.small {
  margin-top: 0;
  padding: 0.5rem 0.85rem;
}
#render {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
#render:hover {
  background: #3f7de6;
}

/* File input is shown as a styled label; hide the native control but keep it
   reachable for keyboard and assistive tech. */
#file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

select {
  font: inherit;
  color: var(--fg);
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  min-height: 44px;
}

/* -------------------------------------------------------------------------- */
/* App layout                                                                 */
/* -------------------------------------------------------------------------- */
#app {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 640px) {
  #app {
    grid-template-columns: 1fr;
  }
}

#preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
#preview {
  width: 304px;
  height: 540px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.preview-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  max-width: 20rem;
}

/* -------------------------------------------------------------------------- */
/* Settings form                                                              */
/* -------------------------------------------------------------------------- */
#settings {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.field.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}
.field.checkbox input {
  width: 24px;
  height: 24px;
  accent-color: var(--accent);
}
.field label {
  color: var(--fg);
  font-weight: 500;
}
.note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

/* -------------------------------------------------------------------------- */
/* Progress bar                                                               */
/* -------------------------------------------------------------------------- */
#progress .bar {
  height: 12px;
  border-radius: 6px;
  background: var(--panel-2);
  overflow: hidden;
}
#progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.1s linear;
}
#progress-text {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* -------------------------------------------------------------------------- */
/* Result                                                                     */
/* -------------------------------------------------------------------------- */
#result .how-to {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}
#result .how-to ol {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  line-height: 1.6;
}
#download {
  background: var(--ok);
  border-color: var(--ok);
  color: #06210f;
  font-weight: 600;
}
#download:hover {
  background: #43ba6f;
}

/* -------------------------------------------------------------------------- */
/* Status                                                                     */
/* -------------------------------------------------------------------------- */
#status {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.2em;
}
#status.error {
  color: var(--error);
}

/* Vendored Roboto (variable weight, latin subset). Used by the UI and, via
   document.fonts.load in the compositor, by canvas text in the reel itself. */
@font-face {
  font-family: "Roboto";
  src: url("../vendor/Roboto-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* A deliberately disabled setting (e.g. audio on a silent photo) should read
   as "not applicable", not broken. */
.field.is-disabled label {
  color: #6b7280;
}
.field.is-disabled input[type="checkbox"] {
  opacity: 0.4;
}
.privacy {
  color: #8e97a3;
  font-size: 0.85rem;
}
#copy-link {
  margin-left: 0.5rem;
}
#copy-note {
  display: block;
  color: #8e97a3;
  font-size: 0.85rem;
  margin-top: 0.4rem;
  word-break: break-all;
}
