/* Tuotu Astro-projektista: src/styles/agent-form.css (bin/sync-astro.py). */
/*
 * The site's own forms (src/components/AgentForm.astro): the fields one under another, a label above each, a hint and the
 * reason for an error under it, the send button as the hero's green button. Colours are the site's tokens, so both
 * themes work; the field is never white. The paragraphs carry !important and a doubled class on their size, because
 * global.css (body.page-service main :is(p:not(...)):not(...)) sets every paragraph of a service page to 19px !important.
 */

.agent-form:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  display: grid;
  gap: 1.25rem;
  width: 100%;
  max-width: 44rem;
  margin: 0;
}

/* The fields one under another: an email, then the message at the full width. */
.agent-form-fields:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  display: grid;
  gap: 1.25rem;
}

.agent-form-field:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  display: grid;
  align-content: start;
  gap: 0.4rem;
  min-width: 0;
}

.agent-form-field label:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  color: var(--gh-text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

/* "(pakollinen)": in words, so a filler that reads the label knows. */
.agent-form-field .agent-form-req:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  color: var(--gh-muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.agent-form :is(input[type='text'], input[type='email'], select, textarea):where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--gh-border) 85%, var(--gh-text));
  border-radius: 6px;
  background: color-mix(in srgb, var(--gh-text) 4%, var(--gh-bg));
  color: var(--gh-text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
}

.agent-form textarea:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  min-height: 8rem;
  resize: vertical;
}

.agent-form select:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  appearance: auto;
  cursor: pointer;
}

.agent-form :is(input, select, textarea):focus-visible:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  border-color: var(--gh-link);
  outline: 2px solid var(--gh-link);
  outline-offset: 1px;
}

.agent-form :is(input, select, textarea)[aria-invalid='true']:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  border-color: #f85149;
}

body.page-service main .agent-form.agent-form p.agent-form-hint:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  margin: 0;
  color: var(--gh-muted);
  font-size: 0.85rem !important;
  line-height: 1.4 !important;
}

body.page-service main .agent-form.agent-form p.agent-form-note:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  margin: 0;
  color: var(--gh-muted);
  font-size: 0.85rem !important;
  line-height: 1.4 !important;
}

/* The reason a field failed, in red, next to the field. */
body.page-service main .agent-form.agent-form p.agent-form-error:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  margin: 0;
  color: #ffa198;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
}

body.page-service main .agent-form.agent-form p.agent-form-summary:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  margin: 0;
  padding-left: 0.9rem;
  border-left: 3px solid #f85149;
  color: #ffa198;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  line-height: 1.45 !important;
}

/* The message has gone: said in place, in green. */
body.page-service main .agent-form.agent-form p.agent-form-status:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  margin: 0;
  padding-left: 0.9rem;
  border-left: 3px solid var(--gh-green);
  color: var(--gh-text);
  font-size: 1.05rem !important;
  line-height: 1.5 !important;
}

.agent-form p[hidden]:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)),
.agent-form [hidden]:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  display: none !important;
}

/* The send button as the hero's green button (the other forms': wp.css .wp-form .btn). */
.agent-form .btn:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  justify-self: start;
  padding: 0.75rem 1.25rem;
  border-color: transparent;
  border-radius: 6px;
  background: var(--gh-green);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.agent-form .btn:hover:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  border-color: transparent;
  background: var(--gh-green-hover, var(--gh-green));
  color: #fff;
}

.agent-form .btn:disabled:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  opacity: 0.75;
  cursor: progress;
}

/* Honeypot: off-screen for people, out of the tab order, still filled in by naive bots; its label tells an
   agent to leave it empty. */
.agent-form-trap:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* The light theme: the bands' navy keeps the dark field; the error red a little deeper on white groups. */
html.theme-light main.site-main :where(.fl-white, [data-band='white']) .agent-form p.agent-form-error:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)),
html.theme-light main.site-main :where(.fl-white, [data-band='white']) .agent-form p.agent-form-summary:where(:not(.tk-sec, .tk-sec *, .tk-results, .tk-results *, .tk-fp-hero, .tk-fp-hero *)) {
  color: #cf222e;
}
