/* Mobile book rail for the home page book sections (see js/book-rail.js).
   Everything is inside the media query, so desktop is unchanged. */

.book-rail-btn,
.book-rail-dots {
  display: none;
}

@media (max-width: 768px) {
  .book-rail {
    position: relative;
  }

  .book-rail > .rowCustum {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    gap: 12px;
    padding: 4px 16px 12px;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
    scrollbar-width: none;
  }

  .book-rail > .rowCustum::-webkit-scrollbar {
    display: none;
  }

  /* trailing spacer keeps the end gutter inside the scroller */
  .book-rail > .rowCustum::after {
    content: "";
    flex: 0 0 4px;
  }

  /* two cards per screen plus a sliver of the next one */
  .book-rail > .rowCustum > .colWidth {
    flex: 0 0 calc((100% - 12px - 36px) / 2);
    width: auto;
    max-width: none;
    margin: 0;
    scroll-snap-align: start;
  }

  .book-rail-btn {
    position: absolute;
    top: 96px;
    z-index: 5;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #155b2c;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .book-rail-btn.is-left { left: 6px; }
  .book-rail-btn.is-right { right: 6px; }
  .book-rail-btn[hidden] { display: none; }

  .book-rail-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 2px 0 10px;
  }

  .book-rail-dots i {
    width: 8px;
    height: 8px;
    border-radius: 6px;
    background: #b9c9bd;
    transition: width 0.2s ease, background-color 0.2s ease;
  }

  .book-rail-dots i.on {
    width: 22px;
    background: #155b2c;
  }

  /* the channel banner and footer strip already cover WhatsApp on mobile */
  .wa-float-btn {
    display: none !important;
  }
}

/* Mobile spacing between home page sections */
@media (max-width: 768px) {
  .blog-section {
    padding: 16px 0 12px;
  }

  .blog-section .heading-center h2,
  .our-vision .heading-center h2 {
    margin-bottom: 28px;
  }

  .blog-section .post-box {
    margin: 4px 0 8px;
  }

  .mazeed h3 {
    margin: 12px 0 8px;
  }

  .our-vision {
    padding: 12px 0;
  }
}

/* Book card buttons on mobile: one full-width row each, icon beside the label */
@media (max-width: 768px) {
  body .book-rail .btn-row {
    flex-direction: column;
    gap: 8px;
    padding: 0 8px 12px;
  }

  body .book-rail .btn-row .download-btn {
    width: 100%;
  }

  body .book-rail .btn-row .read-post {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px 8px;
    font-size: 16px;
    line-height: 1.6;
    white-space: nowrap;
  }

  body .book-rail .btn-row .read-post i {
    display: inline-block;
    margin: 0;
    font-size: 15px;
  }
}

/* Softer buttons: Read is the solid primary, Download is a light outline */
@media (max-width: 768px) {
  body .book-rail .btn-row {
    gap: 6px;
    padding: 0 10px 12px;
  }

  body .book-rail .btn-row .download-btn {
    margin: 0;
    padding: 0;
  }

  /* Read first, then Download */
  body .book-rail .btn-row .download-btn:nth-child(2) {
    order: -1;
  }

  body .book-rail .btn-row .read-post {
    padding: 6px 8px;
    font-size: 15px;
    border-radius: 8px;
    box-shadow: none;
  }

  body .book-rail .btn-row .download-btn:nth-child(1) .read-post {
    background: #fff !important;
    color: #155b2c !important;
    border: 1.5px solid #b9d3c1;
  }

  body .book-rail .btn-row .download-btn:nth-child(1) .read-post i {
    color: #155b2c !important;
  }
}

/* Read button: light green tint instead of a solid fill */
@media (max-width: 768px) {
  body .book-rail .btn-row .download-btn:nth-child(2) .read-post {
    background: #e3f1e7 !important;
    color: #155b2c !important;
    border: 1.5px solid #a9cdb4;
  }

  body .book-rail .btn-row .download-btn:nth-child(2) .read-post i {
    color: #155b2c !important;
  }
}

/* Option 2: Read and Download side by side, icon above the label.
   Overrides custom.css (max-width:480px) which forced a 30px gap and 12px padding. */
@media (max-width: 768px) {
  /* buttons sit at the bottom of every card, even when titles differ in length */
  body .book-rail .post-box > div:last-child {
    margin-top: auto;
  }

  body .book-rail .btn-row {
    flex-direction: row;
    gap: 6px !important;
    padding: 8px 10px 14px;
    margin-top: 0 !important;
  }

  body .book-rail .btn-row .download-btn {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    margin: 0;
    padding: 0;
  }

  body .book-rail .btn-row .download-btn .read-post {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 9px 2px !important;
    float: none;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.6;
    border-radius: 10px;
    white-space: nowrap;
  }

  body .book-rail .btn-row .download-btn .read-post i {
    display: block;
    margin: 0;
    font-size: 17px;
  }

  body .book-rail .btn-row .download-btn .read-post:active {
    background: #cfe5d5 !important;
  }
}

/* Subtle book card buttons: pale fills, hairline borders, regular-weight text */
@media (max-width: 768px) {
  body .book-rail .btn-row .download-btn:nth-child(1) .read-post,
  body .book-rail .btn-row .download-btn:nth-child(2) .read-post {
    padding: 7px 2px !important;
    font-size: 14px;
    font-weight: 400;
    color: #3c6b4a !important;
    border: 1px solid #dbe7de;
    border-radius: 8px;
  }

  /* Read: barely-there tint; Download: plain white */
  body .book-rail .btn-row .download-btn:nth-child(2) .read-post {
    background: #f4f9f5 !important;
  }

  body .book-rail .btn-row .download-btn:nth-child(1) .read-post {
    background: #fff !important;
  }

  body .book-rail .btn-row .download-btn:nth-child(1) .read-post i,
  body .book-rail .btn-row .download-btn:nth-child(2) .read-post i {
    font-size: 15px;
    color: #4c8a5f !important;
  }

  body .book-rail .btn-row .download-btn:nth-child(1) .read-post:active,
  body .book-rail .btn-row .download-btn:nth-child(2) .read-post:active {
    background: #e8f2ea !important;
  }
}

/* Glass arrows: frosted translucent circles over the book covers */
@media (max-width: 768px) {
  body .book-rail .book-rail-btn {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    color: #155b2c;
    transition: background-color 0.2s ease, transform 0.15s ease;
  }

  @supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    body .book-rail .book-rail-btn {
      background: rgba(255, 255, 255, 0.28);
      -webkit-backdrop-filter: blur(12px) saturate(160%);
      backdrop-filter: blur(12px) saturate(160%);
    }
  }

  body .book-rail .book-rail-btn:active {
    transform: scale(0.94);
  }
}
