/* The template editor ("Use this template"), for every invitation template. Laid out the way Actionables sets up a
   template: numbered steps across the top, a "You need" row, the live preview held on the left and one card per
   line of words on the right, each with its own size. Colours and type are the site's own. */

.tsetup-head { justify-content: flex-start; }
.tsetup-back { font-size: 0.92rem; font-weight: 600; color: var(--slate); text-decoration: none; }
.tsetup-back:hover { color: var(--plum); text-decoration: underline; }
.tsetup-saved { margin: 0 0 0 auto; color: var(--slate); font-size: 0.85rem; }

.tsetup { padding-block: 2rem 1.5rem; }
.tsetup-heading { max-width: 44rem; }
.tsetup-eyebrow { margin: 0 0 0.35rem; color: var(--rose); font-size: 0.82rem; font-weight: 700; }
.tsetup-heading h1 { font-size: clamp(2.2rem, 4.4vw, 3.3rem); line-height: 1.05; }
.tsetup-heading p:last-child { margin: 0.6rem 0 0; color: var(--slate); font-size: 1.02rem; }

/* Steps: a tab bar, the step you're on underlined. */
.tsetup-steps { margin-top: 1.6rem; border-bottom: 1px solid var(--rule); }
.tsetup-steps ol { display: flex; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.tsetup-steps button {
  position: relative; display: inline-flex; align-items: center; gap: 0.6rem; min-height: 48px; padding: 0 1rem 0 0.2rem;
  font: inherit; font-size: 0.95rem; font-weight: 600; color: var(--slate); background: none; border: 0; cursor: pointer;
}
.tsetup-steps button:hover { color: var(--plum); }
.tsetup-num {
  display: grid; place-items: center; width: 1.6rem; height: 1.6rem; font-size: 0.78rem;
  color: var(--slate); background: #fff; border: 1px solid var(--rule); border-radius: 50%;
}
.tsetup-steps button[aria-current="step"] { color: var(--ink); }
.tsetup-steps button[aria-current="step"]::after {
  content: ""; position: absolute; inset: auto 0.6rem -1px 0; height: 3px; background: var(--plum); border-radius: 3px 3px 0 0;
}
.tsetup-steps button[aria-current="step"] .tsetup-num { color: #fff; background: var(--plum-fill); border-color: transparent; }

/* You need: what the invitation has, and a quick way to the lines it still needs. */
.tsetup-needs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1rem; margin: 1rem 0 0; font-size: 0.82rem; }
.tsetup-needs-label { color: var(--slate); }
.need {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 32px; padding: 0;
  font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0;
}
button.need { cursor: pointer; }
button.need:hover { color: var(--plum); text-decoration: underline; text-underline-offset: 0.2em; }
.need svg { flex: none; width: 0.95rem; height: 0.95rem; padding: 0.12rem; border-radius: 50%; }
.need--done svg { color: #fff; background: #3f7d56; }
.need--missing { color: var(--wax); }
.need--missing svg { color: #fff; background: var(--wax); }
.need--plain { font-weight: 500; color: var(--slate); }

.tsetup-layout { display: grid; grid-template-columns: minmax(270px, 380px) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; margin-top: 1.4rem; }

/* The live preview: the invitation itself is the one bold thing on the page. */
.tsetup-preview { position: sticky; top: 1rem; padding: 1rem 1rem 1.1rem; background: var(--blush); border: 1px solid var(--rule); border-radius: 18px; }
.tsetup-meta { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; color: var(--slate); font-size: 0.76rem; font-weight: 700; }
.tsetup-format { font-weight: 600; }
#preview { margin-inline: auto; }
#preview[data-kind="card"] { width: min(100%, calc((100dvh - 9rem) * 5 / 7)); }
#preview[data-kind="film"] { width: min(100%, calc((100dvh - 12rem) * 9 / 16)); }
.tsetup-preview .inv--film { aspect-ratio: 9 / 16; border-radius: 12px; }
.tsetup-preview .inv-film { margin-top: 0; }
.tsetup-preview .inv-film-toggle { display: none; } /* the controls under the video take its place */

/* The line being edited, pointed out on the invitation. */
#preview[data-focus="intro"] [data-word="intro"],
#preview[data-focus="names"] [data-word="names"],
#preview[data-focus="title"] [data-word="title"],
#preview[data-focus="date"] [data-word="date"],
#preview[data-focus="venue"] [data-word="venue"],
#preview[data-focus="extra"] [data-word="extra"],
#preview[data-focus="verseText"] [data-word="verseText"],
#preview[data-focus="host"] [data-word="host"] {
  outline: 1.5px dashed rgb(158 45 105 / 0.75); outline-offset: 0.3em; border-radius: 0.15em;
}

.tsetup-player { display: flex; align-items: center; gap: 0.7rem; margin-top: 0.9rem; }
.tsetup-player[hidden] { display: none; }
.tsetup-play {
  display: grid; flex: none; place-items: center; width: 44px; height: 44px; padding: 0;
  color: #fff; background: var(--plum-fill); border: 0; border-radius: 50%; cursor: pointer;
}
.tsetup-play svg { width: 15px; height: 15px; }
.tsetup-play:focus-visible { outline: 3px solid rgb(158 45 105 / 0.45); outline-offset: 2px; }
.tsetup-scrub { flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; accent-color: var(--plum); background: none; }
.tsetup-clock { flex: none; color: var(--slate); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

/* The form: a card for each line of words. */
.tsetup-form { min-width: 0; max-width: 44rem; }
.tsetup-form h2 { font-size: 1.85rem; }
.tsetup-form h2:focus { outline: none; }
.tsetup-help { margin: 0.4rem 0 1rem; color: var(--slate); }
.wcards { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1rem; }
.wcard { grid-column: 1 / -1; display: grid; gap: 0.45rem; align-content: start; padding: 1rem 0 1.1rem; border-top: 1px solid var(--rule); }
.wcard--half { grid-column: auto; }
.wcard-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.wcard-head label { font-weight: 700; font-size: 0.9rem; }
.wcard-reset { padding: 0.2rem 0; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--rose); background: none; border: 0; cursor: pointer; }
.wcard-reset:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.wcard-reset[hidden] { display: none; }
.wcard textarea { resize: vertical; }
.wcard-own { display: grid; gap: 0.8rem; margin-top: 0.4rem; padding: 0.9rem; background: var(--blush); border-radius: 12px; }
.wcard-own[hidden] { display: none; }
.wcard-size { display: grid; grid-template-columns: auto minmax(0, 1fr) 3.2rem; align-items: center; gap: 0.75rem; color: var(--slate); font-size: 0.8rem; }
.wcard-size label { font-weight: 600; }
.wcard-size input { margin: 0; padding: 0; border: 0; background: none; accent-color: var(--plum); }
.wcard-size output { text-align: right; font-variant-numeric: tabular-nums; }

/* Preview and send. */
.tsetup-export { display: grid; gap: 0.6rem; justify-items: start; margin-bottom: 1.25rem; padding: 1.2rem; background: var(--blush); border: 1px solid var(--rule); border-radius: 16px; }
.tsetup-export[hidden] { display: none; }
.tsetup-sub { margin: 1.6rem 0 0; font-family: var(--font-display); font-size: 1.35rem; color: var(--plum); }
.tsetup-sub + .tsetup-help { margin-bottom: 1rem; }
.tsetup-link { display: flex; gap: 0.6rem; }
.tsetup-link input { font-size: 0.95rem; color: var(--slate); }
.tsetup-link .btn { flex: none; white-space: nowrap; }
.tsetup-copied { min-height: 1.6em; margin: 0.5rem 0 0.9rem; color: var(--plum); font-weight: 700; }
.tsetup-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; }

.tsetup-bottom { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.4rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.tsetup-backstep { min-height: 44px; padding: 0 0.4rem; font: inherit; font-weight: 600; color: var(--slate); background: none; border: 0; cursor: pointer; }
.tsetup-backstep:hover:enabled { color: var(--plum); }
.tsetup-backstep:disabled { visibility: hidden; }

.tsetup-foot { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.1rem; color: var(--slate); font-size: 0.8rem; border-top: 1px solid var(--rule); }
.tsetup-foot a { color: inherit; }

@media (max-width: 860px) {
  .tsetup { padding-top: 1rem; }
  .tsetup-heading h1 { font-size: 2rem; }
  .tsetup-heading p:last-child { display: none; }
  .tsetup-steps { position: sticky; top: 0; z-index: 5; margin-inline: -1rem; padding-inline: 0.5rem; background: #fff; }
  .tsetup-steps ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tsetup-steps button { justify-content: center; width: 100%; padding: 0 0.2rem; gap: 0.4rem; font-size: 0.8rem; line-height: 1.2; text-align: left; }
  .tsetup-steps button[aria-current="step"]::after { inset-inline: 0.3rem; }
  .tsetup-layout { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .tsetup-preview { position: static; padding: 0.8rem; }
  #preview[data-kind="card"] { width: min(62vw, 260px); }
  #preview[data-kind="film"] { width: min(52vw, 220px); }
}

@media (max-width: 520px) {
  .tsetup-saved { display: none; }
  .wcards { grid-template-columns: minmax(0, 1fr); }
  .wcard--half { grid-column: 1 / -1; }
  .tsetup-link { flex-direction: column; }
  .tsetup-bottom { position: sticky; bottom: 0; z-index: 4; margin-inline: -1rem; padding: 0.75rem 1rem; background: #fff; }
  .tsetup-bottom .btn { flex: 1; }
  .tsetup-backstep:disabled { display: none; }
  .tsetup-foot { flex-direction: column; }
}

/* Print only the invitation, as a 5 × 7 card. */
@media print {
  @page { size: 5in 7in; margin: 0; }
  body { background: none; }
  body > *:not(main), .skip, .tsetup-heading, .tsetup-steps, .tsetup-needs, .tsetup-form, .tsetup-meta, .tsetup-player, .tsetup-foot { display: none !important; }
  .tsetup, .tsetup-layout, .tsetup-preview { display: block; position: static; margin: 0; padding: 0; background: none; border: 0; }
  #preview, #preview[data-kind] { width: 5in; }
  #preview [data-word] { outline: none !important; }
  .inv { box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  /* An animated invitation prints as a still, cropped to the printed card's shape. */
  .tsetup-preview .inv--film { aspect-ratio: 5 / 7; border-radius: 0; }
  .tsetup-preview .inv-film { margin-top: -5%; }
}
