/*
 * The contact page (/contato, tools/site/pages/contact_page.py and assets/contact.js).
 * Flat components: 1px lines, no shadows. Colours come from the tokens of site.css (--bad, --ok...).
 */

.ct-form[hidden],
.ct-success[hidden],
.ct-noscript[hidden] {
  display: none;
}

.ct-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.ct-main .mk-sub {
  margin-bottom: 28px;
}

/* ---------------------------------------------------------------- Form */

.ct-form {
  display: grid;
  gap: 20px;
}

.ct-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.ct-row-3 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
}

.ct-field {
  min-width: 0;
}

.ct-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
  font-weight: 500;
}

.ct-field input,
.ct-field select,
.ct-field textarea {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.ct-field textarea {
  height: auto;
  min-height: 168px;
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}

.ct-field select {
  padding-right: 40px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23111' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
  cursor: pointer;
}

.ct-field input:hover,
.ct-field select:hover,
.ct-field textarea:hover {
  border-color: #111;
}

.ct-field input:focus-visible,
.ct-field select:focus-visible,
.ct-field textarea:focus-visible {
  border-color: #111;
  outline-offset: 2px;
}

.ct-field [aria-invalid="true"] {
  border-color: var(--bad);
}

.ct-error {
  margin: 6px 0 0;
  color: var(--bad);
  font-size: 0.88rem;
  line-height: 1.4;
}

.ct-error:empty {
  display: none;
}

.ct-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.ct-hint,
.ct-count {
  margin: 0;
}

.ct-count {
  flex: 0 0 auto;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.8rem;
}

/* The honeypot: out of sight for people and screen readers, still in the page for bots */
.ct-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.ct-alert {
  padding: 12px 16px;
  border: 1px solid var(--bad);
  border-radius: 12px;
  background: var(--bad-bg);
  color: var(--bad);
  font-size: 0.95rem;
  line-height: 1.45;
}

.ct-alert:empty {
  display: none;
}

.ct-alert a {
  color: inherit;
  text-decoration: underline;
}

.ct-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
}

.ct-actions .mk-btn {
  flex: 0 0 auto;
}

.ct-privacy {
  flex: 1 1 16rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.ct-privacy a {
  text-decoration: underline;
}

/* Sending: the button is off and shows a spinner instead of the arrow */
.ct-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ct-spin 0.7s linear infinite;
}

.ct-form[aria-busy="true"] .ct-spinner {
  display: inline-block;
}

.ct-form[aria-busy="true"] .mk-btn svg {
  display: none;
}

.ct-form .mk-btn[disabled] {
  opacity: 0.8;
  cursor: progress;
}

.ct-form .mk-btn[disabled]:hover {
  background-size: 0% 100%;
}

@keyframes ct-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------- Success and no-JavaScript panels */

.ct-success {
  padding: 36px;
  border: 1px solid #111;
  border-radius: 18px;
  background: var(--card);
}

.ct-success:focus {
  outline: none;
}

.ct-success:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.ct-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--ok);
}

.ct-success-icon svg {
  width: 24px;
  height: 24px;
}

.ct-success h2 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.ct-success p {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.ct-success .ct-success-note {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.ct-success .mk-btn-quiet {
  padding: 0 18px;
  border: 1px solid var(--line-strong);
}

.ct-noscript {
  padding: 16px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--card);
}

.ct-noscript p {
  margin: 0;
}

.ct-noscript a {
  text-decoration: underline;
}

/* ---------------------------------------------------------------- Side column */

.ct-aside {
  display: grid;
  gap: 32px;
}

.ct-others .mk-label {
  margin-left: 0;
}

.ct-others .ly-topics {
  max-width: none;
}

.ct-others .ly-topic {
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px 0;
}

.ct-others .ly-topic b {
  font-size: 1.2rem;
}

/* ---------------------------------------------------------------- Responsive */

@media (max-width: 1000px) {
  .ct-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }
}

@media (max-width: 640px) {
  .ct-row,
  .ct-row-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .ct-success {
    padding: 24px;
  }

  .ct-actions .mk-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ct-spinner {
    animation-duration: 2s;
  }
}

/* The checklist of the contact page sits next to the form: a quiet card, not the yellow box of the guides. */
.ct-aside .ly-checklist {
  border-color: var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}
