/* TownFront Forms — minimal functional front-end CSS.
   The theme owns the palette; this file only covers structure the theme has no
   reason to know about (honeypot, steps, choices, composites, file lists). */

.tff-form-wrap { margin: 0 0 2rem; }
.tff-form__description { margin: 0 0 1.25rem; }

/* The honeypot must be unreachable for people but present for bots. */
.tff-hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Required / optional markers */
.tf-required { color: #b3261e; margin-left: .15em; }
.tff-field__help { font-size: .9rem; margin: .35rem 0 .5rem; }
.tff-field__error { font-weight: 600; }
.tff-field__error[hidden] { display: none; }
.tf-field__optional { font-weight: 400; opacity: .7; font-size: .9em; margin-left: .25em; }

/* Error summary.
   The summary and the line under a field are the same message at two
   distances, so they are written the same way: no bullets, because the
   summary's own mark has already said what kind of list this is, and a bullet
   beside an underlined link is two signals for one row. A theme that wants
   something else only has to say so. */
.tff-errors__list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .25rem; }
.tff-errors__list a { text-decoration: underline; font-weight: 600; }
.tff-errors:focus,
.tff-form-wrap .tf-notice--success:focus { outline: 3px solid currentColor; outline-offset: 3px; }

/* Fieldsets for grouped controls */
.tff-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.tff-fieldset > legend { padding: 0; }

/* Room between the answers. A tick and its words are one target, and at .4rem
   the targets touched -- on a phone that is a mis-tap, and on any screen it is
   a list that has to be read carefully to be counted. */
.tff-choices { display: grid; gap: .7rem; }
.tff-choices--inline { grid-auto-flow: column; grid-auto-columns: max-content; gap: 1.5rem; }
.tff-choice { display: flex; align-items: flex-start; gap: .6rem; line-height: 1.5; }
.tff-choice input { margin-top: .3rem; flex: 0 0 auto; }
.tff-choice label { font-weight: 400; margin: 0; }

.tff-consent { display: flex; align-items: flex-start; gap: .6rem; line-height: 1.5; }

/* Choosing several from a list ------------------------------------------
   A multiple select is a list you scroll, and at the browser's own line height
   the rows sit on top of one another -- three options in the space of two, and
   nothing to aim at. Given room it reads as a list of choices, and the box is
   tall enough to show them without scrolling at all. */
.tf-form select[multiple],
.tff-form select[multiple] {
	min-height: 11.5rem;
	padding: .35rem .25rem;
	line-height: 1.6;
}
.tf-form select[multiple] option,
.tff-form select[multiple] option {
	padding: .45rem .75rem;
	border-radius: 6px;
}
.tff-consent input { margin-top: .35rem; flex: 0 0 auto; }
.tff-consent__label { font-weight: 400; }

/* Composite fields (name, address) */
.tff-composite { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
/* With the group's legend out of the way these are the field's labels, not
   captions under one, so they are sized and weighted like every other label on
   the form. */
.tff-composite__part label { font-weight: 600; font-size: 1rem; display: block; margin-bottom: .3rem; }
.tff-composite--address .tff-composite__part--line1,
.tff-composite--address .tff-composite__part--line2 { grid-column: 1 / -1; }

/* Files */
.tff-file-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.tff-file-list li { padding: .25rem 0; }
.tff-file-remove { display: flex; align-items: center; gap: .5rem; margin-top: .35rem; }
.tff-file-remove label { font-weight: 400; margin: 0; }
.tff-file-size { opacity: .7; font-size: .9em; }

.tff-divider { border: 0; border-top: 1px solid currentColor; opacity: .2; margin: 1.75rem 0; }
.tff-field__heading { margin: 1.5rem 0 .5rem; }

/* Steps */
.tff-steps__status { font-weight: 600; margin: 0 0 .5rem; }
.tff-steps__list {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem 1.25rem;
	list-style: none;
	margin: 0 0 1.5rem;
	padding: 0;
	counter-reset: none;
}
.tff-steps__item { display: flex; align-items: center; gap: .5rem; opacity: .6; }
.tff-steps__item.is-current,
.tff-steps__item.is-done { opacity: 1; }
.tff-steps__num {
	position: relative;
	isolation: isolate;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	border-radius: 50%;
	border: 2px solid currentColor;
	font-size: .85rem;
	font-weight: 700;
	flex: 0 0 auto;
}
/* The current step is marked with a heavier ring and a tint drawn behind the
   numeral. A solid currentColor fill cannot work here: currentColor resolves to
   the element's own colour, so filling and recolouring the text chase each
   other and the numeral disappears. The tint keeps contrast in any theme. */
.tff-steps__item.is-current .tff-steps__num { border-width: 3px; position: relative; }
.tff-steps__item.is-current .tff-steps__num::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: currentColor;
	opacity: .15;
	z-index: -1;
}
.tff-steps__item.is-current .tff-steps__label { font-weight: 700; }

/* A step already answered is filled in, and is a way back to itself ------
   The row of numbers is where a reader looks to see where they are, so it is
   also where they reach to go back: pressing Back three times to change one
   answer is work nobody should have to do. Answered steps are solid, the one
   in hand is ringed, and the ones ahead are outlines waiting to be filled --
   which is the same thing the row is saying in words. */
.tff-steps__item.is-done .tff-steps__num {
	opacity: 1;
	/* A named colour, not currentColor: the fill and the numeral on it are
	   both drawn from the element's own colour, so with currentColor the two
	   chase each other and the numeral disappears -- the same trap the ring on
	   the current step is written around a few lines up. */
	background: var(--anna-teal, #2E8B78);
	border-color: var(--anna-teal, #2E8B78);
	color: #fff;
}
.tff-steps__item.is-done .tff-steps__num::before { content: none; }

.tff-steps__go {
	display: flex;
	align-items: center;
	gap: .5rem;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
}
.tff-steps__go[disabled] { cursor: default; }
.tff-steps__go:not([disabled]):hover .tff-steps__label { text-decoration: underline; }

/* The arrow says which way the button goes, so the word does not have to. */
.tff-arrow { line-height: 1; }

.tff-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

/* Choosing a file ------------------------------------------------------
   A browser draws its own button here, in its own grey, in its own typeface,
   at whatever height it likes -- three ways for one control on a form to look
   like it came from somewhere else. The ::file-selector-button pseudo-element
   is the button itself, so it takes the same shape as every other button on
   the form and the field around it keeps the field's. */
.tf-form input[type="file"],
.tff-form input[type="file"] {
	width: 100%;
	padding: 8px 10px;
	font: inherit;
	line-height: 1.4;
	cursor: pointer;
}
.tf-form input[type="file"]::file-selector-button,
.tff-form input[type="file"]::file-selector-button {
	margin: 0 .75rem 0 0;
	padding: 8px 18px;
	border: 2px solid transparent;
	border-radius: 999px;
	background: var(--anna-teal-soft, #E6F1EE);
	color: var(--anna-teal-deep, #154D42);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	transition: background-color .2s, color .2s;
}
.tf-form input[type="file"]:hover::file-selector-button,
.tff-form input[type="file"]:hover::file-selector-button {
	background: var(--anna-teal, #2E8B78);
	color: #fff;
}

@media (max-width: 480px) {
	.tff-choices--inline { grid-auto-flow: row; grid-auto-columns: auto; gap: .4rem; }
	.tff-composite { grid-template-columns: 1fr; }
	.tff-actions .tf-btn { width: 100%; justify-content: center; }
	.tff-steps__list { gap: .4rem .75rem; }
	.tff-steps__label { font-size: .85rem; }
}

/* Address suggestions ---------------------------------------------------
   A short list under the street line, drawn in the field's own colours so it
   reads as part of the box rather than as something the browser put there. */
.tff-composite__part--line1 { position: relative; }
.tff-suggest {
	position: absolute;
	z-index: 30;
	left: 0;
	right: 0;
	top: 100%;
	margin: 4px 0 0;
	padding: 4px;
	list-style: none;
	max-height: 15rem;
	overflow-y: auto;
	background: var(--anna-white, #fff);
	border: 2px solid var(--anna-line, #D8DEE2);
	border-radius: 8px;
	box-shadow: var(--anna-shadow, 0 8px 24px rgba(21, 77, 66, .10));
}
.tff-suggest[hidden] { display: none; }
/* Being checked, not gone: while the next reply is in the air the matches
   already found stay put and fade back, so a keystroke costs a shade rather
   than an empty list. */
.tff-suggest.is-stale { opacity: .55; }
/* Turning while the lookup happens, so the pause between the last letter
   and the list reads as work in progress rather than a dead field. */
.tff-suggest__spin {
	position: absolute;
	top: 1rem;
	right: .8rem;
	width: 15px;
	height: 15px;
	border: 2px solid var(--anna-line, #D8DEE2);
	border-top-color: var(--anna-teal, #15604F);
	border-radius: 50%;
	animation: tff-suggest-spin .7s linear infinite;
	pointer-events: none;
}
.tff-suggest__spin[hidden] { display: none; }
@keyframes tff-suggest-spin { to { transform: rotate(360deg); } }
@media ( prefers-reduced-motion: reduce ) {
	.tff-suggest__spin { animation-duration: 2s; }
}
.tff-suggest__hit--busy,
.tff-suggest__hit--busy:hover {
	background: none;
	cursor: default;
	color: var(--anna-ink-soft, #5A6B6A);
}
@media ( prefers-reduced-motion: no-preference ) {
	.tff-suggest { transition: opacity .12s ease; }
}
.tff-suggest__hit {
	padding: .5rem .65rem;
	border-radius: 6px;
	font-size: .95rem;
	line-height: 1.4;
	cursor: pointer;
}
.tff-suggest__hit:hover,
.tff-suggest__hit.is-on { background: var(--anna-teal-soft, #E6F1EE); }
