/* Sidebar/topbar/app-shell CSS lives in style.css now - shared across every
   page, not just home. Only genuinely home-page-specific rules stay here. */

/* The user's own rendered hero photo (columns + emblem on a pedestal) sits
   as a backdrop behind the hero text, then fades out (via a mask gradient)
   into the plain page background below it - rather than being boxed into
   just the hero card. Mobile gets its own shorter height (see the mobile
   media query below) since a phone-width container crops far more of the
   image away than desktop does. */
.hero-zone {
  position: relative;
}

.hero-zone::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /* Fixed, not 100%: keeps background-size:cover width-constrained, so
     this only ever shows the same vivid center slice of the photo as the
     old boxed hero did - just stretched a bit further down past the hero
     card before the mask fades it out, instead of squashing the whole
     image (ceiling/floor and all) to fit a taller area, which produced a
     visible seam where the photo's own floor line landed. #feed-section
     below has matching top spacing so the fade finishes well before the
     news card starts, instead of tinting its top edge. */
  height: 300px;
  background-image: url('/hero-columns.jpg?v=2');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 20px 20px 0 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 65%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 65%, transparent 100%);
  z-index: 0;
}

.hero {
  position: relative;
  z-index: 1;
  padding: 34px 38px;
  margin-bottom: 22px;
  min-height: 220px;
  display: flex;
  align-items: center;
}

.hero-text {
  position: relative;
  max-width: 460px;
}

.hero-text h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #62577F;
  margin-bottom: 14px;
}

.hero-tagline {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: #6F6B72;
  font-size: .9rem;
  line-height: 1.5;
}

.hero-tagline-bar {
  width: 3px;
  align-self: stretch;
  min-height: 20px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

/* Only the news list itself scrolls - the search bar (in .topbar, already
   fixed via style.css), the hero banner and the "Последние новости"
   heading/tag filter all stay put. #home-main overrides the generic
   .page-content scroll behavior (shared with other pages) with its own
   fixed-header/scrolling-body flex layout, scoped by id so nothing else
   using .page-content is affected. */
#home-main.page-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero-zone { flex-shrink: 0; }

/* ── Feed ── */
#feed-section {
  width: auto;
  margin: 64px 48px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

@media (max-width: 768px) {
  /* On mobile the feed area still scrolls the whole page (see the mobile
     media query for #feed-list) rather than fighting for a fixed height in
     an already-cramped viewport. The 48px side margin and 64px top gap
     otherwise exist to clear the hero photo's fade zone on desktop (see
     .hero-zone::before, desktop-only) - on mobile there's no photo to
     clear and the hero itself has no such inset, so the same numbers here
     just squeezed the card in and left a dead gap above it for no reason. */
  #home-main.page-content { overflow-y: auto; }
  #feed-section {
    flex: none;
    margin: 24px 0 0;
  }
}

.feed-section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.feed-section-header h2 {
  font-size: 1.02rem;
  color: #20202A;
  white-space: nowrap;
}

.feed-section-header-line {
  flex: 1;
  height: 1px;
  background: rgba(111, 107, 114, .2);
}

#feed-list {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(111, 107, 114, .08);
  overflow-y: auto;
  min-height: 0;
}

@media (max-width: 768px) {
  #feed-list { overflow-y: visible; }
}

.feed-pagination {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 0 4px;
}
.feed-pagination-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(111, 107, 114, .2);
  background: #fff;
  color: var(--mid);
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
}
.feed-pagination-btn:hover { background: #FCFAFD; }
.feed-pagination-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #F4F0F7;
  font-weight: 600;
  cursor: default;
}
.feed-pagination-btn:disabled {
  opacity: .4;
  cursor: default;
}
.feed-pagination-btn:disabled:hover { background: #fff; }

.post-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(111, 107, 114, .08);
  cursor: pointer;
  transition: background .15s;
}
.post-card:last-child { border-bottom: none; }
.post-card:hover { background: #FCFAFD; }

.post-card-date {
  flex-shrink: 0;
  width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(111, 107, 114, .1);
  border-radius: 12px;
  padding: 8px 4px;
  color: var(--accent);
}

.post-card-date-day {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
}

.post-card-date-month {
  font-size: .68rem;
  text-transform: uppercase;
}

.post-card-body {
  flex: 1;
  min-width: 0;
}

.post-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: #20202A;
  margin-bottom: 4px;
}

.post-card-preview {
  font-size: .85rem;
  color: #6F6B72;
  line-height: 1.5;
  max-height: 3em;
  overflow: hidden;
  margin-bottom: 8px;
}

.post-card-footer {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: .8rem;
  color: var(--mid);
}

.post-card-chevron {
  flex-shrink: 0;
  align-self: center;
  color: var(--mid);
  font-size: 1.3rem;
}

@media (max-width: 768px) {
  .hero {
    padding: 24px 22px;
    min-height: 0;
  }
  .hero-zone::before {
    /* A phone-width container is much narrower relative to the photo's own
       width than desktop, so cover crops in tighter - a shorter height here
       keeps the crop centered on the column/monogram instead of drifting.
       Shifted right of center because a plain center crop at this width
       loses the monogram entirely, showing only columns. */
    height: 190px;
    background-position: 72% center;
    border-radius: 20px 20px 0 0;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
  }
}

.post-like-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .88rem;
  color: var(--mid);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
}

.post-like-btn.liked {
  color: #b0413e;
}

#feed-empty {
  text-align: center;
  color: var(--mid);
  font-size: .88rem;
  padding: 30px 0;
}

/* ── Post editor / view modals ── */
#post-view-overlay .modal-box {
  max-width: 860px;
}

#post-title-input {
  width: 100%;
  border: 1.5px solid rgba(111, 107, 114, .25);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: .95rem;
  font-family: inherit;
  color: #20202A;
  outline: none;
  margin-bottom: 12px;
}

#post-editorjs-container {
  border: 1px solid rgba(111, 107, 114, .18);
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 160px;
}

#post-save-btn {
  background: linear-gradient(135deg, var(--accent) 0%, #B58A58 100%);
  border: none;
  border-radius: 22px;
  color: #F4F0F7;
  padding: 10px 20px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
}

.post-view-content {
  font-size: .92rem;
  line-height: 1.6;
  color: #20202A;
  margin-bottom: 20px;
}

.post-view-content h1, .post-view-content h2, .post-view-content h3 {
  margin: 8px 0 6px;
  line-height: 1.3;
}
.post-view-content h1 { font-size: 1.7rem; }
.post-view-content h2 { font-size: 1.4rem; }
.post-view-content h3 { font-size: 1.2rem; }
.post-view-content h1:first-child,
.post-view-content h2:first-child,
.post-view-content h3:first-child { margin-top: 0; }

.post-view-content p {
  margin-bottom: 10px;
}

.post-view-content > p:first-child {
  font-size: 1.15rem;
  font-weight: 600;
  color: #20202A;
}

.post-view-content ul, .post-view-content ol {
  margin: 0 0 10px 1.3em;
}

.post-view-content li {
  margin-bottom: 4px;
}

.lesson-quote-card {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 10px 16px;
  border-radius: 16px;
  border-left: 4px solid var(--accent);
  background: linear-gradient(135deg, #D0AE7B 0%, #D0AE7B 100%);
}

.lesson-quote-text { color: #20202A; }
.lesson-quote-text p { margin: 0 0 .6em; }
.lesson-quote-text p:last-child { margin-bottom: 0; }

.lesson-quote-caption {
  margin-top: .6em;
  font-size: .85rem;
  color: var(--mid);
}

.post-view-content .lesson-table-scroll {
  overflow-x: auto;
  margin: 12px 0;
}
.post-view-content .lesson-table {
  border-collapse: collapse;
  width: 100%;
  font-size: .92em;
}
.post-view-content .lesson-table td, .post-view-content .lesson-table th {
  border: 1px solid rgba(111, 107, 114, .25);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.post-view-content .lesson-table th {
  background: #FCFAFD;
  font-weight: 600;
}

.post-view-content hr {
  border: none;
  border-top: 1px solid rgba(111, 107, 114, .2);
  margin: 16px 0;
}

.post-view-content img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  margin: 8px 0;
}

.post-view-content a {
  color: #B58A58;
}

.post-edit-btn {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(111, 107, 114, .3);
  border-radius: 10px;
  color: var(--mid);
  padding: 5px 12px;
  font-size: .78rem;
  cursor: pointer;
}

.post-delete-btn {
  background: none;
  border: 1px solid rgba(176, 65, 62, .35);
  border-radius: 10px;
  color: #b0413e;
  padding: 5px 12px;
  font-size: .78rem;
  cursor: pointer;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.post-tag-pill {
  background: #D0AE7B;
  color: #6F6B72;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: .75rem;
  cursor: pointer;
}
.post-tag-pill:hover { background: #D0AE7B; }

.post-tags-row {
  display: flex;
  gap: 16px;
  margin: 4px 0 10px;
}
.post-tag-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  color: #20202A;
  cursor: pointer;
}

.feed-tag-filter {
  display: flex;
  gap: 8px;
  margin: 4px 0 16px;
}
.feed-tag-btn {
  background: none;
  border: 1px solid rgba(111, 107, 114, .3);
  border-radius: 16px;
  color: var(--mid);
  padding: 5px 14px;
  font-size: .82rem;
  cursor: pointer;
}
.feed-tag-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #F4F0F7;
}

.post-view-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(111, 107, 114, .15);
  margin-bottom: 16px;
}

.post-comments h4 {
  font-size: .9rem;
  color: #20202A;
  margin-bottom: 10px;
}

.post-comment {
  padding: 10px 0;
  border-bottom: 1px solid rgba(111, 107, 114, .1);
  font-size: .85rem;
}

.post-comment-meta {
  color: var(--mid);
  font-size: .75rem;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-comment-delete {
  background: none;
  border: none;
  color: #b0413e;
  cursor: pointer;
  font-size: .75rem;
  padding: 0;
}

.post-comment-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.post-comment-form input {
  flex: 1;
  border: 1.5px solid rgba(111, 107, 114, .25);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: .85rem;
  font-family: inherit;
  outline: none;
}

.post-comment-form button {
  background: var(--accent);
  border: none;
  border-radius: 20px;
  color: #F4F0F7;
  padding: 8px 16px;
  font-size: .82rem;
  cursor: pointer;
}


