/* Homeschool Town — submission flow (the write-up surface).
   A warm, single-column scrapbook page, not a SaaS intake form.
   Reuses .pin / .mapboxgl-popup from map-browse.css for the place picker. */

.submit { max-width: 44rem; margin-inline: auto; }

/* ---- Intro promise + start button ---- */
.submit__intro { margin-bottom: var(--s-7); }
.promise-card .btn { margin-top: var(--s-5); }

/* ================= Agreement dialog ================= */
.agree {
  /* margin:auto restores native modal centering that the site-wide `* { margin:0 }` reset strips */
  width: min(32rem, calc(100vw - 2 * var(--s-5))); margin: auto;
  padding: 0; border: 1px solid var(--border-warm); border-radius: var(--r-xl);
  background-image: var(--grad-surface); color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.agree::backdrop { background: oklch(0.255 0.012 50 / 0.42); backdrop-filter: blur(3px); }
.agree[open] { animation: agree-in var(--dur) var(--ease-out-quart); }
.agree__form { padding: clamp(var(--s-5), 4vw, var(--s-6)); }
.agree__title { font-size: var(--t-h3); }
.agree__lead { color: var(--ink-soft); margin-top: var(--s-2); }
.agree__list { list-style: none; padding: 0; margin: var(--s-5) 0; display: flex; flex-direction: column; gap: var(--s-4); }
.agree__list li { display: grid; grid-template-columns: auto 1fr; gap: var(--s-3); align-items: start; line-height: 1.4; }
.agree__list .icon { color: var(--accent); font-size: 1.4rem; margin-top: 0.1em; }
.agree__list strong { font-weight: 600; }

.agree__check, .check, .pick { cursor: pointer; }
.agree__check {
  display: grid; grid-template-columns: auto 1fr; gap: var(--s-3); align-items: start;
  padding: var(--s-4); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--bg); line-height: 1.4; transition: border-color var(--dur-fast), background var(--dur-fast);
}
.agree__check:hover { border-color: var(--accent); }
.agree__check:has(:checked) { border-color: var(--accent); background: var(--accent-tint); }
.agree__check input { width: 1.2rem; height: 1.2rem; margin-top: 0.1em; accent-color: var(--accent); }
.agree__actions { display: flex; gap: var(--s-3); justify-content: flex-end; margin-top: var(--s-5); }
.agree__actions .btn { flex: 0 0 auto; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn[disabled]:hover { transform: none; box-shadow: none; background: var(--primary); }

@keyframes agree-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ================= Form scaffold ================= */
.submit-form { margin: 0; }
.field { border: 0; padding: 0; margin: 0 0 var(--s-6); min-width: 0; }
.field__legend, .field__label {
  display: block; padding: 0; font-weight: 600; font-size: var(--t-body); color: var(--ink); line-height: 1.3;
}
.field__legend { margin-bottom: var(--s-3); }
.field__label { margin-bottom: var(--s-1); }
.field__opt { font-weight: 400; font-size: var(--t-xs); color: var(--muted); letter-spacing: 0.01em; }
.field__help { color: var(--muted); font-size: var(--t-sm); line-height: 1.5; max-width: 60ch; margin-bottom: var(--s-3); }

.field__input {
  width: 100%; padding: 0.72rem 0.9rem;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-size: var(--t-body); line-height: 1.4;
  transition: border-color var(--dur-fast) var(--ease-out-quart), box-shadow var(--dur-fast) var(--ease-out-quart);
}
.field__input::placeholder { color: var(--muted); opacity: 0.8; }
.field__input:hover { border-color: var(--ink-soft); }
.field__input:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.field__input--area { resize: vertical; min-height: 6rem; line-height: 1.6; font-family: var(--font-body); }
.field__input--short { min-height: 4rem; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
@media (max-width: 34rem) { .field-row { grid-template-columns: 1fr; gap: 0; } }

/* ---- Validation ---- */
.field__error { display: none; color: var(--error); font-size: var(--t-sm); font-weight: 500; margin-top: var(--s-2); }
.field__error.field-validation-error,
.field__error:not(:empty) { display: block; }
.input-validation-error.field__input { border-color: var(--error); background: var(--error-tint); }
.input-validation-error.field__input:focus-visible { box-shadow: 0 0 0 3px var(--error-tint); }

.form-errors {
  margin-bottom: var(--s-6); padding: var(--s-4) var(--s-5);
  background: var(--error-tint); border: 1px solid var(--error); border-radius: var(--r-lg);
}
.form-errors.validation-summary-valid { display: none; }
.form-errors__head { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; color: var(--ink); }
.form-errors__head .icon { color: var(--error); flex: none; }
.form-errors ul { margin: var(--s-2) 0 0; padding-left: calc(1.4rem + var(--s-2)); }
.form-errors li { color: var(--ink-soft); font-size: var(--t-sm); line-height: 1.5; }

/* ================= Type segment ================= */
.segment { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
@media (max-width: 30rem) { .segment { grid-template-columns: 1fr; } }
.segment__opt { cursor: pointer; }
.segment input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segment__face {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  column-gap: var(--s-3); row-gap: 0.15rem; align-items: center;
  padding: var(--s-4) var(--s-5);
  background: var(--bg); border: 1.5px solid var(--border-strong); border-radius: var(--r-lg);
  transition: border-color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur);
}
.segment__face .icon { grid-row: 1 / 3; font-size: 1.6rem; color: var(--clay); }
.segment__title { font-weight: 600; color: var(--ink); }
.segment__sub { font-size: var(--t-xs); color: var(--muted); line-height: 1.3; }
.segment__opt:hover .segment__face { border-color: var(--primary); }
.segment input:checked + .segment__face {
  border-color: var(--primary); background: var(--clay-tint); box-shadow: var(--shadow-sm);
}
.segment input:checked + .segment__face .icon { color: var(--primary); }
.segment input:focus-visible + .segment__face { outline: 2.5px solid var(--focus); outline-offset: 2px; }

/* ================= Category picks (radio chips) ================= */
.picks, .checks { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.pick__face, .check__face {
  display: inline-flex; align-items: center; gap: 0.45em;
  font-size: var(--t-sm); font-weight: 500; line-height: 1;
  padding: 0.55rem 0.9rem; border-radius: var(--r-pill);
  background: var(--bg); color: var(--ink); border: 1px solid var(--border-strong);
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.pick__face .icon { font-size: 1.05em; color: var(--primary); }
.pick__face.pick--green .icon { color: var(--accent); }
.pick:hover .pick__face, .check:hover .check__face { border-color: var(--accent); background: var(--accent-tint); }
.pick input:checked + .pick__face, .check input:checked + .check__face {
  background: var(--accent); color: var(--on-accent); border-color: transparent;
}
.pick input:checked + .pick__face .icon { color: var(--on-accent); }
.pick input:focus-visible + .pick__face, .check input:focus-visible + .check__face {
  outline: 2.5px solid var(--focus); outline-offset: 2px;
}
.check input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* ================= Map picker ================= */
.picker { margin-top: var(--s-4); }
.picker__canvas {
  height: clamp(15rem, 38vw, 20rem); border-radius: var(--r-lg);
  overflow: hidden; border: 1px solid var(--border); background: var(--surface); position: relative;
}
.picker__hint {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  margin-top: var(--s-2); font-size: var(--t-sm); color: var(--muted);
}
.picker__readout { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--ink); font-weight: 500; }
.picker__readout::before { content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--primary); }
.picker__clear {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--primary); font-size: var(--t-sm); font-weight: 500; text-decoration: underline; text-underline-offset: 2px;
}
.picker__clear:hover { color: var(--primary-hover); }
.picker__off {
  display: flex; flex-direction: column; gap: var(--s-1); align-items: center; justify-content: center;
  height: 100%; padding: var(--s-5); text-align: center; color: var(--muted); font-size: var(--t-sm);
}
.picker__off strong { color: var(--ink-soft); font-weight: 600; }
/* Picker marker is grab-draggable — the cursor should say so. */
.picker__canvas .pin { cursor: grab; }
.picker__canvas .pin:active { cursor: grabbing; }

/* ================= Photo dropzone ================= */
.dropzone { position: relative; }
.dropzone__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone__input:focus-visible + .dropzone__label { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.dropzone__label {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-1); text-align: center;
  padding: var(--s-6) var(--s-5);
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface); color: var(--muted);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.dropzone__icon { font-size: 1.8rem; color: var(--clay); }
.dropzone__title { color: var(--ink); font-weight: 500; }
.dropzone__browse { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.dropzone__hint { font-size: var(--t-xs); }
.dropzone:hover .dropzone__label,
.dropzone[data-drag="true"] .dropzone__label { border-color: var(--accent); background: var(--accent-tint); }

.thumbs { list-style: none; padding: 0; margin: var(--s-4) 0 0; display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
.thumb { display: flex; flex-direction: column; gap: var(--s-2); }
.thumb__frame { position: relative; aspect-ratio: 3 / 2; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.thumb__img { width: 100%; height: 100%; object-fit: cover; }
.thumb__lead {
  position: absolute; top: var(--s-2); left: var(--s-2);
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--primary); color: var(--on-primary); padding: 0.2rem 0.5rem; border-radius: var(--r-pill);
}
.thumb__remove {
  position: absolute; top: var(--s-2); right: var(--s-2);
  width: 1.75rem; height: 1.75rem; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: oklch(0.255 0.012 50 / 0.62); color: #fff; backdrop-filter: blur(2px);
}
.thumb__remove:hover { background: var(--error); }
.thumb__remove .icon { width: 1rem; height: 1rem; }
.thumb__alt {
  width: 100%; padding: 0.4rem 0.55rem; font-size: var(--t-xs);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg); color: var(--ink);
}
.thumb__alt:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.thumb__lead-btn {
  background: none; border: 0; padding: 0; cursor: pointer; align-self: flex-start;
  font-size: var(--t-xs); color: var(--primary); font-weight: 500; text-decoration: underline; text-underline-offset: 2px;
}

/* ================= Block editor ================= */
.editor__bar { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-4); }
.editor__add {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.45rem 0.8rem; font-size: var(--t-sm); font-weight: 500;
  background: var(--bg); color: var(--ink); border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.editor__add:hover { border-color: var(--primary); color: var(--primary); background: var(--clay-tint); }
.editor__add .ed-ico { width: 1em; height: 1em; }

.eblocks { display: flex; flex-direction: column; gap: var(--s-3); }
.eblock {
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg);
  padding: var(--s-3); transition: border-color var(--dur-fast);
}
.eblock:focus-within { border-color: var(--accent); }
.eblock__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-2); }
.eblock__kind {
  font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
}
.eblock__tools { display: flex; gap: var(--s-1); }
.eblock__tool {
  width: 1.85rem; height: 1.85rem; display: grid; place-items: center;
  background: none; border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer; color: var(--muted);
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.eblock__tool:hover { background: var(--surface-bot); color: var(--ink); border-color: var(--border); }
.eblock__tool[disabled] { opacity: 0.3; cursor: default; }
.eblock__tool--del:hover { color: var(--error); }
.eblock__tool .ed-ico { width: 1.1rem; height: 1.1rem; }
.eblock__text {
  width: 100%; border: 0; background: none; color: var(--ink); resize: none; overflow: hidden;
  font-family: var(--font-body); font-size: var(--t-body); line-height: 1.6; padding: 0.1rem;
}
.eblock__text:focus-visible { outline: none; }
.eblock__text::placeholder { color: var(--muted); opacity: 0.75; }
.eblock--subhead .eblock__text { font-family: var(--font-display); font-size: var(--t-h3); line-height: 1.2; font-weight: 400; }
.eblock--quote { background: var(--surface); }
.eblock--quote .eblock__text {
  font-family: var(--font-display); font-size: 1.3rem; line-height: 1.35; font-style: italic; color: var(--ink);
}

/* ================= Tag input ================= */
.taginput {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  padding: 0.4rem 0.5rem; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--bg);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.taginput:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.taginput__chips { display: contents; list-style: none; margin: 0; padding: 0; }
.tagchip {
  display: inline-flex; align-items: center; gap: 0.3em;
  font-size: var(--t-xs); font-weight: 500; line-height: 1; padding: 0.35rem 0.3rem 0.35rem 0.7rem;
  border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent);
}
.tagchip__x { display: grid; place-items: center; width: 1.1rem; height: 1.1rem; border: 0; border-radius: 50%; cursor: pointer; background: oklch(1 0 0 / 0.18); color: var(--on-accent); }
.tagchip__x:hover { background: oklch(1 0 0 / 0.32); }
.tagchip__x .ed-ico { width: 0.75rem; height: 0.75rem; }
.taginput__field { flex: 1 1 8rem; min-width: 8rem; border: 0; background: none; padding: 0.35rem 0.25rem; font-size: var(--t-sm); color: var(--ink); }
.taginput__field:focus-visible { outline: none; }
.taginput__suggest { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-top: var(--s-3); }
.taginput__suggest-label { font-size: var(--t-xs); color: var(--muted); }
.taginput__suggest .chip[hidden] { display: none; }

/* ================= Time frame ================= */
.timeframe__hint {
  display: inline-flex; vertical-align: -0.15em; margin-left: 0.3em;
  color: var(--muted); cursor: help;
}
.timeframe__hint:hover, .timeframe__hint:focus-visible { color: var(--primary); }
[data-timeframe-fields] { margin-top: var(--s-4); }

/* ================= Author + confirm sections ================= */
.submit-form__section { margin-top: var(--s-7); padding-top: var(--s-6); border-top: 1px solid var(--border); }
.submit-form__section-title { font-size: var(--t-h3); }
.submit-form__section-sub { color: var(--muted); font-size: var(--t-sm); margin: var(--s-1) 0 var(--s-5); }

/* ---- Posting-as card: read-only, author derived from the signed-in account ---- */
.posting-as {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-4); align-items: start;
  padding: var(--s-4) var(--s-5);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.posting-as__avatar { width: 2.5rem; height: 2.5rem; font-size: 0.95rem; }
.posting-as__body { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.posting-as__name { display: block; color: var(--ink); font-size: var(--t-body); }
.posting-as__base { display: inline-flex; align-items: center; gap: 0.4em; font-size: var(--t-sm); color: var(--muted); text-decoration: none; }
.posting-as__base .icon { width: 0.95em; height: 0.95em; }
.posting-as__base--empty { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.posting-as__base--empty:hover { color: var(--primary-hover); }
.posting-as__bio { color: var(--ink-soft); font-size: var(--t-sm); line-height: 1.5; margin: var(--s-1) 0 0; }
.posting-as__bio span { color: var(--muted); font-style: italic; }
.posting-as__edit { flex: none; white-space: nowrap; }
@media (max-width: 30rem) {
  .posting-as { grid-template-columns: auto 1fr; }
  .posting-as__edit { grid-column: 1 / -1; justify-self: start; margin-top: var(--s-1); }
}

.submit-form__confirm {
  margin-top: var(--s-7); padding: clamp(var(--s-5), 4vw, var(--s-6));
  background-image: var(--grad-surface); border: 1px solid var(--border-warm); border-radius: var(--r-xl);
}
.agree__check--inline { background: var(--bg); }
.submit-form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); margin-top: var(--s-5); }
.submit-form__reassure { font-size: var(--t-sm); color: var(--muted); }

.btn[aria-busy="true"] { position: relative; color: transparent; pointer-events: none; }
.btn[aria-busy="true"] svg { visibility: hidden; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 1.1rem; height: 1.1rem;
  border: 2px solid var(--on-primary); border-right-color: transparent; border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .agree[open] { animation: none; }
  .btn[aria-busy="true"]::after { animation-duration: 0s; }
}
