/* ===========================================================
   Freedom4um - Read Article Page Styles
   Version: 2025-10-22h (adds responsive media containment)
   =========================================================== */


/* -----------------------------------------------------------
   General iframe / video / image display for posted content
   ----------------------------------------------------------- */

iframe {
  border: 0;
  background: #000;
  vertical-align: top;
  max-width: 100%;
  height: auto;
}

/* ---- YouTube, Rumble, BitChute embeds ---- */
iframe[src*="youtube.com"],
iframe[src*="rumble.com"],
iframe[src*="bitchute.com"] {
  display: inline-block !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
}

iframe[src*="youtube.com/shorts"],
iframe.yt-shorts {
  display: inline-block !important;
  aspect-ratio: 9 / 16;
  max-width: 360px;
}

iframe[src*="bitchute.com"] {
  aspect-ratio: 4 / 3;
}

/* ---- Image wrappers and scaling ---- */
.image-wrapper {
  display: inline-block !important;
  margin: 10px 0;
  border: 2px solid #ccc;
  background: #fff;
  overflow: hidden;
  width: auto !important;
  max-width: 100%;
  vertical-align: top;
}

/* Use HTML width attr for natural size */
.image-wrapper img {
  display: inline-block !important;
  width: attr(width px) !important;
  height: auto !important;
  max-width: none !important;
  vertical-align: top;
}

/* Fallback if attr() unsupported */
@supports not (width: attr(width px)) {
  .image-wrapper img {
    width: initial !important;
  }
}

/* Hide any editor-only handles */
.image-resize-handle,
.video-resize-handle,
.image-delete-handle,
.video-delete-handle,
.image-overlay,
.video-overlay {
  display: none !important;
}


/* ===========================================================
   Framing, layout, and comment styling
   =========================================================== */

/* 1️⃣ Main layout container */
body.read-article-page .content-wrapper {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  background-color: var(--bg-color);
  width: 100%;
  margin: 0;
  padding: 0;
}

/* 2️⃣ Article frame (fixed margins, matches nav alignment) */
body.read-article-page main.article-frame {
  background-color: #F9E9C7;           /* parchment-like cream */
  border: 1px solid #A32D2D;           /* dark red frame */
  box-shadow: 0 0 10px rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 1.5rem 2rem;

  margin-left: 40px;                   /* aligns with nav bar */
  margin-right: 20px;                  /* gap before sidebar */
  width: calc(100% - 380px);           /* 300px sidebar + 40+40 margins */
  max-width: 1200px;
  box-sizing: border-box;
}

/* 3️⃣ Sidebar styling */
body.read-article-page aside.title-bar {
  width: 300px;
  max-height: 100vh;
  overflow-y: auto;
  margin-right: 40px;
  border-left: 1px solid #ccc;
  padding-left: 10px;
  background-color: var(--bg-color);
  flex-shrink: 0;                      /* prevent collapsing on small screens */
}

/* 4️⃣ Article block inside frame */
.article-block {
  border-left: 6px solid #A32D2D;      /* accent bar */
  padding-left: 1rem;
  margin-bottom: 1rem;

  /* ✅ Hybrid overflow handling */
  overflow-x: auto;                    /* allow scroll if necessary */
  overflow-y: visible;
}

/* ✅ Constrain media inside article content */
.article-frame iframe,
.article-frame img,
.article-frame .video-wrapper,
.article-frame .image-wrapper {
  max-width: 100%;                     /* prevent overflowing sidebar */
  height: auto;
  display: block;
  margin: 1rem auto;
  box-sizing: border-box;
}

/* 5️⃣ Comment section and cards */
.comment-section {
  border-top: 2px solid #A32D2D;
  margin-top: 1rem;
  padding-top: 0.0rem;
}

.comment-card {
  background: #FFFDF8;
  border: 1px solid #D9C3A5;
  border-left: 4px solid #A32D2D;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.comment-card:hover {
  box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

/* Section heading */
.comment-section::before {
  display: block;
  font-family: "Times New Roman", Times, serif;
  font-weight: bold;
  padding: 0rem;
  color: #7D1F1F;
  margin-top: 0rem;
  margin-bottom: 0rem;
  text-align: left;
  font-size: 1.2em;
}

/* 6️⃣ Responsive adjustments */
@media (max-width: 900px) {
  body.read-article-page .content-wrapper {
    flex-direction: column;
  }
  body.read-article-page main.article-frame,
  body.read-article-page aside.title-bar {
    width: auto;
    margin: 10px 20px;
  }
}

/* ============================================
   Reader Comments
   ============================================ */

.article-comments .comment:first-of-type {
    margin-top: 0.1em;
    font-size: 1.1em;
    line-height: 1.3;
    font-family: "Times New Roman", Times, serif;
    color: var(--text-color);
}

.comment {
    margin: 0.3em 0 0.6em 0;
    padding: 0.3em 0.6em;
    border-radius: 4px;
    background-color: transparent;
}

/* Tighten paragraph spacing inside comments */
.comment p {
    margin-block-start: 0.3em !important;
    margin-block-end: 0.3em !important;
}

.comment-body {
    margin: 0.3em 0;
    font-size: 1.05em;
    line-height: 1.35;
}

.comment-meta {
    font-size: 1em;
    color: #555;
    margin-top: 2px;
}

.comment-action {
    font-weight: bold;
    color: var(--link-color);
    text-decoration: none;
}

.comment-action:hover {
    text-decoration: underline;
    color: var(--nav-bg);
}

/* Tighter red separator lines */
.article-comments hr {
    border: none;
    border-bottom: 2px solid var(--nav-bg);
    margin: 0.05em 0 0.0em 0;
}

/* === FINAL OVERRIDE: Sidebar height behavior === */

.content-wrapper {
  display: flex;
  align-items: stretch;
}

/* Force override of global styles */
.content-wrapper > .title-bar {
  flex-shrink: 0;
  width: 300px;
  margin-left: 20px;
  border-left: 1px solid #ccc;
  padding-left: 10px;
  overflow-y: auto;
  height: auto !important;
  max-height: none !important;
  background-color: transparent;
}

/* === Allow JS to control sidebar height === */
.title-bar {
  max-height: none !important;
  height: auto !important;
  background-color: var(--bg-color);
  border-left: 3px solid var(--nav-bg);
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  border-right: 1px solid #ccc;
  border-radius: 6px;
  padding: 10px 14px;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.1);
  margin-top: 5px;
}

/* Header of the sidebar ("Latest News") */
.title-bar-header {
  border-bottom: 2px solid var(--nav-bg);
  margin-bottom: 0.6em;
  padding-bottom: 0.3em;
}

.title-bar-header h3 {
  font-size: 1.2em;
  color: var(--nav-bg);
  margin: 0;
}

/* Article links in sidebar */
.title-bar ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.title-bar li {
  margin: 10px 0;
  line-height: 1.3;
}

.title-bar a.nav-link {
  text-decoration: none;
  color: var(--link-color);
  font-weight: bold;
}

.title-bar a.nav-link:hover {
  color: var(--nav-bg);
  text-decoration: underline;
}

.read-article-frame {
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.1);
}
