
:root {
  --ink: #1c2a1f;
  --paper: #ffffff;
  --line: #e1e8dd;
  --accent: #1e6f4c;
  --accent-dark: #175a3d;
  --accent-soft: #eaf3ec;
  --muted: #647062;
}

* { box-sizing: border-box; }

html, body { overflow-x: hidden; max-width: 100%; }
.layout { max-width: 100vw; }
img { max-width: 100%; height: auto; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", sans-serif;
}

body.lang-ur { font-family: "Noto Nastaliq Urdu", "Inter", sans-serif; }
body.lang-ur h1, body.lang-ur h2, body.lang-ur h3, body.lang-ur .article-body {
  font-family: "Noto Nastaliq Urdu", serif;
  line-height: 2.1;
}
body.lang-en .article-body { font-family: "Source Serif 4", serif; line-height: 1.7; }

.mobile-only { display: none; }

/* Navbar */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--accent);
}
.brand { font-weight: 600; font-size: 1.2rem; color: #fff; text-decoration: none; }
.lang-switch a { margin-inline-start: 1rem; text-decoration: none; color: #dceee2; font-size: 0.9rem; }
.lang-switch a.active { color: #fff; font-weight: 600; }


.header-info {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  color: #dceee2;
  font-size: 0.82rem;
}
.weather-strip { display: flex; gap: 1rem; }
.weather-item { display: flex; align-items: center; gap: 0.2rem; }
.weather-icon { width: 22px; height: 22px; }

@media (max-width: 768px) {
  .site-header { flex-wrap: wrap; row-gap: 0.5rem; }
  .header-info { order: 3; width: 100%; justify-content: space-between; font-size: 0.75rem; }
  .weather-strip { gap: 0.6rem; }
  .desktop-only { display: none; }
  .mobile-only {
    display: block;
    max-width: 640px;
    margin: 2rem auto 0;
    padding: 1.25rem;
    text-align: center;
    border-top: 1px solid var(--line);
  }
  .mobile-only a, .mobile-only .logout-link { display: inline-block; margin: 0 0.7rem; }
}


/* Breaking news ticker */
.ticker-bar {
  display: flex;
  align-items: center;
  background: var(--ink);
  overflow: hidden;
  max-width: 100%;
}

body.lang-ur .datetime-bar { text-align: left; font-family: "Inter", sans-serif; }
.ticker-label {
  background: #c0392b;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 1rem;
  flex-shrink: 0;
}
.ticker-track { overflow: hidden; flex: 1; min-width: 0; }
.ticker-content {
  display: inline-flex;
  white-space: nowrap;
  padding: 0.5rem 0;
  will-change: transform;
}
.ticker-content a {
  color: #f2f2f2;
  text-decoration: none;
  font-size: 0.88rem;
  margin-inline-end: 0.6rem;
}
.ticker-content a:hover { text-decoration: underline; }
.ticker-dot { color: #7a8a7d; margin-inline-end: 0.6rem; }




/* Layout */
.layout { display: flex; width: 100%; max-width: 100vw; overflow: hidden; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--accent-soft);
  border-inline-end: 1px solid var(--line);
  padding: 1.75rem 1.5rem;
  min-height: calc(100vh - 60px);
}
.sidebar h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 1rem; }
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li { margin-bottom: 0.65rem; }
.sidebar a { color: var(--accent-dark); text-decoration: none; font-size: 0.95rem; font-weight: 500; }
.sidebar a:hover { text-decoration: underline; }
.sidebar a.active { font-weight: 700; text-decoration: underline; }
.sidebar-account {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid #c9d9cc;
}
.sidebar-account a {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.88rem;
}
.sidebar-account a.become-writer-link {
  font-weight: 700;
}

.logout-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.logout-link:hover { text-decoration: underline; }


.page { flex: 1 1 0; min-width: 0; max-width: 100%; margin: 0 auto; padding: 2rem 1.5rem; box-sizing: border-box; }
.category-heading { font-size: 1.6rem; margin-bottom: 1.5rem; }

/* Hero carousel */
.hero-carousel { position: relative; border-radius: 12px; overflow: hidden; margin-bottom: 2.5rem; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.carousel-track { position: relative; height: 440px; }
.carousel-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 0.4s ease; }
.carousel-slide.active { opacity: 1; visibility: visible; }
.carousel-image { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 2.5rem 2rem 2rem;
  background: linear-gradient(to top, rgba(10, 25, 15, 0.9), rgba(10, 25, 15, 0.15) 70%, rgba(10, 25, 15, 0));
  color: #fff;
}
.carousel-overlay h2 { margin: 0.5rem 0; font-size: 1.9rem; line-height: 1.25; }
.carousel-overlay h2 a { color: #fff; text-decoration: none; }
.carousel-overlay h2 a:hover { text-decoration: underline; }
.summary-light { color: #e9f0ea; max-width: 620px; margin: 0; }
.tag-light {
  display: inline-block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  background: rgba(255,255,255,0.22); color: #fff; padding: 0.2rem 0.6rem; border-radius: 20px;
}

.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.35); color: #fff; border: none;
  width: 42px; height: 42px; border-radius: 50%;
  font-size: 1.5rem; cursor: pointer; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  direction: ltr;
  unicode-bidi: isolate;
}
.carousel-btn:hover { background: rgba(0,0,0,0.55); }
.carousel-btn.prev { left: 1rem; }
.carousel-btn.next { right: 1rem; }

.carousel-dots { position: absolute; bottom: 1.1rem; left: 50%; transform: translateX(-50%); display: flex; gap: 0.4rem; z-index: 5; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.5); cursor: pointer; border: none; padding: 0; }
.dot.active { background: #fff; }

/* Secondary tier */
.secondary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-bottom: 2.5rem; }
.secondary-image { width: 100%; height: 130px; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 0.5rem; }
.secondary-card h3 { font-size: 1rem; margin: 0.3rem 0; }
.secondary-card h3 a { color: var(--ink); text-decoration: none; }
.secondary-card h3 a:hover { color: var(--accent); }

.section-label {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; margin-bottom: 1.25rem;
}

/* Article cards */
.card {
  display: flex; gap: 1rem; padding: 1rem; margin-bottom: 1rem;
  border: 1px solid var(--line); border-radius: 8px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(30, 111, 76, 0.08); }
.card-image { width: 140px; height: 100px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.card-body { flex: 1; }
.card h2 { font-size: 1.1rem; margin: 0.2rem 0; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card h2 a:hover { color: var(--accent); }

.summary { color: var(--muted); font-size: 0.92rem; }
.meta { color: var(--muted); font-size: 0.8rem; }

.tag {
  display: inline-block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent-dark); background: var(--accent-soft); padding: 0.15rem 0.5rem;
  border-radius: 3px; margin-bottom: 0.3rem;
}

.pagination { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; }
.pagination a { color: var(--accent); text-decoration: none; }

/* Article detail page */
.article-detail {
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: break-word;
}
.article-detail h1 {
  font-size: 2rem;
  margin: 0.5rem 0;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}
.detail-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1rem 0;
  box-sizing: border-box;
}
.article-body {
  font-size: 1.05rem;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}
.article-body * {
  max-width: 100%;
  box-sizing: border-box;
}
.back-link { display: inline-block; margin-top: 2rem; color: var(--accent); text-decoration: none; }
.back-link:hover { text-decoration: underline; }


/* ---------- Mobile responsiveness ---------- */
@media (max-width: 768px) {
  .site-header { padding: 0.85rem 1rem; }
  .brand { font-size: 1.05rem; }

  .ticker-label { padding: 0.4rem 0.7rem; font-size: 0.68rem; }
  .ticker-content a { font-size: 0.82rem; }

  /* Sidebar becomes a horizontal scrolling strip instead of a tall left column */
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    min-height: unset;
    padding: 0.9rem 1rem;
    border-inline-end: none;
    border-bottom: 1px solid var(--line);
  }
  .sidebar h3 { display: none; }
  .sidebar ul {
    display: flex;
    gap: 1.1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar li { margin-bottom: 0; flex-shrink: 0; }

  .page { padding: 1.25rem 1rem; }

  /* Carousel shrinks and text stays readable */
  .carousel-track { height: 260px; }
  .carousel-overlay { padding: 1.5rem 1.2rem 1.2rem; }
  .carousel-overlay h2 { font-size: 1.3rem; }
  .summary-light { display: none; } /* hide summary on small screens to reduce clutter */
  .carousel-btn { width: 34px; height: 34px; font-size: 1.2rem; }

  /* Secondary grid: 3 columns becomes 1 */
  .secondary-grid { grid-template-columns: 1fr; }

  /* Article cards: stack image above text instead of side-by-side */
  .card { flex-direction: column; }
  .card-image { width: 100%; height: 160px; }

  .article-detail h1 { font-size: 1.5rem; }
}

/* Keep the navbar compact regardless of language - the Nastaliq font
   has tall natural spacing that's great for body text but too tall for a navbar. */
.site-header,
.site-header .brand,
.site-header .lang-switch a {
  font-family: "Inter", sans-serif !important;
  line-height: 1.2 !important;
}


.site-footer {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  padding: 1.5rem;
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}
.site-footer a { color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }


/* Auth forms (login, register) */
.auth-card {
  max-width: 420px;
  margin: 1.5rem 0;
  padding: 2rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.04);
}
.auth-card p { margin-bottom: 1.1rem; }
.auth-card label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--ink); margin-bottom: 0.35rem; }
.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid #c9d3cb;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-card ul {
  margin: 0.4rem 0 0;
  padding-inline-start: 1.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.auth-card ul li { margin-bottom: 0.2rem; }
.auth-card .help-text { font-size: 0.78rem; color: var(--muted); margin-top: 0.3rem; }
.auth-card button[type="submit"] {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.7rem;
  border-radius: 6px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.3rem;
}
.auth-card button[type="submit"]:hover { background: var(--accent-dark); }
.auth-footer-link { margin-top: 1rem; font-size: 0.88rem; }

.ad-slot { margin: 1.5rem 0; text-align: center; }
.ad-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.ad-slot img { max-width: 100%; border-radius: 6px; }

.ad-between-articles {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.related-articles { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }

@media (max-width: 768px) {
  .related-grid { grid-template-columns: 1fr; }
}

.search-box input {
  padding: 0.4rem 0.8rem;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 20px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 0.85rem;
  width: 180px;
}
.search-box input::placeholder { color: #dceee2; }
.search-box input:focus { outline: none; background: rgba(255,255,255,0.22); }

@media (max-width: 768px) {
  .search-box { order: 2; width: 100%; margin-top: 0.5rem; }
  .search-box input { width: 100%; }
}

.author-header { display: flex; gap: 1.25rem; align-items: center; margin-bottom: 2rem; }
.author-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }

.brand-logo { height: 40px; display: block; }
@media (max-width: 768px) {
  .brand-logo { height: 32px; }
}