:root {
  --paper: #f0e5cd;
  --paper-deep: #e8dbbd;
  --card: #fbf5e6;
  --ink: #3a2e22;
  --muted: #8a7656;
  --accent: #9c6b2b;      /* deep ochre */
  --accent-deep: #7d521c;
  --gold: #b48a4a;
  --line: #ddccaa;
  --line-soft: #e7dabb;
  --shadow: 0 10px 30px rgba(70, 48, 20, 0.16);
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --display: "Playfair Display", Georgia, serif;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* Aged-paper vignette + a faint grain overlay */
body {
  background-image:
    radial-gradient(120% 120% at 50% 0%, #f7eed8 0%, var(--paper) 55%, var(--paper-deep) 100%);
  min-height: 100vh;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

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

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 2.6rem 1.1rem 1.4rem;
}
.hero-inner { max-width: 640px; margin: 0 auto; }

.frame {
  display: inline-block;
  padding: 9px;
  margin-bottom: 1rem;
  background: var(--card);
  border-radius: 50%;
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,.6);
}
.alex {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold);
  filter: sepia(0.18) contrast(1.02) saturate(0.95);
}

.kicker {
  font-family: var(--serif);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0 0 0.2rem;
  padding-left: 0.32em;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.4rem, 9vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0.1rem 0 0;
}
.hero h1 span { color: var(--accent-deep); font-style: italic; }

.ornament {
  margin: 0.7rem 0 0.4rem;
  color: var(--gold);
  font-size: 1.1rem;
}
.ornament span {
  display: inline-block;
  position: relative;
  padding: 0 1.1rem;
}
.ornament span::before,
.ornament span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 56px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.ornament span::before { right: 100%; transform: scaleX(-1); }
.ornament span::after { left: 100%; }

.lead {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  line-height: 1.35;
  margin: 0.5rem auto 0.4rem;
  max-width: 30rem;
}
.lead em { color: var(--accent-deep); font-style: italic; }
.sub {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0.4rem auto 0;
  max-width: 30rem;
}

/* ---- Layout ---- */
main { max-width: 880px; margin: 0 auto; padding: 0.6rem 1.1rem 3.5rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
  position: relative;
}
/* hairline double-frame, like an old card */
.card::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  pointer-events: none;
}
.upload-card { margin-top: 0.4rem; }

/* ---- Dropzone ---- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  text-align: center;
  padding: 1.7rem 1rem;
  border: 1.5px dashed var(--gold);
  border-radius: 4px;
  background: #fdf9ee;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.dropzone:active { transform: scale(0.995); }
.dropzone.drag { border-color: var(--accent); background: #f8efd9; }
.dz-icon {
  font-size: 1.8rem;
  color: var(--accent-deep);
  width: 58px; height: 58px;
  display: grid; place-items: center;
  background: #f3e6c8;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-weight: 400;
}
.dz-title { font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.dz-hint { color: var(--muted); font-size: 0.95rem; }

/* ---- Preview thumbs ---- */
.preview { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.preview .thumb {
  position: relative; width: 74px; height: 74px;
  overflow: hidden; background: #fff;
  border: 1px solid var(--line);
  padding: 3px;
  box-shadow: 0 2px 6px rgba(70,48,20,.15);
}
.preview .thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview .thumb button {
  position: absolute; top: 1px; right: 1px;
  width: 20px; height: 20px; border: none; border-radius: 50%;
  background: rgba(58,46,34,.78); color: #fff; font-size: 12px; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
}

/* ---- Fields & button ---- */
.field {
  width: 100%; margin-top: 0.7rem; padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--serif); font-size: 1.05rem;
  background: #fffdf7; color: var(--ink);
  resize: vertical;
}
.field::placeholder { color: #ab9a78; font-style: italic; }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(180,138,74,.22); }

.btn {
  width: 100%; margin-top: 1rem; padding: 0.95rem 1rem;
  border: 1px solid var(--accent-deep);
  border-radius: 4px;
  background: var(--accent); color: #fdf6e6;
  font-family: var(--display); font-weight: 700;
  font-size: 1.1rem; letter-spacing: 0.04em; cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  box-shadow: 0 3px 0 rgba(125,82,28,.4);
}
.btn:hover { background: var(--accent-deep); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; box-shadow: none; }

.status { margin-top: 0.8rem; text-align: center; min-height: 1.2em; font-size: 1.05rem; }
.status.ok { color: #4f7a3a; font-style: italic; }
.status.err { color: #b1452f; }
.status.busy { color: var(--muted); font-style: italic; }

/* ---- Gallery ---- */
.gallery-section { margin-top: 2.6rem; }
.gallery-section h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.7rem;
  text-align: center;
  margin: 0 0 1.3rem;
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
}
.gallery-section h2::before,
.gallery-section h2::after {
  content: "";
  height: 1px; width: 48px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.count { color: var(--muted); font-weight: 400; font-size: 1.05rem; font-style: italic; }

.gallery { columns: 2; column-gap: 0.7rem; }
@media (min-width: 560px) { .gallery { columns: 3; } }
@media (min-width: 820px) { .gallery { columns: 4; } }

.tile {
  break-inside: avoid;
  margin-bottom: 0.9rem;
  background: #fffdf7;
  padding: 7px 7px 0;
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(70, 48, 20, 0.14);
  cursor: pointer;
  animation: pop 0.3s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tile img { width: 100%; height: auto; background: #efe3c6; filter: sepia(0.06); }
.tile .ph {
  width: 100%; aspect-ratio: 4 / 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.4rem; color: var(--gold);
  background: repeating-linear-gradient(45deg, #f4ead2, #f4ead2 8px, #efe3c6 8px, #efe3c6 16px);
}
.tile .ph svg { width: 34px; height: 34px; }
.tile .ph small { font-style: italic; color: var(--muted); font-size: 0.85rem; }
.tile .cap { padding: 0.55rem 0.3rem 0.7rem; text-align: center; }
.tile .cap .who { font-family: var(--display); font-weight: 700; font-size: 1rem; }
.tile .cap .msg { color: var(--muted); font-size: 0.95rem; font-style: italic; margin-top: 0.1rem; line-height: 1.35; }

.empty { text-align: center; color: var(--muted); font-style: italic; padding: 2.4rem 0; font-size: 1.1rem; }

/* ---- Lightbox ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(36, 28, 18, 0.93);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1rem;
}
.lightbox img {
  max-width: 100%; max-height: 80vh;
  background: #fff; padding: 8px 8px 0;
  border: 1px solid #c9b88f;
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
}
.lb-close {
  position: absolute; top: 1rem; right: 1rem;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.12); color: #fff;
  font-size: 1.2rem; cursor: pointer;
}
.lb-caption { color: #f3e8d2; margin-top: 1rem; text-align: center; max-width: 40rem; font-family: var(--display); }
.lb-caption .who { font-weight: 700; font-size: 1.15rem; }
.lb-caption .msg { color: #e0d3ba; font-style: italic; margin-top: 0.2rem; }

[hidden] { display: none !important; }
