/* DCBC Drop: an animator's light table. Cel on pegs, blue and red pencil, an exposure sheet. */
:root {
  --table: #DCE4EE;      /* light table glow */
  --sheet: #FBFCFE;      /* cel / paper */
  --ink:   #1C2140;      /* inking line */
  --steel: #7F8CA2;      /* peg bar */
  --rule:  #C4CEDC;      /* sheet grid */
  --blue:  #2F62D8;      /* blue pencil: guides, progress, links */
  --red:   #D7335F;      /* red pencil: drag, errors */
  --ok:    #14805A;
  --font:  "Archivo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: radial-gradient(120% 60rem at 30% 0%, #F1F5FA 0%, var(--table) 70%) no-repeat, var(--table);
  min-height: 100vh;
}
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
a { color: var(--blue); }

/* ---------- buttons ---------- */
.btn {
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: .55rem 1.15rem;
  font-weight: 650;
  cursor: pointer;
  background: transparent;
  transition: background .15s, color .15s;
}
.btn--ink { background: var(--ink); color: var(--sheet); }
.btn--ink:hover:not(:disabled) { background: var(--blue); border-color: var(--blue); }
.btn--line:hover:not(:disabled) { background: var(--ink); color: var(--sheet); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn--big {
  font-size: 1.15rem;
  padding: .85rem 1.8rem;
  font-variation-settings: "wdth" 112;
}

/* ---------- the cel with peg holes (the one bold thing) ---------- */
.cel {
  position: relative;
  background: var(--sheet);
  border-radius: 6px;
  padding: 3.2rem 1.25rem 1rem;
  box-shadow: 0 1px 0 #fff inset, 0 18px 40px -24px rgba(28, 33, 64, .45);
}
.pegs {
  position: absolute;
  top: .9rem; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 2.6rem; align-items: center;
}
.pegs i {
  display: block;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--table);
  box-shadow: inset 0 2px 3px rgba(28, 33, 64, .35);
}
.pegs i.slot { width: 58px; border-radius: 8px; }
.cel::before {             /* the peg bar the cel sits on */
  content: "";
  position: absolute;
  top: 1.12rem; left: 50%;
  width: 196px; height: 10px;
  transform: translateX(-50%);
  background: var(--steel);
  border-radius: 3px;
  opacity: .0;
  transition: opacity .25s;
}
.cel.is-pegged::before { opacity: .9; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.cel--login { width: min(380px, 100%); display: grid; gap: .6rem; padding-bottom: 1.5rem; }
.login-logo { width: 150px; justify-self: center; margin-top: .3rem; }
.login-title {
  margin: 0 0 .6rem;
  text-align: center;
  font-size: 3.4rem;
  line-height: 1;
  font-weight: 850;
  font-variation-settings: "wdth" 125;
  letter-spacing: -.02em;
}
.cel--login label { font-weight: 600; }
.cel--login input {
  border: 2px solid var(--rule);
  border-radius: 6px;
  padding: .65rem .8rem;
  background: #fff;
}
.cel--login input:focus { border-color: var(--blue); outline: none; }
.err { color: var(--red); margin: 0; font-size: .92rem; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; gap: .8rem;
  padding: 1rem clamp(1rem, 3vw, 2.5rem);
}
.top-logo { height: 34px; width: auto; }
.top-name {
  font-weight: 850;
  font-size: 1.5rem;
  font-variation-settings: "wdth" 125;
  border-left: 2px solid var(--ink);
  padding-left: .8rem;
  line-height: 1.1;
}
.top-nav { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.top-out { white-space: nowrap; color: var(--ink); font-weight: 600; text-decoration-thickness: 2px; text-underline-offset: 3px; }

.flash {
  margin: 0 clamp(1rem, 3vw, 2.5rem) .5rem;
  padding: .6rem .9rem;
  border-left: 4px solid;
  background: var(--sheet);
  font-weight: 600;
}
.flash--ok { border-color: var(--ok); }
.flash--err { border-color: var(--red); color: var(--red); }

/* ---------- desk layout ---------- */
.desk {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: .5rem clamp(1rem, 3vw, 2.5rem) 3rem;
  align-items: start;
}
.left { position: sticky; top: 1rem; display: grid; gap: 1.2rem; }

/* field guide inside the cel */
.field {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  border: 2px dashed var(--blue);
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
  background: #fff;
  transition: border-color .15s, background .15s;
}
.field-cross {
  position: absolute; inset: 0;
  background:
    linear-gradient(var(--blue), var(--blue)) center / 18px 1.5px no-repeat,
    linear-gradient(var(--blue), var(--blue)) center / 1.5px 18px no-repeat;
  opacity: .5;
  pointer-events: none;
}
.field-empty { position: relative; text-align: center; padding: 1rem; pointer-events: none; }
.drop-word {
  display: block;
  font-size: clamp(2.6rem, 5vw, 3.6rem);
  line-height: .92;
  font-weight: 850;
  font-variation-settings: "wdth" 125;
  letter-spacing: -.03em;
  margin-bottom: 1rem;
  background: #fff;
  padding: .2rem .4rem;
}
.drop-hint { color: var(--steel); font-size: .95rem; background: #fff; }
.field.is-over { border-color: var(--red); border-style: solid; background: #FFF7F9; }
.field.is-over .drop-word { color: var(--red); }
.field-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0E1226; }
.field-line {
  position: absolute; left: 0; bottom: 0;
  height: 5px; width: 0;
  background: var(--blue);
  transition: width .2s linear;
}
.cel-status { margin: .75rem 0 0; font-size: .95rem; min-height: 1.5em; }
.cel-status.is-err { color: var(--red); font-weight: 600; }

/* settle onto the pegs when a video lands: the one orchestrated motion */
@keyframes settle {
  0%   { transform: translateY(-14px) rotate(-.6deg); }
  70%  { transform: translateY(2px) rotate(0); }
  100% { transform: translateY(0); }
}
.cel.is-landing { animation: settle .45s cubic-bezier(.2, .8, .2, 1); }

/* brief panel */
.brief { display: grid; gap: .7rem; }
.lang { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.lang legend { font-weight: 650; margin-bottom: .45rem; padding: 0; }
.lang label { position: relative; }
.lang input { position: absolute; opacity: 0; }
.lang span {
  display: inline-block;
  padding: .35rem .8rem;
  border: 2px solid var(--rule);
  border-radius: 999px;
  background: var(--sheet);
  cursor: pointer;
  font-weight: 550;
}
.lang input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--sheet); }
.lang input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.note-label { font-weight: 650; }
.note-label span { font-weight: 400; color: var(--steel); }
.brief textarea {
  border: 2px solid var(--rule);
  border-radius: 6px;
  padding: .6rem .75rem;
  background: var(--sheet);
  resize: vertical;
}
.brief textarea:focus { outline: none; border-color: var(--blue); }
.check { display: flex; gap: .55rem; align-items: center; font-size: .95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.brief .btn { justify-self: start; }

/* ---------- right: exposure sheet ---------- */
.sheet-head h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1;
  font-weight: 850;
  font-variation-settings: "wdth" 118;
  letter-spacing: -.02em;
}
.summary { margin: .5rem 0 .9rem; max-width: 62ch; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.tag {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 600;
  padding: .1rem .15rem;
  cursor: pointer;
}
.tag:hover { text-decoration: underline; }
.tags .copy-all { color: var(--ink); text-decoration: underline; }

.xsheet {
  background: var(--sheet);
  border-radius: 6px;
  box-shadow: 0 18px 40px -28px rgba(28, 33, 64, .45);
  /* exposure-sheet grid: a frame column on the left */
  background-image: linear-gradient(90deg, transparent 10.5rem, var(--rule) 10.5rem, var(--rule) calc(10.5rem + 1px), transparent calc(10.5rem + 1px));
}
.xsheet:empty { display: none; }
.row {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  border-bottom: 1px solid var(--rule);
}
.row:last-child { border-bottom: 0; }
.row-side { padding: 1rem .9rem; display: grid; align-content: start; gap: .35rem; }
.row-name { display: flex; align-items: center; gap: .5rem; font-weight: 750; font-size: 1.05rem; }
.row-name input { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }
.row-acct { font-size: .85rem; color: var(--steel); overflow-wrap: anywhere; }
.row-main { padding: .8rem .9rem .9rem; display: grid; gap: .4rem; }
.row-main textarea, .row-main input[type=text] {
  width: 100%;
  border: 1.5px solid transparent;
  border-radius: 4px;
  padding: .5rem .6rem;
  background: #F4F7FB;
  line-height: 1.5;
  resize: vertical;
}
.row-main textarea:focus, .row-main input[type=text]:focus { outline: none; border-color: var(--blue); background: #fff; }
.row-main .small { font-size: .82rem; color: var(--steel); }
.row-foot { display: flex; gap: .8rem; align-items: baseline; justify-content: space-between; font-size: .85rem; }
.count { color: var(--steel); font-variant-numeric: tabular-nums; }
.count.is-over { color: var(--red); font-weight: 700; }
.state { font-weight: 650; }
.state.is-work { color: var(--blue); }
.state.is-ok { color: var(--ok); }
.state.is-err { color: var(--red); }
.state a { font-weight: 700; }
.row.is-off .row-main { opacity: .4; }
.row.is-missing .row-main { opacity: .45; }
.row .retry { margin-left: .5rem; padding: .15rem .6rem; font-size: .8rem; border-width: 1.5px; }

.go { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.2rem; }
.go-note { margin: 0; flex: 1 1 240px; color: var(--steel); }

/* ---------- connections dialog ---------- */
.conn {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(560px, calc(100% - 2rem));
  background: var(--sheet);
  color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(28, 33, 64, .5);
}
.conn::backdrop { background: rgba(28, 33, 64, .45); }
.conn-inner { padding: 1.5rem; display: grid; gap: 1rem; }
.conn h2 { margin: 0; font-size: 1.8rem; font-weight: 850; font-variation-settings: "wdth" 118; }
.conn-lead { margin: -.5rem 0 0; color: var(--steel); }
.conn-list { display: grid; }
.conn-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .2rem 1rem;
  padding: .8rem 0;
  border-bottom: 1px solid var(--rule);
  align-items: center;
}
.conn-row strong { font-size: 1.05rem; }
.conn-acct { grid-column: 1; font-size: .9rem; color: var(--steel); }
.conn-acct.is-on { color: var(--ok); font-weight: 600; }
.conn-note { grid-column: 1 / -1; font-size: .85rem; color: var(--steel); margin: 0; }
.conn-row .btn { grid-row: 1 / span 2; grid-column: 2; padding: .35rem .9rem; text-decoration: none; color: var(--ink); }
.conn-row select { grid-column: 1 / -1; margin-top: .3rem; padding: .4rem; border-radius: 4px; border: 1.5px solid var(--rule); background: #fff; }
.conn-row.is-unset strong { color: var(--steel); }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .desk { grid-template-columns: 1fr; }
  .left { position: static; }
  .field { aspect-ratio: 16 / 11; }
}
@media (max-width: 560px) {
  .xsheet { background-image: none; }
  .row { grid-template-columns: 1fr; }
  .row-side { padding-bottom: 0; }
  .top-logo { height: 26px; }
  .top { gap: .6rem; }
  .top-nav { gap: .7rem; }
  .top-nav .btn { padding: .35rem .8rem; font-size: .9rem; }
  .top-name { font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
