:root {
  --main-width: 50rem;
  --distance-side: 10vw;
}

div.page-container {
  display: grid;
  grid-template-rows: auto auto;
  grid-template-columns: repeat(7, 1fr);
  column-gap: 2rem;
  row-gap: 4rem;
  justify-content: space-between;
  justify-items: start;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
  max-width: var(--main-width);
}

div.page-container.wide {
  width: 100%;
  max-width: none;
}

div.content {
  grid-column: 1 / -1;
  width: 100%;
}

div#header-heading {
  grid-row: 2;
  grid-column: 1/5;
}

div#form {
  grid-row: 2;
  grid-column: 5/9;
  box-shadow: rgba(0, 0, 0, 0.1) 2px 4px 5px 3px;
  border-radius: 15px;
  background-color: var(--white);
  padding: var(--space-s);
  height: fit-content;
}

#blockForm {
  margin-block: var(--space-m);
}

form#form-2 {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr;
  align-items: start;
  margin-inline: -1rem;
  padding-inline: 1rem;
  overflow: hidden;
}

section.form-step {
  display: grid;
  grid-auto-rows: auto;
  grid-row: 2;
  grid-column: 1;
  gap: var(--space-2xs);
  transform: translateY(0%);
  opacity: 100;

  transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out;
  overflow: hidden;
}

section.form-step h4 {
  margin: 0;
}

section.form-step.hidden {
  transform: translateY(100%);
  opacity: 0;
  z-index: -1;
}

section.form-step.done {
  transform: translateY(-100%);
  opacity: 0;
  z-index: -1;
}

#form-step-2 {
  grid-template-rows: repeat(7, auto);
}

.form-step > div:has(> .grecaptcha-badge) {
  grid-row: 6;
}

.form-step > div > .grecaptcha-badge {
  position: static !important;
}

div.input-group {
  display: grid;
  gap: 0;
}

div#petition-text {
  grid-row: 3;
  grid-column: 1/7;
}

div#legal {
  grid-row: 5;
  grid-column: 1/7;
  justify-self: center;
  /* background-color: var(--r-blue-dark); */
  padding: 1rem;
  width: 100%;
  /* color: var(--white); */
}

div#supporter-orgs-wrapper {
  grid-row: 4;
  grid-column: 4/9;
}

div.supporter-orgs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex-wrap: wrap;
  gap: 1rem;
}

div.supporter-orgs > a {
  display: block;
  margin: 0;
}

div.supporter-orgs > a > picture > img {
  padding: 0;
  width: auto;
  height: 5rem;
}

div.supporter-orgs > a > p {
  margin: 0;
  text-align: start;
}

div#supporter-voices-wrapper {
  grid-row: 4;
  grid-column: 1/4;
}

/* div#supporter-voice-scroller>div.quote-card[data-comment='']::before {
  content: "";

} */

div#supporter-voice-scroller > div.quote-card::before {
  display: inline;
  /* position: absolute; */
  top: -0rem;
  left: -0rem;
  z-index: -1;
  content: '”';
  content: '\f4ff';
  /* color: var(--c-aqua); */
  font-weight: 700;
  font-size: 2rem;
  font-family: 'Font Awesome 6 Pro';
}

div#supporter-voices {
  z-index: 1;
  overflow: visible;
}

div#supporter-voice-scroller {
  display: flex;
  flex-flow: column wrap;
}

div#supporter-voice-scroller > div.quote-card {
  display: flex;
  position: relative;
  grid-row: 1;
  align-items: center;
  gap: 1ch;
  box-sizing: border-box;
  padding: 1rem;
}

div#supporter-voice-scroller > div.quote-card > h3 {
  margin-block: 0;
  text-decoration: underline;
  text-decoration-color: var(--c-aqua);
  text-decoration-thickness: 5px;
}

div#social-buttons {
  display: flex;
  flex-flow: row wrap;
  justify-self: center;
  gap: 1rem;
}

div#social-buttons-wrapper {
  grid-row: 3;
  grid-column: 1/7;
}

div.message {
  grid-row: 1;
  grid-column: 1/-1;
  border-radius: 15px;
  background-color: var(--c-aqua);
  padding: 1rem;
  color: var(--r-blue-dark);
}

@media screen and (max-width: 900px) {
  div.page-container {
    grid-template-rows: auto auto auto auto auto;
    grid-template-columns: 100%;
    row-gap: 1rem;
    padding: 1rem;
    max-width: 100vw;
  }

  div.message {
    grid-row: 1;
  }

  div#header-heading {
    grid-row: 2;
    grid-column: 1;
  }

  div#header-petition {
    grid-row: 3;
    grid-column: 1;
  }

  div#body-text {
    grid-row: 4;
    grid-column: 1;
  }

  div#form {
    grid-row: 5;
    grid-column: 1;
    border-radius: 15px;
    background-color: var(--white);
    height: fit-content;
  }

  div#supporter-voices-wrapper {
    grid-row: 7;
    grid-column: 1;
  }

  div#supporter-orgs-wrapper {
    grid-row: 6;
    grid-column: 1;
  }

  div.supporter-orgs {
    grid-auto-columns: 1fr;
  }

  div#legal {
    grid-row: 8;
    grid-column: 1/1;
    padding: 1rem;
    overflow: hidden;
  }

  div.name-field-container {
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr;
    grid-auto-flow: row;
  }

  /* div#supporter-voice-scroller>div.quote-card::before {
    top: -2rem;
    left: -1rem;
  } */
}

.print-preview {
  position: relative;
  grid-column: 1 / -1;
  width: 100%;
  max-height: 80vh;
  overflow: auto;
}

.print-preview .letters {
  width: 100%;
}

.letter-preview {
  margin: 1rem 0;
  box-shadow: rgba(0, 0, 0, 0.1) 2px 4px 5px 3px;
  border-radius: 15px;
  background: white;
  padding: 1rem;
}

.blocks {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.block-card {
  position: relative;
  cursor: default;
  box-shadow: rgba(0, 0, 0, 0.1) 2px 4px 5px 3px;
  border-radius: 15px;
  background: white;
  padding: 1rem;
  padding-right: 3rem;
}
.block-card.selected {
  cursor: move;
}

.move-btns {
  display: none;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  flex-direction: column;
  z-index: 1;
}
.block-card.selected .move-btns {
  display: flex;
}

.move-btns button {
  cursor: pointer;
  border: none;
  background: none;
  font-size: 1rem;
  line-height: 1;
}

fieldset {
  margin-bottom: 1rem;
  box-shadow: rgba(0, 0, 0, 0.1) 2px 4px 5px 3px;
  border: none;
  border-radius: 15px;
  padding: 1rem;
}

legend {
  display: block;
  margin-bottom: 0.5rem;
  padding: 0;
  font-weight: 700;
}

.block-card.dragging {
  opacity: 0.5;
}

.letter-preview p {
  margin: 0 0 1rem 0;
  font-family: var(--copy-font);
}

.hint {
  font-size: 0.9rem;
}

.print-btn {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 1rem;
}

.floating {
  position: fixed;
  right: calc((100vw - min(100vw, var(--main-width))) / 2 + 1rem);
  bottom: 1rem;
  z-index: 1000;
}

.floating.confirm {
  bottom: 1rem;
}
#toggleSelected.floating {
  bottom: 5rem;
}

.selected-area {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 100%);
  z-index: 999;
  transition: transform 0.3s ease;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.3);
  background: white;
  padding: 1rem;
  width: min(100vw, var(--main-width));
  height: 100dvh;
  overflow-y: auto;
}
.selected-area .selected-header {
  display: flex;
  position: sticky;
  top: 0;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
  margin-bottom: 1rem;
  background: inherit;
  padding-bottom: 0.5rem;
}
.selected-area .close-btn {
  position: static;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
}
.selected-area.show {
  transform: translate(-50%, 0);
}

.form-overlay {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 100%);
  z-index: 998;
  transition: transform 0.3s ease;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.3);
  background: white;
  padding: 1rem;
  width: min(100vw, var(--main-width));
  height: 100dvh;
  overflow-y: auto;
}
.form-overlay.show {
  transform: translate(-50%, 0);
}
.form-overlay .form-header {
  display: flex;
  position: sticky;
  top: 0;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
  margin-bottom: 1rem;
  background: inherit;
  padding-bottom: 0.5rem;
}
.form-overlay .close-btn {
  position: static;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
}

.hidden {
  display: none;
}

@media print {
  @page {
    size: A4;
    /* margin: 0; */
  }

  html,
  body {
    box-sizing: border-box;

    height: max-content;
    overflow: auto;
    font-size: 11pt;
  }
  .print-btn {
    display: none;
  }
  .letter-preview {
    margin: 0;
    box-shadow: none;
    font-size: 11pt;
  }

  .letter-preview > :nth-last-child(2),
  .letter-preview > :last-child {
    page-break-after: avoid;
    page-break-before: avoid;
    break-before: avoid;
    break-after: avoid;
    break-inside: avoid;
  }
  div.page-container {
    max-width: none;
  }
  .print-preview {
    max-height: none;
  }
  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    break-inside: avoid;
    max-width: none;
    font-size: 11pt;
  }
  #legal {
    display: none;
  }
}
