@font-face {
  font-family: "Comic Sans MS Web";
  src: url("assets/fonts/comic-sans-ms-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Comic Sans MS Web";
  src: url("assets/fonts/comic-sans-ms-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --black: #000;
  --white: #fff;
  --line: 3px;
  font-family: "Comic Sans MS Web", "Comic Sans MS", "Comic Sans", sans-serif;
  color: var(--black);
  background: var(--white);
}

html,
body,
button,
input,
textarea,
select,
option,
dialog {
  font-family: "Comic Sans MS Web", "Comic Sans MS", "Comic Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--white);
  color: var(--black);
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
  background: var(--white);
}

button,
a,
input,
textarea {
  outline-offset: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px dashed var(--black);
}

.site-header,
main,
footer {
  width: min(1480px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 8px 14px;
  border-bottom: var(--line) solid var(--black);
}

.site-title {
  color: inherit;
  font-size: clamp(1.65rem, 4vw, 2.65rem);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.letter-link,
.text-button {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(500px, 1fr) minmax(560px, 1fr);
  border-bottom: var(--line) solid var(--black);
}

.checkout-status {
  margin: 18px auto 0;
  padding: 13px 16px;
  border: 3px solid var(--black);
  font-weight: 700;
  line-height: 1.45;
}

.animal-browser {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: minmax(290px, 1fr) minmax(230px, 0.75fr);
  grid-template-rows: auto auto;
  align-content: start;
  gap: 8px 34px;
  padding: 26px 8px 30px 34px;
  border-left: var(--line) solid var(--black);
}

.stamp {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  isolation: isolate;
}

.animal-photo {
  position: absolute;
  inset: 7.4%;
  width: 85.2%;
  height: 85.2%;
  object-fit: cover;
  border: 5px solid var(--black);
  z-index: -1;
}

.stamp-border {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.animal-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 10%;
}

.animal-caption h1,
.animal-caption p {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3.35rem);
  line-height: 1;
}

.animal-list {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  margin: 0;
  padding: 2px 0 0;
  border: 0;
  min-width: 0;
}

.animal-list legend {
  margin-bottom: 10px;
  font-size: 1.25rem;
  font-weight: 700;
}

.animal-option {
  display: grid;
  grid-template-columns: 20px 120px 24px;
  justify-content: start;
  width: fit-content;
  max-width: 100%;
  gap: 8px;
  align-items: center;
  min-height: 29px;
  cursor: pointer;
}

.animal-option:hover .animal-name,
.animal-option:has(input:checked) .animal-name {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.animal-option input,
.consent-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--black);
}

.animal-option .price {
  font-variant-numeric: tabular-nums;
  justify-self: end;
  text-align: right;
}

.message-form {
  display: flex;
  grid-column: 1;
  grid-row: 1;
  flex-direction: column;
  padding: 28px clamp(24px, 4vw, 66px) 34px;
}

.message-form h2 {
  margin: 0 0 24px;
  font-size: clamp(2rem, 3vw, 2.8rem);
  line-height: 1.1;
}

.message-form > label:not(.consent-row),
.message-preview h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

.message-form input[type="tel"],
.message-form input[type="text"],
.message-form textarea {
  width: 100%;
  border: 2px solid var(--black);
  border-radius: 0;
  padding: 11px 13px;
  font-size: 1.05rem;
}

.message-form textarea {
  min-height: 132px;
  resize: vertical;
}

.field-help,
.form-note,
.form-error {
  margin: 7px 0 20px;
  font-size: 0.86rem;
  line-height: 1.4;
}

.suggestion-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 2px 12px;
  border-bottom: var(--line) solid var(--black);
}

.text-button {
  border: 0;
  padding: 2px;
  cursor: pointer;
  text-decoration-line: underline;
}

.message-preview {
  padding-top: 10px;
}

.message-preview h3 {
  margin-bottom: 6px;
}

.message-preview p {
  margin: 0;
}

#message-preview {
  min-height: 24px;
  overflow-wrap: anywhere;
}

.attribution {
  margin-top: 4px !important;
}

.consent-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  margin: 22px 0 18px;
  font-size: 0.9rem;
  cursor: pointer;
}

.consent-row a,
footer a,
.legal-page a {
  color: inherit;
  text-underline-offset: 3px;
}

.primary-button,
.secondary-button {
  border: 3px solid var(--black);
  border-radius: 0;
  padding: 12px 24px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  background: var(--black);
  color: var(--white);
}

.primary-button:hover:not(:disabled) {
  background: var(--white);
  color: var(--black);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.secondary-button:hover {
  color: var(--white);
  background: var(--black);
}

.form-note {
  margin: 10px 0 0;
  text-align: center;
}

.test-sms-status {
  min-height: 1.4em;
  margin: 8px 0 0;
  font-size: 0.86rem;
  line-height: 1.4;
  text-align: center;
}

.form-error {
  min-height: 1.4em;
  margin: 10px 0 0;
  font-weight: 700;
  text-align: center;
}

.welcome-letter {
  max-width: 900px;
  padding: clamp(34px, 6vw, 78px) 8px;
}

.welcome-letter h2 {
  margin: 0 0 20px;
  font-size: clamp(1.75rem, 3vw, 2.6rem);
}

.welcome-letter p {
  margin: 0 0 20px;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.6;
}

.legal-page {
  max-width: 820px;
  padding: clamp(34px, 6vw, 72px) 8px;
}

.legal-page h1 {
  margin: 0 0 24px;
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.legal-page p {
  margin: 0 0 20px;
  font-size: 1.05rem;
  line-height: 1.65;
}

footer {
  padding: 18px 8px 26px;
  border-top: var(--line) solid var(--black);
  font-size: 1rem;
  text-align: center;
}

.payment-dialog {
  width: min(580px, calc(100% - 30px));
  padding: 0;
  color: var(--black);
  background: var(--white);
  border: 0;
}

.payment-dialog::backdrop {
  background: rgb(255 255 255 / 88%);
}

.dialog-shell {
  border: 3px solid var(--black);
  padding: 18px;
}

.dialog-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--black);
}

.dialog-heading-row h2 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.close-button {
  width: 42px;
  height: 42px;
  border: 0;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.order-summary {
  margin: 18px 0;
}

.order-summary div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 6px 0;
}

.order-summary dt {
  font-weight: 700;
}

.order-summary dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.payment-placeholder {
  padding: 15px;
  border: 2px dashed var(--black);
}

.payment-placeholder p {
  margin: 0 0 8px;
  line-height: 1.45;
}

.payment-placeholder p:last-child {
  margin-bottom: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

@media (max-width: 1080px) {
  .order-layout {
    grid-template-columns: 1fr;
  }

  .animal-browser {
    grid-column: auto;
    grid-row: auto;
    border-left: 0;
    border-bottom: var(--line) solid var(--black);
  }

  .message-form {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 680px) {
  .site-header,
  main,
  footer {
    width: min(100% - 24px, 1480px);
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .animal-browser {
    grid-template-columns: 1fr;
    padding: 22px 0 28px;
  }

  .animal-list {
    grid-column: 1;
    grid-row: auto;
    columns: 2;
    column-gap: 24px;
  }

  .animal-list legend {
    column-span: all;
  }

  .animal-option {
    break-inside: avoid;
  }

  .message-form {
    padding: 26px 0 34px;
  }

  .suggestion-row,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-actions button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .animal-list {
    columns: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

#message-preview { white-space: pre-wrap; overflow-wrap: anywhere; }
