/* ── WORDS PAGE ─────────────────────────────────────────────── */

.right {
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 0;
}

.words-section-wrap {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  padding: 3rem 4vw 2rem;
  background: rgba(0,0,0,0.2);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border-radius: 15px;
  border-left: 3px solid #ffffff57;
  overflow: hidden;
}

#listView { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Post list */
.post-list-wrap {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: rgba(184,146,42,0.2) transparent;
}
.post-list-wrap::-webkit-scrollbar { width: 3px; }
.post-list-wrap::-webkit-scrollbar-thumb { background: rgba(184,146,42,0.2); }

.post-list { display: flex; flex-direction: column; }

.post-item {
  display: flex; flex-direction: row; align-items: center; gap: 1.2rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(200,185,160,0.12);
  cursor: pointer; text-decoration: none;
  transition: background 0.2s;
}
.post-item:first-child { border-top: 1px solid rgba(200,185,160,0.12); }
.post-item:hover { background: rgb(0 51 88 / 20%); }

.post-item-thumb {
  width: 84px; height: 84px; flex-shrink: 0;
  border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(184,146,42,0.12);
  align-self: center;
  box-shadow: 2px 2px 10px #292929;
}
.post-item-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.85); transition: filter 0.2s;
}
.post-item:hover .post-item-thumb img { filter: brightness(1.05); }

.post-item-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 0.15rem;
  align-self: center;
}

.post-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem; font-weight: 400;
  color: var(--parchment); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-item:hover .post-title { color: var(--gold); }

.post-item-meta {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem;
}
.post-date {
  font-size: 1.05rem; font-style: italic;
  color: var(--parchment); opacity: 0.6;
}
.post-word-count {
  font-size: 0.92rem; font-style: italic;
  color: var(--parchment); opacity: 0.85;
}
.post-arrow {
  font-size: 0.85rem; color: var(--bright-gold);
  opacity: 0; transition: opacity 0.2s;
  flex-shrink: 0; margin-left: auto; padding-right: 0.4rem;
  align-self: center; white-space: nowrap;
}
.post-item:hover .post-arrow { opacity: 0.7; }

/* Post reader */
.post-reader {
  display: none; flex-direction: column;
  flex: 1; min-height: 0; overflow: hidden;
}
.post-reader.visible { display: flex; }

.post-reader-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 1rem; font-style: italic; color: var(--gold);
  opacity: 0.6; cursor: pointer; margin-bottom: 1.2rem;
  background: none; border: none; padding: 0;
  text-decoration: none; align-self: flex-start;
  transition: opacity 0.2s; flex-shrink: 0;
}
.post-reader-back:hover { opacity: 1; }

.post-reader-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
  font-weight: 700; font-style: italic;
  color: var(--parchment); line-height: 1.2;
  margin-bottom: 0.4rem; flex-shrink: 0;
}
.post-reader-date {
  font-size: 0.98rem; font-style: italic;
  color: var(--parchment); opacity: 0.4;
  margin-bottom: 1.5rem; flex-shrink: 0;
}
.post-reader-divider {
  width: 40px; height: 1px; background: var(--gold);
  opacity: 0.4; margin-bottom: 1.5rem; flex-shrink: 0;
}
.post-reader-body {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: rgba(184,146,42,0.2) transparent;
  font-size: clamp(1.1rem, 1.3vw, 1.25rem);
  font-style: italic; line-height: 1.9;
  color: var(--parchment); opacity: 0.9;
}
.post-reader-body::-webkit-scrollbar { width: 3px; }
.post-reader-body p + p { margin-top: 1.1rem; }
.post-reader-body a { color: var(--gold); }
.post-reader-body h2, .post-reader-body h3 {
  font-family: 'Playfair Display', serif; font-style: italic;
  margin: 1.5rem 0 0.5rem; color: var(--parchment);
}

/* ── Native WordPress images: honor editor placement + sizes ──────────────────
   Standalone images authored in the post keep WordPress's own alignment
   (left / right / center / wide / full) and the width set in the editor. */
.post-reader-body img {
  max-width: 100%; height: auto;
  border-radius: 10px;
  border: 5px solid rgba(255,255,255,0.3);
  box-sizing: border-box;
}
.post-reader-body figure { margin: 1.5rem 0; }
.post-reader-body figure img { display: block; }
.post-reader-body figcaption {
  font-size: 0.9rem; font-style: italic;
  color: var(--bone); opacity: 0.7;
  text-align: center; margin-top: 0.4rem;
}
/* Standalone post images: Alt Text overlaid as an always-visible frosty band
   across the bottom of the image (added by JS, see single.js). */
.post-reader-body .post-img-figure {
  position: relative; display: inline-block;
  line-height: 0;
}
.post-reader-body .post-img-figure.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.post-reader-body .post-img-figure.alignleft  { float: left;  margin: 0.5rem 1.5rem 1rem 0; max-width: 50%; }
.post-reader-body .post-img-figure.alignright { float: right; margin: 0.5rem 0 1rem 1.5rem; max-width: 50%; }
.post-reader-body .post-img-figure.alignwide  { display: block; margin-left: -4vw; margin-right: -4vw; max-width: calc(100% + 8vw); }
.post-reader-body .post-img-figure.aligncenter > img,
.post-reader-body .post-img-figure.alignwide > img { width: 100%; }
.post-reader-body .post-img-figure > img,
.post-reader-body .post-img-figure > a { display: block; }
.post-reader-body .post-img-alt {
  position: absolute; left: 5px; right: 5px; bottom: 4px;
  border-radius: 0 0 5px 5px;
  display: flex; align-items: flex-end;
  padding: 0.6rem 0.85rem;
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  backdrop-filter: blur(8px) saturate(1.1);
  border-top: 1px solid rgba(232, 224, 208, 0.18);
  pointer-events: none;
}
.post-reader-body .post-img-alt span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem; font-style: italic; line-height: 1.35;
  color: var(--parchment); opacity: 0.92;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}
/* WordPress alignment classes */
.post-reader-body .aligncenter,
.post-reader-body figure.aligncenter { margin-left: auto; margin-right: auto; text-align: center; }
.post-reader-body .aligncenter img { margin-left: auto; margin-right: auto; }
.post-reader-body .alignleft,
.post-reader-body figure.alignleft {
  float: left; margin: 0.5rem 1.5rem 1rem 0; max-width: 50%;
}
.post-reader-body .alignright,
.post-reader-body figure.alignright {
  float: right; margin: 0.5rem 0 1rem 1.5rem; max-width: 50%;
}
.post-reader-body .alignwide { margin-left: -4vw; margin-right: -4vw; max-width: calc(100% + 8vw); }
.post-reader-body .alignfull  { margin-left: -4vw; margin-right: -4vw; max-width: calc(100% + 8vw); }
/* Clear floats so following text/headings don't overlap wrapped images */
.post-reader-body::after { content: ''; display: block; clear: both; }

/* Blog status / error */
.words-status {
  font-style: italic; color: var(--bone); opacity: 0.5;
  font-size: 0.95rem; padding: 1rem 0;
}

/* Mobile */
@media (max-width: 1520px) {
  .words-section-wrap { position: relative; height: auto; min-height: auto; overflow: visible; }
  .post-list-wrap { overflow: visible; max-height: none; }
  .post-reader-body { overflow: visible; }
  #listView { flex: none; }
}

/* ── Photo grid in single-post reader (.marius-thoughts-photo-grid) ──────────── */
.post-reader-body .photo-zoom-hint {
  display: block;
  width: fit-content;
  margin: 1.5rem auto 0.75rem;
  padding: 0.1rem 0.8rem;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.74rem; font-style: normal;
  letter-spacing: 0.04em;
  color: #f3dede;
  background: rgb(187 0 0 / 38%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgb(149 123 127 / 40%);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.post-reader-body .photo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  padding: 0 5px;
  margin: 1.5rem 0;
}
.post-reader-body .photo-slot {
  aspect-ratio: 1/1; overflow: hidden;
  cursor: zoom-in; position: relative;
  transition: transform 0.25s;
}
.post-reader-body .photo-slot img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  box-sizing: border-box;
  border-radius: 10px;
  border: 5px solid rgba(255,255,255,0.3);
  filter: brightness(0.85);
  transition: filter 0.25s, transform 0.3s;
  -webkit-user-select: none; user-select: none;
  -webkit-user-drag: none;
}
.post-reader-body .photo-slot:hover img {
  filter: brightness(1.05); transform: scale(1.05);
}
.post-reader-body .photo-slot:hover { z-index: 2; }
.post-reader-body .photo-slot-alt {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end;
  padding: 0.55rem 0.7rem;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, transparent 55%);
  opacity: 0; transition: opacity 0.22s;
  pointer-events: none;
}
.post-reader-body .photo-slot:hover .photo-slot-alt { opacity: 1; }
.post-reader-body .photo-slot-alt span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.8rem; font-style: italic;
  color: #e8e0d0; line-height: 1.3;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* ── Standalone (non-gallery) images in post body ─────────────────────────── */
.post-reader-body .photo-slot--inline {
  aspect-ratio: unset;
  width: 100%; max-width: 66.666%;
  margin: 1.5rem 0;
  border-radius: 8px;
  box-shadow: none !important;
  transform: none !important;
  transition: none !important;
}
.post-reader-body .photo-slot--inline img {
  width: 100%; height: auto; object-fit: contain;
  border-radius: 8px;
  filter: none !important;
  transform: none !important;
  transition: none !important;
}
.post-reader-body .photo-slot--inline:hover img {
  filter: none !important;
  transform: none !important;
}
.post-reader-body .photo-slot--inline:hover {
  box-shadow: none !important;
  transform: none !important;
}
.post-reader-body .photo-slot--inline .photo-slot-alt {
  border-radius: 0 0 8px 8px;
}

/* ── In-panel photo reader (mirrors the Images page) ─────────────────────────── */
.words-section-wrap .photo-reader {
  display: none;
  flex: 1; min-height: 0;
  flex-direction: column;
  gap: 1rem;
}
.words-section-wrap .photo-reader.open { display: flex; }
.words-section-wrap .photo-reader-back {
  align-self: flex-start; flex-shrink: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem; font-style: italic;
  color: var(--bone); opacity: 0.7;
  background: none; border: none; cursor: pointer;
  padding: 0; transition: opacity 0.2s, color 0.2s;
}
.words-section-wrap .photo-reader-back:hover { opacity: 1; color: var(--bright-gold); }
.words-section-wrap .photo-reader-stage {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
.words-section-wrap .photo-reader-img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; display: block;
  border-radius: 10px;
  border: 5px solid rgba(255,255,255,0.3);
  box-sizing: border-box;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  -webkit-user-select: none; user-select: none;
  -webkit-user-drag: none;
}
.words-section-wrap .photo-reader-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; line-height: 1; color: var(--parchment);
  background: rgba(0,0,0,0.35);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.3);
  cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.words-section-wrap .photo-reader-arrow:hover { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.words-section-wrap .photo-reader-prev { left: 0.5rem; }
.words-section-wrap .photo-reader-next { right: 0.5rem; }
.words-section-wrap .photo-reader-caption {
  flex-shrink: 0; text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem; font-style: italic; line-height: 1.5;
  color: var(--parchment); opacity: 0.85;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}
.words-section-wrap .photo-reader-caption:empty { display: none; }
/* When the reader is open, the post article is hidden (Images-style swap). */
.words-section-wrap .post-reader.reader-hidden { display: none; }

/* ── Lightbox (shared, single-post) ──────────────────────────────────────────── */
.photo-viewer {
  display: none; position: absolute; inset: 0; z-index: 200;
  align-items: center; justify-content: center;
  pointer-events: all; cursor: default;
  background: rgba(0,0,0,0.45);
}
.photo-viewer.open { display: flex; }
.photo-viewer-card {
  position: relative;
  display: flex; flex-direction: column; align-items: stretch;
  gap: 0;
  background: rgba(10,10,10,0.8);
  border: 1px solid rgba(184,146,42,0.25);
  border-radius: 12px; padding: 30px;
  max-width: calc(100% - 60px);
  max-height: calc(100% - 60px);
  pointer-events: all;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7);
}
.photo-viewer-close {
  position: absolute; top: 12px; right: 14px;
  font-size: 1rem; color: var(--bone); opacity: 0.5;
  background: none; border: none; cursor: pointer;
  transition: opacity 0.2s; line-height: 1; padding: 0;
  z-index: 1;
}
.photo-viewer-close:hover { opacity: 1; }
.photo-viewer-img {
  max-height: calc(100vh - 260px); max-width: 100%;
  object-fit: contain; border-radius: 6px; display: block;
}
.photo-viewer-alt {
  position: relative;
  display: flex; align-items: flex-end;
  margin-top: 0.75rem;
  min-height: 1.8em; padding-right: 4.5rem;
  flex-shrink: 0;
}
.photo-viewer-alt span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem; font-style: italic; line-height: 1.5;
  color: var(--bone); opacity: 0.6;
}
.photo-viewer-nav {
  position: absolute; right: 0; bottom: 0;
  display: flex; gap: 0.6rem;
}
.photo-viewer-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; color: var(--bone); opacity: 0.5;
  transition: opacity 0.2s; padding: 0;
}
.photo-viewer-btn:hover { opacity: 1; }

@media (max-width: 1520px) {
  .post-reader-body .photo-grid { grid-template-columns: repeat(3, 1fr); }
  .photo-viewer-card { padding: 15px; }
  .photo-viewer-img { max-height: 55vh; }
}

/* ── Crafts single reader — readability enhancements ─────────────── */
/* The crafts background (treehouse) is lighter, so strengthen the
   backdrop panel and text contrast for the reader on crafts posts.    */
.mc-page--crafts .words-section-wrap {
  background: rgba(0,0,0,0.34);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.mc-page--crafts .post-reader-title {
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.mc-page--crafts .post-reader-date {
  opacity: 0.75;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.mc-page--crafts .post-reader-body {
  font-style: normal;
  line-height: 1.85;
  opacity: 1;
  color: var(--parchment);
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
.mc-page--crafts .post-reader-body a { text-shadow: none; }
