/* ================================================================
   beginner-form.css — absolute-beginner interest form (Web3Forms)
   Used by index + lessons in all three locales. Loaded only by those
   pages, not from components.css, so the 43k word pages don't carry
   styles for a component they never render.

   The site had no form styling at all before this (only the TOCFL
   search input), so the control styling here is derived from
   .tocfl-search-input and the card conventions in home.css.
   ================================================================ */

.beginner-form-section {
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%);
}

.bf-wrap {
  display: grid;
  gap: var(--space-7);
}
@media (min-width: 1000px) {
  .bf-wrap {
    grid-template-columns: minmax(280px, 400px) 1fr;
    gap: var(--space-8);
    align-items: start;
  }
  /* Intro stays in view while the long availability grid scrolls past. */
  .bf-intro { position: sticky; top: var(--space-6); }
}

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

.bf-form {
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: 0 8px 28px rgba(42, 36, 56, 0.08);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
@media (min-width: 600px) {
  .bf-form { padding: var(--space-7); }
}

/* Honeypot — off-screen rather than display:none, which some bots skip. */
.bf-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.bf-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Fields ---------------------------------------------------- */

.bf-grid {
  display: grid;
  gap: var(--space-5);
}
@media (min-width: 560px) {
  .bf-grid { grid-template-columns: 1fr 1fr; }
}

.bf-field {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bf-field label,
.bf-fieldset legend {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.bf-req { color: var(--accent-deep); }

.bf-hint {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.bf-field input,
.bf-field select,
.bf-field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;                 /* >=16px — no iOS zoom on focus */
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--cream-deep);
  border-radius: var(--r-md);
  padding: 12px 14px;
  transition: border-color var(--t-fast) var(--ease-soft),
              box-shadow var(--t-fast) var(--ease-soft);
}
.bf-field textarea { resize: vertical; min-height: 84px; }

.bf-field input:focus,
.bf-field select:focus,
.bf-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}

/* Only flag a field once the browser has actually validated it, so the form
   doesn't greet people with red borders before they have typed anything. */
.bf-form.is-validated .bf-field input:invalid,
.bf-form.is-validated .bf-field select:invalid {
  border-color: var(--rose);
}

.bf-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ---- Radio rows ------------------------------------------------ */

.bf-radios {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.bf-radios label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--cream-deep);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-soft),
              background var(--t-fast) var(--ease-soft);
}
.bf-radios label:hover { border-color: var(--accent); }
.bf-radios input { accent-color: var(--accent-deep); margin: 0; }
.bf-radios label:has(:checked) {
  background: var(--accent);
  border-color: var(--accent-deep);
  font-weight: 600;
}
.bf-radios label:has(:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---- Availability grid (7 days x 3 slots) ---------------------- */

.bf-slots {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bf-slots-head,
.bf-slot-row {
  display: grid;
  grid-template-columns: minmax(64px, 1.1fr) repeat(3, 1fr);
  gap: 4px;
  align-items: center;
}
.bf-slots-head span {
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
  padding-bottom: 2px;
}
.bf-day {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  /* Long day names must not push the three slot columns out of alignment. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bf-slot-row label {
  display: grid;
  place-items: center;
  min-height: 42px;
  background: var(--cream);
  border: 1px solid var(--cream-deep);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-soft),
              border-color var(--t-fast) var(--ease-soft);
}
.bf-slot-row label:hover { border-color: var(--accent); }
.bf-slot-row input { accent-color: var(--accent-deep); margin: 0; }
.bf-slot-row label:has(:checked) {
  background: var(--accent);
  border-color: var(--accent-deep);
}
.bf-slot-row label:has(:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---- Submit + status ------------------------------------------- */

.bf-submit {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
  border-top: 1px solid var(--cream-deep);
  padding-top: var(--space-5);
}
.bf-btn[disabled] { opacity: 0.6; cursor: progress; }
.bf-privacy {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.bf-status {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 0;
}
.bf-status:empty { display: none; }
.bf-status[data-state="ok"] {
  padding: var(--space-4);
  border-radius: var(--r-md);
  background: var(--accent-2);
  color: var(--ink);
  font-weight: 600;
}
.bf-status[data-state="error"] {
  padding: var(--space-4);
  border-radius: var(--r-md);
  background: var(--rose);
  color: var(--ink);
  font-weight: 600;
}

/* Replaces the form body on success, so nobody re-submits by reflex. */
.bf-form.is-sent > *:not(.bf-status) { display: none; }

@media (prefers-reduced-motion: reduce) {
  .bf-field input,
  .bf-field select,
  .bf-field textarea,
  .bf-radios label,
  .bf-slot-row label { transition: none; }
}
