/*
 Theme Name:   ArtFasad Child
 Theme URI:    https://artfasad.com/
 Description:  Дочерняя тема GeneratePress для artfasad.com — стили главной страницы (сетка постов), центрирование изображений, TOC, related posts, кнопки шеринга и хавер-эффекты.
 Author:       ArtFasad
 Author URI:   https://artfasad.com/
 Template:     generatepress
 Version:      1.0.0
 Text Domain:  artfasad-child
*/

/* ======================================
   1. HOME PAGE — POST GRID
   ====================================== */

/* Full container width — home page only */
body.home .container.grid-container {
  max-width: 100% !important;
}

/* Post grid */
body.home .site-main {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  padding: 20px;
  align-items: start;
}

/* Pagination spans full width */
body.home .site-main #nav-below {
  grid-column: 1 / -1;
}

/* Card layout */
body.home .site-main article {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  overflow: hidden;
}

/* Inner padding for card content */
body.home .site-main article .inside-article {
  padding: 16px;
}

/* Original image aspect ratio */
body.home .site-main article .post-image {
  aspect-ratio: auto;
  overflow: hidden;
  margin: 0 !important;
  display: block !important;
}

body.home .site-main article .post-image img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 !important;
}

/* Tablets — 2 columns */
@media (max-width: 768px) {
  body.home .container.grid-container {
    max-width: 100% !important;
    padding: 0 !important;
  }
  body.home .site-main {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    padding: 12px;
  }
}

/* Mobile — 1 column */
@media (max-width: 480px) {
  body.home .site-main {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 8px;
  }
}

/* ======================================
   2. IMAGE CENTERING (Global)
   ====================================== */
.post-image,
.page-header-image,
.featured-image,
.featured-image img,
.entry-content img,
.entry-content figure,
.entry-content .wp-block-image {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center;
    float: none !important;
}

.entry-content img.alignleft,
.entry-content img.alignright {
    float: none;
}

.entry-content span:has(> img) {
    display: block;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* ======================================
   3. TABLE OF CONTENTS (TOC)
   ====================================== */
nav.af-toc {
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 0;
    margin: 32px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden;
    border-left: 1px solid #e8e8e8;
}

nav.af-toc button.af-toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 20px;
    background: #ffffff;
    color: #111;
    border: none;
    border-bottom: 1px solid #e8e8e8;
    border-radius: 0;
    cursor: pointer;
    box-shadow: none;
    font-size: 15px;
    font-weight: 600;
    box-sizing: border-box;
}

nav.af-toc button.af-toc-toggle:hover {
    background: #fafafa;
    color: #111;
}

nav.af-toc button.af-toc-toggle span.af-toc-title {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    letter-spacing: 0.01em;
}

nav.af-toc button.af-toc-toggle svg.af-toc-icon {
    flex-shrink: 0;
    color: #888;
    transition: transform 0.25s ease;
}

nav.af-toc button.af-toc-toggle[aria-expanded="true"] svg.af-toc-icon {
    transform: rotate(180deg);
}

nav.af-toc ul.af-toc-list {
    margin: 0;
    padding: 8px 0;
    list-style: none;
    background: #ffffff;
}

nav.af-toc ul.af-toc-list li {
    margin: 0;
    padding: 0;
    list-style: none;
    background: none;
    border: none;
}

nav.af-toc ul.af-toc-list li::before,
nav.af-toc ul.af-toc-list li::after {
    display: none;
}

/* Styles for H2 */
nav.af-toc ul.af-toc-list li.toc-level-2 > a {
    display: flex;
    align-items: center;
    padding: 7px 20px;
    color: #222;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.45;
    gap: 8px;
    background: none;
    border: none;
    box-shadow: none;
}

nav.af-toc ul.af-toc-list li.toc-level-2 > a::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    min-width: 5px;
    border-radius: 50%;
    background: #1e73be;
    flex-shrink: 0;
}

nav.af-toc ul.af-toc-list li.toc-level-2 > a:hover {
    color: #1e73be;
    background: #f4f8fd;
    text-decoration: none;
}

/* Styles for H3 */
nav.af-toc ul.af-toc-list li.toc-level-3 > a {
    display: flex;
    align-items: center;
    padding: 6px 20px 6px 38px;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.45;
    gap: 8px;
    background: none;
    border: none;
    box-shadow: none;
}

nav.af-toc ul.af-toc-list li.toc-level-3 > a::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 4px;
    min-width: 4px;
    border-radius: 50%;
    background: #aaa;
    flex-shrink: 0;
}

nav.af-toc ul.af-toc-list li.toc-level-3 > a:hover {
    color: #1e73be;
    background: #f4f8fd;
    text-decoration: none;
}

/* Styles for H4 */
nav.af-toc ul.af-toc-list li.toc-level-4 > a {
    display: flex;
    align-items: center;
    padding: 5px 20px 5px 56px;
    color: #777;
    text-decoration: none;
    font-size: 12.5px;
    line-height: 1.45;
    gap: 8px;
    background: none;
    border: none;
    box-shadow: none;
}

nav.af-toc ul.af-toc-list li.toc-level-4 > a::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 3px;
    min-width: 3px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
}

nav.af-toc ul.af-toc-list li.toc-level-4 > a:hover {
    color: #1e73be;
    background: #f4f8fd;
    text-decoration: none;
}

/* Mobile Responsiveness for TOC */
@media (max-width: 600px) {
    nav.af-toc ul.af-toc-list li.toc-level-2 > a,
    nav.af-toc ul.af-toc-list li.toc-level-3 > a,
    nav.af-toc ul.af-toc-list li.toc-level-4 > a {
        font-size: 13px;
    }
}

/* ======================================
   4. TECHNICAL TWEAKS
   ====================================== */
@media (prefers-reduced-motion: no-preference) {
    :target {
        scroll-behavior: smooth;
    }
}

.entry-content h2[id],
.entry-content h3[id],
.entry-content h4[id] {
    scroll-margin-top: 110px;
}

.generate-back-to-top {
    z-index: 99999 !important;
}

/* ======================================
   5. LIGHTBOX SHARE BAR (see assets/js/lightbox-share.js)
   ====================================== */
.lb-share-bar {
    /* dynamic inline positioning is set from JS; base visuals live here */
}

/* ======================================
   6. RELATED POSTS
   ====================================== */
.afc-related-posts-container {
    margin-top: 60px;
    margin-bottom: 40px;
    clear: both;
}

.afc-related-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 30px;
    text-align: center;
    color: #111;
}

.afc-related-posts-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1250px;
    margin: 0 auto;
}

.afc-related-post {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.afc-related-post a.img-link {
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
}

.afc-related-post img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.afc-related-post:hover img {
    transform: scale(1.08);
}

.afc-related-post h3 {
    font-size: 17px;
    margin-top: 15px;
    line-height: 1.4;
    font-weight: 600;
}

.afc-related-post h3 a {
    text-decoration: none;
    color: #333;
    transition: color 0.2s;
}

.afc-related-post h3 a:hover {
    color: #1e73be;
    text-decoration: underline;
}

@media (max-width: 480px) {
    .afc-related-posts-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ======================================
   7. SHARE BUTTONS
   ====================================== */
.gp-share-wrapper {
    margin: 30px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.gp-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    text-decoration: none !important;
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
    border: none;
}

.gp-share-btn:hover {
    opacity: 0.85;
    transform: translateY(-2px);
}

.gp-share-btn svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
    display: block;
}

.gp-fb { background-color: #1877F2; }
.gp-x { background-color: #000000; }
.gp-pin { background-color: #E60023; }
.gp-wa { background-color: #25D366; }
.gp-in { background-color: #0A66C2; }
.gp-email { background-color: #757575; }

@media (max-width: 768px) {
    .gp-share-wrapper { justify-content: center; }
}

/* ===================================
   9. Links in bold
   ================================ */
.entry-content a {
    font-weight: bold;
}

/* Hover-zoom */
.entry-content img, .post-thumbnail img {
  transition: transform .5s cubic-bezier(.25,.8,.25,1);
  display: block;
}
.entry-content figure, .post-thumbnail {
  overflow: hidden;
  border-radius: 8px;
}
.entry-content figure:hover img,
.post-thumbnail:hover img {
  transform: scale(1.06);
}
/* overlay caption */
.entry-content figure { position: relative; }
.entry-content figure figcaption {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.45); color: #fff;
  padding: 8px 12px; font-size: 13px;
  opacity: 0; transform: translateY(6px);
  transition: all .35s .05s;
}
.entry-content figure:hover figcaption {
  opacity: 1; transform: translateY(0);
}
