@font-face {
  font-family: 'Permanent Marker';
  src: url('/static/fonts/PermanentMarker-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Caveat';
  src: url('/static/fonts/Caveat-Variable.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

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

:root {
  --bg: #fafaf8;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e0ddd8;
  --accent: #2a2a2a;
  --card-bg: #fff;
  --error: #c33;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --fg: #e8e6e1;
    --muted: #8a8a8a;
    --border: #333;
    --accent: #e8e6e1;
    --card-bg: #242424;
    --error: #e55;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  min-height: 100dvh;
}

.centered {
  max-width: 400px;
  margin: 15vh auto 0;
  padding: 0 1rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }

.subtitle { color: var(--muted); margin-bottom: 1.5rem; }
.hint { color: var(--muted); font-size: 0.875rem; margin-top: 1rem; }
.hint a { color: var(--fg); }
.error { color: var(--error); margin-bottom: 1rem; font-size: 0.875rem; }
.empty { color: var(--muted); font-style: italic; }

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  margin-top: 1rem;
}

input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--bg);
  color: var(--fg);
}

button {
  margin-top: 1.25rem;
  width: 100%;
  padding: 0.625rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

button:hover { opacity: 0.85; }

.link { color: var(--muted); font-size: 0.875rem; display: block; text-align: center; margin-top: 1rem; }

nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 600; }
.user { margin-left: auto; color: var(--muted); font-size: 0.875rem; }

.link-button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0;
  margin: 0;
  width: auto;
}

.link-button:hover { color: var(--fg); }

.container { max-width: 640px; margin: 2rem auto; padding: 0 1.5rem; }

section { margin-bottom: 2rem; }

.item-list { list-style: none; }
.item-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.item-list a { color: var(--fg); text-decoration: none; font-weight: 500; }
.item-list a:hover { text-decoration: underline; }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--border);
  color: var(--muted);
  vertical-align: middle;
}

.inline { display: inline; }

.inline-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.inline-form input { flex: 1; }
.inline-form button { width: auto; margin-top: 0; padding: 0.5rem 1rem; }

h3 { font-size: 0.95rem; margin-bottom: 0.5rem; margin-top: 1.5rem; }
h3:first-child { margin-top: 0; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
}

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

.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.5rem;
  text-align: center;
  word-break: break-all;
}

.status-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  background: rgba(0,0,0,0.6);
  color: #fff;
}
.status-badge.rejected { background: var(--error); }

a.button {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
}
a.button:hover { opacity: 0.85; }

input[type="file"] {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--bg);
  color: var(--fg);
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.drop-zone.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.drop-zone-text {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.drop-zone-hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}
.drop-zone-browse {
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}
.drop-zone-browse:hover { opacity: 0.85; }
.drop-zone-browse input { display: none; }
.file-list {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}
#upload-btn {
  margin-top: 0.75rem;
}

/* Curation screen */
.curate-layout {
  max-width: 640px;
  margin: 1rem auto;
  padding: 0 1rem;
}

.curate-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}

.curate-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.curate-form { margin-top: 1rem; }

.curate-caption { margin-bottom: 0.75rem; }
.curate-caption input { margin-top: 0.25rem; }

.curate-stack { margin-bottom: 1rem; }
.curate-stack select { margin-top: 0.25rem; }

.curate-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.curate-actions button {
  flex: 1;
  min-width: 80px;
  margin-top: 0;
  padding: 0.625rem 0.5rem;
  font-size: 0.875rem;
}

.btn-assign { background: #2d7d46; color: #fff; }
.btn-skip { background: var(--border); color: var(--fg); }
.btn-reject { background: #b8860b; color: #fff; }
.btn-delete { background: var(--error); color: #fff; }

/* Polaroid view */
.view-bg {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #111;
  padding: 1rem;
}

.polaroid {
  background: #fff;
  padding: 5% 5% 0 5%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  max-width: 420px;
  width: 100%;
}

.polaroid-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.polaroid-chin {
  height: 0;
  padding-bottom: 26%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaroid-caption {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-1deg);
  font-family: 'Permanent Marker', 'Caveat', cursive;
  font-size: clamp(1rem, 4vw, 1.5rem);
  color: #222;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-controls {
  margin-top: 1.5rem;
}

.view-next {
  display: inline-block;
  padding: 0.5rem 2rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
}
.view-next:hover { background: rgba(255,255,255,0.25); }

nav a.brand {
  color: var(--fg);
  text-decoration: none;
}
nav a.link-button {
  text-decoration: none;
}
