/* CaspiaDrop — a small set of custom styles; the visual system is still driven by Tailwind */

:root {
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: #f9f8f6;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
  background-size: auto, 180px 180px;
}

body::after {
  border: 1px solid rgba(26, 26, 26, 0.055);
  content: '';
  inset: 10px;
  pointer-events: none;
  position: fixed;
  z-index: 40;
}

@media (max-width: 640px) {
  body::after {
    inset: 6px;
  }
}

[hidden] {
  display: none !important;
}

::selection {
  background: #1a1a1a;
  color: #f9f8f6;
}

a,
button,
summary,
label {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
summary,
label:has(.switch input:not(:disabled)) {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

:focus-visible {
  outline: none;
}

/* Accessibility skip link */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  transform: translateY(-200%);
  border-radius: 0.5rem;
  background: #1a1a1a;
  color: #f9f8f6;
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  transition: transform 160ms ease;
}

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

/* Shared typographic hierarchy */
.eyebrow {
  color: #6f6b64;
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  line-height: 1.5;
  text-transform: uppercase;
}

.form-label {
  display: block;
  margin-bottom: 0.35rem;
  color: #6f6b64;
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 1.5;
  text-transform: uppercase;
}

.hint {
  margin-top: 0.55rem;
  color: #767169;
  font-size: 0.6875rem;
  line-height: 1.65;
}

.field-error {
  margin-top: 0.5rem;
  color: #a24e3d;
  font-size: 0.6875rem;
  line-height: 1.5;
}

/* Form fields */
.field {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #d5d0c8;
  border-radius: 0;
  background: transparent;
  color: #1a1a1a;
  font-size: 0.9rem;
  line-height: 1.6;
  outline: none;
  padding: 0.6rem 0 0.7rem;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.field::placeholder {
  color: #a09d97;
}

.field:hover {
  border-bottom-color: #aaa49b;
}

.field:focus {
  border-bottom-color: #1a1a1a;
  background: rgba(255, 255, 255, 0.34);
}

.field[aria-invalid="true"] {
  border-bottom-color: #a24e3d;
}

.field:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

textarea.field {
  min-height: 6.5rem;
  line-height: 1.7;
  resize: none;
}

input[readonly].field {
  color: #6b6b6b;
}

/* Disclosure panels */
summary::-webkit-details-marker {
  display: none;
}

summary {
  list-style: none;
}

details[open] > summary .summary-chevron {
  transform: rotate(180deg);
}

/* Toggle switches */
.switch {
  display: inline-flex;
  flex: none;
  position: relative;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  align-items: center;
  background: transparent;
  border: 1px solid #cfc9c0;
  border-radius: 2px;
  display: flex;
  height: 1.375rem;
  padding: 3px;
  transition:
    background-color 180ms ease,
    border-color 180ms ease;
  width: 2.25rem;
}

.switch-knob {
  background: #8f8a82;
  border-radius: 0;
  height: 0.75rem;
  transform: translateX(0);
  transition:
    background-color 180ms ease,
    transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  width: 0.75rem;
}

.switch input:checked + .switch-track {
  background: #1a1a1a;
  border-color: #1a1a1a;
}

.switch input:checked + .switch-track .switch-knob {
  background: #f9f8f6;
  transform: translateX(1rem);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid rgba(26, 26, 26, 0.22);
  outline-offset: 3px;
}

.switch input:disabled + .switch-track {
  opacity: 0.35;
}

label:has(.switch input:disabled) {
  cursor: not-allowed;
}

/* Drop zone */
#dropzone.is-dragging {
  background: #f4f2ee;
  border-color: #1a1a1a;
  transform: scale(0.995);
}

#dropzone.is-disabled {
  cursor: wait;
  opacity: 0.55;
  pointer-events: none;
}

/* Guest file queue */
.queue-row {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.8rem 0.9rem;
}

.queue-row + .queue-row {
  border-top: 1px solid #e5e2de;
}

.queue-icon {
  align-items: center;
  background: transparent;
  border: 1px solid #ddd8cf;
  border-radius: 0;
  color: #77736c;
  display: flex;
  flex: none;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.queue-meta {
  min-width: 0;
  flex: 1;
}

.queue-name {
  color: #1a1a1a;
  display: block;
  font-size: 0.75rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.queue-detail {
  color: #6b6b6b;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.625rem;
  line-height: 1.5;
  margin-top: 0.15rem;
}

.file-status {
  align-items: center;
  display: inline-flex;
  font-size: 0.5rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1;
  padding: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.file-status::before {
  background: currentColor;
  border-radius: 50%;
  content: '';
  height: 3px;
  margin-right: 5px;
  width: 3px;
}

.file-status--queued {
  color: #8d8880;
}

.file-status--uploading {
  color: #1a1a1a;
}

.file-status--delivered {
  color: #3d513f;
}

.file-status--failed {
  color: #a24e3d;
}

.remove-file {
  align-items: center;
  border-radius: 0;
  color: #a09d97;
  display: inline-flex;
  flex: none;
  height: 1.75rem;
  justify-content: center;
  transition:
    background-color 160ms ease,
    color 160ms ease;
  width: 1.75rem;
}

.remove-file:hover {
  background: transparent;
  color: #1a1a1a;
}

.remove-file:focus-visible {
  outline: 2px solid rgba(26, 26, 26, 0.2);
  outline-offset: 1px;
}

/* Success state */
#success-state:not([hidden]) .success-mark {
  animation: mark-pop 500ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.check-path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
}

#success-state:not([hidden]) .check-path {
  animation: check-draw 520ms 180ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Loading dots */
.loading-dots {
  align-items: center;
  display: flex;
  gap: 0.28rem;
  justify-content: center;
}

.loading-dots span {
  animation: loading-pulse 1.2s ease-in-out infinite;
  background: #d5d0c8;
  border-radius: 9999px;
  height: 0.25rem;
  width: 0.25rem;
}

.loading-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.loading-dots span:nth-child(3) {
  animation-delay: 240ms;
}

/* Gentle error feedback */
.shake {
  animation: soft-shake 320ms ease;
}

/* Setup dialog */
.guide-dialog {
  margin: auto;
}

.guide-dialog[open] {
  animation: dialog-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.guide-dialog::backdrop {
  animation: backdrop-in 220ms ease both;
}

.code-scroll {
  scrollbar-color: #4a4843 transparent;
  scrollbar-width: thin;
}

.code-scroll::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.code-scroll::-webkit-scrollbar-thumb {
  background: #4a4843;
  border-radius: 9999px;
}

@keyframes mark-pop {
  from {
    opacity: 0;
    transform: scale(0.82);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes check-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes loading-pulse {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes soft-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
