/*
 * "Ajouter mon livre" page: numbered form cards on the left, a sticky
 * preview with a checklist and the send button on the right.
 */

.submit-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--gap); align-items: start; }
.submit-main { min-width: 0; }

/* "Avant de commencer" */
.rules { border: 2px solid var(--violet); }
.rules-title { font-size: 20px; margin-bottom: 10px; }
.rules-list { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.rules-list li::marker { font-weight: 600; }

/* Accordion: one <details> per section */
.acc { padding: 0; }
.acc-head {
  display: flex; align-items: center; gap: 12px;
  min-height: 72px; padding: 16px 24px;
  list-style: none; cursor: pointer; border-radius: var(--radius-lg);
}
.acc-head::-webkit-details-marker { display: none; }
.acc-head:hover .acc-title { color: var(--violet-ink); }
.acc-title { flex: 1; font-family: var(--font-display); font-size: 21px; font-weight: 700; }
.acc-status { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 12px; background: var(--ground); color: var(--text-muted); white-space: nowrap; }
.acc-status.done { background: var(--lime-soft); color: var(--lime-ink); }
.acc-chevron { width: 20px; height: 20px; flex: none; color: var(--text-muted); transition: transform .2s; }
.acc[open] .acc-chevron { transform: rotate(180deg); }
.acc-body { padding: 0 24px 24px; }
.acc-next { display: flex; justify-content: flex-end; margin-top: 20px; }
.step {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--violet-soft); color: var(--violet-ink);
  font-size: 14px; font-weight: 600;
}

/* Emphasis taken from the Tally form */
.label-em { margin-left: 6px; color: var(--red); font-weight: 600; }
.label-opt { margin-left: 6px; font-weight: 400; color: var(--text-muted); }

/* Shop link: "https://" is printed before the field and cannot be typed over. */
.url-field {
  display: flex; align-items: stretch; min-height: var(--control-h);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden;
}
.url-field:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.url-field.invalid { border-color: var(--red); background: var(--red-soft); }
.url-prefix {
  display: flex; align-items: center; padding: 0 4px 0 14px;
  font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); user-select: none;
}
.url-field input { min-height: 0; padding-left: 0; border: 0; border-radius: 0; background: transparent; font-family: var(--font-mono); font-size: 13px; }
.url-field input:focus { box-shadow: none; }
.callout { display: flex; gap: 12px; margin: 16px 0; padding: 14px 16px; border-radius: var(--radius); font-size: 14px; }
.callout p + p { margin-top: 6px; }
.callout-icon { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.callout.warn { background: var(--amber-soft); color: #4D2E00; }
.callout.warn .callout-icon { color: var(--amber-ink); }
.callout.info { background: var(--violet-soft); color: var(--violet-ink); }
.certify {
  display: flex; align-items: flex-start; gap: 12px; margin: 20px 0 0;
  padding: 16px; border: 2px solid var(--violet); border-radius: var(--radius);
  color: var(--text); font-size: 14px; font-weight: 400; cursor: pointer;
}
.certify input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.certify strong { display: block; margin-bottom: 4px; }
.certify.invalid { border-color: var(--red); background: var(--red-soft); }
.certify.tw-none { border-width: 1px; border-color: #E8B65C; background: var(--amber-soft); color: #4D2E00; }
.certify.tw-none.invalid { border-width: 2px; border-color: var(--red); background: var(--red-soft); color: var(--text); }
.certify.tw-none.disabled { opacity: .5; cursor: not-allowed; }

.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.label-row label { margin-bottom: 6px; }
.field-hint { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.field-hint strong { color: var(--text); }
.isbn-hint { display: flex; justify-content: space-between; gap: 12px; }
.isbn-count { flex: none; font-variant-numeric: tabular-nums; }
.isbn-rule { display: inline-block; margin-top: 10px; padding: 4px 10px; border-radius: 6px; background: var(--red); color: #FFFFFF; font-size: 13px; font-weight: 600; }
#s-isbn.valid { border-color: var(--lime-ink); padding-right: 40px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232F6B00' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") right 14px center / 18px no-repeat; }
#s-isbn.suspicious { border-color: #E8B65C; }
.isbn-warn { margin-top: 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--amber-soft); color: #4D2E00; font-size: 13px; }
#s-isbn.valid.invalid { border-color: var(--red); background-color: var(--red-soft); }
.field-error { margin-top: 6px; font-size: 13px; font-weight: 500; color: var(--red); }

.api-note { margin-top: 16px; padding: 12px 16px; border-radius: var(--radius); background: var(--violet-soft); color: var(--violet-ink); font-size: 13px; }

/* Spice scale and narration */
.spice-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.spice-choice { flex-direction: column; gap: 4px; padding: 14px; }
.spice-type { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--violet-ink); }
.spice-choice input { margin: 0; }
.spice-head { display: flex; align-items: center; gap: 8px; }
.spice-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1; }
.spice-choice .chili { width: 14px; height: 14px; }
.narration-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.narration-choice { padding: 12px; }
.spice-options.invalid .choice, .narration-options.invalid .choice { border-color: var(--red); }

/* Tag families */
.tag-groups { display: flex; flex-direction: column; gap: 18px; }
.tag-group-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tag-search { margin-top: 8px; min-height: 40px; border-radius: var(--radius-sm); }
.tag-group-hint p + p { margin-top: 2px; }
#s-tags.invalid { border-radius: var(--radius); outline: 2px solid var(--red); outline-offset: 6px; }

/* Promotion opt-in: the lime card, clickable as a whole */
.promo-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px;
  margin: 0; padding: 24px; border-radius: var(--radius-lg);
  background: var(--lime); color: var(--ink); font-weight: 400; cursor: pointer;
}
.promo-bg { position: absolute; right: -24px; top: -20px; width: 140px; height: 140px; opacity: .12; }
.promo-kicker { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.promo-title { font-family: var(--font-display); font-size: 23px; font-weight: 700; line-height: 1.2; max-width: 420px; }
.promo-text { font-size: 14px; color: #2A2A2A; max-width: 460px; }
.promo-switch { display: inline-flex; align-items: center; gap: 12px; margin-top: 6px; min-height: var(--control-h); font-weight: 600; }
.promo-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 48px; height: 28px; flex: none; border-radius: 14px; background: rgba(20, 20, 20, .18); transition: background .15s; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #FFFFFF; transition: transform .15s; }
.promo-switch input:checked + .switch-track { background: var(--violet); }
.promo-switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); background: var(--lime); }
.promo-switch input:focus-visible + .switch-track { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Trigger warnings: amber triangle */
.tw-icon { width: 18px; height: 18px; flex: none; color: var(--amber-ink); }
.acc-title-tw { display: inline-flex; align-items: center; gap: 10px; }
.acc-title-tw .tw-icon { width: 22px; height: 22px; }
#s-tw .tag-pill[aria-pressed="true"] { background: var(--amber-ink); color: #FFFFFF; }

/* Preview */
.submit-aside { position: sticky; top: var(--gap); max-height: calc(100vh - 2 * var(--gap)); overflow-y: auto; border-radius: var(--radius-lg); }
.preview-tags { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; max-height: 210px; overflow-y: auto; padding-right: 4px; }
.preview-tags:empty { display: none; }
.preview-card { display: flex; flex-direction: column; gap: 14px; }
.preview-kicker { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.preview-book { display: flex; gap: 14px; }
.preview-book .cover { width: 72px; height: 106px; font-size: 26px; }
#pv-spice:empty { display: none; }
.pv-block { display: flex; flex-direction: column; gap: 8px; }
.pv-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--amber-ink); }
.pv-label .tw-icon { width: 16px; height: 16px; }
.pv-tw-none { font-size: 13px; color: var(--text-muted); }
.tag-pill.tw-pill, .tag-pill.tw-pill:hover { background: var(--amber-soft); color: #4D2E00; }
.pv-promo { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--lime); color: var(--ink); font-size: 13px; font-weight: 600; }
.pv-promo-icon { width: 18px; height: 18px; flex: none; }
.pv-shop { font-size: 12px; color: var(--violet-ink); overflow-wrap: anywhere; }
.preview-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.preview-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.checklist { list-style: none; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-muted); }
.checklist li { display: flex; align-items: center; gap: 10px; }
.checklist li::before { content: ''; width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.checklist li.done { color: var(--text); }
.checklist li.done::before { border-color: var(--violet); background: var(--violet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D7FC6E' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 12px no-repeat; }
.preview-card .btn.block { margin-top: 0; }
.readonly-note { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--violet-soft); color: var(--violet-ink); font-size: 13px; font-weight: 700; }
.btn.ghost { border-color: transparent; color: var(--text-muted); }

@media (max-width: 1100px) {
  .submit-layout { grid-template-columns: minmax(0, 1fr); }
  .submit-aside { position: static; max-height: none; }
}
@media (max-width: 700px) {
  .form-row, .form-row.three { grid-template-columns: minmax(0, 1fr); }
  .spice-options, .narration-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .acc-head { padding: 14px 16px; gap: 10px; }
  .acc-title { font-size: 19px; }
  .acc-body { padding: 0 16px 20px; }
}

@media (max-width: 1100px) and (min-width: 701px) {
  .spice-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Thank-you dialog */
.thanks p + p { margin-top: 10px; }
.thanks-insta a { color: var(--violet-ink); font-weight: 600; }
