/* ==========================================================================
   Memory Drop — Phase 2 stylesheet
   Tokens are sourced verbatim from .planning/phases/02-form-and-sign-endpoint/02-UI-SPEC.md.
   No web fonts, no gradients, no shadows beyond focus rings, no override-priority rules.
   All inputs render at exactly 16px to disable iOS Safari zoom-on-focus (Pitfall #6).
   ========================================================================== */

:root {
  /* === Spacing scale (4-point base) === */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;

  /* === Touch target minimum (Apple HIG / Material constant) === */
  --touch-min: 44px;

  /* === Color === */
  --color-bg: #fafafa;
  --color-text: #1a1a1a;
  --color-surface: #ffffff;
  --color-border: #d4d4d4;
  --color-text-muted: #6b6b6b;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-error: #b91c1c;
  --color-error-bg: #fef2f2;
  --color-success: #15803d; /* reserved for Phase 3 status pill */

  /* === Typography === */
  --text-display: 28px;
  --text-heading: 20px;
  --text-body: 16px;
  --text-small: 14px;
  --weight-strong: 600;
  --weight-normal: 400;
}

/* === Reset / base === */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-body);
  line-height: 1.5;
  min-height: 100vh;
}

/* === iOS zoom-prevention floor (Pitfall #6) — never override down === */

input,
textarea,
select {
  font-size: 16px;
  font-family: inherit;
}

/* === Page layout (mobile-first) === */

#main {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-3) var(--space-6) var(--space-3);
}

@media (min-width: 480px) {
  #main {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

@media (min-width: 768px) {
  #main {
    padding: var(--space-7) var(--space-5);
  }
}

/* === Header block === */

.brand {
  font-size: var(--text-display);
  font-weight: var(--weight-strong);
  line-height: 1.2;
  margin: 0 0 var(--space-2) 0;
  color: var(--color-text);
}

.collection {
  font-size: var(--text-heading);
  font-weight: var(--weight-strong);
  line-height: 1.25;
  margin: 0 0 var(--space-2) 0;
  color: var(--color-text);
}

.subtitle {
  font-size: var(--text-body);
  font-weight: var(--weight-normal);
  line-height: 1.5;
  margin: 0 0 var(--space-5) 0;
  color: var(--color-text);
}

/* === Student name input === */

.name-label {
  display: block;
  font-size: var(--text-small);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-1) 0;
}

.name-input {
  display: block;
  width: 100%;
  height: var(--touch-min);
  padding: 0 var(--space-3);
  font-size: 16px; /* LOCKED — Pitfall #6, never override */
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  outline: none;
}

.name-input:focus {
  border: 2px solid var(--color-accent);
}

/* === Picker disabled helper === */

.picker-helper {
  font-size: var(--text-small);
  color: var(--color-text-muted);
  margin: var(--space-1) 0 0 0;
}

.picker-helper[hidden] {
  display: none;
}

/* === Dropzone === */
/* Visually-hidden file input — accessible standard pattern. */

.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 120px;
  padding: var(--space-4);
  margin-top: var(--space-4);
  font-size: var(--text-body);
  color: var(--color-text);
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color 100ms;
}

@media (min-width: 768px) {
  .dropzone {
    min-height: 160px;
  }
}

/* Idle (default) — handled above. Hover only on hover-capable devices. */
@media (hover: hover) and (pointer: fine) {
  .dropzone:not(.dropzone--disabled):hover {
    border-color: var(--color-text-muted);
  }
}

/* Drag-over: dashed → solid accent transition signals "release here" */
.dropzone.dropzone--drag-over {
  border: 2px solid var(--color-accent);
  background: var(--color-bg);
}

/* Keyboard focus on the underlying input bubbles to the label */
.dropzone:focus-within {
  border: 2px solid var(--color-accent);
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Disabled state: 1px solid (NOT dashed — signals "not yet"); page-bg fill ("absent") */
.dropzone.dropzone--disabled {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* Dropzone copy — same DOM, two strings via ::before content. Touch-only by default. */
.dropzone-copy::before {
  content: attr(data-touch-copy);
}

@media (hover: hover) and (pointer: fine) {
  .dropzone-copy::before {
    content: attr(data-hover-copy);
  }
}

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

/* === Section headings === */

.section-heading {
  font-size: var(--text-heading);
  font-weight: var(--weight-strong);
  line-height: 1.25;
  color: var(--color-text);
  margin: var(--space-4) 0 var(--space-2) 0;
}

.section-heading[hidden] {
  display: none;
}

/* === "Stored safely" note (D-03) === */

.stored-safely {
  font-size: var(--text-small);
  color: var(--color-text-muted);
  margin: var(--space-1) 0 var(--space-3) 0;
}

/* === File lists === */

.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Accepted-file row */

.file-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--touch-min);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.file-row:last-child {
  border-bottom: none;
}

.file-row .filename {
  flex: 1;
  font-size: var(--text-body);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.file-row .filesize {
  font-size: var(--text-small);
  color: var(--color-text-muted);
  margin-left: var(--space-2);
}

/* Phase 3 will populate .status-pill — keep slot empty in Phase 2 */
.file-row .status-pill {
  margin-left: var(--space-2);
}

/* Rejected-file row — two-line layout (filename + reason) */

.file-row--rejected {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: var(--touch-min);
  padding: var(--space-2) var(--space-3);
  background: var(--color-error-bg);
  border-bottom: 1px solid var(--color-border);
  border-left: 3px solid var(--color-error);
}

.file-row--rejected:last-child {
  border-bottom: none;
}

.file-row--rejected .filename {
  font-size: var(--text-body);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.file-row--rejected .reason {
  font-size: var(--text-small);
  color: var(--color-error);
  margin-top: var(--space-1);
}

/* === Empty state === */

.empty-state {
  text-align: left;
  font-size: var(--text-body);
  color: var(--color-text-muted);
  padding: var(--space-3) 0;
}

.empty-state[hidden] {
  display: none;
}

/* === Wrong-link view (D-10 — total replacement of form) === */

.wrong-link {
  /* Inherits #main outer padding/centering. No card chrome. */
}

.wrong-link h2 {
  font-size: var(--text-heading);
  font-weight: var(--weight-strong);
  line-height: 1.25;
  color: var(--color-text);
  margin: 0 0 var(--space-2) 0;
}

.wrong-link p {
  font-size: var(--text-body);
  font-weight: var(--weight-normal);
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0;
}
