:root {
  --bg: #faf8f5;
  --ink: #2b2722;
  --muted: #6f6a62;
  --accent: #a9784f;
  --accent-dark: #8a5f3c;
  --card: #ffffff;
  --border: #e7e1d8;
  --error: #b3261e;
  --error-bg: #fdecea;
  --ok: #2e7d32;
  --ok-bg: #eaf6ea;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(43, 39, 34, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

a { color: var(--accent-dark); }

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ---------- Hero / título ---------- */
.hero { text-align: center; margin-bottom: 36px; }
.hero-small { text-align: left; position: relative; }
.hero-title {
  font-size: 2.4rem;
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.hero-subtitle { color: var(--muted); margin: 0; }
.back-link {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--accent-dark); }

/* ---------- Galeria ---------- */
.gallery { margin-bottom: 32px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.gallery-item {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 4 / 3;
  background: var(--card);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* ---------- Comunidade: mosaico tipo Google Images ---------- */
.community-masonry {
  column-count: 4;
  column-gap: 14px;
}
.community-tile {
  margin: 0 0 14px;
  break-inside: avoid;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--card);
  border: 1px solid var(--border);
}
.community-tile-media {
  position: relative;
  line-height: 0;
}
.community-tile img,
.community-tile video {
  width: 100%;
  height: auto;
  display: block;
}
/* Carimbo de data sobre a foto/vídeo, estilo câmara analógica. */
.community-tile-datestamp {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffb703;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.85), 0 0 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.community-tile figcaption {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.community-tile-title {
  font-size: 0.85rem;
  font-weight: 700;
}
@media (max-width: 900px) { .community-masonry { column-count: 3; } }
@media (max-width: 640px) { .community-masonry { column-count: 2; } }
@media (max-width: 420px) { .community-masonry { column-count: 1; } }

/* ---------- Texto de apresentação ---------- */
.intro-text {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  white-space: pre-wrap;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* ---------- Blog ---------- */
.blog-heading { font-size: 1.6rem; margin-bottom: 20px; }
.post-list { display: flex; flex-direction: column; gap: 24px; }
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 280px 1fr;
}
.post-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-body { padding: 20px 24px; display: flex; flex-direction: column; }
.post-title { font-weight: 700; margin: 0 0 8px; font-size: 1.2rem; }
.post-text { margin: 0 0 14px; white-space: pre-wrap; color: var(--ink); }
.community-link {
  font-size: 0.78rem;
  color: #1a56db;
  text-decoration: none;
  margin-top: auto;
}
.community-link:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .post-card { grid-template-columns: 1fr; }
  .post-photo { aspect-ratio: 16 / 9; }
}

.empty-state { color: var(--muted); font-style: italic; }

/* ---------- Auth pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.auth-card h1 { font-size: 1.4rem; margin-top: 0; }
.auth-hint { color: var(--muted); font-size: 0.92rem; }
.auth-card form, form.auth-card { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.auth-card label { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.auth-card input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}
.auth-card button, .button-link {
  margin-top: 14px;
  padding: 11px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: inline-block;
}
.auth-card button:hover, .button-link:hover { background: var(--accent-dark); }
.qr-code { width: 200px; height: 200px; margin: 16px auto; display: block; }
.secret-key {
  display: block;
  background: var(--bg);
  border: 1px dashed var(--border);
  padding: 8px;
  border-radius: 8px;
  word-break: break-all;
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.form-error {
  background: var(--error-bg);
  color: var(--error);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
}

/* ---------- Admin / Backoffice ---------- */
.admin-page { max-width: 880px; margin: 0 auto; padding: 32px 24px 100px; }
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.admin-header h1 { margin: 0; font-size: 1.6rem; }
.admin-header-actions { display: flex; align-items: center; gap: 16px; }
.link-button {
  background: none;
  border: none;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  text-decoration: underline;
}

.flash { padding: 10px 14px; border-radius: 8px; font-size: 0.92rem; margin-bottom: 16px; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--error-bg); color: var(--error); }

.admin-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}
.admin-section h2 { margin-top: 0; font-size: 1.15rem; }

.admin-form { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.admin-form label { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
.admin-form input[type="text"],
.admin-form textarea,
.admin-form input[type="file"] {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}
.admin-form button, .admin-form-inline button {
  align-self: flex-start;
  margin-top: 10px;
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.admin-form button:hover, .admin-form-inline button:hover { background: var(--accent-dark); }
.word-count-hint { font-size: 0.78rem; color: var(--muted); margin: 0; }

.admin-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.admin-thumb { text-align: center; }
.admin-thumb img,
.admin-thumb video {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 6px;
}
.admin-thumb form.admin-form-inline { margin-bottom: 4px; }
.admin-thumb input[type="date"] {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  flex: 1;
  min-width: 0;
}
.admin-form-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.danger-button {
  background: none;
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}
.danger-button:hover { background: var(--error-bg); }

.admin-post { border-top: 1px solid var(--border); padding: 14px 0; }
.admin-post summary { cursor: pointer; font-size: 1rem; padding: 6px 0; }
.admin-post-preview { max-width: 200px; border-radius: 8px; margin: 10px 0; display: block; }
.admin-post-actions { margin-top: 6px; }
