/*
Theme Name: InfoFlick Magbook Child
Theme URI: https://infoflick.com/
Description: InfoFlick custom child theme for Magbook with a modern news homepage.
Author: InfoFlick
Template: magbook
Version: 1.0.0
*/

/* Parent Magbook stylesheet is loaded by functions.php. */

/* INFOFLICK HOME V2 START */
:root {
  --if-max: 1240px;
  --if-gap: 24px;
  --if-border: #e6e6e6;
  --if-text: #111;
  --if-muted: #6b6b6b;
}

.if-home,
.if-home * {
  box-sizing: border-box;
}

.if-home {
  color: var(--if-text);
  background: #fff;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.if-container {
  width: min(var(--if-max), calc(100% - 40px));
  margin-inline: auto;
}

.if-breaking {
  border-bottom: 1px solid var(--if-border);
  background: #111;
  color: #fff;
}

.if-breaking-inner {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 18px;
  overflow: hidden;
}

.if-breaking-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  white-space: nowrap;
}

.if-breaking-track {
  display: flex;
  gap: 30px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.if-breaking-track::-webkit-scrollbar {
  display: none;
}

.if-breaking-track a {
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}


.if-section {
  padding: 34px 0;
}

.if-section + .if-section {
  border-top: 1px solid #f0f0f0;
}

.if-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.if-section-heading h1,
.if-section-heading h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: -.025em;
}

.if-section-heading a {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.if-latest-grid {
  display: grid;
  grid-template-columns: 1.65fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--if-gap);
  align-items: start;
}

.if-latest-card {
  min-width: 0;
}

.if-latest-featured {
  grid-row: span 2;
}

.if-card-image {
  display: block;
  overflow: hidden;
  background: #f2f2f2;
  border-radius: 6px;
  aspect-ratio: 16 / 10;
}

.if-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}

.if-card-image:hover img {
  transform: scale(1.025);
}

.if-card-body {
  padding-top: 10px;
}

.if-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--if-muted);
  font-size: 11px;
  line-height: 1.4;
}

.if-meta a {
  font-weight: 700;
  text-decoration: none;
}

.if-meta time {
  color: var(--if-muted);
}

.if-card-body h2,
.if-card-body h3 {
  margin: 0;
  line-height: 1.28;
  letter-spacing: -.015em;
}

.if-card-body h2 {
  font-size: 20px;
}

.if-card-body h3 {
  font-size: 17px;
}

.if-card-body h2 a,
.if-card-body h3 a {
  color: inherit;
  text-decoration: none;
}

.if-card-body p {
  margin: 7px 0 0;
  color: #666;
  font-size: 13px;
  line-height: 1.55;
}

.if-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--if-gap);
}

.if-category-card {
  min-width: 0;
}

.if-newsletter {
  padding: 12px 0 54px;
}

.if-newsletter-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 28px 32px;
  border: 1px solid var(--if-border);
  border-radius: 8px;
  background: #fafafa;
}

.if-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}

.if-newsletter h2 {
  margin: 5px 0;
  font-size: 24px;
}

.if-newsletter p {
  margin: 0;
  color: #666;
  font-size: 13px;
}

.if-newsletter-button {
  flex: 0 0 auto;
  padding: 11px 18px;
  border-radius: 5px;
  background: #111;
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .if-container {
    width: min(var(--if-max), calc(100% - 28px));
  }

  .if-latest-grid {
    grid-template-columns: 1.2fr 1fr;
  }

  .if-latest-featured {
    grid-row: span 2;
  }

  .if-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .if-container {
    width: min(var(--if-max), calc(100% - 20px));
  }

  .if-breaking-inner {
    gap: 12px;
  }

  .if-breaking-label {
    font-size: 10px;
  }

  .if-section {
    padding: 26px 0;
  }

  .if-section-heading h1,
  .if-section-heading h2 {
    font-size: 21px;
  }

  .if-latest-grid {
    grid-template-columns: 1fr;
  }

  .if-latest-featured {
    grid-row: auto;
  }

  .if-category-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .if-card-body h2 {
    font-size: 18px;
  }

  .if-card-body h3 {
    font-size: 15px;
  }

  .if-card-body p {
    font-size: 12px;
  }

  .if-newsletter-inner {
    display: block;
    padding: 22px;
  }

  .if-newsletter-button {
    display: inline-block;
    margin-top: 16px;
  }
}
/* INFOFLICK HOME V2 END */


/* INFOFLICK HOME V3 */
.if-home {
  width: 100%;
}

.if-home .if-container {
  width: min(1400px, calc(100% - 48px));
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.if-latest-section {
  width: 100%;
}

.if-latest-grid,
.if-category-grid {
  width: 100%;
}

}

@media (max-width: 640px) {
  .if-home .if-container {
    width: calc(100% - 20px);
  }
}
/* END INFOFLICK HOME V3 */

/* INFOFLICK HOME V5 */
.if-home {
  width: 100%;
  margin: 0;
  padding: 0;
  background: #fff;
  color: #111;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.if-home .if-container {
  width: 100%;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(12px, 3vw, 48px);
  padding-right: clamp(12px, 3vw, 48px);
}

.if-home .if-section {
  width: 100%;
  padding: 34px 0;
}

.if-home .if-section + .if-section {
  border-top: 1px solid #e9e9e9;
}

.if-section-heading {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 24px;
  margin: 0 0 18px !important;
  padding: 0 0 12px;
  border-bottom: 1px solid #dcdcdc;
}

.if-section-heading h1,
.if-section-heading h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 !important;
  padding: 0 !important;
  color: #111 !important;
  font-size: 25px !important;
  line-height: 1.2 !important;
  font-weight: 800 !important;
  letter-spacing: -.02em;
}

.if-section-heading h1 > span,
.if-section-heading h2 > span {
  display: inline-block;
  width: 5px;
  height: 25px;
  flex: 0 0 5px;
  background: #ef233c;
}

.if-section-heading > a {
  flex: 0 0 auto;
  color: #111 !important;
  font-size: 11px !important;
  line-height: 1;
  font-weight: 800 !important;
  text-decoration: none !important;
  white-space: nowrap;
}

.if-section-heading > a b {
  font-size: 14px;
  font-weight: 800;
}

.if-news-grid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 20px !important;
  align-items: start !important;
  width: 100%;
}

.if-news-card {
  min-width: 0;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  background: #fff;
}

.if-card-image {
  display: block !important;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  margin: 0 !important;
  padding: 0 !important;
  background: #f1f1f1;
  border-radius: 5px;
  text-decoration: none !important;
}

.if-card-image img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  transition: transform .25s ease;
}

.if-card-image:hover img {
  transform: scale(1.025);
}

.if-image-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: #eee;
}

.if-card-body {
  display: block !important;
  width: 100%;
  padding: 9px 0 0 !important;
  margin: 0 !important;
}

.if-meta {
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 6px !important;
  padding: 0 !important;
  color: #777 !important;
  font-size: 10px !important;
  line-height: 1.4 !important;
  text-transform: none;
}

.if-meta a {
  color: #e51d3e !important;
  font-weight: 800 !important;
  text-decoration: none !important;
}

.if-meta time {
  color: #777 !important;
}

.if-card-body h2,
.if-card-body h3 {
  display: block !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  color: #111 !important;
  font-size: 16px !important;
  line-height: 1.32 !important;
  font-weight: 750 !important;
  letter-spacing: -.01em;
}

.if-card-body h2 a,
.if-card-body h3 a {
  display: inline !important;
  color: #111 !important;
  text-decoration: none !important;
}

.if-card-body h2 a:hover,
.if-card-body h3 a:hover {
  color: #e51d3e !important;
}

.if-card-body p {
  margin: 6px 0 0 !important;
  padding: 0 !important;
  color: #666 !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
}

.if-empty {
  margin: 0;
  color: #777;
}

/* Explicitly hide any leftover featured/hero/breaking elements from older versions. */
.if-home .if-hero-wrap,
.if-home .if-featured-section,
.if-home .if-breaking,
.if-home .if-hero-grid,
.if-home .if-hero-image-card {
  display: none !important;
}

.if-news-grid {
    gap: 22px !important;
  }
}

@media (max-width: 1100px) {
  .if-news-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  .if-home .if-container {
    width: 100%;
    padding-left: 14px;
    padding-right: 14px;
  }

  .if-home .if-section {
    padding: 27px 0;
  }

  .if-section-heading h1,
  .if-section-heading h2 {
    font-size: 21px !important;
  }

  .if-section-heading h1 > span,
  .if-section-heading h2 > span {
    height: 21px;
    flex-basis: 4px;
    width: 4px;
  }

  .if-news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px 14px !important;
  }

  .if-card-body h2,
  .if-card-body h3 {
    font-size: 15px !important;
  }
}

@media (max-width: 480px) {
  .if-home .if-container {
    width: 100%;
    padding-left: 10px;
    padding-right: 10px;
  }

  .if-news-grid {
    grid-template-columns: 1fr !important;
  }

  .if-section-heading {
    margin-bottom: 15px !important;
  }
}
/* END INFOFLICK HOME V5 */

/* INFOFLICK HOME V6 - TOP THUMBNAILS + HERO SLIDER */
.if-home .if-container {
  width: 100%;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(12px, 3vw, 48px);
  padding-right: clamp(12px, 3vw, 48px);
}

/* Top 5 thumbnail slider */
.if-top-slider-section {
  width: 100%;
  padding: 18px 0 12px;
  background: #fff;
}

.if-top-slider {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.if-top-track {
  display: flex;
  gap: 16px;
  width: 100%;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 2px 0 5px;
}

.if-top-track::-webkit-scrollbar {
  display: none;
}

.if-top-slide {
  flex: 0 0 calc((100% - 64px) / 5);
  min-width: 0;
}

.if-top-slide > a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #111;
  text-decoration: none;
}

.if-top-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 5px;
  background: #eee;
}

.if-top-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.if-top-title {
  display: -webkit-box;
  overflow: hidden;
  color: #111;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.32;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.if-slider-arrow {
  z-index: 2;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.if-top-prev { margin-right: 10px; }
.if-top-next { margin-left: 10px; }

/* Hero slider */
.if-hero-section {
  width: 100%;
  padding: 12px 0 26px;
  background: #fff;
}

.if-hero-slider {
  position: relative;
  width: 100%;
}

.if-hero-track {
  position: relative;
  width: 100%;
}

.if-hero-slide {
  display: none;
  width: 100%;
}

.if-hero-slide.is-active {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, .85fr);
  gap: 28px;
  align-items: center;
}

.if-hero-image {
  width: 100%;
  aspect-ratio: 16 / 8.8;
  overflow: hidden;
  border-radius: 6px;
  background: #eee;
}

.if-hero-image a,
.if-hero-image img {
  display: block;
  width: 100%;
  height: 100%;
}

.if-hero-image img {
  object-fit: cover;
}

.if-hero-content {
  padding: 8px 30px 8px 0;
}

.if-hero-content .if-meta {
  margin-bottom: 9px !important;
}

.if-hero-content h1 {
  margin: 0 !important;
  padding: 0 !important;
  font-size: clamp(28px, 3vw, 44px) !important;
  line-height: 1.12 !important;
  font-weight: 800 !important;
  letter-spacing: -.03em;
}

.if-hero-content h1 a {
  color: #111 !important;
  text-decoration: none !important;
}

.if-hero-content p {
  margin: 13px 0 0 !important;
  color: #666 !important;
  font-size: 14px !important;
  line-height: 1.65 !important;
}

.if-hero-prev { position: absolute; left: 12px; top: calc(50% - 17px); }
.if-hero-next { position: absolute; right: 12px; top: calc(50% - 17px); }

.if-hero-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 13px;
}

.if-hero-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ccc;
  cursor: pointer;
}

.if-hero-dot.is-active {
  width: 22px;
  border-radius: 8px;
  background: #ef233c;
}

/* Ensure all homepage article text stays below the image */
.if-home .if-card-image,
.if-home .if-featured-image,
.if-home .if-hero-image {
  position: relative;
}

.if-home .if-card-body,
.if-home .if-featured-content,
.if-home .if-hero-content {
  position: static;
  background: #fff;
  color: #111;
}

/* Responsive */
@media (max-width: 1100px) {
  .if-top-slide {
    flex-basis: calc((100% - 32px) / 3);
  }

  .if-hero-slide.is-active {
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, .8fr);
    gap: 20px;
  }

  .if-hero-content h1 {
    font-size: 30px !important;
  }
}

@media (max-width: 760px) {
  .if-home .if-container {
    width: 100%;
    padding-left: 14px;
    padding-right: 14px;
  }

  .if-top-slider-section {
    padding-top: 12px;
  }

  .if-top-slide {
    flex-basis: calc((100% - 14px) / 2);
  }

  .if-slider-arrow {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .if-hero-slide.is-active {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .if-hero-image {
    aspect-ratio: 16 / 9;
  }

  .if-hero-content {
    padding: 0 5px;
  }

  .if-hero-content h1 {
    font-size: 25px !important;
  }

  .if-hero-prev,
  .if-hero-next {
    top: calc(50% - 15px);
  }
}

@media (max-width: 480px) {
  .if-home .if-container {
    width: 100%;
    padding-left: 10px;
    padding-right: 10px;
  }

  .if-top-slide {
    flex-basis: 78%;
  }

  .if-top-prev,
  .if-top-next {
    display: none;
  }

  .if-hero-section {
    padding-bottom: 18px;
  }

  .if-hero-content h1 {
    font-size: 23px !important;
  }
}
/* END INFOFLICK HOME V6 */

/* INFOFLICK HOME V7 - FLUID FULL-WIDTH RESPONSIVE LAYOUT */

/* Fluid container: no fixed maximum width */
.if-home .if-container {
  width: 100% !important;
  max-width: none !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: clamp(12px, 3vw, 48px) !important;
  padding-right: clamp(12px, 3vw, 48px) !important;
}

/* Prevent horizontal overflow */
.if-home {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Top thumbnails adapt continuously */
.if-top-slide {
  flex: 0 0 clamp(180px, 18vw, 280px);
}

/* Hero adapts to available width */
.if-hero-slide.is-active {
  width: 100%;
}

.if-hero-image {
  width: 100%;
}

/* Latest/category grids */
.if-news-grid {
  width: 100%;
}

/* Large desktop: 5 columns */
@media (min-width: 1200px) {
  .if-news-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}

/* Medium desktop/tablet landscape: 4 columns */
@media (min-width: 900px) and (max-width: 1199px) {
  .if-news-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .if-hero-slide.is-active {
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  }
}

/* Tablet: 3 columns */
@media (min-width: 600px) and (max-width: 899px) {
  .if-home .if-container {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  .if-news-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .if-top-slide {
    flex-basis: clamp(190px, 30vw, 250px);
  }

  .if-hero-slide.is-active {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .if-hero-content {
    padding: 0 4px;
  }
}

/* Mobile: 2 columns */
@media (min-width: 421px) and (max-width: 599px) {
  .if-home .if-container {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .if-news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .if-top-slide {
    flex-basis: 48%;
  }

  .if-hero-slide.is-active {
    grid-template-columns: 1fr;
  }
}

/* Small mobile: 1 column where needed */
@media (max-width: 420px) {
  .if-home .if-container {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .if-news-grid {
    grid-template-columns: 1fr !important;
  }

  .if-top-slide {
    flex-basis: 78%;
  }

  .if-hero-slide.is-active {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .if-hero-content {
    padding: 0 2px;
  }

  .if-hero-content h1 {
    font-size: clamp(22px, 7vw, 28px) !important;
  }
}

/* Images remain responsive and never distort */
.if-home img {
  max-width: 100%;
}

.if-home .if-card-image,
.if-home .if-top-thumb,
.if-home .if-hero-image {
  width: 100%;
}

/* Keep controls usable on touch devices */
.if-slider-arrow {
  min-width: 34px;
  min-height: 34px;
  touch-action: manipulation;
}
/* END INFOFLICK HOME V7 */

/* INFOFLICK HOME V9 - STABLE RESPONSIVE HOMEPAGE */

/* Top thumbnail slider is permanently removed. */
.if-home .if-top-slider-section,
.if-home .if-top-slider,
.if-home .if-top-track,
.if-home .if-top-slide,
.if-home .if-top-prev,
.if-home .if-top-next {
  display: none !important;
}

/* Fluid centered content: no fixed maximum width. */
.if-home {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.if-home .if-container {
  width: 100%;
  max-width: none !important;
  margin-inline: auto;
  padding-inline: clamp(12px, 3vw, 48px);
}

/* Hero slider */
.if-hero-section {
  width: 100%;
  padding: 20px 0 30px;
}

.if-hero-slide {
  display: none;
  width: 100%;
}

.if-hero-slide.is-active {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr);
  gap: clamp(20px, 3vw, 42px);
  align-items: center;
}

.if-hero-image {
  width: 100%;
  aspect-ratio: 16 / 8.5;
  overflow: hidden;
  border-radius: 6px;
  background: #eee;
}

.if-hero-image a,
.if-hero-image img {
  display: block;
  width: 100%;
  height: 100%;
}

.if-hero-image img {
  object-fit: cover;
}

.if-hero-content {
  position: static !important;
  padding: 0 clamp(0px, 1vw, 16px) 0 0;
  background: #fff !important;
}

.if-hero-content h1 {
  margin: 0 !important;
  color: #111 !important;
  font-size: clamp(26px, 3.2vw, 46px) !important;
  line-height: 1.12 !important;
  font-weight: 800 !important;
  letter-spacing: -.03em;
}

.if-hero-content h1 a {
  color: #111 !important;
  text-decoration: none !important;
}

.if-hero-content p {
  margin: 12px 0 0 !important;
  color: #666 !important;
  font-size: clamp(13px, 1.1vw, 15px) !important;
  line-height: 1.6 !important;
}

/* Article rows */
.if-news-grid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: clamp(14px, 1.7vw, 24px) !important;
  width: 100%;
  align-items: start;
}

.if-news-card {
  min-width: 0;
  width: 100%;
}

.if-card-image {
  display: block !important;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 5px;
  background: #eee;
}

.if-card-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.if-card-body {
  position: static !important;
  width: 100%;
  padding-top: 9px !important;
  background: #fff !important;
}

.if-card-body h2,
.if-card-body h3 {
  color: #111 !important;
  margin: 0 !important;
  line-height: 1.32 !important;
}

.if-card-body h2 a,
.if-card-body h3 a {
  color: #111 !important;
  text-decoration: none !important;
}

/* Tablet */
@media (max-width: 1100px) {
  .if-news-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .if-hero-slide.is-active {
    grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr);
  }
}

/* Mobile/tablet */
@media (max-width: 760px) {
  .if-home .if-container {
    padding-inline: 16px;
  }

  .if-news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .if-hero-slide.is-active {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .if-hero-image {
    aspect-ratio: 16 / 9;
  }

  .if-hero-content {
    padding: 0 !important;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .if-home .if-container {
    padding-inline: 10px;
  }

  .if-news-grid {
    grid-template-columns: 1fr !important;
  }

  .if-hero-content h1 {
    font-size: 24px !important;
  }
}
/* END INFOFLICK HOME V9 */


/* INFOFLICK HOME V10 - LATEST NEWS 5-IMAGE SLIDER */

/* Latest News becomes a horizontal five-story image slider. */
.if-latest-section .if-section-heading {
  align-items: center !important;
}

.if-slider-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.if-latest-slider {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.if-latest-track {
  display: flex;
  gap: 20px;
  width: 100%;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  padding: 2px 0 8px;
}

.if-latest-track::-webkit-scrollbar {
  display: none;
}

.if-latest-slide {
  flex: 0 0 calc((100% - 80px) / 5);
  min-width: 0;
  scroll-snap-align: start;
}

.if-latest-slide .if-card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: block;
  overflow: hidden;
  border-radius: 5px;
  background: #eee;
}

.if-latest-slide .if-card-image img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.if-latest-slide .if-card-body {
  padding-top: 9px !important;
}

.if-latest-slide .if-card-body h3 {
  margin: 0 !important;
  font-size: 16px !important;
  line-height: 1.32 !important;
  font-weight: 750 !important;
}

.if-latest-slide .if-card-body h3 a {
  color: #111 !important;
  text-decoration: none !important;
}

.if-latest-slide .if-card-body p {
  margin-top: 6px !important;
}

/* Large screens: exactly five cards visible */
@media (min-width: 1200px) {
  .if-latest-slide {
    flex-basis: calc((100% - 80px) / 5);
  }
}

/* Medium desktop: four visible */
@media (min-width: 900px) and (max-width: 1199px) {
  .if-latest-slide {
    flex-basis: calc((100% - 60px) / 4);
  }
}

/* Tablet: three visible */
@media (min-width: 600px) and (max-width: 899px) {
  .if-latest-slide {
    flex-basis: calc((100% - 40px) / 3);
  }
}

/* Mobile: two visible */
@media (min-width: 421px) and (max-width: 599px) {
  .if-latest-slide {
    flex-basis: calc((100% - 14px) / 2);
  }
}

/* Small mobile: one large card visible */
@media (max-width: 420px) {
  .if-latest-slide {
    flex-basis: 88%;
  }

  .if-slider-controls {
    gap: 5px;
  }

  .if-latest-slide .if-card-body h3 {
    font-size: 17px !important;
  }
}

/* Keep all Latest News text below the image and black. */
.if-latest-slide .if-card-body,
.if-latest-slide .if-meta,
.if-latest-slide h3,
.if-latest-slide h3 a,
.if-latest-slide p {
  position: static !important;
  background: #fff !important;
  color: #111 !important;
}
/* END INFOFLICK HOME V10 */

/* =========================================================
   INFOFLICK HOME V11
   Completely white, fluid and mobile-safe
   ========================================================= */

/* Kill inherited dark backgrounds from Magbook on the homepage. */
html,
body,
body.home,
body.blog,
body.page-template-default {
  background: #fff !important;
  color: #111 !important;
}

body.home #page,
body.home #content,
body.home .site,
body.home .site-content,
body.home .content-area,
body.home .main-content,
body.home .container,
body.home .wrapper,
body.home .site-main {
  background: #fff !important;
}

/* Homepage must occupy the complete viewport width. */
body.home #page,
body.home .site,
body.home .site-content,
body.home .content-area,
body.home .site-main,
body.home #primary,
body.home .if-home {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin-left: auto !important;
  margin-right: auto !important;
  float: none !important;
}

/* Remove inherited sidebar/secondary column that can create the black right panel. */
body.home #secondary,
body.home .widget-area,
body.home .sidebar,
body.home aside.sidebar,
body.home .secondary {
  display: none !important;
}

/* Remove inherited content/sidebar layout constraints. */
body.home .site-content .container,
body.home .site-content .inner-wrap,
body.home .site-content .content-wrapper,
body.home .main-content-wrap,
body.home .main-wrapper {
  width: 100% !important;
  max-width: none !important;
  padding: 0 !important;
  margin: 0 auto !important;
  background: #fff !important;
}

/* Fluid homepage container. */
body.home .if-home .if-container {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 auto !important;
  padding-left: clamp(10px, 3vw, 48px) !important;
  padding-right: clamp(10px, 3vw, 48px) !important;
}

/* Never allow any child element to create horizontal overflow. */
body.home .if-home,
body.home .if-home section,
body.home .if-home .if-container {
  max-width: 100% !important;
  overflow-x: hidden;
}

/* Hero: image and text stay inside the viewport. */
body.home .if-hero-section,
body.home .if-hero-slider,
body.home .if-hero-track,
body.home .if-hero-slide.is-active {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

body.home .if-hero-slide.is-active {
  display: grid !important;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, .8fr) !important;
  align-items: center !important;
}

body.home .if-hero-image,
body.home .if-hero-image a,
body.home .if-hero-image img {
  max-width: 100% !important;
  min-width: 0 !important;
}

body.home .if-hero-content {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-wrap: anywhere;
  word-break: normal;
  background: #fff !important;
  color: #111 !important;
}

/* Latest News slider and category grids are fluid. */
body.home .if-latest-slider,
body.home .if-latest-track,
body.home .if-news-grid,
body.home .if-news-card,
body.home .if-latest-slide {
  min-width: 0 !important;
  max-width: 100% !important;
}

body.home .if-latest-track {
  width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

/* No accidental black overlay/background on article text. */
body.home .if-card-body,
body.home .if-latest-slide .if-card-body,
body.home .if-category-section,
body.home .if-latest-section {
  background: #fff !important;
  color: #111 !important;
}

body.home .if-card-body h2,
body.home .if-card-body h3,
body.home .if-card-body h2 a,
body.home .if-card-body h3 a {
  color: #111 !important;
}

/* Images scale naturally without stretching. */
body.home .if-home img {
  max-width: 100% !important;
  height: auto;
}

body.home .if-card-image img,
body.home .if-hero-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Tablet */
@media (max-width: 899px) {
  body.home .if-hero-slide.is-active {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  body.home .if-hero-content {
    padding: 0 !important;
  }

  body.home .if-news-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* Mobile */
@media (max-width: 600px) {
  body.home .if-home .if-container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  body.home .if-news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.home .if-hero-image {
    aspect-ratio: 16 / 9 !important;
  }

  body.home .if-hero-content h1 {
    font-size: clamp(23px, 7vw, 30px) !important;
    line-height: 1.15 !important;
  }

  body.home .if-hero-content p {
    font-size: 13px !important;
  }
}

/* Small phones */
@media (max-width: 420px) {
  body.home .if-home .if-container {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  body.home .if-news-grid {
    grid-template-columns: 1fr !important;
  }

  body.home .if-latest-slide {
    flex-basis: 88% !important;
  }

  body.home .if-hero-slide.is-active {
    gap: 12px !important;
  }
}

/* Desktop: use the available screen width while preserving clean gutters. */
@media (min-width: 1200px) {
  body.home .if-home .if-container {
    padding-left: clamp(28px, 4vw, 64px) !important;
    padding-right: clamp(28px, 4vw, 64px) !important;
  }
}

/* Remove common Magbook homepage wrapper backgrounds/borders that can appear dark. */
body.home .entry-content,
body.home .type-page,
body.home .page,
body.home .hentry {
  background: #fff !important;
  border: 0 !important;
}

/* END INFOFLICK HOME V11 */

/* INFOFLICK HOME V12 - LATEST NEWS REMOVED */
.if-home .if-latest-section,
.if-home .if-latest-slider,
.if-home .if-latest-track,
.if-home .if-latest-slide,
.if-home .if-latest-prev,
.if-home .if-latest-next {
  display: none !important;
}
/* END INFOFLICK HOME V12 */
