/* Forms: labels above soft cream fields with a green border, at least 48px tall. */
form { display: flex; flex-direction: column; gap: 22px; }
.cipri-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.cipri-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cipri-field.cipri-field-full { grid-column: 1 / -1; }
.cipri-field label, .cipri-fieldset legend { font-family: var(--f-display); font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--cream-soft); border: 1px solid var(--field-border); border-radius: 2px; padding: .7em .85em; min-height: 48px; width: 100%; }
input:focus, textarea:focus, select:focus, input.cipri-sg-is-focus { outline: 2px solid var(--orange); outline-offset: 3px; border-color: var(--green); box-shadow: 0 0 0 3px var(--green); }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--orange); }  /* an error keeps its orange border while the field has focus */
textarea { min-height: 130px; resize: vertical; }
/* iOS Safari draws a date or time field at a width of its own and centres its value, which pushed
   the field past a phone's edge and slid the page sideways: hold it to its column like the rest. */
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; }
input::-webkit-date-and-time-value { text-align: start; min-height: 1lh; }  /* empty, it has no line, and the field came up short */
/* A list to pick from (the number of guests: a wheel on a phone) looks like the fields around
   it, with a chevron drawn in the ink colour at its end. */
select { -webkit-appearance: none; appearance: none; cursor: pointer; padding-inline-end: 2.6em;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 1.3em) 50%, calc(100% - .95em) 50%; background-size: .35em .35em; background-repeat: no-repeat; }
.cipri-fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
/* A legend is no flex item, so the gap above doesn't reach it: its own margin, and none of the
   browser's padding, put the toggle where a label puts its field. In two columns the toggle
   grows to the row, so it lines up with the field beside it. */
.cipri-fieldset legend { padding: 0; margin-bottom: 6px; }
.cipri-fieldset .cipri-seg { flex: 1; }
.cipri-seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--green); border-radius: 2px; overflow: hidden; }
.cipri-seg label { display: flex; align-items: center; justify-content: center; min-height: 48px; cursor: pointer; font-family: var(--f-display); letter-spacing: .1em; text-transform: uppercase; font-size: .85rem; text-align: center; padding: 6px 10px; }
.cipri-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cipri-seg input:checked + span { color: var(--cream); }
.cipri-seg label:has(input:checked) { background: var(--green); color: var(--cream); }
.cipri-seg label:has(input:focus-visible) { outline: 2px solid currentColor; outline-offset: -6px; }
.cipri-green .cipri-seg { border-color: var(--cream); }  /* on a green band the toggle inverts: the selected option is cream */
.cipri-green .cipri-seg input:checked + span { color: var(--green); }
.cipri-green .cipri-seg label:has(input:checked) { background: var(--cream); color: var(--green); }
/* A tick box (a consent field: the newsletter tick): the box, then what it agrees to in the
   body's own letters, on one line that wraps. Its hint and its error take a line each below. */
.cipri-field-consent { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 6px 12px; }
.cipri-field-consent input { flex: none; width: 24px; height: 24px; min-height: 0; padding: 0; margin: 2px 0 0; accent-color: var(--orange); cursor: pointer; }
.cipri-field-consent label { flex: 1; min-width: 0; font-family: inherit; font-size: 1rem; letter-spacing: 0; text-transform: none; cursor: pointer; }
.cipri-field-consent p { flex-basis: 100%; }
.cipri-thanks { border-top: 3px solid var(--orange); background: var(--cream-soft); color: var(--ink); padding: 32px; text-align: center; }
.cipri-thanks h3 { margin-bottom: 8px; }

@media (max-width: 760px) {
  .cipri-fields { grid-template-columns: minmax(0, 1fr); }
}

/* What the gem's form adds: the summary of what to fix, a field's own error, a field's instructions. */
.cipri-form-errors { border-top: 3px solid var(--orange); background: var(--cream-soft); color: var(--ink); padding: 20px 24px; }
.cipri-form-errors ul { margin: 8px 0 0; padding-left: 1.2em; }
.cipri-form-error, .cipri-form-hint { font-size: .9rem; }
