@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/css/fonts/sg-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/css/fonts/jbm-latin.woff2') format('woff2');
}

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

:root {
  --bg: oklch(0.992 0.003 240);
  --paper: oklch(0.985 0.004 240);
  --ink: oklch(0.16 0.012 250);
  --muted: oklch(0.5 0.012 250);
  --rule: oklch(0.16 0.012 250);
  --accent: oklch(0.52 0.205 252);
  --accent-soft: oklch(0.95 0.04 252);
  --success: oklch(0.57 0.14 150);
  --warning: oklch(0.62 0.15 55);
  --danger: oklch(0.56 0.18 25);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(
      90deg,
      transparent calc(50% - 1px),
      var(--rule) calc(50% - 1px),
      var(--rule) calc(50% + 1px),
      transparent calc(50% + 1px)
    ),
    var(--bg);
  color: var(--ink);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  letter-spacing: 0;
}

button,
select,
input {
  font: inherit;
}

button {
  min-height: 48px;
  border: 2px solid var(--rule);
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:not(:disabled):hover {
  background: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  transform: translateY(-160%);
  background: var(--ink);
  color: var(--bg);
  border: 2px solid var(--accent);
  padding: 0.75rem 1rem;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.upload-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  border-inline: 2px solid var(--rule);
}

.upload-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 74px;
  padding: 18px 22px;
  border-bottom: 2px solid var(--rule);
}

.upload-head-links {
  display: flex;
  gap: 18px;
  align-items: center;
}

.upload-mark {
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  text-decoration: none;
}

.dot {
  color: var(--accent);
}

.upload-logout {
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
}

.upload-logout:hover {
  color: var(--accent);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.upload-hero {
  display: grid;
  grid-template-columns: 1fr 180px;
  border-bottom: 2px solid var(--rule);
}

.upload-hero-copy {
  padding: 28px 24px 30px;
  border-right: 2px solid var(--rule);
}

.upload-hero h1 {
  margin: 10px 0 12px;
  font-size: clamp(52px, 12vw, 88px);
  font-weight: 500;
  line-height: 0.88;
  letter-spacing: -0.04em;
}

.upload-hero p:not(.eyebrow) {
  max-width: 28rem;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.upload-status {
  display: flex;
  align-items: flex-end;
  padding: 20px;
  background: var(--accent);
  color: white;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  line-height: 1.45;
  text-transform: uppercase;
}

.upload-status.is-warning {
  background: var(--warning);
  color: var(--ink);
}

.upload-status.is-success {
  background: var(--success);
}

.upload-form {
  display: grid;
  gap: 0;
  border-bottom: 2px solid var(--rule);
}

.upload-field,
.upload-picker,
.upload-actions {
  padding: 22px 24px;
  border-bottom: 1px solid var(--rule);
}

.upload-field {
  display: grid;
  gap: 10px;
}

.upload-field label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.upload-field select {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--rule);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  font-size: 18px;
}

.upload-field-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.upload-picker-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.upload-picker-option {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 112px;
  align-content: center;
  border: 2px dashed var(--rule);
  background: var(--paper);
  padding: 24px;
  cursor: pointer;
  overflow: hidden;
}

.upload-picker-option:hover {
  border-style: solid;
  background: var(--accent-soft);
}

.upload-picker-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-picker-input:focus-visible {
  outline: none;
}

.upload-picker-option:has(.upload-picker-input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.picker-title {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.picker-sub {
  color: var(--muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.upload-drop-hint {
  display: none;
  margin: 12px 0 0;
}

.upload-picker.is-drag-over {
  background: var(--accent-soft);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.upload-picker.is-drag-over .upload-drop-hint,
.upload-picker.is-drag-over .picker-selection {
  border-color: var(--accent);
  color: var(--accent);
}

.upload-picker.is-drop-disabled {
  opacity: 0.72;
}

@media (hover: hover) and (pointer: fine) {
  .upload-drop-hint {
    display: block;
  }
}

.picker-selection {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  background: var(--bg);
}

.upload-preview {
  margin: 0;
  border-bottom: 1px solid var(--rule);
  background: var(--ink);
}

.upload-preview.is-selected {
  display: grid;
}

.upload-preview.is-placeholder {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.upload-preview.is-placeholder img {
  display: none;
}

.upload-preview.is-placeholder figcaption {
  position: static;
  max-width: 28ch;
  margin: 0 auto;
  color: rgb(255 255 255 / 0.9);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
}

.upload-preview img {
  width: 100%;
  max-height: 42vh;
  object-fit: contain;
  background: var(--ink);
}

.upload-preview img[hidden] {
  display: none;
}

.upload-preview figcaption {
  padding: 12px 20px;
  color: white;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.upload-progress {
  height: 8px;
  overflow: hidden;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--rule);
}

.upload-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.upload-progress-bar.is-indeterminate {
  width: 35%;
  animation: upload-progress-indeterminate 1.4s ease-in-out infinite;
}

@keyframes upload-progress-indeterminate {
  0% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(320%);
  }
}

.upload-actions {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 12px;
  border-bottom: 0;
}

.upload-secondary {
  background: var(--bg);
  color: var(--ink);
}

.upload-secondary:not(:disabled):hover {
  background: var(--paper);
  color: var(--accent);
}

.upload-message,
.upload-queue,
.upload-batch {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
  padding: 24px;
  border-bottom: 2px solid var(--rule);
}

.upload-batch-panel {
  display: grid;
  gap: 12px;
  min-width: min(100%, 320px);
}

.batch-summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  max-width: 34ch;
}

.batch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 2px solid var(--rule);
  background: var(--paper);
}

.batch-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-bottom: 1px solid oklch(0.16 0.012 250 / 0.12);
}

.batch-item:last-child {
  border-bottom: 0;
}

.batch-item-name {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}

.batch-item-status {
  margin: 0;
  color: var(--muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.batch-item-error {
  margin: 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.35;
}

.batch-item.is-uploading,
.batch-item.is-processing {
  background: var(--accent-soft);
}

.batch-item.is-uploaded {
  background: oklch(0.96 0.04 150);
}

.batch-item.is-failed {
  background: oklch(0.96 0.04 25);
}

.batch-item.is-waiting .batch-item-status {
  color: var(--warning);
}

.batch-clear {
  justify-self: end;
  min-width: 130px;
}

.upload-message h2,
.upload-queue h2 {
  margin: 6px 0 0;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.upload-message p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.upload-message.is-success {
  background: oklch(0.96 0.04 150);
}

.upload-message.is-error {
  background: oklch(0.96 0.04 25);
}

.upload-message.is-warning {
  background: oklch(0.97 0.04 55);
}

.queue-summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  max-width: 34ch;
}

.upload-queue-actions {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.queue-count {
  display: grid;
  place-items: center;
  width: 54px;
  aspect-ratio: 1;
  border: 2px solid var(--rule);
  background: var(--accent);
  color: white;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 22px;
}

.queue-clear {
  min-width: 130px;
}

@media (max-width: 620px) {
  body {
    background: var(--bg);
  }

  .upload-shell {
    border-inline: 0;
  }

  .upload-head {
    min-height: 64px;
    padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  }

  .upload-hero {
    grid-template-columns: 1fr;
  }

  .upload-hero-copy {
    border-right: 0;
    border-bottom: 2px solid var(--rule);
    padding: 24px 20px;
  }

  .upload-status {
    min-height: 70px;
    padding: 16px 20px;
  }

  .upload-field,
  .upload-picker,
  .upload-actions,
  .upload-message,
  .upload-queue,
  .upload-batch {
    padding-inline: 20px;
  }

  .upload-actions {
    grid-template-columns: 1fr;
  }

  .upload-picker-options {
    grid-template-columns: 1fr;
  }

  .upload-message,
  .upload-queue,
  .upload-batch {
    grid-template-columns: 1fr;
  }

  .upload-batch-panel {
    min-width: 0;
  }

  .upload-preview img {
    max-height: 16vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
