/*
Theme Name: Black Pearl
Theme URI: http://localhost/md.com/
Author: Dimas
Author URI: http://localhost/
Description: Custom WordPress theme built from scratch
Version: 1.5
License: GNU General Public License v2 or later
Text Domain: blackpearl
*/

* {
  box-sizing: border-box;
  font-family: 'Merriweather', Georgia, serif;
}

/* Reset some default browser styles */
body,
h1,
h2,
h3,
p,
ul {
  margin: 0;
  padding: 0;
}

/* Remove default list styling */
ul {
  list-style: none;
}

/* Basic typography */
body {
  line-height: 1.7;
  background: #ffffff;
  color: #333;
  padding: 1.25rem;
}

body > img:first-child {
  display: none !important;
}

/* Main layout container */
.site-main {
  display: flex; /* Flex layout for main content + sidebar */
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Left column for posts */
.content-area {
  flex: 3; /* Take 3/4 of space relative to sidebar */
}

/* Sidebar styling */
.sidebar {
  width: 30%;
  padding: 1rem;
  background: #fefefe; /* Slight contrast to body */
}

/* Popular posts list */
.popular-posts li.popular-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.popular-posts li .popular-thumb img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.popular-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* margin-top: -0.5rem; */
}

.popular-info a {
  font-weight: 600;
  text-decoration: none;
  color: #111111;
  display: block;
  line-height: 1.3;
}

.popular-info a:hover {
  color: #007acc;
  text-decoration: underline;
}

.popular-info .views {
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 4px;
}

/* -------------------
   Headline Carousel
------------------- */
.headline-carousel {
  position: relative;
  overflow: hidden; /* Hide overflowing slides */
  border-bottom: 1px solid #eee;
  margin-bottom: 3rem;
}

.headline-slides {
  display: flex; /* Arrange slides horizontally */
  transition: transform 0.5s ease-in-out; /* Smooth slide transition */
}

.headline-slide {
  width: 100%; /* Each slide takes full container width */
  flex-shrink: 0; /* Prevent shrinking */
  padding: 1rem 0;
}

/* Hide radio buttons used for slide control */
.carousel-radio {
  display: none;
}

/* Slide navigation dots */
.carousel-dots {
  text-align: center;
  margin-top: 0.5rem;
}

.carousel-dots label {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin: 0 5px;
  background: #ccc;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.3s;
}

/* Checked slide changes transform */
#slide1:checked ~ .headline-slides { transform: translateX(0); }
#slide2:checked ~ .headline-slides { transform: translateX(-100%); }
#slide3:checked ~ .headline-slides { transform: translateX(-200%); }

/* Active dot styling */
#slide1:checked ~ .carousel-dots label[for="slide1"],
#slide2:checked ~ .carousel-dots label[for="slide2"],
#slide3:checked ~ .carousel-dots label[for="slide3"] {
  background: #007acc; /* Active dot color */
}

/* Headline slide image & text */
.headline-slide img {
  width: 100%;
  border-radius: 16px;
  margin-bottom: 1rem;
  transition: transform 0.4s ease;
  object-fit: cover; /* Maintain aspect ratio */
}

.headline-slide img:hover {
  transform: scale(1.03); /* Slight zoom effect */
}

.headline-slide .entry-title {
  line-height: 1.4;
  margin-top: 1rem;
}

.headline-slide .entry-title a {
  color: #111111;
  text-decoration: none;
  font-size: 1.8rem;
  font-weight: 700;
}

.headline-slide .entry-title a:hover {
  color: #007acc;
}

.headline-slide .entry-content {
  font-size: 1.1rem;
  color: #444;
}

.headline-slide .entry-content > p {
  margin: 0.5rem 0 0;
}

.headline-slide .read-more {
  color: #007acc;
  text-decoration: none;
  font-weight: 500;
}

.headline-slide .read-more:hover {
  opacity: 0.8;
}

/* Headline slide image & text */
.headline-image {
  position: relative;
  width: 100%;

  /* Modern browsers: enforce 16:9 aspect ratio */
  aspect-ratio: 16 / 9;

  /* Fallback for older browsers (IE / old Safari) */
  height: 0;
  padding-bottom: 56.25%; /* 16:9 ratio = 9 / 16 * 100 */

  overflow: hidden;  /* Hide overflow for absolute img */
  border-radius: 16px; /* Rounded corners for wrapper */
}

.headline-image img {
  position: absolute; /* Fill the wrapper box */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;   /* Crop & center without stretching */
  transition: transform 0.4s ease;
}

.headline-image img:hover {
  transform: scale(1.03); /* Slight zoom on hover */
}

.headline-slide .entry-title a {
  color: #111111;
  text-decoration: none;
  font-size: 1.8rem;
  font-weight: 700;
}

.headline-slide .entry-title a:hover {
  color: #007acc;
}

.headline-slide .entry-content {
  font-size: 1.1rem;
  color: #444;
}

.headline-slide .read-more {
  color: #007acc;
  text-decoration: none;
  font-weight: 500;
}

.headline-slide .read-more:hover {
  opacity: 0.8;
}


/* -------------------
   Post list
------------------- */
.post-list .section-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #eee;
  padding-bottom: 0.5rem;
}

.post-list .post-excerpt {
  background: #ffffff;
  padding: 15px;
  margin-bottom: 1.25rem;
  border: 1px solid #eee;
  border-radius: 6px;
  display: flex; /* Align thumbnail + text side by side */
  gap: 15px;
  flex-wrap: wrap;
  align-items: flex-start; /* Align top for thumbnail + content */
}

.post-list .post-excerpt--pushed {
  margin-bottom: 3.25rem;
}

.post-list .post-thumbnail {
  flex: 0 0 200px; /* Fixed width for thumbnail */
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
}

.post-list .post-thumbnail img {
  width: 100%;
  height: 11.25rem;
  min-height: 11.25rem;
  object-fit: cover; /* Prevent distortion */
  display: block;
  border-radius: 12px;
}

.post-list .entry-header {
  flex: 1;
}

.post-list .entry-title {
  font-size: 1.3em;
  margin-bottom: 8px;
}

.post-list .entry-title a {
  color: #111111;
  text-decoration: none;
}

.post-list .entry-title a:hover {
  color: #007acc;
  text-decoration: underline;
}

.post-list .entry-summary {
  font-size: 0.95em;
  color: #444;
  margin-bottom: 10px;
}

.post-list .read-article-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background-color: #111;
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95em;
  transition: background 0.3s ease;
}

.post-list .read-article-button:hover {
  background-color: #007acc;
}

.post-list .read-article-button svg {
  stroke: #fff;
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.post-list .read-article-button:hover svg {
  transform: translateX(3px); /* Move arrow on hover */
}

.entry-categories {
  margin: 0.5rem 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.category-chip {
  display: inline-block;
  padding: 2px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  border-radius: 50px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.category-chip:hover {
  opacity: 0.8;
}

/* SDGs-inspired palette (exclude blue & green) */
.category-chip:nth-child(1n) { background: #E5243B; } /* Red */
.category-chip:nth-child(2n) { background: #FF3A21; } /* Orange */
.category-chip:nth-child(3n) { background: #FCC30B; } /* Yellow */
.category-chip:nth-child(4n) { background: #A21942; } /* Purple/Crimson */
.category-chip:nth-child(5n) { background: #FD6925; } /* Deep Orange */
.category-chip:nth-child(6n) { background: #DD1367; } /* Pink */
.category-chip:nth-child(7n) { background: #C5192D; } /* Dark Red */
.category-chip:nth-child(8n) { background: #FFA500; } /* Amber */
.category-chip:nth-child(9n) { background: #FF6F61; } /* Coral */
.category-chip:nth-child(10n) { background: #BF8B2E; } /* Brownish */

.see-all-container {
  text-align: center;
  margin-top: 1.5rem;
}

.see-all-button {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background: #007acc;
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.3s ease;
  width: 100%;
}

.see-all-button:hover {
  opacity: 0.8;
}

/* -------------------
   Sidebar widgets
------------------- */
.widget {
  margin-bottom: 1.25rem;
}

.widget-title, .widgettitle {
  font-size: 1.2em;
  margin-bottom: 10px;
  border-bottom: 2px solid #007acc;
  padding-bottom: 5px;
}

.widget ul li {
  margin-bottom: 8px;
}

.widget ul li a {
  color: #111111;
  text-decoration: none;
}

.widget ul li a:hover {
  color: #007acc;
  text-decoration: underline;
}

.about-author-widget {
  padding: 1rem;
  text-align: left;
}

.about-author-widget__summary {
  align-items: center;
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.about-author-widget .author-avatar {
  width: 150px;
}

.about-author-widget .author-avatar img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.about-author-widget .author-bio {
  color: #555;
  font-size: 0.95rem;
  margin: 0;
  padding: 1rem 0 0;
  text-align: center;
  width: 100%;
}

.about-author-widget__complementary {
  text-align: center;
}

.about-author-widget .author-social {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-left: auto;
  margin-top: 0.5rem;
  padding-left: 0;
  width: 100%;
}

.about-author-widget .author-social a {
  color: #555;
  font-size: 1.5rem;
  transition: color 0.3s ease;
}

.about-author-widget .author-social a:last-child {
  line-height: 1.4;
}

.about-author-widget .author-social a:hover {
  color: #1da1f2;
}

.about-author-widget .author-social svg {
  width: 1em; 
  height: 1em;
  fill: currentColor;
  display: inline-block;
  vertical-align: middle;
}

/* Banner style */
.banner-slot img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

/* -------------------
   Responsive adjustments
------------------- */
@media (max-width: 1024px) {
  .site-main {
    flex-direction: column; /* Stack content + sidebar */
  }

  .sidebar {
    order: 1; /* Sidebar below content */
    width: 100%; /* Full width on tablet/mobile */
    border-left: none;
    border-top: 1px solid #ddd;
    margin-top: 1.25rem;
    padding-left: 0;
    padding-right: 0;
  }

  .headline-slides {
    flex-direction: row; /* Keep horizontal */
    width: 100%;
  }

  .headline-slide {
    flex: 0 0 100%; /* full width per slide */
  }

  .headline-slide img {
    height: auto;
    max-height: 300px;
    object-fit: cover;
  }

  /* Make post list thumbnail + text stack vertically */
  .post-list .post-excerpt {
    flex-direction: column;
    gap: 10px;
  }

  .post-list .post-thumbnail {
    flex: 1 1 100%;
    width: 100%;        /* Force full width */
    max-width: 100%;    /* Prevent shrinking */
    height: auto;       /* Auto height for natural ratio */
  }

  .post-list .post-thumbnail img {
    width: 100%;        /* Full width */
    height: auto;       /* Scale proportionally */
    border-radius: 12px;
    object-fit: cover;
  }

  .widget_media_image > a {
    display: block;
    text-align: center;
  }

  .wp-block-image.size-large {
    text-align: center;
  }
}

@media (max-width: 768px) {
  .headline-slide img {
    max-height: 200px;
  }

  .post-list .section-title {
    font-size: 1.5rem;
  }

  .about-author-widget__summary {
    flex-direction: column;
  }

  .about-author-widget .author-bio {
    padding: 1rem 0 0;
    text-align: center;
    width: 100%;
  }

  .about-author-widget .author-social {
    justify-content: center;
    padding-left: 0;
    width: 100%;
  }
}