/*
Theme Name: NewsFlash
Theme URI: https://example.com/newsflash
Author: IGotSmarter
Author URI: https://example.com
Description: A lightweight, official-looking English news theme optimized for Core Web Vitals and PageSpeed.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: newsflash
Tags: news, blog, two-columns, custom-logo, custom-menu, featured-images, accessibility-ready, editor-style
*/

/* ----------------------------------------------------------
   Design system (CSS variables)
   ---------------------------------------------------------- */
:root{
  --nf-bg:#ffffff;
  --nf-surface:#ffffff;
  --nf-text:#0b1220;
  --nf-muted:#516071;
  --nf-border:#e6e9ef;
  --nf-primary:#b91c1c; /* customizable */
  --nf-accent:#0ea5e9;
  --nf-success:#16a34a;

  --nf-radius:14px;
  --nf-radius-sm:10px;
  --nf-shadow:0 8px 28px rgba(12,18,32,.10);

  --nf-container:1180px;
  --nf-gutter:18px;

  --nf-font:system-ui,-apple-system,"Segoe UI",Roboto,Arial,"Noto Sans","Liberation Sans",sans-serif;
  --nf-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;

  --nf-h1:clamp(1.7rem,1.2rem + 1.6vw,2.6rem);
  --nf-h2:clamp(1.35rem,1.05rem + 1vw,1.85rem);
  --nf-h3:1.15rem;
  --nf-body:1rem;
  --nf-small:.92rem;
  --nf-line:1.7;
}

/* Optional dark mode (toggle adds .nf-dark on body) */
body.nf-dark{
  --nf-bg:#0b1220;
  --nf-surface:#0f172a;
  --nf-text:#eaf0ff;
  --nf-muted:#b6c1d6;
  --nf-border:#1f2a44;
  --nf-shadow:0 10px 30px rgba(0,0,0,.35);
}

/* ----------------------------------------------------------
   Base
   ---------------------------------------------------------- */
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:var(--nf-font);
  color:var(--nf-text);
  background:var(--nf-bg);
  line-height:var(--nf-line);
  text-rendering:optimizeLegibility;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;text-decoration:none}
a:hover{text-decoration:underline}
img{max-width:100%;height:auto;display:block}
button,input{font:inherit}
hr{border:0;border-top:1px solid var(--nf-border);margin:24px 0}

.nf-container{
  max-width:var(--nf-container);
  padding:0 var(--nf-gutter);
  margin:0 auto;
}

.nf-skip-link{
  position:absolute; left:-9999px; top:auto;
  width:1px; height:1px; overflow:hidden;
}
.nf-skip-link:focus{
  left:12px; top:12px;
  width:auto; height:auto;
  padding:10px 12px;
  background:var(--nf-surface);
  border:1px solid var(--nf-border);
  border-radius:10px;
  z-index:9999;
}

/* ----------------------------------------------------------
   Header
   ---------------------------------------------------------- */
.nf-topbar{
  border-bottom:1px solid var(--nf-border);
  background:var(--nf-surface);
}
.nf-topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 0;
}
.nf-brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.nf-logo img{height:32px;width:auto}
.nf-site-title{
  font-weight:800;
  letter-spacing:-.02em;
  line-height:1.1;
  font-size:1.1rem;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.nf-site-tagline{
  margin:0;
  font-size:.85rem;
  color:var(--nf-muted);
  line-height:1.1;
}

.nf-actions{
  display:flex; align-items:center; gap:10px;
}
.nf-icon-btn{
  border:1px solid var(--nf-border);
  background:transparent;
  border-radius:12px;
  padding:8px 10px;
  cursor:pointer;
}
.nf-icon-btn:hover{background:rgba(0,0,0,.03)}
body.nf-dark .nf-icon-btn:hover{background:rgba(255,255,255,.06)}

.nf-nav{
  border-bottom:1px solid var(--nf-border);
  background:var(--nf-surface);
}
.nf-nav-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 0;
  gap:12px;
}
.nf-menu{
  margin:0; padding:0;
  list-style:none;
  display:flex;
  flex-wrap:wrap;
  gap:14px;
}
.nf-menu a{
  display:inline-flex;
  align-items:center;
  padding:8px 10px;
  border-radius:12px;
  color:var(--nf-text);
  font-weight:700;
  font-size:.95rem;
}
.nf-menu a:hover{
  text-decoration:none;
  background:rgba(0,0,0,.04);
}
body.nf-dark .nf-menu a:hover{background:rgba(255,255,255,.06)}

.nf-burger{
  display:none;
}
.nf-search{
  display:none;
  padding:10px 0 14px;
}
.nf-search form{
  display:flex;
  gap:10px;
}
.nf-search input[type="search"]{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--nf-border);
  border-radius:12px;
  background:var(--nf-bg);
  color:var(--nf-text);
}
.nf-search button{
  padding:10px 14px;
  border-radius:12px;
  border:1px solid var(--nf-border);
  background:var(--nf-primary);
  color:#fff;
  font-weight:800;
  cursor:pointer;
}
.nf-search.is-open{display:block}

.nf-breaking{
  background:linear-gradient(90deg,var(--nf-primary),#ef4444);
  color:#fff;
}
.nf-breaking-inner{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 0;
}
.nf-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:900;
  font-size:.84rem;
  letter-spacing:.04em;
  text-transform:uppercase;
  background:rgba(255,255,255,.15);
  padding:6px 10px;
  border-radius:999px;
}
.nf-breaking a{color:#fff;text-decoration:underline}

/* ----------------------------------------------------------
   Layout / cards
   ---------------------------------------------------------- */
.nf-grid{
  display:grid;
  gap:18px;
}
.nf-main{
  grid-template-columns: 1.6fr .9fr;
  align-items:start;
  padding:18px 0 34px;
}
@media (max-width: 980px){
  .nf-main{grid-template-columns:1fr}
}

.nf-card{
  background:var(--nf-surface);
  border:1px solid var(--nf-border);
  border-radius:var(--nf-radius);
  overflow:hidden;
}
.nf-card:hover{box-shadow:var(--nf-shadow)}
.nf-card a:hover{text-decoration:none}

.nf-thumb{
  aspect-ratio: 16/9;
  background:linear-gradient(135deg,rgba(0,0,0,.06),rgba(0,0,0,.02));
  overflow:hidden;
}
.nf-thumb img{width:100%;height:100%;object-fit:cover}

.nf-card-body{padding:14px}
.nf-kicker{
  display:inline-flex;
  gap:8px;
  align-items:center;
  font-size:.78rem;
  font-weight:900;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--nf-primary);
}
.nf-kicker .nf-dot{
  width:6px;height:6px;border-radius:999px;background:var(--nf-primary);
}
.nf-title{
  margin:8px 0 0;
  font-size:1.05rem;
  line-height:1.25;
  letter-spacing:-.01em;
}
.nf-excerpt{
  margin:10px 0 0;
  color:var(--nf-muted);
  font-size:var(--nf-small);
}
.nf-meta{
  margin:10px 0 0;
  color:var(--nf-muted);
  font-size:.85rem;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.nf-meta time{font-variant-numeric:tabular-nums}

.nf-hero{
  display:grid;
  gap:18px;
  grid-template-columns: 1fr; /* big story + 4 stories under it on large screens */
}
.nf-hero-big .nf-card-body{padding:16px}
.nf-hero-big .nf-title{font-size:1.35rem}
.nf-hero-small{
  display:grid; gap:12px;
  grid-template-columns:1fr 1fr;
}
@media (max-width: 580px){
  .nf-hero-small{grid-template-columns:1fr}
}
.nf-hero-small .nf-thumb{aspect-ratio: 4/3}
.nf-section-title{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  margin:22px 0 12px;
}
.nf-section-title h2{
  margin:0;
  font-size:var(--nf-h2);
  letter-spacing:-.02em;
}
.nf-section-title a{color:var(--nf-primary);font-weight:800}

.nf-list{
  display:grid;
  gap:12px;
}
.nf-list-item{
  display:flex;
  gap:12px;
  padding:12px;
  border:1px solid var(--nf-border);
  border-radius:var(--nf-radius-sm);
  background:var(--nf-surface);
}
.nf-list-item:hover{box-shadow:var(--nf-shadow)}
.nf-list-item .nf-thumb{
  width:140px;
  flex:0 0 140px;
  border-radius:12px;
  overflow:hidden;
}
@media (max-width: 580px){
  /* Mobile: keep Latest list thumbnails small so text stays visible */
  .nf-list-item > a{align-items:flex-start !important;}
  .nf-list-item .nf-thumb{
    width:96px;
    flex:0 0 96px;
    aspect-ratio: 1 / 1;
  }
  .nf-excerpt{display:none;}
}
.nf-list-item h3{margin:6px 0 0;font-size:1rem;line-height:1.25}

.nf-badges{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:12px;
}
.nf-badge{
  display:inline-flex;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--nf-border);
  color:var(--nf-muted);
  font-size:.84rem;
  font-weight:700;
}
.nf-badge:hover{border-color:var(--nf-primary);color:var(--nf-primary);text-decoration:none}

.nf-sidebar .nf-card{padding:14px}
.nf-widget-title{
  margin:0 0 10px;
  font-size:1.05rem;
  letter-spacing:-.01em;
}
.nf-trending{
  display:grid;
  gap:10px;
}
.nf-trending a{
  display:block;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--nf-border);
}
.nf-trending a:hover{box-shadow:var(--nf-shadow);text-decoration:none}
.nf-trending .nf-rank{
  display:inline-flex;
  width:26px;height:26px;
  align-items:center;justify-content:center;
  border-radius:10px;
  background:rgba(185,28,28,.10);
  color:var(--nf-primary);
  font-weight:900;
  margin-right:10px;
}
.nf-newsletter p{margin:6px 0 12px;color:var(--nf-muted)}
.nf-newsletter input{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--nf-border);
  border-radius:12px;
  background:var(--nf-bg);
  color:var(--nf-text);
  margin-bottom:10px;
}
.nf-newsletter button{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--nf-border);
  background:var(--nf-primary);
  color:#fff;
  font-weight:900;
  cursor:pointer;
}

.nf-ad{
  border:1px dashed var(--nf-border);
  border-radius:12px;
  padding:12px;
  color:var(--nf-muted);
  text-align:center;
  font-size:.9rem;
  background:transparent;
}

/* ----------------------------------------------------------
   Post / content
   ---------------------------------------------------------- */
.nf-article{
  padding:18px 0 34px;
}
.nf-article header{
  margin-bottom:14px;
}
.nf-article h1{
  font-size:var(--nf-h1);
  line-height:1.15;
  letter-spacing:-.03em;
  margin:0;
}
.nf-byline{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-top:12px;
  color:var(--nf-muted);
  font-size:.92rem;
}
.nf-byline a{color:var(--nf-primary);font-weight:800;text-decoration:none}
.nf-byline a:hover{text-decoration:underline}
.nf-feature{
  margin:16px 0 0;
  border-radius:var(--nf-radius);
  overflow:hidden;
  border:1px solid var(--nf-border);
}
.nf-content{
  margin-top:18px;
  font-size:1.06rem;
}
.nf-content > *{max-width: 72ch}
.nf-content p{margin:0 0 1.05em}
.nf-content h2{font-size:var(--nf-h2);margin:1.2em 0 .6em;letter-spacing:-.02em}
.nf-content h3{font-size:var(--nf-h3);margin:1em 0 .5em}
.nf-content ul,.nf-content ol{padding-left:1.1em}
.nf-content table{
  width:100%;
  border-collapse:collapse;
  font-size:0.98rem;
  margin:1em 0;
}
.nf-content th,.nf-content td{
  border:1px solid var(--nf-border);
  padding:10px;
  vertical-align:top;
}
.nf-content blockquote{
  margin:1.1em 0;
  padding:12px 14px;
  border-left:4px solid var(--nf-primary);
  background:rgba(185,28,28,.06);
  border-radius:12px;
}
.nf-content pre{
  overflow:auto;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--nf-border);
  background:rgba(0,0,0,.04);
  font-family:var(--nf-mono);
  font-size:.92rem;
}
body.nf-dark .nf-content pre{background:rgba(255,255,255,.06)}

.nf-share{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:14px;
}
.nf-share a{
  border:1px solid var(--nf-border);
  border-radius:999px;
  padding:8px 12px;
  font-weight:800;
  font-size:.9rem;
}
.nf-share a:hover{
  border-color:var(--nf-primary);
  color:var(--nf-primary);
  text-decoration:none;
}

.nf-pagination{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-top:22px;
}
.nf-pagination a{
  border:1px solid var(--nf-border);
  border-radius:12px;
  padding:10px 12px;
  font-weight:800;
}
.nf-pagination a:hover{box-shadow:var(--nf-shadow);text-decoration:none}

.nf-footer{
  border-top:1px solid var(--nf-border);
  background:var(--nf-surface);
  padding:24px 0 30px;
}
.nf-footer-grid{
  display:grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap:18px;
}
@media (max-width: 980px){
  .nf-footer-grid{grid-template-columns: 1fr 1fr; }
}
@media (max-width: 580px){
  .nf-footer-grid{grid-template-columns:1fr}
}
.nf-footer small{color:var(--nf-muted)}
.nf-footer h3{margin:0 0 10px}
.nf-footer a{color:var(--nf-muted)}
.nf-footer-menu{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.nf-footer-menu a{text-decoration:none}
.nf-footer-menu a:hover{text-decoration:underline}
.nf-footer a:hover{color:var(--nf-primary)}

/* ----------------------------------------------------------
   Mobile menu
   ---------------------------------------------------------- */
@media (max-width: 880px){
  .nf-burger{display:inline-flex}
  .nf-menu{
    display:none;
    width:100%;
    flex-direction:column;
    gap:6px;
    padding:12px 0;
  }
  .nf-menu.is-open{display:flex}
  .nf-nav-inner{flex-wrap:wrap}
}

/* WordPress core helpers */
.screen-reader-text{position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden}
.wp-block-image img{border-radius:12px}
.wp-block-separator{border-top:1px solid var(--nf-border)}

@media (max-width: 640px){
  /* Mobile: category sections show one card per row */
  .nf-grid{grid-template-columns:1fr !important;}
}
