/* ===========================
   bestforedu.com – Homepage
   Polished hover, motion & focus
   (mobile-optimized)
   =========================== */

/* -------- Theme tokens -------- */
:root{
  --bfe-accent:#e10600;            /* brand red */
  --bfe-ink:#0f172a;               /* headings */
  --bfe-body:#111827;              /* text */
  --bfe-muted:#6b7280;             /* meta */
  --bfe-line:#e5e7eb;              /* borders */
  --bfe-card:#ffffff;              /* bg */
  --bfe-shadow:0 10px 25px rgba(2, 6, 23, .08);
  --bfe-shadow-lg:0 18px 35px rgba(2, 6, 23, .16);
  --bfe-radius:12px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.001ms !important;animation-iteration-count:1 !important;transition-duration:.001ms !important;scroll-behavior:auto !important}
}

/* Global link & image behavior inside the page container */
.bfe-wrap a{color:inherit;text-decoration:none;transition:color .18s ease,opacity .18s ease,transform .18s ease,box-shadow .18s ease}
.bfe-wrap a:hover{color:var(--bfe-ink)}
.bfe-wrap img{display:block;max-width:100%;height:auto;transition:transform .35s ease,filter .35s ease,opacity .2s ease}

/* Focus-visible for accessibility */
.bfe-wrap a:focus-visible{outline:2px solid var(--bfe-accent);outline-offset:3px;border-radius:8px}

/* Container */
.bfe-wrap{max-width:1220px;margin:0 auto;padding:24px 16px}

/* ===== TOP AREA (two big + right column) ===== */
.bfe-top{display:grid;grid-template-columns:2fr 2fr 1.2fr;gap:24px}
@media (max-width:1100px){.bfe-top{grid-template-columns:1fr}}
.bfe-col{display:flex;flex-direction:column;gap:18px}

/* Big feature cards */
.bfe-feature{position:relative;border-radius:var(--bfe-radius);overflow:hidden;display:block;color:#fff;min-height:340px;background:#000;box-shadow:var(--bfe-shadow)}
.bfe-feature img{width:100%;height:100%;object-fit:cover;transform:scale(1.001)}
.bfe-feature:after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(0,0,0,.2) 0%,rgba(0,0,0,.86) 100%)}
.bfe-feature .bfe-cap{position:absolute;left:18px;right:18px;bottom:18px;z-index:2}
.bfe-cat{display:inline-block;background:var(--bfe-accent);color:#fff;border-radius:999px;padding:6px 10px;font-size:12px;letter-spacing:.3px;text-transform:uppercase;margin-bottom:8px}
.bfe-feature h2{margin:6px 0 6px;font-size:28px;line-height:1.15;color:#fff;text-shadow:0 2px 8px rgba(0,0,0,.45)}
.bfe-meta{opacity:.9;font-size:14px;color:#e5e7eb}

/* Feature hover */
.bfe-feature:hover{box-shadow:var(--bfe-shadow-lg);transform:translateY(-2px)}
.bfe-feature:hover img{transform:scale(1.04)}
.bfe-feature:hover:after{background:linear-gradient(180deg,rgba(0,0,0,.25),rgba(0,0,0,.9))}

/* Small media rows (thumbnail + text) */
.bfe-list{display:flex;gap:12px;padding:12px 0;border-top:1px solid var(--bfe-line)}
.bfe-list:first-of-type{border-top:0}
.bfe-thumb{width:112px;height:70px;object-fit:cover;border-radius:8px;flex:0 0 112px;background:#f3f4f6}
.bfe-list h4{margin:0 0 6px;font-size:16px;line-height:1.25}
.bfe-list .bfe-meta{font-size:12px;color:var(--bfe-muted)}
/* List hover */
.bfe-list:hover .bfe-thumb{transform:scale(1.03)}
.bfe-list:hover h4{text-decoration:underline}
.bfe-list:hover{transform:translateY(-1px)}

/* Right column medium cards */
.bfe-card{display:block;background:var(--bfe-card);border-radius:10px}
.bfe-card img{width:100%;height:180px;object-fit:cover;border-radius:10px;margin-bottom:8px;background:#f3f4f6}
.bfe-card h3{margin:0 0 6px;font-size:18px;line-height:1.25}
.bfe-card .bfe-meta{color:var(--bfe-muted)}
/* Card hover */
.bfe-card:hover{transform:translateY(-3px);box-shadow:var(--bfe-shadow-lg)}
.bfe-card:hover img{transform:scale(1.04)}
.bfe-card:hover h3{text-decoration:underline}

/* ===== SECONDARY STRIP ===== */
.bfe-strip{display:grid;grid-template-columns:1.6fr 2fr 1.2fr;gap:24px;margin:28px 0}
@media (max-width:1100px){.bfe-strip{grid-template-columns:1fr}}
.bfe-heading{font-weight:700;font-size:14px;letter-spacing:.4px;text-transform:uppercase;border-left:4px solid var(--bfe-accent);padding-left:10px;margin:0 0 12px;color:var(--bfe-ink)}

/* Left: More Top Stories list */
.bfe-toplist .item{display:flex;gap:12px;padding:12px 0;border-top:1px solid var(--bfe-line)}
.bfe-toplist .item:first-child{border-top:0}
.bfe-toplist .ph{width:110px;height:70px;border-radius:8px;object-fit:cover;flex:0 0 110px;background:#f3f4f6}
.bfe-toplist h4{margin:0 0 6px;font-size:16px;line-height:1.25}
.bfe-toplist .meta{font-size:12px;color:var(--bfe-muted)}
/* Hover */
.bfe-toplist .item:hover .ph{transform:scale(1.03)}
.bfe-toplist .item:hover h4{text-decoration:underline}

/* Center: section feature + minis */
.bfe-center .feature{position:relative;border-radius:var(--bfe-radius);overflow:hidden;display:block;color:#fff;min-height:300px;margin-bottom:12px;background:#000;box-shadow:var(--bfe-shadow)}
.bfe-center .feature img{width:100%;height:100%;object-fit:cover;transform:scale(1.001)}
.bfe-center .feature:after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(0,0,0,.2),rgba(0,0,0,.86))}
.bfe-center .cap{position:absolute;left:18px;right:18px;bottom:18px;z-index:2}
.bfe-center .cap h2{margin:6px 0 6px;font-size:24px;line-height:1.15;color:#fff;text-shadow:0 2px 8px rgba(0,0,0,.45)}
.bfe-center .feature:hover{box-shadow:var(--bfe-shadow-lg);transform:translateY(-2px)}
.bfe-center .feature:hover img{transform:scale(1.04)}
.bfe-center .feature:hover:after{background:linear-gradient(180deg,rgba(0,0,0,.25),rgba(0,0,0,.9))}
.bfe-mini{display:grid;grid-template-columns:1fr;gap:14px}
.bfe-mini .card{display:flex;gap:12px}
.bfe-mini .card img{width:120px;height:76px;border-radius:8px;object-fit:cover;background:#f3f4f6}
.bfe-mini .card h5{margin:0 0 6px;font-size:16px;line-height:1.25}
.bfe-mini .card:hover img{transform:scale(1.03)}
.bfe-mini .card:hover h5{text-decoration:underline}

/* Right: Topic block */
.bfe-right .ad{background:#f3f4f6;border-radius:10px;height:180px;margin-bottom:16px}
.bfe-topic .badge{display:inline-block;background:#111;color:#fff;font-size:11px;padding:4px 8px;border-radius:999px;margin-bottom:8px}
.bfe-topic .lead{display:block}
.bfe-topic .lead img{width:100%;height:170px;border-radius:10px;object-fit:cover;margin:6px 0;background:#f3f4f6}
.bfe-topic .lead h3{margin:0 0 6px;font-size:18px;line-height:1.25}
.bfe-topic .lead:hover img{transform:scale(1.04)}
.bfe-topic .lead:hover h3{text-decoration:underline}
.bfe-topic .links a{display:block;color:var(--bfe-accent);font-weight:700;margin:8px 0 4px}
.bfe-topic .links a:hover{text-decoration:underline}
.bfe-topic .links p{margin:0 0 8px;color:#374151;font-size:14px}

/* ===== FULL-WIDTH SPOTLIGHT ===== */
.bfe-spotlight{margin:28px 0}
.bfe-spot{position:relative;border-radius:var(--bfe-radius);overflow:hidden;display:block;color:#fff;background:#000;box-shadow:var(--bfe-shadow)}
.bfe-spot img{width:100%;height:100%;object-fit:cover;transform:scale(1.001)}
.bfe-spot:after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(0,0,0,.22),rgba(0,0,0,.88))}
.bfe-spot .cap{position:absolute;left:22px;right:22px;bottom:22px;z-index:2}
.bfe-spot h2{margin:8px 0 6px;font-size:30px;line-height:1.15;color:#fff;text-shadow:0 2px 8px rgba(0,0,0,.45)}
.bfe-spot:hover{box-shadow:var(--bfe-shadow-lg);transform:translateY(-2px)}
.bfe-spot:hover img{transform:scale(1.045)}
.bfe-spot:hover:after{background:linear-gradient(180deg,rgba(0,0,0,.28),rgba(0,0,0,.92))}

/* ===== CATEGORY ROWS ===== */
.bfe-sec{margin-top:28px}
.bfe-sec h3{margin:0 0 12px;border-left:4px solid var(--bfe-accent);padding-left:10px;font-size:20px;color:var(--bfe-ink)}
.bfe-grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}
@media (max-width:900px){.bfe-grid3{grid-template-columns:1fr 1fr}}
@media (max-width:600px){.bfe-grid3{grid-template-columns:1fr}}
.bfe-grid3 .bfe-card{background:var(--bfe-card);border-radius:10px;box-shadow:var(--bfe-shadow);padding-bottom:8px}
.bfe-grid3 .bfe-card img{height:190px;border-radius:10px 10px 0 0;background:#f3f4f6}
.bfe-grid3 .bfe-card h3{padding:8px 8px 0}
.bfe-grid3 .bfe-card .bfe-meta{padding:0 8px 8px;color:var(--bfe-muted)}
.bfe-grid3 .bfe-card:hover{transform:translateY(-3px);box-shadow:var(--bfe-shadow-lg)}
.bfe-grid3 .bfe-card:hover img{transform:scale(1.04)}
.bfe-grid3 .bfe-card:hover h3{text-decoration:underline}

/* Utilities */
.bfe-empty{color:#9ca3af;font-style:italic}

/* Extra contrast guard (keeps titles white on media) */
.bfe-feature .bfe-cap h2,
.bfe-center .feature .cap h2,
.bfe-spot .cap h2{color:#fff !important;text-shadow:0 2px 8px rgba(0,0,0,.45)}

/* --- Spotlight height tuning (shorter + responsive) --- */
.bfe-spotlight { margin:24px 0 } /* a touch tighter */

/* Force a fixed responsive height and stop growth */
.bfe-spot{
  min-height: 0 !important;                     /* cancel any earlier min-height */
  height: clamp(220px, 32vw, 300px) !important; /* fixed, responsive height */
  overflow: hidden;                              /* clip overflow */
}

/* scale the headline a bit to match the reduced height */
.bfe-spot h2{
  font-size: clamp(20px, 3.4vw, 26px) !important;
}

/* slightly raise caption so it never clashes with the edge */
.bfe-spot .cap{ bottom:16px }

/* if an image is very tall, keep good crop */
.bfe-spot img{ height:100% !important; object-fit:cover }

/* darker overlay still, to keep text readable at smaller sizes */
.bfe-spot:after{
  background: linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.9)) !important;
}

/* ===========================
   MOBILE OPTIMIZATIONS
   =========================== */

/* Remove hover zooms on touch to avoid blur from transform scaling */
@media (hover:none){
  .bfe-feature:hover,
  .bfe-center .feature:hover,
  .bfe-spot:hover,
  .bfe-card:hover,
  .bfe-list:hover,
  .bfe-toplist .item:hover,
  .bfe-topic .lead:hover{ transform:none; box-shadow:none }
  .bfe-feature:hover img,
  .bfe-center .feature:hover img,
  .bfe-spot:hover img,
  .bfe-card:hover img,
  .bfe-list:hover .bfe-thumb,
  .bfe-toplist .item:hover .ph,
  .bfe-topic .lead:hover img{ transform:none }
}

/* Tablet tweaks (<= 900px) – slightly smaller images and tighter gaps */
@media (max-width: 900px){
  .bfe-wrap{ padding:20px 14px }
  .bfe-grid3{ gap:14px }
  .bfe-grid3 .bfe-card img{ height:170px }
  .bfe-card img{ height:160px }
  .bfe-feature{ min-height:300px }
  .bfe-center .feature{ min-height:260px }
  .bfe-spot h2{ font-size: clamp(18px, 3.2vw, 24px) !important }
}

/* Phone tweaks (<= 680px) – scale down images to avoid upscaling blur */
@media (max-width: 680px){
  .bfe-wrap{ padding:16px 12px }

  /* Top features: shorter boxes */
  .bfe-feature{ min-height:240px }
  .bfe-feature h2{ font-size:22px; line-height:1.15 }
  .bfe-feature .bfe-cap{ left:14px; right:14px; bottom:14px }

  /* Center feature */
  .bfe-center .feature{ min-height:220px }
  .bfe-center .cap h2{ font-size:20px }

  /* Right cards: reduce image height */
  .bfe-card img{ height:140px }

  /* List thumbs: smaller, crisper aspect ratio */
  .bfe-thumb{ width:96px; height:58px; flex:0 0 96px; border-radius:8px }
  .bfe-toplist .ph{ width:96px; height:58px; flex:0 0 96px }

  /* Category grid cards: smaller hero image */
  .bfe-grid3 .bfe-card img{ height:150px }

  /* Headlines a touch smaller */
  .bfe-grid3 .bfe-card h3{ font-size:16px }
  .bfe-list h4{ font-size:15px }
  .bfe-topic .lead h3{ font-size:16px }
}

/* Small phones (<= 520px) – enforce aspect ratios to stop blurry scaling */
@media (max-width: 520px){
  /* Spotlight already clamped; keep it short */
  .bfe-spot{ height: 220px !important }
  .bfe-spot .cap{ bottom:12px }

  /* Use aspect ratios instead of fixed pixel heights to prevent stretch */
  .bfe-card img{ height:auto; aspect-ratio: 16/9; }
  .bfe-grid3 .bfe-card img{ height:auto; aspect-ratio: 16/9; }
  .bfe-feature{ min-height:210px }
  .bfe-center .feature{ min-height:200px }

  /* Thumbs as 3:2 ratio */
  .bfe-thumb,
  .bfe-toplist .ph{
    width: 88px; flex: 0 0 88px;
    height:auto; aspect-ratio: 3/2;
  }

  /* Tighter spacing */
  .bfe-top{ gap:16px }
  .bfe-col{ gap:14px }
  .bfe-strip{ gap:16px; margin:22px 0 }
}

/* Micro phones (<= 380px) – extra safeguards */
@media (max-width: 380px){
  .bfe-wrap{ padding:14px 10px }
  .bfe-feature{ min-height:190px }
  .bfe-center .feature{ min-height:180px }
  .bfe-card img{ aspect-ratio: 16/10 }   /* a hair taller for readability */
  .bfe-grid3 .bfe-card img{ aspect-ratio: 16/10 }
  .bfe-feature h2{ font-size:20px }
  .bfe-center .cap h2{ font-size:18px }
}
