/*
Theme Name: Njalla Magazine
Theme URI: https://njalla.io
Author: Njalla
Author URI: https://njalla.io
Description: Bold magazine-style theme inspired by Unboxholics. Large hero images, grid cards, visual-first layout.
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: njalla-magazine
Tags: news, magazine, grid-layout, featured-images, custom-logo
*/

/* ── RESET & BASE ─────────────────────────────────────────────── */
*{box-sizing:border-box;margin:0;padding:0}
html{font-size:16px;scroll-behavior:smooth}
body{
  font-family:'Inter',system-ui,-apple-system,sans-serif;
  background:var(--bg);color:var(--text);
  -webkit-font-smoothing:antialiased;line-height:1.6;
}
a{color:inherit;text-decoration:none}
img{max-width:100%;height:auto;display:block}
ul,ol{list-style:none}

:root{
  --bg:#f8f9fa;
  --white:#ffffff;
  --text:#111827;
  --text-sec:#4b5563;
  --muted:#9ca3af;
  --border:#e5e7eb;
  --accent:#5DD9AB;
  --accent-dark:#3dab85;
  --accent-bg:rgba(93,217,171,0.08);
  --red:#ef4444;--orange:#f97316;--purple:#8b5cf6;--emerald:#10b981;--blue:#3b82f6;
  --font:'Inter',system-ui,sans-serif;
  --mono:'JetBrains Mono',monospace;
  --radius:12px;
  --shadow:0 2px 8px rgba(0,0,0,0.06);
  --shadow-hover:0 8px 24px rgba(0,0,0,0.1);
  --max-w:1280px;
}

/* ── LAYOUT ───────────────────────────────────────────────────── */
.wrap{max-width:var(--max-w);margin:0 auto;padding:0 1.5rem}

/* ── HEADER ───────────────────────────────────────────────────── */
/* #9 static navbar */
.mag-header{
  background:var(--white);border-bottom:1px solid var(--border);
  position:relative;z-index:100;
}
.mag-header-top{
  display:flex;align-items:center;justify-content:space-between;
  max-width:var(--max-w);margin:0 auto;padding:.6rem 1.5rem;
}
.mag-logo{display:flex;align-items:center;gap:0;font-size:1.8rem;font-weight:800;letter-spacing:-.04em;color:var(--text)}
.mag-logo svg{margin:0 3px;flex-shrink:0}

/* Header actions — search, social, theme toggle */
.mag-actions{display:flex;align-items:center;gap:.5rem;flex-shrink:0}
.mag-search-btn,.mag-icon-btn{
  display:inline-flex;align-items:center;justify-content:center;
  width:40px;height:40px;border-radius:10px;border:1px solid var(--border);
  color:var(--text-sec);transition:all .2s;background:none;cursor:pointer;
  flex-shrink:0;
}
.mag-search-btn:hover,.mag-icon-btn:hover{color:var(--accent-dark);border-color:var(--accent);background:var(--accent-bg)}
.mag-search-btn svg,.mag-icon-btn svg{width:20px;height:20px;flex-shrink:0}
.mag-icon-btn svg{fill:currentColor}

/* Search overlay */
.search-overlay{
  display:none;position:fixed;top:0;left:0;right:0;bottom:0;
  background:rgba(0,0,0,0.5);z-index:200;align-items:flex-start;justify-content:center;padding-top:120px;
}
.search-overlay.open{display:flex}
.search-box{
  background:var(--white);border-radius:var(--radius);padding:1.25rem;width:90%;max-width:560px;
  box-shadow:0 16px 48px rgba(0,0,0,0.15);
}
.search-box input{
  width:100%;border:1px solid var(--border);border-radius:8px;
  padding:.65rem 1rem;font-size:1rem;color:var(--text);font-family:var(--font);outline:none;
}
.search-box input:focus{border-color:var(--accent)}
.search-box input::placeholder{color:var(--muted)}

/* Theme toggle — #7 */
.theme-toggle{
  display:flex;align-items:center;justify-content:center;
  width:40px;height:40px;border-radius:10px;border:1px solid var(--border);
  color:var(--text-sec);transition:all .2s;background:none;cursor:pointer;
}
.theme-toggle:hover{color:var(--accent-dark);border-color:var(--accent);background:var(--accent-bg)}
.theme-toggle svg{width:20px;height:20px}

/* Dark theme — dark grey bg, white text */
[data-theme="dark"]{
  --bg:#1a1a1a;
  --white:#242424;
  --text:#f0f0f0;
  --text-sec:#c8c8c8;
  --muted:#808080;
  --border:rgba(255,255,255,0.1);
  --shadow:0 2px 8px rgba(0,0,0,0.3);
  --shadow-hover:0 8px 24px rgba(0,0,0,0.4);
}
[data-theme="dark"] .mag-header{background:rgba(26,26,26,0.97);border-bottom-color:rgba(255,255,255,0.08)}
[data-theme="dark"] .mag-nav{background:#1e1e1e}
[data-theme="dark"] .ticker-bar{background:#1e1e1e;border-bottom-color:rgba(255,255,255,0.08)}
[data-theme="dark"] .mag-footer{background:#141414}
[data-theme="dark"] .article-content,[data-theme="dark"] .article-content p{color:#e0e0e0}
[data-theme="dark"] .article-content h2,[data-theme="dark"] .article-content h3{color:#f0f0f0}
[data-theme="dark"] .single-title{color:#ffffff}
[data-theme="dark"] .single-excerpt{color:#b0b0b0}
[data-theme="dark"] .card-body h3{color:#f0f0f0}
[data-theme="dark"] .section-title{border-bottom-color:rgba(255,255,255,0.12)}
[data-theme="dark"] .section-title h2{color:#e8e8e8}
[data-theme="dark"] .tc-name{color:#909090}
[data-theme="dark"] .tc-price{color:#e8e8e8}
[data-theme="dark"] .single-back{color:#909090}
[data-theme="dark"] .single-meta{color:#909090}
[data-theme="dark"] .article-source{border-top-color:rgba(255,255,255,0.1);color:#808080}
[data-theme="dark"] .card-body .meta{color:#808080}
[data-theme="dark"] .hero-main .hero-img-placeholder{background:linear-gradient(135deg,#1a3028,#0f2a1e)}
[data-theme="dark"] .hero-side .hero-img-placeholder{background:linear-gradient(135deg,#1a1a2e,#16213e)}
[data-theme="dark"] .card .card-img-placeholder{background:linear-gradient(135deg,#1a2a22,#15251c)}
[data-theme="dark"] .search-overlay{background:rgba(0,0,0,0.7)}
[data-theme="dark"] .search-box{background:#1a1a1a}
[data-theme="dark"] .scroll-btn{background:#1a1a1a;border-color:rgba(255,255,255,0.1)}
[data-theme="dark"] .ticker-chip{background:#141414;border-color:rgba(255,255,255,0.08)}
[data-theme="dark"] .tag-crypto{background:rgba(93,217,171,0.15);color:#5DD9AB}
[data-theme="dark"] .tag-tech{background:rgba(139,92,246,0.15);color:#a78bfa}
[data-theme="dark"] .tag-finance{background:rgba(16,185,129,0.15);color:#34d399}
[data-theme="dark"] .tag-ai{background:rgba(249,115,22,0.15);color:#fb923c}
[data-theme="dark"] .tag-security{background:rgba(239,68,68,0.15);color:#f87171}

/* Nav bar */
.mag-nav{
  background:#272f37;overflow:hidden;
}
.mag-nav-inner{
  display:flex;align-items:center;justify-content:center;max-width:var(--max-w);margin:0 auto;
  padding:0 1.5rem;gap:0;overflow-x:auto;scrollbar-width:none;
}
.mag-nav-inner::-webkit-scrollbar{display:none}
.mag-nav a{
  padding:.65rem 1.1rem;font-size:.78rem;font-weight:600;
  color:rgba(255,255,255,0.7);white-space:nowrap;transition:all .15s;
  border-bottom:2px solid transparent;
}
.mag-nav a:hover,.mag-nav a.active{
  color:#fff;border-bottom-color:var(--accent);
}

/* Market Ticker — single row, no wrap */
.ticker-bar{
  background:var(--white);border-bottom:1px solid var(--border);
  overflow:hidden;padding:.4rem 0;
}
.ticker-inner{
  display:flex;flex-wrap:nowrap;gap:.6rem;overflow-x:auto;scrollbar-width:none;
  max-width:var(--max-w);margin:0 auto;padding:0 1.5rem;
  justify-content:center;
}
.ticker-inner::-webkit-scrollbar{display:none}
.ticker-chip{
  background:var(--bg);border:1px solid var(--border);border-radius:5px;
  padding:.2rem .65rem;display:inline-flex;flex-direction:row;align-items:center;gap:.5rem;flex-shrink:0;min-width:100px;
}
.tc-name{font-size:.58rem;font-weight:700;color:var(--muted);font-family:var(--mono);min-width:28px}
.tc-price{font-size:.72rem;font-weight:600;font-family:var(--mono)}
.tc-change{font-size:.55rem;font-family:var(--mono);margin-left:auto}
.tc-up{color:#10b981}.tc-dn{color:#ef4444}

/* Scroll to top/bottom */
.scroll-btns{
  position:fixed;bottom:2rem;right:1.5rem;display:flex;flex-direction:column;gap:.4rem;z-index:90;
}
.scroll-btn{
  width:38px;height:38px;border-radius:50%;
  background:var(--white);border:1px solid var(--border);box-shadow:var(--shadow);
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;color:var(--muted);transition:all .2s;
}
.scroll-btn:hover{color:var(--accent-dark);border-color:var(--accent)}
.scroll-btn svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2.5;stroke-linecap:round}

/* ── HERO GRID — 1 main + 3 side ──────────────────────────────── */
.hero-grid{
  display:grid;grid-template-columns:1fr 1fr;grid-template-rows:repeat(3,1fr);gap:.75rem;
  margin:1.5rem 0;height:480px;
}
.hero-main{
  grid-row:1/4;border-radius:var(--radius);overflow:hidden;position:relative;
  background:var(--white);box-shadow:var(--shadow);
}
.hero-main a{display:block;position:relative}
.hero-main .hero-img{width:100%;aspect-ratio:4/3;object-fit:cover}
.hero-main .hero-img-placeholder{width:100%;aspect-ratio:4/3;background:linear-gradient(135deg,#d1fae5,#a7f3d0)}
.hero-main .hero-overlay{
  position:absolute;bottom:0;left:0;right:0;
  background:linear-gradient(0deg,rgba(0,0,0,.8) 0%,transparent 100%);
  padding:2rem 1.5rem 1.25rem;color:#fff;
}
.hero-main .hero-overlay .tag{margin-bottom:.5rem}
.hero-main .hero-overlay h2{font-size:1.5rem;font-weight:700;line-height:1.25;margin-bottom:.4rem}
.hero-main .hero-overlay p{font-size:.82rem;opacity:.85;line-height:1.5}

.hero-side{
  border-radius:var(--radius);overflow:hidden;position:relative;
  background:var(--white);box-shadow:var(--shadow);
}
.hero-side a{display:block;position:relative;height:100%}
.hero-side .hero-img{width:100%;height:100%;object-fit:cover}
.hero-side .hero-img-placeholder{width:100%;height:100%;background:linear-gradient(135deg,#e0e7ff,#c7d2fe)}
.hero-side .hero-overlay{
  position:absolute;bottom:0;left:0;right:0;
  background:linear-gradient(0deg,rgba(0,0,0,.75) 0%,transparent 100%);
  padding:1rem 1rem .8rem;color:#fff;
}
.hero-side .hero-overlay h3{font-size:.92rem;font-weight:600;line-height:1.3}
.hero-side .hero-overlay .meta{font-size:.65rem;opacity:.7;margin-top:.25rem}

/* ── SECTION ──────────────────────────────────────────────────── */
.section-title{
  display:flex;align-items:center;gap:.75rem;
  margin:2rem 0 1rem;padding-bottom:.65rem;border-bottom:2px solid var(--text);
}
.section-title h2{font-size:1.1rem;font-weight:700;text-transform:uppercase;letter-spacing:.02em}
.section-title .accent-bar{width:4px;height:22px;background:var(--accent);border-radius:2px;flex-shrink:0}

/* ── CARD GRID ────────────────────────────────────────────────── */
.card-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:1.25rem;margin-bottom:2rem}

.card{
  background:var(--white);border-radius:var(--radius);overflow:hidden;
  box-shadow:var(--shadow);transition:transform .2s,box-shadow .2s;
}
.card:hover{transform:translateY(-2px);box-shadow:var(--shadow-hover)}
.card a{display:block}
.card .card-img{width:100%;aspect-ratio:16/10;object-fit:cover;background:#e5e7eb}
.card .card-img-placeholder{width:100%;aspect-ratio:16/10;background:linear-gradient(135deg,#f0fdf4,#dcfce7)}
.card .card-body{padding:.85rem}
.card .card-body .tag{margin-bottom:.4rem}
.card .card-body h3{font-size:.88rem;font-weight:600;line-height:1.38;margin-bottom:.35rem;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.card .card-body .meta{font-size:.65rem;color:var(--muted);font-family:var(--mono)}

/* ── LIST CARDS (sidebar) ─────────────────────────────────────── */
.list-item{
  display:grid;grid-template-columns:100px 1fr;gap:.75rem;
  padding:.65rem 0;border-bottom:1px solid var(--border);align-items:center;
}
.list-item:last-child{border-bottom:none}
.list-item:hover{opacity:.8}
.list-item .list-img{width:100px;height:66px;border-radius:6px;object-fit:cover;background:#e5e7eb}
.list-item .list-img-placeholder{width:100px;height:66px;border-radius:6px;background:linear-gradient(135deg,#f0fdf4,#dcfce7)}
.list-item h4{font-size:.78rem;font-weight:600;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.list-item .meta{font-size:.6rem;color:var(--muted);font-family:var(--mono);margin-top:.2rem}

/* Main + Sidebar layout */
.mag-layout{display:grid;grid-template-columns:1fr 340px;gap:2.5rem;margin:1.5rem 0}
.mag-sidebar{position:sticky;top:80px;height:fit-content}

/* ── TAGS ──────────────────────────────────────────────────────── */
.tag{
  font-size:.6rem;font-weight:700;letter-spacing:.07em;text-transform:uppercase;
  padding:3px 8px;border-radius:4px;white-space:nowrap;display:inline-block;
}
.tag-crypto{background:rgba(93,217,171,0.12);color:#3dab85}
.tag-tech{background:rgba(139,92,246,0.1);color:#7c3aed}
.tag-finance{background:rgba(16,185,129,0.1);color:#059669}
.tag-ai{background:rgba(249,115,22,0.1);color:#ea580c}
.tag-security{background:rgba(239,68,68,0.1);color:#dc2626}

/* ── SINGLE ARTICLE — #8 wider layout ─────────────────────────── */
.single-hero{width:100%;max-height:500px;object-fit:cover;border-radius:var(--radius)}
.single-hero-wrap{max-width:960px;margin:1.5rem auto 0;padding:0 1.5rem}
.single-wrap{max-width:960px;margin:0 auto;padding:2rem 1.5rem}
.single-back{display:inline-flex;align-items:center;gap:.4rem;color:var(--muted);font-size:.82rem;margin-bottom:1.5rem}
.single-back:hover{color:var(--accent-dark)}
.single-back svg{width:14px;height:14px}
.single-tags{display:flex;gap:.4rem;margin-bottom:.75rem}
.single-title{font-size:2.2rem;font-weight:800;line-height:1.15;margin-bottom:.6rem;letter-spacing:-.02em;color:var(--text)}
.single-excerpt{font-size:1.1rem;color:var(--text-sec);line-height:1.6;margin-bottom:.75rem}
.single-meta{font-size:.76rem;color:var(--muted);font-family:var(--mono);display:flex;gap:1rem;margin-bottom:2rem;flex-wrap:wrap}

.article-content{line-height:1.8;font-size:1.02rem}
.article-content p{margin-bottom:1.5rem}
.article-content h2{font-size:1.4rem;font-weight:700;margin:2.5rem 0 1rem}
.article-content h3{font-size:1.2rem;font-weight:600;margin:2rem 0 .8rem}
.article-content strong{color:var(--accent-dark);font-weight:600}
.article-content a{color:var(--accent-dark);text-decoration:underline;text-underline-offset:2px}
.article-content blockquote{border-left:3px solid var(--accent);padding:.75rem 1.25rem;margin:1.5rem 0;background:var(--accent-bg);border-radius:0 6px 6px 0}
.article-content img{border-radius:8px;margin:1.5rem 0;width:100%;height:auto}
.article-content pre{background:#1e1e2e;color:#cdd6f4;border:1px solid var(--border);border-radius:8px;padding:1rem 1.25rem;overflow-x:auto;font-family:var(--mono);font-size:.85rem;line-height:1.6;margin:1.5rem 0}
.article-content code{font-family:var(--mono);font-size:.88em;background:rgba(0,0,0,.06);padding:2px 6px;border-radius:4px}
.article-content pre code{background:none;padding:0;font-size:inherit;border-radius:0}
[data-theme="dark"] .article-content pre{background:#111118;border-color:rgba(255,255,255,0.1)}
[data-theme="dark"] .article-content code{background:rgba(255,255,255,0.08)}

.article-source{font-size:.82rem;color:var(--muted);padding-top:1.5rem;border-top:1px solid var(--border);margin-top:2rem}
.article-source a{color:var(--accent-dark)}

.article-footer-meta{
  margin-top:2.5rem;padding:1rem 1.25rem;
  background:var(--bg);border:1px solid var(--border);border-radius:8px;
  font-size:.78rem;color:var(--muted);font-family:var(--mono);
  line-height:1.8;
}
.article-footer-meta a{color:var(--accent-dark);text-decoration:none}
.article-footer-meta a:hover{text-decoration:underline}

/* ── PAGINATION — #6 fix ──────────────────────────────────────── */
.pagination,.nav-links{display:flex;align-items:center;justify-content:center;gap:.35rem;margin:2rem 0;padding-top:1.5rem;border-top:1px solid var(--border)}
.pagination a,.pagination span,.nav-links a,.nav-links span{
  display:flex;align-items:center;justify-content:center;
  min-width:36px;height:36px;border-radius:8px;border:1px solid var(--border);
  font-size:.78rem;font-weight:600;color:var(--muted);transition:all .2s;padding:0 .5rem;
}
.pagination a:hover,.nav-links a:hover{border-color:var(--accent);color:var(--accent-dark)}
.pagination .current,.nav-links .current{background:var(--accent-bg);border-color:var(--accent);color:var(--accent-dark)}
.nav-links .dots{border:none;min-width:auto}

/* ── FOOTER ───────────────────────────────────────────────────── */
.mag-footer{
  background:#272f37;color:rgba(255,255,255,0.6);
  padding:2.5rem 1.5rem;margin-top:3rem;text-align:center;
}
.mag-footer .wordmark{font-size:1.2rem;font-weight:700;color:#fff;margin-bottom:.4rem}
.mag-footer .ipa{font-size:.72rem;font-family:var(--mono);margin-bottom:.75rem}
.mag-footer .links{display:flex;gap:1.25rem;justify-content:center;margin-bottom:.5rem}
.mag-footer .links a{color:rgba(255,255,255,0.5);font-size:.74rem;transition:color .2s}
.mag-footer .links a:hover{color:var(--accent)}
.mag-footer .copy{font-size:.6rem;opacity:.3}

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media(max-width:1024px){
  .card-grid{grid-template-columns:repeat(3,1fr)}
  .mag-layout{grid-template-columns:1fr}
  .mag-sidebar{position:static}
}
@media(max-width:768px){
  .hero-grid{grid-template-columns:1fr;grid-template-rows:auto;height:auto}
  .hero-main{grid-row:auto}
  .card-grid{grid-template-columns:repeat(2,1fr)}
  .mag-search{display:none}
  .hero-main .hero-overlay h2{font-size:1.2rem}
  .single-title{font-size:1.6rem}
}
@media(max-width:480px){
  .card-grid{grid-template-columns:1fr}
  .list-item{grid-template-columns:80px 1fr}
}

/* ── WP ───────────────────────────────────────────────────────── */
.wp-caption{max-width:100%}
.alignleft{float:left;margin:0 1.5rem 1rem 0}
.alignright{float:right;margin:0 0 1rem 1.5rem}
.aligncenter{display:block;margin:1.5rem auto}
.screen-reader-text{clip:rect(1px,1px,1px,1px);position:absolute;width:1px;height:1px;overflow:hidden}
