/* ============================================================
   PINNWAND — Community Gallery · style.css
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,400;0,600;1,400&family=DM+Sans:wght@400;500&display=swap');

/* --- CSS Variables --- */
:root {
  --bg:            #f7f4f0;
  --bg-2:          #eeeae4;
  --surface:       #ffffff;
  --surface-2:     #f2ede8;
  --text:          #18130e;
  --text-2:        #6b5f54;
  --text-3:        #a89b8e;
  --accent:        #c9613a;
  --accent-h:      #b05530;
  --accent-light:  #f8ece6;
  --border:        rgba(0,0,0,0.08);
  --border-2:      rgba(0,0,0,0.14);
  --radius-sm:     8px;
  --radius:        14px;
  --radius-lg:     20px;
  --shadow-sm:     0 1px 4px rgba(0,0,0,0.07), 0 0 1px rgba(0,0,0,0.05);
  --shadow:        0 2px 10px rgba(0,0,0,0.09), 0 0 1px rgba(0,0,0,0.06);
  --shadow-hover:  0 8px 28px rgba(0,0,0,0.13), 0 0 1px rgba(0,0,0,0.06);
  --shadow-modal:  0 24px 64px rgba(0,0,0,0.28);
  --transition:    .18s ease;
  --font-display:  'Fraunces', Georgia, serif;
  --font-body:     'DM Sans', system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg:            #161210;
  --bg-2:          #1e1a17;
  --surface:       #231f1b;
  --surface-2:     #2b2622;
  --text:          #f0ebe5;
  --text-2:        #a89b8e;
  --text-3:        #6b5f54;
  --accent:        #e07045;
  --accent-h:      #c9613a;
  --accent-light:  #2e1c12;
  --border:        rgba(255,255,255,0.07);
  --border-2:      rgba(255,255,255,0.12);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: var(--font-body); }
input, textarea { font-family: var(--font-body); }

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 62px;
  background: rgba(247,244,240,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  transition: background var(--transition);
}

[data-theme="dark"] .nav {
  background: rgba(22,18,16,0.88);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.3px;
}

.nav-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.nav-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  width: 16px; height: 16px;
}

.nav-search input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  border-radius: 24px;
  border: 1.5px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}
.nav-search input:focus { border-color: var(--accent); }
.nav-search input::placeholder { color: var(--text-3); }

.nav-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border-2);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-h); }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  padding: 0;
}
.btn-icon:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn-icon svg { width: 16px; height: 16px; }

/* ============================================================
   CATEGORIES BAR
   ============================================================ */
.categories-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 62px;
  z-index: 100;
  transition: background var(--transition);
}
.categories-bar::-webkit-scrollbar { display: none; }

.cat-pill {
  padding: 6px 16px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  border: 1.5px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  transition: all var(--transition);
}
.cat-pill:hover, .cat-pill.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ============================================================
   MASONRY GRID
   ============================================================ */
.grid-wrap { padding: 16px 16px 60px; }

.masonry {
  columns: 5;
  column-gap: 12px;
}
@media (max-width: 1400px) { .masonry { columns: 4; } }
@media (max-width: 1100px) { .masonry { columns: 3; } }
@media (max-width: 700px)  { .masonry { columns: 2; } }
@media (max-width: 400px)  { .masonry { columns: 1; } }

/* PIN CARD */
.pin {
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
}
.pin:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.pin-img-wrap { position: relative; overflow: hidden; }
.pin-img-wrap img {
  width: 100%;
  height: auto;
  transition: transform .35s ease;
}
.pin:hover .pin-img-wrap img { transform: scale(1.04); }

/* Pin overlay */
.pin-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 40%, rgba(0,0,0,0.5) 100%);
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
}
.pin:hover .pin-overlay { opacity: 1; }

.pin-overlay-top { display: flex; justify-content: flex-end; gap: 6px; }
.pin-overlay-bottom { display: flex; justify-content: space-between; align-items: center; }

.save-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition);
}
.save-btn:hover { background: var(--accent-h); }

.overlay-icon-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  display: flex; align-items: center; justify-content: center;
  color: #18130e;
  transition: background var(--transition);
  flex-shrink: 0;
}
.overlay-icon-btn:hover { background: #fff; }
.overlay-icon-btn svg { width: 14px; height: 14px; }

.overlay-icon-btn.liked { background: #fee2e2; color: #e24b4a; }

/* Pin footer */
.pin-footer { padding: 10px 12px 12px; }
.pin-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 7px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pin-meta { display: flex; align-items: center; gap: 7px; }
.avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.pin-author { font-size: 12px; color: var(--text-2); }
.pin-likes {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-3);
  display: flex; align-items: center; gap: 3px;
}
.pin-likes svg { width: 11px; height: 11px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-3);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: .4; }
.empty-state p { font-size: 15px; }

/* ============================================================
   LIGHTBOX / MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  display: flex;
  box-shadow: var(--shadow-modal);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  transition: background var(--transition);
}
.modal-close:hover { background: var(--bg-2); }
.modal-close svg { width: 16px; height: 16px; }

.modal-img {
  flex: 0 0 50%;
  max-height: 90vh;
  overflow: hidden;
}
.modal-img img { width: 100%; height: 100%; object-fit: cover; }

.modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 28px;
  gap: 18px;
}

.modal-actions-top { display: flex; gap: 8px; justify-content: flex-end; }

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.3;
  color: var(--text);
}
.modal-desc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
}

.modal-author-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.modal-author-row .avatar { width: 36px; height: 36px; font-size: 13px; }
.modal-author-name { font-size: 14px; font-weight: 500; }
.modal-author-sub { font-size: 12px; color: var(--text-3); }
.follow-btn {
  margin-left: auto;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border-2);
  background: transparent;
  color: var(--text);
  transition: all var(--transition);
}
.follow-btn:hover, .follow-btn.following {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* Like row in modal */
.modal-like-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.like-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border-2);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.like-btn:hover { border-color: #e24b4a; color: #e24b4a; }
.like-btn.liked { background: #fee2e2; border-color: #fca5a5; color: #e24b4a; }
.like-btn svg { width: 15px; height: 15px; }

.board-btn {
  flex: 1;
  padding: 9px 16px;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition);
}
.board-btn:hover { background: var(--accent-h); }

/* Comments */
.comments-section { border-top: 1px solid var(--border); padding-top: 16px; }
.comments-title { font-size: 14px; font-weight: 500; margin-bottom: 12px; color: var(--text-2); }

.comment {
  display: flex; gap: 9px;
  margin-bottom: 12px;
}
.comment .avatar { width: 28px; height: 28px; font-size: 10px; flex-shrink: 0; margin-top: 2px; }
.comment-body {}
.comment-author { font-size: 13px; font-weight: 500; color: var(--text); }
.comment-text { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-top: 1px; }
.comment-time { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.comment-input-row {
  display: flex; gap: 9px; align-items: flex-end; margin-top: 12px;
}
.comment-input-row .avatar { width: 28px; height: 28px; font-size: 10px; flex-shrink: 0; }
.comment-input-wrap { flex: 1; }
.comment-input-wrap textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-2);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color var(--transition), background var(--transition);
}
.comment-input-wrap textarea:focus { border-color: var(--accent); }
.comment-input-wrap textarea::placeholder { color: var(--text-3); }
.comment-submit {
  margin-top: 6px;
  float: right;
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition);
}
.comment-submit:hover { background: var(--accent-h); }

@media (max-width: 640px) {
  .modal { flex-direction: column; }
  .modal-img { flex: 0 0 220px; }
}

/* ============================================================
   BOARDS PANEL (Sidebar/Modal)
   ============================================================ */
.boards-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

.boards-panel-header {
  padding: 20px 20px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.boards-panel-header h3 { font-family: var(--font-display); font-size: 18px; }

.boards-panel-body { padding: 16px 20px 20px; overflow-y: auto; flex: 1; }

.board-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--bg);
}
.board-card:hover { border-color: var(--accent); background: var(--accent-light); }
.board-card.selected { border-color: var(--accent); background: var(--accent-light); }

.board-thumb {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  overflow: hidden;
}
.board-thumb canvas, .board-thumb img { width: 100%; height: 100%; object-fit: cover; }
.board-info { flex: 1; }
.board-info-name { font-size: 14px; font-weight: 500; }
.board-info-count { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.board-check { color: var(--accent); }
.board-check svg { width: 18px; height: 18px; }

.new-board-form { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 14px; }
.new-board-form input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-2);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  margin-bottom: 8px;
  transition: border-color var(--transition);
}
.new-board-form input:focus { border-color: var(--accent); }
.new-board-form input::placeholder { color: var(--text-3); }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn .2s ease, toastOut .2s ease 2.3s forwards;
}
@keyframes toastIn  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { to   { opacity:0; transform:translateY(8px); } }

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.divider { height: 1px; background: var(--border); margin: 4px 0; }

[x-cloak] { display: none !important; }