:root {
  --ink: #15120d;
  --ink-2: #1d1913;
  --ink-3: #241f17;
  --paper: #ede6d6;
  --paper-dim: #a89e8c;
  --safelight: #e8590c;
  --safelight-2: #ff6b1f;
  --safelight-dim: #7a3312;
  --negative: #4e6b5c;
  --line: rgba(237, 230, 214, 0.12);
  --line-strong: rgba(237, 230, 214, 0.24);
  --danger: #c1443c;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

/* Header / film strip */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}

.perf {
  height: 5px;
  background-color: var(--safelight-dim);
  background-image: radial-gradient(circle, var(--ink) 42%, transparent 43%);
  background-size: 14px 5px;
  background-position: 4px center;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--paper);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.brand-dot {
  color: var(--safelight);
  margin-left: 4px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--paper-dim);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  position: relative;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--paper);
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--safelight);
}

.logout-form {
  margin: 0;
  display: inline;
}

/* Layout */

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px 80px;
  min-height: calc(100vh - 46px);
}

.sheet-head {
  margin-bottom: 28px;
}

.sheet-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.4rem;
  color: var(--paper);
  margin: 0 0 6px;
}

.sheet-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--paper-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
}

.flash {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 10px 14px;
  margin: 0 0 20px;
  border: 1px solid var(--line-strong);
}

.flash--ok {
  color: var(--negative);
  border-color: var(--negative);
}

.flash--error {
  color: var(--danger);
  border-color: var(--danger);
}

/* Contact sheet grid */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.frame {
  position: relative;
  background: var(--ink-2);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  padding: 14px;
  transition: background 0.15s ease;
}

.frame:hover,
.frame:focus-visible {
  background: var(--ink-3);
}

.frame:hover .frame-window,
.frame:focus-visible .frame-window {
  box-shadow: 0 0 0 1px var(--safelight), 0 0 24px rgba(232, 89, 12, 0.35);
}

.frame:focus-visible {
  outline: 2px solid var(--safelight);
  outline-offset: -2px;
}

.frame-number {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--paper-dim);
  letter-spacing: 0.05em;
}

.frame-type {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.75rem;
  color: var(--safelight);
}

.frame-type--video {
  color: var(--negative);
}

.frame-window {
  margin-top: 10px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  transition: box-shadow 0.15s ease;
}

.frame-window img,
.frame-window video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.frame-caption {
  margin-top: 10px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--paper-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  padding: 60px 32px;
  text-align: center;
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--paper);
  margin: 0 0 8px;
}

.empty-state__body {
  font-family: var(--font-body);
  color: var(--paper-dim);
  margin: 0;
}

.empty-state a {
  color: var(--safelight);
}

/* Upload */

.upload-wrap {
  max-width: 640px;
  margin: 0 auto;
}

.dropzone-form {
  margin-top: 24px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed var(--line-strong);
  padding: 60px 24px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone--active {
  border-color: var(--safelight);
  background: rgba(232, 89, 12, 0.05);
}

.dropzone__glyph {
  font-size: 2rem;
  color: var(--safelight);
}

.dropzone__text {
  font-family: var(--font-body);
  color: var(--paper);
  font-size: 1rem;
}

.dropzone__link {
  color: var(--safelight);
  text-decoration: underline;
}

.dropzone__hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--paper-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dropzone input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.filelist {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--paper-dim);
}

.filelist__item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filelist__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.filelist__name {
  color: var(--paper);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filelist__bar {
  height: 4px;
  background: var(--line);
  overflow: hidden;
}

.filelist__fill {
  height: 100%;
  width: 0%;
  background: var(--safelight);
  transition: width 0.15s ease;
}

.filelist__status {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filelist__item--done .filelist__fill {
  background: var(--negative);
}

.filelist__item--done .filelist__status {
  color: var(--negative);
}

.filelist__item--error .filelist__fill {
  background: var(--danger);
}

.filelist__item--error .filelist__status {
  color: var(--danger);
}

/* Buttons */

.btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 20px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--paper-dim);
}

.btn--primary {
  background: var(--safelight);
  border-color: var(--safelight);
  color: var(--ink);
  font-weight: 600;
  margin-top: 20px;
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--safelight-2);
  border-color: var(--safelight-2);
}

.btn--block {
  width: 100%;
}

.btn--danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn--danger:hover,
.btn--danger:focus-visible {
  background: var(--danger);
  color: var(--paper);
}

/* Viewer */

.viewer {
  max-width: 1000px;
  margin: 0 auto;
}

.viewer__stage {
  background: #000;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.viewer__media {
  max-width: 100%;
  max-height: 78vh;
  display: block;
}

.viewer__strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 4px;
}

.viewer__filename {
  display: block;
  font-family: var(--font-body);
  color: var(--paper);
  font-size: 1rem;
  margin-bottom: 4px;
  word-break: break-word;
}

.viewer__exif {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--paper-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.viewer__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.viewer__actions form {
  margin: 0;
}

/* Login */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  border: 1px solid var(--line-strong);
  padding: 40px 32px;
  background: var(--ink-2);
}

.login-card__stamp {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--safelight);
  margin-bottom: 18px;
}

.login-card__title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--paper);
  margin: 0 0 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--paper-dim);
}

.field input {
  background: var(--ink);
  border: 1px solid var(--line-strong);
  color: var(--paper);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.field input:focus-visible {
  outline: none;
  border-color: var(--safelight);
}

/* Responsive */

@media (max-width: 640px) {
  .header-inner {
    padding: 14px 20px;
  }

  .main {
    padding: 28px 20px 60px;
  }

  .sheet-title {
    font-size: 1.9rem;
  }

  .contact-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .viewer__stage {
    min-height: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
