/*
  Input 02 — Inset Label Field — standalone HTML/CSS implementation.
  No build step, no framework, no external dependency: copy index.html and
  this file into any project as-is. `--input-accent` is a plain custom
  property — override it wherever this field is used.
*/

:root {
  --input-accent: #39ff14;
  --input-fg: oklch(0.145 0 0);
  --input-border: oklch(0.87 0 0);
  --input-border-hover: oklch(0.72 0 0);
  --input-muted: oklch(0.5 0 0);
  --input-error: oklch(0.58 0.19 20);
  --input-success: oklch(0.6 0.14 155);
}

.inset-field {
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

.inset-field__shell {
  border-radius: 0.75rem;
  border: 1px solid var(--input-border);
  background-color: #ffffff;
  padding: 0.625rem 1rem 0.75rem;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.inset-field__shell:hover {
  border-color: var(--input-border-hover);
}

/*
  Focus/error emphasis is shown on the shell — never the bare input,
  which stays borderless so the shell is the field's only visible
  boundary. `:focus-within` reacts to real DOM focus (so browser autofill
  needs no extra wiring); `:has()` lets the focused-and-invalid
  combination get its own tinted ring in pure CSS.
*/
.inset-field__shell:focus-within {
  border-color: var(--input-fg);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--input-accent) 35%, transparent);
}

.inset-field__shell:focus-within:has(.inset-field__value[aria-invalid="true"]) {
  border-color: var(--input-error);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--input-error) 30%, transparent);
}

.inset-field--error .inset-field__shell {
  border-color: var(--input-error);
}

.inset-field--disabled .inset-field__shell {
  border-color: var(--input-border);
  background-color: oklch(0.97 0 0);
}

.inset-field--disabled .inset-field__shell:hover {
  border-color: var(--input-border);
}

.inset-field__label {
  display: block;
  margin-bottom: 0.25rem;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--input-muted);
}

.inset-field__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inset-field__value {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--input-fg);
  outline: none;
}

.inset-field__value::placeholder {
  color: var(--input-muted);
}

.inset-field__value:disabled {
  cursor: not-allowed;
  color: var(--input-muted);
}

.inset-field__icon {
  display: flex;
  flex-shrink: 0;
  color: var(--input-success);
}

/* An author-origin `display` rule on the same element always beats the
   UA stylesheet's `[hidden] { display: none }`, regardless of
   specificity — so the hidden state must be re-declared explicitly here,
   or a JS-toggled `hidden` icon never actually disappears. */
.inset-field__icon[hidden] {
  display: none;
}

.inset-field--error .inset-field__icon {
  color: var(--input-error);
}

.inset-field__message {
  margin: 0.375rem 0 0;
  font-size: 0.875rem;
  color: var(--input-muted);
}

.inset-field--error .inset-field__message {
  color: var(--input-error);
}

.inset-field--success .inset-field__message {
  color: var(--input-success);
}

@media (prefers-reduced-motion: reduce) {
  .inset-field__shell {
    transition: none;
  }
}

/*
  Page layout — the canvas this resource is presented on. Adjust or drop it
  when placing the resource inside your own layout.
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}
.input02-layout {
  display: flex;
  min-height: 20rem;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.input02-layout__panel {
  display: flex;
  width: 100%;
  max-width: 400px;
  flex-direction: column;
  gap: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background-color: #ffffff;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 40px -16px rgba(0, 0, 0, 0.14);
}
@media (max-width: 380px) {
  .input02-layout {
    padding: 1rem;
  }
  .input02-layout__panel {
    padding: 1.25rem;
  }
}
