/*
 * Form styles for the yolk.co.uk forms (checkout first; offer and lease to
 * follow) on top of tokens.css and site.css. Provisional until the forms
 * are drawn in Figma: fields follow the site's 8px scale, 44px high (the button height) with
 * --rule outlines, 8px corners and an --ink ring on focus.
 */
/* Form pages (buy, lease, offer): a header without links, the page ground, a
   section-head style title (the step as a label, the domain at h2), then
   the form on a white card in the left two thirds and the order summary
   (components/site/OrderSummary) on a cream card in the right third,
   sticky. On phones the summary sits above the form. The title matches the
   lander's hero ("Buy now" where the lander says "Domain for sale"). */
.form-page { padding-block: var(--s-6) var(--s-8); }
.form-title { margin-bottom: var(--s-5); }
.form-title > span { display: block; }
.form-title .label { margin-bottom: var(--label-gap); }
.form-title .h2 { font: var(--text-domain); letter-spacing: var(--ls-domain); overflow-wrap: anywhere; }
.form-title .h2 a { color: inherit; text-decoration: none; }
.form-title .h2 a:hover { text-decoration: underline 0.035em; text-underline-offset: 0.08em; }
.form-shell { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s-4) var(--gutter); align-items: start; }
.form-main { grid-column: 1; grid-row: 1; }
.card.form-aside { grid-column: 2; grid-row: 1; position: sticky; top: var(--s-3); padding: var(--s-6) var(--s-4); background: var(--cream); }
/* The order summary's foot torn like a till receipt: 14×7 teeth cut by a mask. */
.card.form-aside.receipt {
  --tooth: 7px;
  padding-bottom: calc(var(--s-6) + var(--tooth));
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--tooth)) var(--tooth) repeat-x;
}
/* The nest (components/site/NestArt) shares the sidebar's cell: it rides the
   foot of the window while the form scrolls past, then settles level with
   the form's foot. Too short a window for it and the summary both, it just
   sits at the foot. */
.form-nest { grid-column: 2; grid-row: 1; align-self: end; justify-self: center; position: sticky; bottom: var(--s-6); max-width: 21.4375rem; }
@media (max-height: 46em) { .form-nest { position: static; } }
.form-nest { transition: opacity 0.2s, visibility 0.2s; }
.form-nest.crowded { opacity: 0; visibility: hidden; }
/* The enquiry form has no summary, just the stamp (components/site/StampArt) in the nest's place. */
.form-nest.form-stamp { max-width: 13rem; align-self: start; top: var(--s-3); bottom: auto; margin-top: 0.5rem; }
@media (min-width: 64em) { .form-shell.wide { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); } }
/* Two columns only from 64em: narrower, the sidebar squeezes the form's fields and the lease figures */
@media (max-width: 63.99em) {
  .form-shell { grid-template-columns: minmax(0, 1fr); }
  .form-main, .card.form-aside { grid-column: 1; grid-row: auto; }
  .form-main { max-width: 48rem; }
  .card.form-aside, .form-nest { display: none; }
}
/* Phones: the white card runs to the screen edges, its padding the page margin, so the fields line up with the title, and on down to the footer. */
@media (max-width: 44.99em) {
  .card.form-main { margin-inline: calc(-1 * var(--page-margin)); padding-inline: var(--page-margin); padding-bottom: calc(2 * var(--s-4)); border-radius: 0; }
  .form-page:has(.card.form-main) { padding-bottom: 0; }
}
.summary-heading { font: var(--text-card-title); letter-spacing: var(--ls-card-title); padding-bottom: var(--s-2); margin-bottom: var(--s-2); border-bottom: 1px solid var(--form-rule); }
.summary { padding-bottom: var(--s-2); border-bottom: 1px solid var(--form-rule); }
.form-aside .summary-heading, .form-aside .summary { border-color: var(--aside-rule); }
.summary div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2); padding: 0.25rem 0; line-height: 1.5rem; }
.summary dt { min-width: 0; color: var(--ink-3); }
.summary dd { margin: 0; color: var(--ink-3); text-align: right; white-space: nowrap; }
.summary .summary-item dt, .summary .summary-item dd { color: var(--ink); font-weight: 475; }
.summary-item dt { overflow-wrap: anywhere; }
.summary-total { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2); padding-top: var(--s-2); font: var(--text-card-title); letter-spacing: var(--ls-card-title); color: var(--ink); }
.summary-total > * { font-weight: 500; }
.summary-total > :last-child { letter-spacing: 0.02em; }
/* The Google rating at the foot of the receipt, under its own rule. */
.summary-rating { margin-top: var(--s-3); padding-top: var(--s-2); border-top: 1px solid var(--aside-rule); }
.next-note { margin-bottom: var(--s-4); color: var(--ink-2); }
.next-note strong { font-weight: 475; color: var(--ink); }
.next-note:has(+ .next-note) { margin-bottom: var(--s-2); }
.next-note:last-child { margin-bottom: 0; }
.next-logo { display: block; height: 1.125rem; width: auto; margin: var(--s-4) 0 var(--s-3); color: var(--ink); }
.fine { margin-top: var(--s-2); }
.form-section + .form-section { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--form-rule); }
.form-section > h2 { font: var(--text-card-title); letter-spacing: var(--ls-card-title); margin-bottom: var(--s-3); }
.form-section > h2:has(+ .form-note) { margin-bottom: 0.25rem; }
.form-section > .form-note { font: var(--text-small); color: var(--ink-3); margin-bottom: var(--s-3); }

/* Message pages (checkout return and cancelled, lease preparing, offer sent):
   the form page layout with one card of text in place of the form. */
.message > * + * { margin-top: var(--s-2); }
.message > h2 { font: var(--text-card-title); letter-spacing: var(--ls-card-title); margin-bottom: var(--s-3); }
.message > h3 { font: var(--text-card-title); letter-spacing: var(--ls-card-title); margin-top: var(--s-4); }
.message > h3.divided { padding-top: var(--s-4); border-top: 1px solid var(--form-rule); }
.message p { color: var(--ink-2); }
.message strong { font-weight: 475; color: var(--ink); }
.message .summary { margin-top: var(--s-3); padding-top: var(--s-1); border-top: 1px solid var(--form-rule); }
.message .note { font: var(--text-small); color: var(--ink-3); }
.message .actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }
.message .transfer-form { margin-top: var(--s-3); }
.message .readout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: var(--s-3); background: var(--cream); border-radius: var(--radius-card); }
.readout > div { display: flex; flex-direction: column; padding: var(--s-2); min-width: 0; }
.readout > div + div { box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.08); }
.readout dt { font: var(--text-key); color: var(--ink-3); }
.readout dd { margin: 0; font: var(--text-figure); color: var(--ink); overflow-wrap: anywhere; }
.readout dd a { font: var(--text-small); font-weight: 400; color: var(--ink-3); margin-left: 0.5rem; white-space: nowrap; }
@media (max-width: 44.99em) {
  .message .readout { grid-template-columns: minmax(0, 1fr); }
  .readout > div + div { box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.08); }
}

/* Illustration in the sidebar column of message pages, level with the top of the card */
.form-art { grid-column: 2; grid-row: 1; display: flex; justify-content: center; }
.form-art img { display: block; width: 100%; max-width: 21.25rem; height: auto; }
@media (max-width: 63.99em) { .form-art { display: none; } }

.combo { position: relative; }
.field .combo input[role=combobox]:not([type=radio]):not([type=checkbox]) {
  padding-right: var(--s-6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23151514' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--s-2) center;
}
.combo-list {
  position: absolute; z-index: 10; top: calc(100% + 0.25rem); left: 0; right: 0;
  max-height: 16.5rem; overflow-y: auto; margin: 0; padding: 0.25rem 0; list-style: none;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-card);
  box-shadow: 0 0.5rem 1.5rem rgba(21, 21, 21, 0.1);
}
.combo-list[hidden] { display: none; }
.combo-list li { padding: 0.625rem var(--s-2); font: var(--text-body); color: var(--ink); cursor: pointer; }
.combo-list li[hidden] { display: none; }
.combo-list li:hover, .combo-list li[aria-selected=true] { background: var(--cream); }

.field { margin: 0 0 1.25rem; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { display: block; font: var(--text-field-label); color: var(--ink); margin-bottom: 0.25rem; padding: 0; }
.field .optional, .form-section > h2 .optional { font-weight: 400; color: var(--ink-3); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s-3); }
@media (max-width: 44.99em) { .field-row { grid-template-columns: minmax(0, 1fr); } }

.field input:not([type=radio]):not([type=checkbox]), .field select, .field textarea {
  display: block; width: 100%; min-height: var(--button-h); padding: 0.625rem var(--s-2);
  font: var(--text-body); color: var(--ink); background: var(--card);
  border: 1px solid var(--rule); border-radius: var(--radius-card);
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 8rem; resize: vertical; }
.field textarea.compact { min-height: 6rem; }
.field input:not([type=radio]):not([type=checkbox]):hover, .field select:hover, .field textarea:hover { border-color: var(--rule-strong); }
.field input:not([type=radio]):not([type=checkbox]):focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink);
}
.field select {
  appearance: none; padding-right: var(--s-6); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23151514' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--s-2) center;
}
.field .hint { font: var(--text-small); color: var(--ink-3); margin-top: 0.25rem; }
.field-row .row-hint { grid-column: 1 / -1; margin: -1rem 0 1.25rem; font: var(--text-small); color: var(--ink-3); }
.field input.short { max-width: 12rem; }
.turnstile.shown { margin-top: var(--s-4); }
@media (min-width: 45em) { .turnstile { width: calc((100% - var(--s-3)) / 2); } }

/* Radios and checkboxes: native controls in ink, label text alongside */
.choices { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); }
.field .choice { display: flex; align-items: flex-start; gap: 0.75rem; margin: 0; font: var(--text-body); color: var(--ink-2); cursor: pointer; }
.field .choice input { flex: 0 0 auto; width: 1.125rem; height: 1.125rem; margin: 0.25rem 0 0; accent-color: var(--ink); cursor: pointer; }

.req-mark { color: var(--ink-3); font-weight: 400; }
.req::after { content: " *"; color: var(--ink-3); font-weight: 400; }

/* Validation messages after a POST */
.form-error { border: 1px solid var(--error-edge); background: var(--error-bg); color: var(--error); border-radius: var(--radius-card); padding: var(--s-2) var(--s-3); margin-bottom: var(--s-4); font: var(--text-body); }
.form-error ul { list-style: disc; padding-left: 1.25rem; margin-top: 0.25rem; }

/* Honeypot: off screen for people, still in the form for bots */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
[hidden] { display: none !important; }
