/* -----------------------------------------------------------
   Tokens
   ----------------------------------------------------------- */
:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --ink-soft: #5b5a57;
  --line: #e4ded3;
  --line-strong: #c8c0b1;
  --accent: #6b6256;
  --accent-soft: rgba(107, 98, 86, 0.08);
  --ok: #2f7d4a;
  --ok-soft: rgba(47, 125, 74, 0.1);
  --err: #a3372a;
  --err-soft: rgba(163, 55, 42, 0.08);
  --shadow: 0 1px 2px rgba(20, 16, 8, 0.04),
    0 8px 24px rgba(20, 16, 8, 0.04);

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 20px;

  --serif: "Playfair Display", "Hoefler Text", "Times New Roman", Georgia,
    serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --surface: #1c1b17;
    --ink: #ece7dc;
    --ink-soft: #9e988b;
    --line: #2a2823;
    --line-strong: #3d3a32;
    --accent: #c9bfa9;
    --accent-soft: rgba(201, 191, 169, 0.08);
    --ok: #7ec18e;
    --ok-soft: rgba(126, 193, 142, 0.1);
    --err: #e08a7a;
    --err-soft: rgba(224, 138, 122, 0.1);
    --shadow: none;
  }
}

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

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@media (min-width: 600px) {
  body {
    font-size: 17px;
  }
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
}

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

/* -----------------------------------------------------------
   Layout
   ----------------------------------------------------------- */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--s-6) var(--s-5) var(--s-8);
}

@media (min-width: 600px) {
  main {
    padding: var(--s-7) var(--s-5) var(--s-8);
  }
}

/* -----------------------------------------------------------
   Hero
   ----------------------------------------------------------- */
.hero {
  text-align: center;
  padding-block: var(--s-4) var(--s-4);
}

@media (min-width: 600px) {
  .hero {
    padding-block: var(--s-6) var(--s-5);
  }
}

.portrait {
  width: clamp(140px, 36vw, 192px);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto var(--s-5);
  background: var(--line);
}

h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 6.2vw, 44px);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.15;
  margin: 0 0 var(--s-3);
}

.dates {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  margin: 0 0 var(--s-4);
}

.divider {
  width: 56px;
  height: 1px;
  background: var(--line-strong);
  border: 0;
  margin: 0 auto var(--s-5);
}

.lede {
  color: var(--ink-soft);
  max-width: 42ch;
  margin: 0 auto;
  line-height: 1.6;
}

/* -----------------------------------------------------------
   Uploader heading (visually hidden)
   ----------------------------------------------------------- */
h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  margin: 0 0 var(--s-4);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -----------------------------------------------------------
   Picker / dropzone
   ----------------------------------------------------------- */
.picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  min-height: 160px;
  padding: var(--s-7) var(--s-5);
  border: 2px dashed var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

@media (max-width: 600px) {
  .picker {
    min-height: 140px;
    padding: var(--s-6) var(--s-4);
  }
}

.picker:hover,
.picker:focus-within,
.picker.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.picker.is-dragging {
  border-style: solid;
}

.picker-icon {
  width: 32px;
  height: 32px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.picker-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}

.picker-hint {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.4;
  max-width: 28ch;
}

.picker-mobile-only {
  display: none;
}

@media (max-width: 600px) {
  .picker-desktop-only {
    display: none;
  }
  .picker-mobile-only {
    display: inline;
  }
}

#files {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* -----------------------------------------------------------
   Success banner
   ----------------------------------------------------------- */
.banner {
  display: none;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-4);
  padding: var(--s-4);
  background: var(--ok-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
  font-size: 15px;
}

.banner.is-visible {
  display: flex;
}

.banner-icon {
  width: 20px;
  height: 20px;
  color: var(--ok);
  flex-shrink: 0;
}

.banner-text {
  flex: 1;
  min-width: 0;
}

.banner-action {
  background: none;
  border: 0;
  padding: var(--s-2) var(--s-3);
  margin: -8px -8px -8px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  border-radius: var(--r-sm);
  min-height: 44px;
}

.banner-action:hover {
  background: var(--accent-soft);
}

/* -----------------------------------------------------------
   File list
   ----------------------------------------------------------- */
.file-list {
  list-style: none;
  padding: 0;
  margin: var(--s-4) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.file-list:empty {
  display: none;
}

.file-list li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--s-4);
  align-items: center;
  padding: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

@media (max-width: 600px) {
  .file-list li {
    grid-template-columns: 48px 1fr;
    gap: var(--s-3);
  }
}

.thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--r-sm);
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

@media (max-width: 600px) {
  .thumb {
    width: 48px;
    height: 48px;
  }
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-video::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-list .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-3);
}

.file-name {
  font-size: 15px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.file-meta {
  font-size: 13px;
  color: var(--ink-soft);
}

.file-state {
  flex-shrink: 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.file-state.ok {
  color: var(--ok);
}

.file-state.err {
  color: var(--err);
}

.progress {
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 200ms ease;
}

.progress.is-active {
  opacity: 1;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 150ms ease;
}

.retry-link {
  align-self: flex-start;
  background: none;
  border: 0;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  min-height: 32px;
}

.retry-link:hover {
  color: var(--ink);
}

/* -----------------------------------------------------------
   Contact line + Turnstile + status
   ----------------------------------------------------------- */
.contact {
  margin: var(--s-6) 0 var(--s-2);
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
}

.contact a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.contact a:hover {
  color: var(--ink);
}

.turnstile {
  display: flex;
  justify-content: center;
}

.turnstile:empty {
  display: none;
}

.status {
  margin: var(--s-3) 0 0;
  min-height: 1.4em;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--err);
}

/* -----------------------------------------------------------
   noscript
   ----------------------------------------------------------- */
.noscript {
  margin: var(--s-5) 0;
  padding: var(--s-4);
  background: var(--err-soft);
  border: 1px solid var(--err);
  border-radius: var(--r);
  color: var(--ink);
  font-size: 14px;
  text-align: center;
}

/* -----------------------------------------------------------
   Reduced motion
   ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
