:root {
  --bg: #f7f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --line: #e5e7eb;
  --brand: #0284c7;
  --accent: #22d3ee;
  --fs: 16px;
  --r: 16px;
  --shadow: 0 6px 18px rgba(2, 8, 23, 0.06);
}
html[data-font="small"] {
  --fs: 15px;
}
html[data-font="large"] {
  --fs: 18px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Noto Sans Myanmar", system-ui, -apple-system, Segoe UI,
    Roboto, Arial, sans-serif;
  font-size: var(--fs);
}
.shadow {
  box-shadow: var(--shadow);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.topbar .row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.brand {
  font-weight: 800;
  letter-spacing: 0.2px;
}
.btn {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.btn.sm {
  padding: 6px 10px;
}
.btn.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #075985;
  font-size: 0.9rem;
}
.nav {
  position: sticky;
  top: 48px;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  overflow: auto;
}
.nav button {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  white-space: nowrap;
}
.nav button.active {
  border-color: var(--brand);
}
.settings-inline {
  gap: 8px;
}
.opt {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.space {
  flex: 1;
}
.section {
  display: none;
}
.section.active {
  display: block;
}
.wrap {
  padding: 14px;
  max-width: 1100px;
  margin: 0 auto;
}
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.grid.two {
  grid-template-columns: 1fr;
}
.grid.three {
  grid-template-columns: 1fr;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--shadow);
}
/* Records list labels */
.card ol { margin-top: 8px; }
.card ol li { margin: 4px 0; line-height: 1.5; }
.card ol li strong { display: inline-block; min-width: 140px; }
.rec-photo-box { margin-bottom: 10px; text-align: center; }
.rec-photo { max-width: 140px; max-height: 140px; object-fit: cover; border-radius: 10px; }
.hero {
  text-align: left;
}
.hero h1 {
  margin: 0.2rem 0;
}
.title {
  margin: 0;
}
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.qr {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
.badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.8rem;
}
.note {
  color: var(--muted);
  font-size: 0.95rem;
}
.small {
  font-size: 0.85rem;
}
footer {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
.cards .card {
  transition: transform 0.15s ease;
}
.cards .card:hover {
  transform: translateY(-2px);
}
.blocks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
}
.block {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}
.block textarea {
  min-height: 90px;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.calendar .day {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  min-height: 130px;
  display: flex;
  flex-direction: column;
}
.calendar .day .d {
  font-weight: 700;
  font-size: 0.9rem;
}
.calendar .day textarea {
  margin-top: 6px;
  width: 100%;
  min-height: 64px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 6px;
  resize: vertical;
}
.calendar .day .note-view {
  margin-top: 6px;
  color: #64748b;
  white-space: pre-wrap;
  font-size: 0.9rem;
}
.tag {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  display: inline-block;
  margin-top: 6px;
}
.month-nav .pill {
  background: #ecfeff;
  color: #0e7490;
}
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 50;
}
.modal.show {
  display: block;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 23, 0.5);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 92vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.modal-card input {
  width: 100%;
  margin: 8px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
@media (min-width: 640px) {
  .grid.two {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid.three {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .wrap {
    max-width: 1200px;
  }
}
html[data-theme="dark"] {
  --bg: #0b1220;
  --card: #101827;
  --ink: #e5e7eb;
  --muted: #94a3b8;
  --line: #1f2937;
  --brand: #38bdf8;
  --accent: #60a5fa;
  background-image: radial-gradient(
      rgba(255, 255, 255, 0.06) 1px,
      transparent 1px
    ),
    linear-gradient(#0b1220, #0b1220);
  background-size: 4px 4px, auto;
  background-attachment: fixed;
}
html[data-theme="warm"] {
  --bg: #fffaf3;
  --card: #fff7ed;
  --ink: #3f2d1c;
  --muted: #7c5e3e;
  --line: #f2e8da;
  --brand: #ea580c;
  --accent: #f59e0b;
}
html[data-theme="emerald"] {
  --bg: #effdf5;
  --card: #ffffff;
  --ink: #064e3b;
  --muted: #0f766e;
  --line: #c7f0da;
  --brand: #10b981;
  --accent: #34d399;
}
html[data-theme="ocean"] {
  --bg: #ecfeff;
  --card: #ffffff;
  --ink: #0e7490;
  --muted: #0284c7;
  --line: #bae6fd;
  --brand: #06b6d4;
  --accent: #22d3ee;
}
html[data-theme="rose"] {
  --bg: #fff1f2;
  --card: #ffffff;
  --ink: #9f1239;
  --muted: #be123c;
  --line: #fecdd3;
  --brand: #f43f5e;
  --accent: #fb7185;
}
.gradient {
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.12),
    rgba(2, 132, 199, 0.06)
  );
}

/* --- Records photo fit --- */
.rec-photo-box {
  height: 240px; /* နည်းနည်းမြင့်ပေးထားတယ် */
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  overflow: hidden; /* scroll bar မပေါ်အောင် */
  margin-bottom: 8px;
}
.rec-photo-box img.rec-photo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain; /* <- fit: အပြည့်ထင် ပြ */
}
.rec-photo-box.empty {
  border: 1px dashed var(--line);
  color: #94a3b8;
}
@media (min-width: 640px) {
  .rec-photo-box {
    height: 260px;
  }
}

/* === Editable media preview & controls === */
.block .post-media {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}
.block .post-media .prev {
  width: 85%;
  max-width: 900px;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line, #e5e7eb);
}
.block .media-input {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.file.small input[type="file"] {
  display: none;
}
.file.small span {
  display: inline-block;
  padding: 6px 10px;
  border: 1px dashed var(--line, #e5e7eb);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

/* Post as blocks (one per row) */
#postGrid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
#postGrid .card {
  display: block;
  width: 100%;
}

/* Media center + 65% */
.post-media {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}
.post-media > img,
.post-media > video,
.post-media > audio {
  width: 65%;
  max-width: 900px;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line, #e5e7eb);
}

/* Footer & admin buttons */
.post-foot {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.post-actions {
  display: inline-flex;
  gap: 8px;
}
.btn.small {
  padding: 5px 10px;
  font-size: 0.85rem;
  border-radius: 8px;
}
.btn.danger {
  background: #ef4444;
  color: #fff;
}
.btn.edit {
  background: #3b82f6;
  color: #fff;
}

/* Like button */
.like-btn {
  border: 1px solid var(--line, #e5e7eb);
  background: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.like-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}
.like-btn.liked {
  background: #fee2e2;
  border-color: #fecaca;
  color: #b91c1c;
}
.like-count {
  min-width: 1.5ch;
  text-align: right;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding: 20px 16px 10px;
}

.footer-grid {
  display: grid;
  /* grid-template-columns: 1.2fr 1fr 1.2fr; */
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-brand {
  display: flex;
  gap: 10px;
  align-items: center;
}
.footer-brand .logo {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #001223;
  font-weight: 900;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}
.f-link {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--chip);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
}
.f-link:hover {
  outline: 2px solid var(--accent);
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.s-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
}
.s-btn:hover {
  outline: 2px solid var(--accent);
}
.s-btn svg {
  width: 26px;
  height: 26px;
  fill: #ddd;
  transition: fill 0.25s ease;
}

.s-btn:hover svg {
  fill: var(--accent, #0ea5e9);
}

.footer-bottom {
  display: flex;
  justify-content: center;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
}

/* --- Post Read-more clip --- */
.post-card .body {
  line-height: 1.7;
}
.post-card .body.clip {
  max-height: 320px; /* ကိုယ်စိတ်ကြိုက် ပြင်နိုင် */
  overflow: hidden;
  position: relative;
}
.post-card .body.clip::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--card));
}
.light .post-card .body.clip::after {
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--card));
}
.read-more {
  margin-top: 8px;
  display: inline-block;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--chip);
  cursor: pointer;
}

/* --- Pager --- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 0;
  margin-top: 8px;
}
.pager .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === Media preview === */
.media-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 10px auto;
  max-width: 90%;
}
.media-wrap img,
.media-wrap video,
.media-wrap audio {
  max-width: 65%; /* preview smaller (65%) */
  border-radius: 10px;
  cursor: zoom-in;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.media-wrap img:hover,
.media-wrap video:hover {
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
}

/* Fullscreen Zoom modal */
/* Utility */
.hidden {
  display: none !important;
}

/* Zoom modal — တစ်ခုပဲပြ, ကျန်တာ ပျောက် */
.media-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.media-modal img,
.media-modal video,
.media-modal audio {
  max-width: 95%;
  max-height: 95%;
  border-radius: 10px;
  cursor: zoom-out;
}
/* .media-modal.hidden { display: none; } */

/* === Responsive Image Gallery (1–3 per row) === */
.gallery {
  display: grid;
  gap: 10px;
  margin: 10px 0;
}
.gallery-row {
  display: grid;
  gap: 10px;
}
.gallery-row.cols-1 {
  grid-template-columns: 1fr;
}
.gallery-row.cols-2 {
  grid-template-columns: 1fr 1fr;
  align-items: center;
  justify-content: center;
}
.gallery-row.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  justify-content: center;
}

.gallery-row .cell {
  height: 240px; /* default height */
  display: flex;
  align-items: center; /* vertical center */
  justify-content: center; /* horizontal center */
  background: #fafafa;
  border-radius: 12px;
  overflow: hidden; /* tidy corners */
}
.gallery-row .cell.portrait {
  height: 320px;
}

.gallery-row img {
  max-width: 100%;
  max-height: 100%;
  width: auto; /* keep ratio */
  height: auto; /* keep ratio */
  object-fit: contain; /* never crop */
  border-radius: 8px;
  cursor: zoom-in;
  display: block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.gallery-row img:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
}

/* Mobile tweak */
@media (max-width: 720px) {
  .gallery-row .cell {
    height: 200px;
  }
  .gallery-row .cell.portrait {
    height: 260px;
  }
}

/* video / audio full width as before */
.post-media video,
.post-media audio {
  width: 100%;
  border-radius: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.4em;
  font-weight: bold;
}

.brand .logo {
  height: 40px;
  width: auto;
  border-radius: 8px;
  object-fit: contain;
}

.event-admin .ev-preview {
  display: grid;
  place-items: center;
  border: 1px dashed var(--border, #dbe2ea);
  border-radius: 12px;
  padding: 8px;
}
.event-admin .ev-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}