/*
Theme Name:         Tez News
Theme URI:          https://example.com/tez-news
Author:             Mayank Patel
Description:        A fast, mobile-first WordPress news theme with a bold Indian newsroom feel, breaking-news strip, category navigation, article grids, and clean reading pages.
Version:            1.0.0
Requires at least:  6.0
Tested up to:       6.5
Requires PHP:       7.4
License:            GNU General Public License v2 or later
License URI:        https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:        tez-news
Tags:               news, blog, custom-logo, custom-menu, featured-images, right-sidebar, threaded-comments, translation-ready
*/

:root {
  --tn-red: #d71920;
  --tn-red-dark: #a90f16;
  --tn-ink: #171717;
  --tn-muted: #666a73;
  --tn-line: #e7e7ea;
  --tn-bg: #f4f5f7;
  --tn-paper: #ffffff;
  --tn-gold: #f4b000;
  --tn-blue: #0b5cab;
  --tn-radius: 8px;
  --tn-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  --tn-wrap: 1180px;
  --tn-glass: rgba(255, 255, 255, 0.85);
}

@media (prefers-color-scheme: dark) {
  :root {
    --tn-bg: #0f1115;
    --tn-paper: #1a1d23;
    --tn-ink: #f0f2f5;
    --tn-line: #2d3139;
    --tn-muted: #9ba1ad;
    --tn-glass: rgba(26, 29, 35, 0.85);
    --tn-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--tn-ink);
  background: var(--tn-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

/* Dark Mode Body Class */
body.dark-mode {
  /* This class will be added by JavaScript to override system preference if user toggles */
  --tn-bg: #0f1115;
  --tn-paper: #1a1d23;
  --tn-ink: #f0f2f5;
  --tn-line: #2d3139;
  --tn-muted: #9ba1ad;
  --tn-glass: rgba(26, 29, 35, 0.85);
  --tn-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* General Link Styling */
a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--tn-red);
  outline: none; /* Remove default focus outline */
}

button,
input,
textarea,
select {
  font: inherit;
  color: var(--tn-ink);
  background: var(--tn-paper);
  border: 1px solid var(--tn-line);
  border-radius: var(--tn-radius);
  padding: 8px 12px;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--tn-red);
}

/* Reset for specific elements */
button {
  cursor: pointer;
  padding: 0;
  border: none;
  background: none;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: min(calc(100% - 28px), var(--tn-wrap));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--tn-paper);
  border-bottom: 1px solid var(--tn-line);
}

.top-bar {
  background: #f8f9fa;
  border-bottom: 1px solid var(--tn-line);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tn-muted);
}

@media (prefers-color-scheme: dark) {
  .top-bar { background: #14171c; }
}

.top-bar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
}

.top-link {
  margin-left: 15px;
  transition: color 0.2s;
}

.top-link.login-btn {
  background: var(--tn-red);
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px; /* Increased gap */
  padding: 15px 0;
}

.site-branding {
  flex: 0 0 auto;
}

.header-ad-container {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 728px;
}

.custom-logo {
  max-height: 48px;
  width: auto;
}

.site-title {
  margin: 0;
  font-size: clamp(1.45rem, 5vw, 2.25rem);
  line-height: 1;
  font-weight: 900;
  color: var(--tn-red);
  text-transform: uppercase;
}

.site-description {
  margin: 3px 0 0;
  color: var(--tn-muted);
  font-size: 0.82rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px; /* Adjusted gap */
}

.icon-button,
.search-submit {
  display: inline-grid;
  place-items: center;
  width: 40px; /* Slightly smaller buttons */
  height: 40px;
  border: 1px solid var(--tn-line);
  border-radius: var(--tn-radius);
  background: var(--tn-paper);
  color: var(--tn-ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.icon-button:active {
  transform: scale(0.95);
}

/* Dark Mode Toggle specific styles */
.dark-mode-toggle .sun-icon,
body.dark-mode .dark-mode-toggle .moon-icon {
  display: none;
}

body.dark-mode .dark-mode-toggle .sun-icon {
  display: inline-block;
}

.icon-button:hover,
.icon-button:focus,
.search-submit:hover,
.search-submit:focus {
  border-color: var(--tn-red);
  color: var(--tn-red);
}

.search-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 8px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transform: rotate(45deg);
}

.hamburger {
  position: relative;
}

.hamburger span,
.hamburger::before,
.hamburger::after {
  content: "";
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 10px;
}

.hamburger span {
  margin: 5px 0;
}

.search-panel {
  display: none;
  padding: 0 0 14px;
}

.search-panel.is-open {
  display: block;
}

.search-form {
  display: flex;
  gap: 8px;
}

.search-field {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--tn-line);
  border-radius: var(--tn-radius);
  padding: 0 12px;
  background: #fff;
}

.search-submit {
  width: auto;
  min-width: 54px;
  padding: 0 14px;
  background: var(--tn-red);
  border-color: var(--tn-red);
  color: #fff;
}

.primary-nav {
  display: none; /* Hidden by default on mobile */
  position: sticky;
  top: 0; /* Sticks below the main header */
  z-index: 90; /* Lower than site-header */
  background: var(--tn-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--tn-line);
  border-bottom: 1px solid var(--tn-line); /* Added bottom border */
}

.primary-nav.is-open {
  display: block;
}

.primary-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.primary-menu {
  display: flex;
  flex-direction: column;
}

.primary-menu a {
  display: block;
  padding: 13px 0;
  border-bottom: 1px solid var(--tn-line);
  font-weight: 800;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.primary-menu a:hover,
.primary-menu a:focus {
  color: var(--tn-red);
}

/* Dropdown Menu (basic styling for mega menu concept) */
.primary-menu li {
  position: relative;
}

.primary-menu li ul {
  display: none; /* Hidden by default */
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 200px;
  background: var(--tn-paper);
  border: 1px solid var(--tn-line);
  border-radius: var(--tn-radius);
  box-shadow: var(--tn-shadow);
  z-index: 99;
  list-style: none;
  padding: 10px 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

/* Show dropdown on hover/focus */
.primary-menu li:hover > ul,
.primary-menu li:focus-within > ul {
  display: block;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.primary-menu li ul li {
  border-bottom: none;
}

.primary-menu li ul li a {
  padding: 8px 15px;
  border-bottom: none;
  font-weight: 600;
  white-space: nowrap;
}

.primary-menu li ul li a:hover {
  background: var(--tn-bg);
  color: var(--tn-red);
}

.ticker {
  background: var(--tn-red);
  color: #fff;
  overflow: hidden;
}

.ticker .wrap {
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 42px;
}

.ticker-label {
  flex: 0 0 auto;
  padding: 4px 10px;
  background: var(--tn-ink);
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ticker-label::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--tn-red);
  border-radius: 50%;
  animation: tn-pulse 1.5s infinite;
}

@keyframes tn-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(215, 25, 32, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(215, 25, 32, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(215, 25, 32, 0); }
}

.ticker-items {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.ticker-items::-webkit-scrollbar {
  display: none;
}

.ticker-items a {
  font-weight: 700;
}

.site-main {
  padding: 22px 0 34px;
}

.layout {
  display: grid;
  gap: 20px;
}

.content-area,
.sidebar-area {
  min-width: 0;
}

.section-title,
.widget-title,
.page-title {
  margin: 0 0 14px;
  font-size: clamp(1.25rem, 4vw, 1.8rem);
  line-height: 1.15;
  font-weight: 900;
}

.section-title::after,
.widget-title::after {
  content: "";
  display: block;
  width: 54px;
  height: 4px;
  margin-top: 8px;
  background: linear-gradient(90deg, var(--tn-red), var(--tn-gold));
  border-radius: 4px;
}

.hero-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
}

.news-card {
  overflow: hidden;
  background: var(--tn-paper);
  border: 1px solid var(--tn-line);
  border-radius: var(--tn-radius);
  box-shadow: var(--tn-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-card a {
  display: block;
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(18, 24, 38, 0.12);
}

.news-card__image {
  aspect-ratio: 16 / 9;
  background: #d9dde5;
  overflow: hidden;
}

.news-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.news-card:hover .news-card__image img {
  transform: scale(1.035);
}

.news-card__body {
  padding: 13px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--tn-red);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--tn-red);
}

.news-card__title {
  margin: 6px 0 0;
  font-size: 1.05rem;
  line-height: 1.22;
  font-weight: 900;
}

.news-card--lead .news-card__title {
  font-size: clamp(1.45rem, 6vw, 2.45rem);
}

.news-card__meta,
.entry-meta {
  margin-top: 8px;
  color: var(--tn-muted);
  font-size: 0.84rem;
}

.story-list {
  display: grid;
  gap: 12px;
}

.story-row {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px;
  background: var(--tn-paper);
  border: 1px solid var(--tn-line);
  border-radius: var(--tn-radius);
}

.story-row__thumb {
  aspect-ratio: 1 / 0.76;
  overflow: hidden;
  border-radius: 6px;
  background: #d9dde5;
}

.story-row__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-row__title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.25;
  font-weight: 900;
}

.story-row__meta {
  margin-top: 6px;
  color: var(--tn-muted);
  font-size: 0.78rem;
}

.post-grid {
  display: grid;
  gap: 16px;
}

.category-section {
  margin-top: 26px;
}

.category-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.category-header .section-title {
  margin: 0;
}

.view-all {
  color: var(--tn-blue);
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.entry,
.not-found {
  background: var(--tn-paper);
  border: 1px solid var(--tn-line);
  border-radius: var(--tn-radius);
  padding: 16px;
}

.entry + .entry {
  margin-top: 16px;
}

.entry-title {
  margin: 0;
  font-size: clamp(1.45rem, 5vw, 2.35rem);
  line-height: 1.15;
  font-weight: 900;
}

.entry-thumbnail {
  margin: 16px 0;
  overflow: hidden;
  border-radius: var(--tn-radius);
}

.entry-content {
  color: #25272d;
}

.entry-content a {
  color: var(--tn-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.entry-content p {
  margin: 0 0 1rem;
}

.entry-content h2,
.entry-content h3 {
  line-height: 1.2;
}

.entry-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--tn-line);
  color: var(--tn-muted);
  font-size: 0.88rem;
}

.pagination,
.post-navigation {
  margin-top: 22px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-numbers,
.post-page-numbers,
.nav-previous a,
.nav-next a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid var(--tn-line);
  border-radius: var(--tn-radius);
  background: #fff;
  font-weight: 800;
}

.page-numbers.current,
.post-page-numbers.current {
  background: var(--tn-red);
  border-color: var(--tn-red);
  color: #fff;
}

.sidebar-area {
  display: grid;
  gap: 16px;
  align-content: start;
}

.widget {
  padding: 15px;
  background: var(--tn-paper);
  border: 1px solid var(--tn-line);
  border-radius: var(--tn-radius);
}

.widget ul {
  padding-left: 18px;
}

.widget li + li {
  margin-top: 8px;
}

.site-footer {
  padding: 26px 0;
  background: var(--tn-ink);
  color: #f2f2f4;
}

.footer-grid {
  display: grid;
  gap: 18px;
}

.footer-title {
  margin: 0 0 8px;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 900;
}

.footer-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-menu a {
  color: #f2f2f4;
  font-weight: 700;
}

@media (min-width: 640px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-row {
    grid-template-columns: 128px 1fr;
  }
}

@media (min-width: 900px) {
  .hamburger {
    display: none;
  }

  .primary-nav,
  .primary-nav.is-open {
    display: block;
  }

  .primary-menu {
    flex-direction: row;
    gap: 24px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .primary-menu::-webkit-scrollbar {
    display: none;
  }

  .primary-menu a {
    padding: 12px 0;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }

  .primary-menu a:hover,
  .primary-menu a:focus,
  .primary-menu .current-menu-item > a {
    border-bottom-color: var(--tn-red);
  }

  .layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  }

  .hero-side {
    display: grid;
    gap: 14px;
  }

  .post-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .entry {
    padding: 24px;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
}

@media (max-width: 420px) {
  .wrap {
    width: min(calc(100% - 20px), var(--tn-wrap));
  }

  .header-main {
    min-height: 62px;
  }

  .site-title {
    font-size: 1.35rem;
  }

  .site-description,
  .top-strip {
    font-size: 0.76rem;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .story-row {
    grid-template-columns: 92px 1fr;
  }
}

/* Social Share Buttons */
.share-container {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid var(--tn-line);
}

.share-title {
  margin: 0 0 14px;
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tn-muted);
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 6px;
  color: #fff !important;
  font-size: 0.9rem;
  font-weight: 800;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.share-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.share-btn--facebook { background-color: #1877f2; }
.share-btn--twitter { background-color: #000000; }
.share-btn--whatsapp { background-color: #25d366; }

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--tn-glass);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-top: 1px solid var(--tn-line);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 999;
  padding: 0 10px;
}

@media (min-width: 900px) {
  .mobile-bottom-nav { display: none; }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--tn-muted);
  text-decoration: none;
  flex: 1; /* Distribute items evenly */
  padding: 5px 0;
  transition: color 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--tn-red);
}

.nav-icon {
  font-size: 1.3rem;
  margin-bottom: 3px;
}

.nav-label {
  line-height: 1;
}

/* Desktop Specific Adjustments */
@media (min-width: 900px) {
  .top-bar-left {
    flex: 1; /* Allow date to take more space */
  }

  .primary-menu {
    justify-content: center; /* Center align desktop menu */
  }

  .primary-menu li ul {
    left: 50%; /* Center dropdown under parent */
    transform: translateX(-50%) translateY(10px);
  }

  .primary-menu li:hover > ul,
  .primary-menu li:focus-within > ul {
    transform: translateX(-50%) translateY(0);
  }
}

/* Mobile Specific Adjustments */
@media (max-width: 768px) {
  .top-bar-right .social-icons,
  .top-bar-right .language-switcher,
  .top-bar-right .top-link:not(.login-btn) {
    display: none; /* Hide some elements on smaller mobile screens */
  }

  .top-bar .wrap {
    justify-content: center; /* Center date if other elements are hidden */
  }

  .header-main .header-ad-container {
    display: none; /* Hide ad on very small screens */
  }

  .site-branding {
    flex: 1; /* Allow logo to take more space */
  }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--tn-glass);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-top: 1px solid var(--tn-line);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 999;
  padding: 0 10px;
}

@media (min-width: 900px) {
  .mobile-bottom-nav { display: none; }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--tn-muted);
}
