/* Janów — clean editorial theme: black-on-white, high-contrast serif display,
   generous whitespace, matching the camp's poster aesthetic. */

:root {
  --bg: #fbfaf7;        /* warm off-white */
  --surface: #ffffff;
  --surface-2: #f4f2ec;
  --border: #e6e2d8;
  --text: #15120d;      /* near-black, warm */
  --muted: #6f6a60;
  --accent: #15120d;    /* editorial = ink */
  --danger: #b42318;
  --ok: #287d3c;
  --radius: 10px;
  --maxw: 680px;
  --serif: "Didot", "Bodoni 72", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand { font-family: var(--serif); font-weight: 700; letter-spacing: 0.01em; }
h1 { line-height: 1.05; }

a { color: var(--text); text-underline-offset: 2px; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* --- Landing / gate --- */
.gate-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.gate-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
}
.gate-card h1 {
  font-size: 2.4rem;
  margin: 0 0 0.4rem;
}
.gate-card p.muted, p.muted {
  color: var(--muted);
  font-size: 0.95rem;
}
.gate-card p.muted { margin: 0 0 1.5rem; }

input, textarea, button, select { font: inherit; }

input[type="text"], input[type="password"], input[type="email"] {
  width: 100%;
  padding: 0.8rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-align: center;
  letter-spacing: 0.12em;
}
input:focus, textarea:focus { outline: none; border-color: var(--text); }

button, .btn {
  display: inline-block;
  margin-top: 1rem;
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--text);
  color: #fff;
  border: 1px solid var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
button:hover, .btn:hover { opacity: 0.85; }

.error { color: var(--danger); font-size: 0.9rem; margin-top: 0.75rem; min-height: 1.2em; }

/* Gate consent: secondary "just now" button, scan hint, cookie note */
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--surface-2); opacity: 1; }
.scan-hint { color: var(--ok); font-size: 0.9rem; margin: 0.5rem 0 0.25rem; }
.cookie-note { font-size: 0.8rem; color: var(--muted); margin: 1rem 0 0; line-height: 1.4; }
.cookie-note a { color: var(--muted); }

/* Cookie policy / prose page */
.prose { line-height: 1.7; }
.prose h1 { font-size: 1.9rem; margin: 0.5rem 0 1rem; }
.prose h2 { font-size: 1.25rem; margin: 1.75rem 0 0.5rem; }
.prose ul { padding-left: 1.2rem; }
.prose code { background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.9em; }
.cookie-table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; font-size: 0.92rem; }
.cookie-table th, .cookie-table td { text-align: left; vertical-align: top; padding: 0.6rem; border: 1px solid var(--border); }
.cookie-table th { background: var(--surface-2); }

/* --- Top bar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(251,250,247,0.9);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.topbar { flex-wrap: wrap; gap: 0.5rem; }
.topbar .brand { font-size: 1.5rem; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.9rem; font-size: 0.9rem; }
.topbar nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.topbar nav a:hover { color: var(--text); }

.back-link { display: inline-block; color: var(--muted); text-decoration: none; font-size: 0.9rem; margin: 0 0 0.5rem; }
.back-link:hover { color: var(--text); }

.form-actions { display: flex; align-items: center; gap: 1.25rem; margin-top: 1.75rem; }
.form-actions button[type="submit"] { margin-top: 0; }
.btn-secondary { color: var(--muted); text-decoration: none; }
.btn-secondary:hover { color: var(--text); text-decoration: underline; }

/* --- Feed --- */
.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.post h2 { margin: 0 0 0.35rem; font-size: 1.6rem; line-height: 1.15; }
.post .meta { color: var(--muted); font-size: 0.8rem; margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 0.06em; }
.post .body { font-size: 1.02rem; }
.post .body img, .post .body video { max-width: 100%; border-radius: 6px; }
.post .media { margin-top: 1rem; display: grid; gap: 0.75rem; }
.post .media img, .post .media video { width: 100%; border-radius: 6px; display: block; border: 1px solid var(--border); }
.post .media img, .post .body img { cursor: zoom-in; }

/* Tap-to-enlarge overlay */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

/* Document (PDF) attachment */
.doc-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}
.doc-link:hover { border-color: var(--text); }
.doc-link .doc-ic { font-size: 1.3rem; }

.empty { color: var(--muted); text-align: center; padding: 4rem 1rem; font-style: italic; }

button.linklike {
  width: auto; margin: 0; padding: 0;
  background: none; color: var(--muted); border: none; font-weight: 400;
}
button.linklike:hover { background: none; color: var(--text); text-decoration: underline; opacity: 1; }
button.linklike.danger { color: var(--danger); }

/* --- Admin --- */
.admin-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.admin-actions .btn { width: auto; margin: 0; }

.post-form label { display: block; margin: 1.25rem 0 0.4rem; font-weight: 600; }
.post-form input[type="text"] { text-align: left; letter-spacing: normal; }
.post-form input[type="file"] { display: block; margin-top: 0.4rem; color: var(--muted); }
#editor { background: #fff; color: #111; border-radius: 0 0 8px 8px; min-height: 200px; font-family: var(--sans); }
.ql-toolbar.ql-snow { border-radius: 8px 8px 0 0; background: var(--surface-2); border-color: var(--border); }
.ql-container.ql-snow { border-color: var(--border); }
.post-form button[type="submit"] { width: auto; margin-top: 1.75rem; }

.media-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

.list-head { display: flex; align-items: center; justify-content: space-between; }
.list-head .btn { width: auto; margin: 0; }
.admin-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border);
}
.row-actions { display: flex; align-items: center; gap: 1rem; white-space: nowrap; font-size: 0.9rem; }
.admin-row .meta { color: var(--muted); font-size: 0.8rem; }

/* --- Access codes --- */
.code-create {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem;
  margin: 1.25rem 0 2rem; padding: 1.25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.code-create label { display: flex; flex-direction: column; gap: 0.4rem; font-weight: 600; }
.code-create input { text-align: left; letter-spacing: normal; }
.code-create button { width: auto; margin: 0; }
label.checkbox { flex-direction: row; align-items: center; gap: 0.45rem; font-weight: 400; }
label.checkbox input { width: auto; }

.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.code-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; text-align: center;
}
.code-card .qr { background: #fff; border-radius: 6px; padding: 6px; border: 1px solid var(--border); }
.code-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.3rem; letter-spacing: 0.12em; margin: 0.7rem 0 0.2rem; }
.badge { display: inline-block; font-size: 0.7rem; padding: 0.12rem 0.5rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.badge.ok { background: rgba(40,125,60,0.12); color: var(--ok); }
.badge.off { background: rgba(180,35,24,0.1); color: var(--danger); }
.badge.email { background: rgba(21,18,13,0.08); color: var(--text); }
.code-actions { display: flex; justify-content: center; gap: 1rem; margin-top: 0.75rem; font-size: 0.9rem; }
.hashmono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Prevent long links/words from forcing horizontal scroll on narrow screens. */
.post .body, .post h2, .admin-row, .doc-link { overflow-wrap: anywhere; }
img, video { max-width: 100%; }

/* --- Phone polish --- */
@media (max-width: 480px) {
  .container { padding: 1.1rem 1rem 3rem; }
  .post { padding: 1.25rem; }
  .post h2 { font-size: 1.35rem; }
  .post .body { font-size: 1rem; }
  .gate-card { padding: 2rem 1.5rem; }
  .gate-card h1 { font-size: 2rem; }
  .topbar { padding: 0.85rem 1rem; }
  .topbar .brand { font-size: 1.3rem; }
  .code-create { padding: 1rem; gap: 0.85rem; }
  .code-create label, .code-create button, .code-create input { width: 100%; }
  /* Comfortable tap targets for admin row actions. */
  .row-actions { gap: 1.25rem; }
  .row-actions a, .row-actions button { padding: 0.25rem 0; }
}
