:root {
  --ink: #1c1a17;
  --paper: #f6f3ee;
  --panel: #ffffff;
  --line: #e3ddd2;
  --accent: #2f6f5e;   /* deep pine — a mosaic of "tiles" reads well in cool greens */
  --accent-2: #c96f3e; /* warm clay counterpoint, used sparingly */
  --muted: #8a8478;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

/* Signature element: a thin strip of mosaic "tiles" along the very top,
   each one a slightly different hand-picked hue, standing in for the
   photos-becoming-a-picture idea before any photo exists. */
.tilebar {
  display: flex;
  width: 100%;
  height: 10px;
}
.tilebar span {
  flex: 1 1 0;
  height: 100%;
}
.tilebar span:nth-child(6n+1) { background: #2f6f5e; }
.tilebar span:nth-child(6n+2) { background: #c96f3e; }
.tilebar span:nth-child(6n+3) { background: #e3ddd2; }
.tilebar span:nth-child(6n+4) { background: #7fa393; }
.tilebar span:nth-child(6n+5) { background: #1c1a17; }
.tilebar span:nth-child(6n)   { background: #d9b88f; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

h1 {
  font-family: "Iowan Old Style", Georgia, serif;
  font-weight: 600;
  font-size: 2.4rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
  color: var(--accent);
}

.lede {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 0 0 2rem;
  max-width: 46ch;
}

/* One-tap upload button: big, thumb-friendly, no second confirmation step */
.upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 1.15rem 1rem;
  background: var(--accent);
  color: #fdfaf5;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, background 0.15s ease;
}
.upload-btn:active { transform: scale(0.98); }
.upload-btn:hover { background: #275e50; }
.upload-btn.small {
  width: auto;
  display: inline-flex;
  padding: 0.7rem 1.2rem;
  font-size: 1rem;
  border-radius: 10px;
}
.upload-btn-icon { font-size: 1.4rem; line-height: 1; }
.upload-btn-fallback {
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 1rem;
}

.hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.75rem 0 2.5rem;
}

.preview {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}
.preview img {
  display: block;
  width: 100%;
  height: auto;
}
.preview-caption {
  margin: 0;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.preview-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.flashes { margin-bottom: 1.5rem; }
.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
}
.flash-success { background: #e4efe9; color: #275e50; border: 1px solid #c3ddd2; }
.flash-error { background: #f6e6e0; color: #9c4322; border: 1px solid #ecc9b8; }

/* Admin */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
}
.stat-list { list-style: none; margin: 0 0 1rem; padding: 0; font-size: 0.95rem; line-height: 1.9; }
.warn { color: var(--accent-2); }
.muted { color: var(--muted); }

.stats-details {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}
.stats-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  -webkit-tap-highlight-color: transparent;
}
.stats-details summary::-webkit-details-marker { display: none; }
.stats-details summary::before {
  content: "▸";
  display: inline-block;
  font-size: 0.75em;
  transition: transform 0.15s ease;
}
.stats-details[open] summary::before { transform: rotate(90deg); }
.stats-details summary:hover { color: #275e50; }

.stats-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 0.9rem 0 0;
  font-size: 0.88rem;
}
.stats-grid dt { color: var(--muted); }
.stats-grid dd { margin: 0; word-break: break-word; }
.inline-form { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.inline-form button, .inline-form input[type=file] {
  font-family: inherit;
  font-size: 0.95rem;
}
.inline-form button {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.settings-label {
  font-weight: 600;
  font-size: 0.9rem;
}
.settings-input-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.settings-input-row input[type=number] {
  width: 6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
}
.settings-suffix {
  color: var(--muted);
  font-size: 0.9rem;
}
.settings-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  max-width: 52ch;
}
.settings-form button {
  align-self: flex-start;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.9rem;
}
.tile-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
}
.tile-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.tile-card figcaption {
  padding: 0.4rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.35;
  word-break: break-all;
}
.delete-btn {
  width: 100%;
  border: none;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--accent-2);
  padding: 0.4rem;
  font-size: 0.75rem;
  cursor: pointer;
}
.delete-btn:hover { background: #f6e6e0; }

@media (max-width: 480px) {
  h1 { font-size: 1.9rem; }
  .wrap { padding: 1.75rem 1rem 3rem; }
}
