/* AMB Interactive. Palette lifted from ambinteractive.com; Manrope stands in
   for Sailec, which is licensed and cannot be embedded. */

:root {
  --ground: #1C1A1B;
  --surface: #232122;
  --bar: #201E1F;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #4D7C8E;
  --accent-lift: #5d90a4;
  --text: #FFFFFF;
  --muted: #929091;
  --faint: #737373;
  --ghost: #5f5d5e;
  --warn: #D6A45A;
  --warn-bg: #262023;
  --err: #C65A4A;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 15px/1.55 Manrope, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- header ---- */

header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 40px;
  border-bottom: 1px solid var(--line);
}
header img { height: 26px; width: auto; display: block; }
header .rule { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.16); }
header .wordmark { font-size: 15px; font-weight: 700; }
header .wordmark .arrow { color: var(--accent); }
header .spacer { flex: 1; }
header a { color: var(--muted); font-size: 14px; text-decoration: none; }
header a:hover { color: var(--text); }

main { max-width: 1080px; margin: 0 auto; padding: 32px 40px 64px; }

/* ---- surfaces ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
}

h2 { font-size: 17px; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.01em; }

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 8px;
}
.hint { font-size: 13px; color: var(--faint); margin: 6px 0 0; }

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

input[type="text"], input[type="url"], input[type="password"], select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--ground);
  color: var(--text);
  font: inherit;
}
select { appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23929091' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
input::placeholder { color: var(--ghost); }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

button {
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  height: 48px;
  padding: 0 28px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--accent-lift); }
button.secondary { background: transparent; border: 1px solid rgba(255, 255, 255, 0.22); color: var(--text); }
button.secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
button.pill { border-radius: 9999px; background: #fff; color: var(--ground); }
button.pill:hover:not(:disabled) { background: #e8e8e8; }

/* After the variants, so a disabled button always reads as disabled whatever
   else it is. Ordering matters here: these share specificity with .secondary
   and .pill, so an earlier rule would simply lose. */
button:disabled,
button.secondary:disabled,
button.pill:disabled {
  background: #302d2e;
  border-color: transparent;
  color: var(--ghost);
  cursor: not-allowed;
}

/* ---- source picker ---- */

.tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tab {
  height: auto; padding: 0 0 10px; margin-right: 26px;
  background: none; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--muted); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.tab:hover:not(.is-on) { background: none; color: var(--text); }
.tab.is-on { color: var(--text); border-bottom-color: var(--accent); }

.pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.frames {
  margin-top: 16px;
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.frames:empty { display: none; }
.frame-row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  height: auto; padding: 13px 16px;
  background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0;
  color: var(--text); font-size: 14px; font-weight: 500;
  text-transform: none; letter-spacing: normal; text-align: left;
}
.frame-row:first-child { border-top: 0; }
.frame-row:hover:not(:disabled) { background: rgba(77, 124, 142, 0.14); }
.frame-row:disabled { background: transparent; }
.frame-row .name { flex: 1; font-weight: 700; }
.frame-row:disabled .name { color: var(--ghost); font-weight: 500; }
.frame-row .dim { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.frame-row .flag {
  font-size: 11px; font-weight: 700; color: var(--warn);
  background: rgba(214, 164, 90, 0.14); border-radius: 5px; padding: 3px 8px;
}
.frames-empty { padding: 18px; font-size: 14px; color: var(--faint); margin: 0; }

/* ---- frame summary ---- */

.summary { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 20px; }
.summary .who { flex: 1; }
.summary .eyebrow {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); display: block; margin-bottom: 6px;
}
.summary h1 { margin: 0; font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.summary .stats { display: flex; gap: 26px; }
.summary .stat { display: flex; flex-direction: column; gap: 3px; }
.summary .stat span:first-child { font-size: 12px; color: var(--faint); }
.summary .stat span:last-child { font-size: 17px; font-weight: 700; }

/* ---- warnings ---- */

.warn {
  background: var(--warn-bg);
  border: 1px solid rgba(214, 164, 90, 0.34);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.warn strong {
  display: block; color: var(--warn); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px;
}
.warn ul { margin: 0; padding-left: 18px; color: #cfcbcc; font-size: 14px; }
.warn li + li { margin-top: 4px; }

/* ---- slice rows ---- */

.slice {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.slice:first-child { border-top: 0; padding-top: 8px; }
.slice img {
  width: 100%; display: block;
  border: 1px solid rgba(255, 255, 255, 0.10); border-radius: 8px;
  background: #fff;
}
.slice .meta { font-size: 12px; color: var(--faint); margin-top: 8px; }
.slice .head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.slice .num {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.slice .needs {
  font-size: 12px; font-weight: 700; color: var(--warn);
  background: rgba(214, 164, 90, 0.14); border-radius: 5px; padding: 3px 8px;
}
.slice .fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.slice label { font-size: 12px; text-transform: none; letter-spacing: normal; color: var(--muted); }
.slice input.flagged { border-color: rgba(214, 164, 90, 0.40); }

/* ---- action bar ---- */

.actions { display: flex; align-items: center; gap: 14px; }
.actions .say { flex: 1; }
.actions .say strong { display: block; font-size: 14px; font-weight: 700; }
.actions .say span { font-size: 13px; color: var(--faint); }

/* ---- progress and results ---- */

.status { font-size: 14px; color: var(--muted); margin: 16px 0 0; }
.status.err { color: var(--err); }
.error { color: var(--err); font-size: 14px; }
.done { color: var(--text); font-weight: 700; font-size: 15px; }
.done a { color: var(--accent); }

.steps { margin: 12px 0 0; padding-left: 18px; font-size: 13px; color: var(--faint); }
.steps li + li { margin-top: 3px; }

.hidden { display: none !important; }

/* ---- sign in ---- */

.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 28px; padding: 40px;
}
.login-wrap img { height: 44px; width: auto; display: block; }
.login-wrap .card { width: 100%; max-width: 380px; margin: 0; padding: 32px; border-radius: 16px; }
.login-wrap h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }
.login-wrap h1 .arrow { color: var(--accent); }
.login-wrap p.sub { margin: 0 0 26px; color: var(--muted); font-size: 14px; }
.login-wrap button { width: 100%; margin-top: 22px; }
.login-wrap .foot { color: var(--faint); font-size: 12px; margin: 0; }

.pick.pick-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
.addfile { display: flex; gap: 10px; margin-top: 14px; }
.addfile input { flex: 1; }
.addfile button { height: 46px; padding: 0 20px; }

/* ---- loading: skeletons, spinners, progress ---- */

@keyframes shimmer { to { background-position-x: -200%; } }

.skel {
  background: linear-gradient(90deg, #2a2728 8%, #333031 18%, #2a2728 28%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 6px;
  display: block;
}
.skel-line { height: 12px; }
.skel-line + .skel-line { margin-top: 8px; }
.skel-field { height: 46px; border-radius: 10px; }
.skel-thumb { width: 100%; border-radius: 8px; }

/* A frame row before the list arrives. */
.skel-row {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px; border-top: 1px solid var(--line);
}
.skel-row:first-child { border-top: 0; }

@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--accent);
  border-radius: 9999px;
  animation: spin 0.7s linear infinite;
}
.spinner.on-accent { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }

button .spinner { display: inline-block; vertical-align: -3px; margin-right: 9px; }

/* Indeterminate bar for work with no known percentage. */
@keyframes slide { 0% { left: -35%; } 100% { left: 100%; } }

.progress {
  position: relative; overflow: hidden;
  height: 4px; border-radius: 9999px; background: #2b2829; margin-top: 16px;
}
.progress::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 35%;
  background: var(--accent); border-radius: 9999px;
  animation: slide 1.25s ease-in-out infinite;
}

/* Step list: done, running, waiting. */
.steps-rich { list-style: none; margin: 14px 0 0; padding: 0; }
.steps-rich li {
  display: flex; align-items: center; gap: 11px;
  font-size: 14px; color: var(--muted); padding: 5px 0;
}
.steps-rich li.done { color: var(--text); }
.steps-rich li.now { color: var(--text); font-weight: 700; }
.steps-rich .tick { width: 16px; height: 16px; flex-shrink: 0; }

/* Slice previews fade in rather than snapping. */
.slice img { opacity: 0; transition: opacity 0.25s ease; }
.slice img.loaded { opacity: 1; }
.slice .thumb-wrap { position: relative; }
.slice .thumb-wrap .skel-thumb { position: absolute; inset: 0; height: 100%; }
.slice .thumb-wrap.ready .skel-thumb { display: none; }

@media (prefers-reduced-motion: reduce) {
  .skel, .progress::after, .spinner { animation: none; }
  .skel { background: #2f2c2d; }
  .progress::after { left: 0; width: 100%; opacity: 0.5; }
  .slice img { transition: none; }
}

/* ---- responsive ----
   Two breakpoints, each fixing a specific thing rather than a device:
   960px is where the three-up picker and the thumbnail-beside-fields slice row
   stop fitting; 640px is where horizontal rows have to become stacks. */

@media (max-width: 960px) {
  main { padding: 24px 20px 48px; }
  header { padding: 16px 20px; gap: 12px; }

  /* File, page and filter no longer fit three across. */
  .pick.pick-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pick.pick-3 > :last-child { grid-column: 1 / -1; }

  /* The preview moves above its fields rather than shrinking to nothing. Capped
     in both directions: full width turns a short logo bar into a 750px band and
     makes the page enormous, and a tall slice would run to several screens. */
  .slice { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .slice .thumb-wrap { max-width: 420px; }
  .slice img, .slice .skel-thumb { max-height: 320px; object-fit: contain; object-position: left top; }
}

@media (max-width: 640px) {
  main { padding: 20px 14px 40px; }
  header { padding: 14px 16px; gap: 10px; flex-wrap: wrap; }
  header .wordmark { font-size: 14px; }

  .card { padding: 18px; border-radius: 12px; }

  .pick, .pick.pick-3 { grid-template-columns: minmax(0, 1fr); }
  .pick.pick-3 > :last-child { grid-column: auto; }

  /* Alt text and link stack, so neither is squeezed to unusable. */
  .slice .fields { grid-template-columns: minmax(0, 1fr); }

  .summary { flex-direction: column; align-items: flex-start; gap: 14px; }
  .summary h1 { font-size: 22px; }
  .summary .stats { gap: 20px; }

  /* Buttons go full width and stack; a row of them overflows at this size. */
  .actions { flex-direction: column; align-items: stretch; }
  .actions .say { margin-bottom: 4px; }
  .actions button { width: 100%; }

  .addfile { flex-wrap: wrap; }
  .addfile input { flex: 1 1 100%; }
  .addfile button { flex: 1; }

  /* The frame list gets tight: drop the dimensions, keep the name and flag. */
  .frame-row { padding: 12px 13px; gap: 10px; }
  .frame-row .dim { display: none; }

  .tab { margin-right: 18px; font-size: 12px; }
}
