/*
  Input 08 — File Upload — standalone HTML/CSS/JS implementation.
  No build step, no framework, no external dependency: copy index.html,
  this file, and script.js into any project as-is.
*/

: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);
}

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

.dropzone__label {
  display: block;
  margin-bottom: 0.375rem;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--input-fg);
}

.dropzone__control {
  display: block;
  cursor: pointer;
}

/* Kept in the accessible tree and tab order (never `display:none`) so
   keyboard users can Tab to it and press Enter/Space to open the file
   picker — only visually hidden. */
.dropzone__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dropzone__zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  border: 2px dashed var(--input-border);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: border-color 150ms ease, background-color 150ms ease;
}

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

.dropzone[data-drag-over="true"] .dropzone__zone {
  border-color: var(--input-fg);
  background-color: oklch(0.97 0 0);
}

.dropzone[data-error="true"] .dropzone__zone {
  border-color: var(--input-error);
  background-color: color-mix(in oklab, var(--input-error) 6%, transparent);
}

/* The real, focusable control is the hidden native input — this sibling
   selector gives the *visual* zone a focus-visible ring whenever it has
   focus. */
.dropzone__input:focus-visible ~ .dropzone__zone {
  border-color: var(--input-fg);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--input-accent) 40%, transparent);
}

.dropzone__icon {
  display: flex;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--input-muted);
}

.dropzone[data-error="true"] .dropzone__icon {
  color: var(--input-error);
}

.dropzone__zone-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--input-fg);
}

.dropzone__file {
  display: none;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--input-border);
  background-color: #ffffff;
  padding: 0.75rem 1rem;
}

.dropzone[data-has-file="true"] .dropzone__file {
  display: flex;
}

.dropzone[data-has-file="true"] .dropzone__zone {
  display: none;
}

.dropzone__file-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: var(--input-muted);
}

.dropzone__file-info {
  min-width: 0;
  flex: 1;
  text-align: left;
}

.dropzone__file-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--input-fg);
}

.dropzone__file-size {
  display: block;
  font-size: 0.75rem;
  color: var(--input-muted);
}

.dropzone__remove {
  display: flex;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9999px;
  background: none;
  color: var(--input-muted);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.dropzone__remove:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--input-fg);
}

.dropzone__remove:focus-visible {
  outline: 2px solid var(--input-accent);
  outline-offset: 1px;
}

.dropzone__remove svg {
  width: 0.875rem;
  height: 0.875rem;
}

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

.dropzone[data-error="true"] .dropzone__message {
  color: var(--input-error);
}

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

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

body {
  margin: 0;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}
.input08-layout {
  display: flex;
  min-height: 20rem;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.input08-layout__panel {
  width: 100%;
  max-width: 505px;
  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);
}
