/* Content Studio. Matches the T.IM studio bar palette. The board scrolls inside
   its own container, so the page itself never scrolls sideways on a phone. */
:root {
  color-scheme: dark;
  --bg: #0e1a2e;
  --panel: #15243f;
  --panel-2: #1c2f50;
  --line: #25395c;
  --text: #f6f4ef;
  --muted: #9fb0c8;
  --accent: #e8c96a;
  --danger: #f2a08a;
  --radius: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 'Barlow', 'Helvetica Neue', Arial, sans-serif;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  letter-spacing: 0.02em;
  margin: 0;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.1rem;
  color: var(--accent);
}

h3 {
  font-size: 1rem;
  margin: 16px 0 8px;
}

.top,
#app,
#waiting,
#studio-sync {
  padding-left: 16px;
  padding-right: 16px;
}

.top {
  padding-top: 16px;
  display: grid;
  gap: 12px;
}

.intro,
.muted {
  color: var(--muted);
  margin: 0;
}

#waiting {
  padding-top: 24px;
  padding-bottom: 24px;
  color: var(--muted);
}

#studio-sync {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  background: var(--panel);
}

#studio-sync summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--accent);
}

#studio-sync form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#studio-sync [role='status'] {
  color: var(--muted);
}

/* Shared controls */
label {
  display: grid;
  gap: 4px;
  font-size: 0.92rem;
  color: var(--muted);
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

input,
select,
textarea,
button {
  font: inherit;
  color: var(--text);
  min-height: 44px;
}

input,
select,
textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  font-size: 16px; /* stops iOS zooming into the field */
}

textarea {
  resize: vertical;
}

input[type='checkbox'] {
  width: 22px;
  min-height: 22px;
  margin: 0;
}

button,
.file-button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button[type='submit'] {
  background: var(--accent);
  color: #1a1404;
  border-color: var(--accent);
  font-weight: 600;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Toolbars */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: end;
}

.toolbar.actions {
  align-items: center;
}

.toolbar label {
  min-width: 140px;
}

.toolbar .grow {
  flex: 1 1 220px;
}

#status {
  min-height: 1.4em;
  color: var(--accent);
  margin: 0;
}

#conflicts {
  color: var(--danger);
  margin: 0;
}

/* Capture */
#app {
  padding-top: 16px;
  padding-bottom: 24px;
}

.capture {
  display: grid;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}

.capture-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.capture-row .grow {
  flex: 1 1 220px;
}

.capture button[type='submit'] {
  justify-self: start;
}

/* Next up: one row per video, nearest date first. */
#next-up,
#videos {
  margin-bottom: 20px;
}

#next-up h2,
.videos-head h2 {
  margin-bottom: 8px;
}

#next-up-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.next {
  width: 100%;
  display: grid;
  gap: 2px;
  text-align: left;
  justify-content: stretch;
  background: var(--panel);
  padding: 10px 12px;
}

.next .meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.next .overdue {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.9rem;
}

.videos-head {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

/* Board: stage columns side by side; on a phone, a list of the stages that
   have videos (see the media query at the end). */
#board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x proximity;
}

.none-yet {
  display: none;
  color: var(--muted);
  margin: 0;
}

.column {
  flex: 0 0 240px;
  scroll-snap-align: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 120px;
}

.column h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--accent);
}

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 6px 2px;
}

.card {
  width: 100%;
  justify-content: stretch;
  display: grid;
  gap: 4px;
  text-align: left;
  background: var(--bg);
  padding: 10px;
}

.card.archived {
  opacity: 0.6;
}

.card strong {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.card .meta,
.card .progress {
  color: var(--muted);
  font-size: 0.85rem;
}

.card .overdue {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.85rem;
}

.card .badge {
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.8rem;
}

/* Detail dialog */
dialog#detail {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: hidden;
  flex-direction: column;
}

/* Only an open dialog is laid out; a closed one must stay hidden. */
dialog#detail[open] {
  display: flex;
}

dialog#detail::backdrop {
  background: rgb(4 9 18 / 0.7);
}

.detail-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.detail-head h2 {
  font-size: 1.3rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.tabs {
  flex: none;
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  white-space: nowrap;
}

.tabs button[aria-selected='true'] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.panel {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 16px 20px;
  overflow-y: auto;
  display: grid;
  gap: 12px;
  align-content: start;
}

.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.row,
.inline,
.shot-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.inline input {
  flex: 1 1 200px;
}

.shot-form .grow {
  flex: 1 1 200px;
}

.steps ul,
.shots,
.attachments,
.tool-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.steps .step {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.steps .step label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 1rem;
}

.shot {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.shot .kind {
  color: var(--accent);
  font-size: 0.85rem;
}

.shot .text {
  overflow-wrap: anywhere;
}

.shot button {
  justify-self: end;
}

.filming {
  background: var(--panel-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.film-now {
  font-size: 1.2rem;
  margin: 0;
  overflow-wrap: anywhere;
}

.tool-links {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px 12px;
}

.tool-links a,
.attachment a {
  color: var(--accent);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  overflow-wrap: anywhere;
}

.attachment {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.danger-row {
  margin: 8px 0 0;
}

.stage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.stage-row .grow {
  flex: 1 1 180px;
}

#d-advance,
button.primary {
  background: var(--accent);
  color: #1a1404;
  border-color: var(--accent);
  font-weight: 600;
}

#backup,
#app > #studio-sync {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 16px;
  background: var(--panel);
}

#backup summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--accent);
}

#backup .toolbar {
  padding-bottom: 12px;
}

/* Shot rows: kind and text on top, then status and Remove, then notes. */
.shot {
  grid-template-columns: 1fr auto;
}

.shot .kind,
.shot .text,
.shot input {
  grid-column: 1 / -1;
}

.shot select {
  width: auto;
  justify-self: start;
}

@media (min-width: 720px) {
  .top,
  #app,
  #waiting,
  #studio-sync {
    padding-left: 24px;
    padding-right: 24px;
  }

  /* All six stages fit side by side on a laptop; narrower screens scroll the board. */
  .column {
    flex: 1 0 180px;
  }

  .shot {
    grid-template-columns: 110px 1fr 150px auto;
  }

  .shot .kind {
    grid-column: 1;
  }

  .shot .text {
    grid-column: 2;
  }

  .shot input {
    grid-column: 2 / -1;
  }
}

/* Phones: stages become a list of the ones that have videos. */
@media (max-width: 719px) {
  .intro {
    display: none;
  }

  #board {
    display: grid;
    overflow: visible;
    padding-bottom: 0;
  }

  .column {
    min-height: 0;
  }

  .column.empty-stage {
    display: none;
  }

  .none-yet:not(.has-videos) {
    display: block;
  }

  /* Search and platform share a row. */
  .videos-head .toolbar {
    gap: 8px;
  }

  .videos-head .toolbar .grow {
    flex: 1 1 150px;
  }

  .videos-head .toolbar label {
    min-width: 0;
  }
}

/* Phones: the detail sheet fills the screen. */
@media (max-width: 600px) {
  dialog#detail {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .grid {
    grid-template-columns: 1fr;
  }

}
