/* forms.css — fully custom form controls (no native browser styling anywhere) */

.f-field { margin-bottom: 16px; }
.f-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em;
  color: var(--color-mut); margin-bottom: 6px;
}
.f-label .req { color: var(--color-accent-hi); }
.f-hint { font-size: 11.5px; color: var(--color-dim); margin-top: 5px; line-height: 1.45; }
.f-error { font-size: 11.5px; color: var(--color-accent-hi); margin-top: 5px; }
.f-counter { margin-left: auto; font-size: 10.5px; font-weight: 500; color: var(--color-dim); }
.f-counter.ok { color: var(--color-ok); }
.f-counter.bad { color: var(--color-warn); }

/* text inputs / textareas */
.f-input, .f-textarea {
  width: 100%; max-width: 100%; appearance: none; outline: none; /* max-width: a w-auto select sized to a long option ran off a phone */
  background: var(--color-panel);
  border: 1px solid var(--color-edge);
  border-radius: 11px;
  color: var(--color-txt);
  font-size: 13.5px;
  padding: 9px 13px;
  box-shadow: inset 0 1px 1px rgba(28,28,24,.04);
  transition: border-color .16s var(--ease-smooth), box-shadow .2s var(--ease-smooth);
}
.f-input::placeholder, .f-textarea::placeholder { color: var(--color-dim); }
.f-input:focus, .f-textarea:focus {
  border-color: color-mix(in srgb, var(--color-accent) 55%, var(--color-edge2));
  box-shadow: inset 0 1px 1px rgba(28,28,24,.04), 0 0 0 3px color-mix(in srgb, var(--color-accent) 14%, transparent);
}
.f-textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
.f-input.mono, .f-textarea.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* select trigger — selects NEVER open natively; always a searchable modal */
.f-select {
  width: 100%; display: flex; align-items: center; gap: 8px;
  background: var(--color-panel);
  border: 1px solid var(--color-edge);
  border-radius: 11px; cursor: pointer;
  padding: 9px 13px; font-size: 13.5px; color: var(--color-txt);
  box-shadow: inset 0 1px 1px rgba(28,28,24,.04);
  text-align: left;
}
.f-select:hover { border-color: var(--color-edge2); }
.f-select:focus-visible { outline: none; border-color: color-mix(in srgb, var(--color-accent) 55%, var(--color-edge2)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 14%, transparent); }
.f-select .placeholder { color: var(--color-dim); }
.f-select .chev { margin-left: auto; color: var(--color-dim); transition: transform .18s var(--ease-smooth); }
.f-select.open .chev { transform: rotate(180deg); }
.f-select .val-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--color-panel3); border: 1px solid var(--color-edge);
  padding: 2px 9px; border-radius: 999px; font-size: 12px;
}

/* iPhone-style toggle */
.f-toggle {
  --w: 44px; --h: 26px;
  position: relative; width: var(--w); height: var(--h); flex: none;
  border-radius: 999px; cursor: pointer; border: 1px solid var(--color-edge);
  background: var(--color-track);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.4);
  transition: background .2s var(--ease-smooth), border-color .2s var(--ease-smooth), box-shadow .25s var(--ease-smooth);
}
.f-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: calc(var(--h) - 6px); height: calc(var(--h) - 6px);
  border-radius: 999px; background: var(--color-knob);
  box-shadow: 0 2px 6px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.9);
  transition: transform .22s var(--ease-spring);
}
.f-toggle[aria-checked="true"] {
  background: var(--color-accent);
  border-color: color-mix(in srgb, var(--color-accent) 70%, transparent);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.25), 0 0 14px color-mix(in srgb, var(--color-accent) 32%, transparent);
}
.f-toggle[aria-checked="true"]::after { transform: translateX(calc(var(--w) - var(--h) + 2px)); }
.f-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 22%, transparent); }
.f-toggle-row { display: flex; align-items: center; gap: 12px; }
.f-toggle-row .t-label { font-size: 13.5px; }
.f-toggle-row .t-sub { font-size: 11.5px; color: var(--color-dim); margin-top: 1px; }

/* radio pills */
.f-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.f-pill {
  padding: 7px 15px; border-radius: 999px; cursor: pointer; user-select: none;
  font-size: 12.5px; font-weight: 500;
  color: var(--color-mut);
  background: var(--color-panel);
  border: 1px solid var(--color-edge);
  transition: all .15s var(--ease-smooth);
}
.f-pill:hover { color: var(--color-txt); border-color: var(--color-edge2); transform: translateY(-1px); }
.f-pill.active {
  color: #fff;
  background: var(--color-accent);
  border-color: color-mix(in srgb, var(--color-accent) 70%, transparent);
  box-shadow: none;
}

/* custom radio (dot list variant) */
.f-radio-row { display: flex; align-items: center; gap: 10px; padding: 7px 2px; cursor: pointer; border-radius: 8px; }
.f-radio-dot {
  width: 18px; height: 18px; border-radius: 999px; flex: none;
  border: 1.5px solid var(--color-edge2); background: var(--color-panel2);
  display: grid; place-items: center;
  transition: border-color .15s, box-shadow .2s;
}
.f-radio-dot::after {
  content: ''; width: 8px; height: 8px; border-radius: 999px;
  background: var(--color-accent-hi); transform: scale(0);
  transition: transform .18s var(--ease-spring);
}
.f-radio-row[aria-checked="true"] .f-radio-dot { border-color: var(--color-accent); box-shadow: 0 0 8px color-mix(in srgb, var(--color-accent) 30%, transparent); }
.f-radio-row[aria-checked="true"] .f-radio-dot::after { transform: scale(1); }

/* custom checkbox */
.f-check {
  width: 18px; height: 18px; border-radius: 6px; flex: none; cursor: pointer;
  border: 1.5px solid var(--color-edge2); background: var(--color-panel2);
  display: grid; place-items: center; color: transparent;
  transition: all .16s var(--ease-smooth);
}
.f-check.checked {
  background: var(--color-accent);
  border-color: transparent; color: #fff;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--color-accent) 35%, transparent);
}

/* chips (tags) input */
.f-chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  background: var(--color-panel);
  border: 1px solid var(--color-edge); border-radius: 11px;
  padding: 7px 9px; min-height: 42px; cursor: text;
  box-shadow: inset 0 1px 1px rgba(28,28,24,.04);
}
.f-chips:focus-within { border-color: color-mix(in srgb, var(--color-accent) 55%, var(--color-edge2)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 14%, transparent); }
.f-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--color-panel3); border: 1px solid var(--color-edge2);
  border-radius: 999px; padding: 3px 6px 3px 11px; font-size: 12px;
  animation: chip-in .16s var(--ease-spring);
}
@keyframes chip-in { from { opacity: 0; transform: scale(.85); } }
.f-chip button { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 999px; color: var(--color-dim); cursor: pointer; background: transparent; border: 0; }
.f-chip button:hover { color: var(--color-txt); background: var(--color-edge2); }
.f-chips input { flex: 1; min-width: 90px; background: transparent; border: 0; outline: 0; color: var(--color-txt); font-size: 13px; padding: 3px; }
.f-chips input::placeholder { color: var(--color-dim); }

/* stepper */
.f-stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--color-edge); border-radius: 11px; overflow: hidden; background: var(--color-panel2); box-shadow: inset 0 1px 1px rgba(28,28,24,.04); }
.f-stepper button {
  width: 34px; display: grid; place-items: center; cursor: pointer;
  color: var(--color-mut); background: transparent; border: 0; font-size: 15px;
}
.f-stepper button:hover { color: var(--color-txt); background: var(--color-panel3); }
.f-stepper input {
  width: 64px; text-align: center; background: transparent; border: 0; outline: 0;
  color: var(--color-txt); font-size: 13.5px; font-weight: 600;
  border-left: 1px solid var(--color-edge); border-right: 1px solid var(--color-edge);
}

/* slider */
.f-slider { position: relative; padding: 8px 0 4px; }
.f-slider input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 5px; border-radius: 999px; background: var(--color-panel3); outline: none; }
.f-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 999px;
  background: var(--color-knob);
  border: 0; cursor: grab;
  box-shadow: 0 2px 8px rgba(0,0,0,.5), 0 0 0 4px color-mix(in srgb, var(--color-accent) 22%, transparent);
  transition: box-shadow .2s;
}
.f-slider input[type=range]:active::-webkit-slider-thumb { cursor: grabbing; box-shadow: 0 2px 8px rgba(0,0,0,.5), 0 0 0 7px color-mix(in srgb, var(--color-accent) 26%, transparent); }
.f-slider .track-fill { position: absolute; left: 0; top: 14.5px; height: 5px; border-radius: 999px; background: var(--color-accent); pointer-events: none; }
.f-slider .bubble { font-size: 11.5px; color: var(--color-mut); font-weight: 600; margin-top: 7px; text-align: right; }

/* height control (pills + meters) */
.f-height { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.f-height .meters { display: none; align-items: center; gap: 7px; animation: chip-in .18s var(--ease-spring); }
.f-height.custom .meters { display: inline-flex; }
.f-height .meters .f-input { width: 96px; }
.f-height .meters .unit { font-size: 12px; color: var(--color-dim); }

/* color swatches */
.f-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.f-swatch {
  width: 30px; height: 30px; border-radius: 999px; cursor: pointer; position: relative;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.35);
  transition: transform .15s var(--ease-spring), box-shadow .2s;
}
.f-swatch:hover { transform: scale(1.12); }
.f-swatch.active {
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 45%, transparent), 0 2px 8px rgba(0,0,0,.4);
  transform: scale(1.12);
}
.f-swatch.custom-trigger { background: conic-gradient(red, orange, yellow, lime, cyan, blue, magenta, red); display: grid; place-items: center; }

/* image picker */
.f-imagepick {
  display: flex; align-items: center; gap: 12px;
}
.f-imagepick .preview {
  width: 76px; height: 76px; border-radius: 12px; object-fit: cover;
  border: 1px solid var(--color-edge); background: var(--color-panel2);
  display: grid; place-items: center; color: var(--color-dim);
}
.f-imagepick .actions { display: flex; flex-direction: column; gap: 6px; }

/* form section headers inside modals */
.f-section {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-dim); margin: 22px 0 12px;
}
.f-section::after { content: ''; flex: 1; height: 1px; background: var(--color-edge); }
.f-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 640px) { .f-grid2 { grid-template-columns: 1fr; } }

/* A stated fact inside a form — a studio law or derived value the operator cannot change.
   Reads as data, not as a disabled input (a disabled input still looks like it might become
   editable, and still round-trips a value on submit). */
.f-static {
  padding: 9px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-panel2, #151926) 70%, transparent);
  border: 1px dashed var(--color-edge, #222a3d);
  color: var(--color-mut, #8d95ab);
  font-size: 13px;
}
.f-static.mono { font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; }
