/* assets/css/style.css */

/* ============================================================
   MNYILINGA NEWS — DESIGN TOKENS
   ============================================================ */
:root {
  --yellow:      #fdb913;
  --black:       #102039;
  --black-deep:  #0a1628;
  --black-mid:   #162d4a;
  --black-light: #1e3a5f;
  --white:       #ffffff;
  --gray-100:    #f5f5f5;
  --gray-200:    #e8e8e8;
  --gray-400:    #999999;
  --gray-600:    #555555;
  --red-new:     #cb1111;

  --font-display: "PT Serif", Georgia, serif;
  --font-body:    "PT Serif", Georgia, serif;
  --font-mono:    "PT Sans", Arial, sans-serif;
  --font-ui:      "Inter", sans-serif;

  --header-h:   56px;
  --cat-nav-h:  48px;  /* explicit — prevents CLS on mobile */
  --max-w:    1280px;
  --tr:       0.18s ease;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 14px;
}

body {
  font-family: var(--font-body);
  background: var(--white);
  color: var(--black);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* Nafasi ya chini kwa ajili ya bottom nav (64px) */
  padding-bottom: 64px;
}

img {
  display: block;
  max-width: 100%;
  object-fit: cover;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-body);
}

/* ============================================================
   INTER FONT — header, footer, nav na UI elements zote
   ============================================================ */
#site-header,
#site-header *,
.footer,
.footer *,
.category-nav,
.category-nav *,
.cat-btn,
.nav-drawer,
.nav-drawer *,
.bottom-nav,
.bottom-nav * {
  font-family: "Inter", sans-serif !important;
}

/* ============================================================
   HEADER — STICKY
   ============================================================ */
#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: #102039;
  border-bottom: 3px solid var(--yellow);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  height: var(--header-h);
  gap: 16px;
}

.site-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-img {
  height: 38px;
  width: auto;
  display: block;
  overflow: visible;
}

.header-spacer {
  flex: 1;
}

/* ============================================================
   HAMBURGER BUTTON
   ============================================================ */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  cursor: pointer;
  padding: 0;
  background: none;
  border: none;
  flex-shrink: 0;
}

.hamburger-btn span {
  display: block;
  height: 2px;
  background: var(--white);
  transition:
    transform 0.32s cubic-bezier(0.77, 0, 0.175, 1),
    opacity 0.22s ease,
    background 0.2s ease;
  transform-origin: left center;
}

.hamburger-btn:hover span {
  background: var(--yellow);
}

.hamburger-btn.open span:nth-child(1) {
  transform: rotate(41deg) translateY(-1px);
  background: var(--yellow);
}

.hamburger-btn.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0.2);
}

.hamburger-btn.open span:nth-child(3) {
  transform: rotate(-41deg) translateY(1px);
  background: var(--yellow);
}

/* ============================================================
   CATEGORY NAV — FIXED CHINI YA HEADER
   --cat-nav-h: height ya nav — CSS variable moja kubadilisha kila kitu
   ============================================================ */

.category-nav {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 899;
  background: #0a1628;
  border-bottom: 1px solid #1e3a5f;
  overflow-x: auto;
  overflow-y: hidden;      /* kuzuia yoyote ya vertical overflow */
  scrollbar-width: none;

  /* ── SHERIA KALI YA UKUBWA ── */
  height: var(--cat-nav-h);

  /* ── CONTAINMENT: browser inaambiwa kwa nguvu —
     "element hii haitegemei chochote nje yake.
      kitu chochote ndani yake hakiathiri layout/paint ya nje."
     Hii ndiyo sababu header haisogei — containment sawa na hii
     tunatumia sasa kwenye category nav pia.
     (Hatutumii 'size' kwa sababu overflow-x:auto inahitaji uhuru) */
  contain: layout style paint;

  /* ── GPU LAYER — element inabaki kwenye compositing layer yake
     mwenyewe, browser haiiangalii tena wakati wa page navigation */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  /* ── STACKING CONTEXT mpya — inazuia z-index leakage na repaints */
  isolation: isolate;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.category-nav-inner {
  display: flex;
  align-items: center;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
  gap: 8px;
  height: 100%;

  /* Containment ya inner pia — inafunga mzunguko kabisa */
  contain: layout style;
}

.cat-btn {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #aabdd0;
  white-space: nowrap;
  border: 1px solid #1e3a5f;
  border-radius: 4px;
  background: transparent;
  flex-shrink: 0;
  cursor: pointer;

  /* ── FLEXBOX CENTERING badala ya line-height ──
     line-height inategemea font metrics (inabadilika na font).
     Flexbox ni geometry tu — haitegemei font kabisa */
  display: inline-flex;
  align-items: center;
  justify-content: center;

  /* ── UKUBWA MKALI usioathiriwa na kitu chochote ── */
  height: 28px;
  min-width: 0;
  padding: 0 14px;

  /* ── KUZUIA font metrics kuathiri layout ya button ── */
  contain: layout;
  overflow: hidden;

  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.15s ease;
}

.cat-btn:hover {
  color: var(--white);
  border-color: #4a7ab5;
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.cat-btn.active {
  color: var(--black);
  background: var(--yellow);
  border-color: var(--yellow);
  font-weight: 800;
}

/* ILI MAUDHUI YASIFUNIKWE NA HEADER + CATEGORY NAV
   Inatumia CSS variables — sehemu moja tu kubadilisha */
main {
  padding-top: calc(var(--header-h) + var(--cat-nav-h) + 16px);
}

/* ============================================================
   NAV DRAWER OVERLAY
   ============================================================ */
.nav-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

.nav-drawer-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* ============================================================
   NAV DRAWER
   ============================================================ */
.nav-drawer {
  position: fixed;
  top: 0;
  left: -100vw;
  width: 100vw;
  height: 100vh;
  background: #0a1628;
  z-index: 999;
  transition: left 0.38s cubic-bezier(0.77, 0, 0.175, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}

.nav-drawer::-webkit-scrollbar {
  display: none;
}

.nav-drawer.open {
  left: 0;
}

/* Drawer head — logo + close button */
.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid #1e3a5f;
  flex-shrink: 0;
}

.drawer-logo-img {
  height: 24px;
  width: auto;
  display: block;
  overflow: visible;
}

.nav-drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #162d4a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aabdd0;
  transition:
    background 0.2s ease,
    color 0.2s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.nav-drawer-close:hover {
  background: #1e3a5f;
  color: var(--white);
}

.nav-drawer-close svg {
  width: 16px;
  height: 16px;
}

/* Drawer search */
.nav-drawer-search-wrap {
  padding: 14px 16px 0;
  flex-shrink: 0;
}

.nav-drawer-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0d1f35;
  border: 1px solid #1e3a5f;
  border-radius: 8px;
  padding: 9px 14px;
  transition: border-color 0.2s ease;
}

.nav-drawer-search-box:focus-within {
  border-color: var(--yellow);
}

.nav-drawer-search-box svg {
  width: 15px;
  height: 15px;
  stroke: #4a7ab5;
  fill: none;
  flex-shrink: 0;
  transition: stroke 0.2s;
}

.nav-drawer-search-box:focus-within svg {
  stroke: var(--yellow);
}

.nav-drawer-search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.82rem;
  width: 100%;
}

.nav-drawer-search-input::placeholder {
  color: #4a7ab5;
}

.nav-drawer-search-results {
  margin-top: 10px;
  display: none;
  flex-direction: column;
  gap: 3px;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: none;
}

.nav-drawer-search-results.visible {
  display: flex;
}

.dss-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #162d4a;
  border: 1px solid #1e3a5f;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
  text-decoration: none;
}

.dss-item:hover {
  background: #1e3a5f;
  border-color: #4a7ab5;
}

.dss-thumb {
  width: 44px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: #1e3a5f;
}

.dss-title {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 600;
  color: #ccd9e8;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dss-hint {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: #4a7ab5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 2px 2px;
}

.dss-no-result {
  font-size: 0.75rem;
  color: #4a7ab5;
  padding: 10px 4px;
  text-align: center;
}

/* Drawer body — links */
.nav-drawer-body {
  padding: 10px 12px 12px;
  flex: 1;
}

.nav-drawer-section-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4a7ab5;
  padding: 14px 8px 6px;
}

.nav-drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: 8px;
  color: #ccd9e8;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition:
    background 0.18s ease,
    color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-drawer-item:hover {
  background: #162d4a;
  color: var(--white);
}

.nav-drawer-item svg {
  stroke: #6b8aaa;
  flex-shrink: 0;
  transition: stroke 0.18s ease;
}

.nav-drawer-item:hover svg {
  stroke: var(--yellow);
}

.nav-drawer-divider {
  height: 1px;
  background: #1e3a5f;
  margin: 6px 8px;
}

/* Drawer footer — social icons */
.nav-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px 20px 20px;
  border-top: 1px solid #1e3a5f;
  flex-shrink: 0;
}

.nav-drawer-social {
  color: #6b8aaa;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-drawer-social:hover {
  color: var(--yellow);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: linear-gradient(180deg, #0a1628 0%, #060e1a 100%);
  color: #fff;
  padding: 60px 20px;
  text-align: center;
  margin-top: 50px;
}

.footer-container {
  max-width: 1000px;
  margin: 0 auto;
}

.footer hr {
  border: 0;
  border-top: 1px solid #1e3a5f;
  margin: 30px auto;
  max-width: 1000px;
}

.follow-title {
  margin-bottom: 20px;
  font-size: 20px;
  font-family: "Inter", sans-serif;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 30px;
  font-size: 22px;
  margin-bottom: 40px;
}

.social-icons a {
  color: #fff;
  transition: 0.3s;
}

.social-icons a:hover {
  color: #00e0ff;
}

.download-title {
  margin-bottom: 27px;
  font-size: 15px;
  font-family: "Inter", sans-serif;
}

.app-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.app-btn {
  background: #111827;
  border: 1px solid #1e3a5f;
  color: #fff;
  padding: 12px 14px;
  border-radius: 6px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.app-btn:hover {
  border-color: var(--yellow);
  background: #162d4a;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  margin-bottom: 40px;
}

.footer-links a {
  color: #ffffff;
  text-decoration: none;
  font-size: 13px;
  font-family: "Inter", sans-serif;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.footer-links a:hover {
  opacity: 1;
}

.copyright {
  color: #ffffff;
  font-size: 13px;
  font-family: "Inter", sans-serif;
  max-width: 700px;
  margin: auto;
  line-height: 1.6;
  opacity: 0.5;
}

/* ============================================================
   BOTTOM NAV — FIXED CHINI
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 950;
  background: #102039;
  border-top: none;
  display: flex;
  align-items: stretch;
  height: 64px;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--white);
  font-family: "Inter", sans-serif;
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition:
    color 0.2s ease,
    background 0.2s ease;
  position: relative;
  padding: 0;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
  stroke: var(--white);
  fill: none;
  transition:
    stroke 0.2s ease,
    fill 0.2s ease;
  flex-shrink: 0;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--yellow);
}

.bottom-nav-item:hover svg,
.bottom-nav-item.active svg {
  stroke: var(--yellow);
}

.bottom-nav-divider {
  width: 1px;
  background: #1e3a5f;
  align-self: stretch;
  flex-shrink: 0;
}
