/*
Theme Name:   PB-Theme
Theme URI:    https://paryavaranbharat.in
Description:  ParyavaranBharat Child Theme — The Modern Earth-Steward design system built on BuddyX
Author:       ParyavaranBharat
Author URI:   https://paryavaranbharat.in
Template:     buddyx
Version:      1.0.0
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  pb-theme
Tags:         sustainability, community, news, buddypress
*/

/* ============================================================
   DESIGN TOKENS — The Modern Earth-Steward System
   ============================================================ */
:root {
  /* Core Brand Colors */
  --pb-primary:               #012d1d;
  --pb-secondary:             #006c48;
  --pb-background:            #fbf9f3;
  --pb-surface:               #ffffff;
  --pb-on-surface:            #1b1c18;
  --pb-on-surface-variant:    #414844;
  --pb-outline:               #717973;
  --pb-outline-variant:       #c1c8c2;

  /* Container Surfaces (tonal layering — no divider lines) */
  --pb-surface-dim:                  #dcdad4;
  --pb-surface-container-lowest:     #ffffff;
  --pb-surface-container-low:        #f5f3ed;
  --pb-surface-container:            #f0eee8;
  --pb-surface-container-high:       #eae8e2;
  --pb-surface-container-highest:    #e4e2dd;

  /* Primary Scale */
  --pb-primary-fixed:         #c1ecd4;
  --pb-primary-fixed-dim:     #a5d0b9;
  --pb-primary-container:     #1b4332;
  --pb-on-primary:            #ffffff;
  --pb-on-primary-fixed:      #002114;
  --pb-on-primary-container:  #86af99;
  --pb-inverse-primary:       #a5d0b9;

  /* Secondary Scale */
  --pb-secondary-fixed:       #92f7c3;
  --pb-secondary-fixed-dim:   #75daa8;
  --pb-secondary-container:   #92f7c3;
  --pb-on-secondary:          #ffffff;
  --pb-on-secondary-fixed:    #002113;
  --pb-on-secondary-container:#00734d;

  /* Tertiary / Earth Tones */
  --pb-tertiary:              #3b2000;
  --pb-tertiary-fixed:        #ffdcbc;
  --pb-tertiary-fixed-dim:    #efbd8a;
  --pb-tertiary-container:    #55350e;
  --pb-on-tertiary:           #ffffff;
  --pb-on-tertiary-fixed:     #2c1700;
  --pb-on-tertiary-container: #cc9e6d;

  /* Error */
  --pb-error:                 #ba1a1a;
  --pb-error-container:       #ffdad6;
  --pb-on-error:              #ffffff;
  --pb-on-error-container:    #93000a;

  /* Typography */
  --pb-font-headline:         'Newsreader', Georgia, serif;
  --pb-font-body:             'Inter', system-ui, sans-serif;
  --pb-font-hindi:            'Noto Sans Devanagari', sans-serif;

  /* Spacing */
  --pb-radius-sm:   0.25rem;
  --pb-radius-md:   0.5rem;
  --pb-radius-lg:   0.75rem;
  --pb-radius-xl:   1rem;
  --pb-radius-full: 9999px;

  /* Shadows — editorial, not material */
  --pb-shadow-editorial: 0 12px 32px -4px rgba(27, 28, 24, 0.06);
  --pb-shadow-card:      0 2px 8px 0 rgba(27, 28, 24, 0.05);
  --pb-shadow-nav:       0 1px 3px 0 rgba(27, 28, 24, 0.08);
}

/* ============================================================
   GOOGLE FONTS IMPORT
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300..800;1,6..72,300..800&family=Inter:wght@300;400;500;600;700&family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');

/* ============================================================
   GLOBAL RESETS & BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--pb-background);
  color: var(--pb-on-surface);
  font-family: var(--pb-font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* No divider lines — use background shifts */
hr {
  display: none;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6,
.pb-headline {
  font-family: var(--pb-font-headline);
  color: var(--pb-primary);
  line-height: 1.15;
  font-weight: 600;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
  color: var(--pb-on-surface);
}

a {
  color: var(--pb-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--pb-primary);
}

.pb-label {
  font-family: var(--pb-font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pb-hindi {
  font-family: var(--pb-font-hindi);
}

/* ============================================================
   NAVIGATION — Glassmorphic
   ============================================================ */
#masthead,
.site-header,
.pb-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background-color: rgba(251, 249, 243, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--pb-shadow-nav);
  transition: background-color 0.3s ease;
}

.site-header .site-branding a,
.pb-nav .site-title {
  font-family: var(--pb-font-headline);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--pb-primary) !important;
}

.main-navigation a,
.pb-nav-link {
  font-family: var(--pb-font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(27, 28, 24, 0.7);
  transition: color 0.15s ease;
}

.main-navigation a:hover,
.pb-nav-link:hover,
.pb-nav-link.active {
  color: var(--pb-primary);
}

/* Push content below fixed nav */
.site-content,
#content {
  padding-top: 72px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.pb-btn,
.button,
input[type="submit"],
button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--pb-font-body);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--pb-radius-md);
  padding: 0.5rem 1.25rem;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.pb-btn-primary,
input[type="submit"],
button[type="submit"] {
  background: linear-gradient(135deg, var(--pb-primary), var(--pb-primary-container));
  color: var(--pb-on-primary);
}

.pb-btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  color: var(--pb-on-primary);
}

.pb-btn-secondary {
  background-color: var(--pb-secondary-fixed);
  color: var(--pb-on-secondary-fixed);
}

.pb-btn-ghost {
  background: transparent;
  color: var(--pb-primary);
  border: 1.5px solid var(--pb-primary);
}

.pb-btn-pill {
  border-radius: var(--pb-radius-full);
  padding: 0.375rem 1rem;
}

/* ============================================================
   CARDS — Editorial Style
   ============================================================ */
.pb-card,
.entry-card,
.post-card {
  background-color: var(--pb-surface-container-lowest);
  border-radius: var(--pb-radius-xl);
  overflow: hidden;
  box-shadow: var(--pb-shadow-card);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.pb-card:hover {
  box-shadow: var(--pb-shadow-editorial);
  transform: translateY(-2px);
}

.pb-card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.pb-card-body {
  padding: 1.25rem;
}

.pb-card-tag {
  display: inline-block;
  background-color: var(--pb-secondary-fixed);
  color: var(--pb-on-secondary-fixed);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: var(--pb-radius-sm);
  margin-bottom: 0.5rem;
}

.pb-card-title {
  font-family: var(--pb-font-headline);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--pb-primary);
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.pb-card-excerpt {
  font-size: 0.875rem;
  color: var(--pb-on-surface-variant);
  line-height: 1.5;
}

.pb-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--pb-outline);
  margin-top: 0.75rem;
}

/* ============================================================
   HERO SECTION — News Homepage
   ============================================================ */
.pb-hero {
  position: relative;
  height: clamp(400px, 60vh, 640px);
  border-radius: var(--pb-radius-xl);
  overflow: hidden;
  cursor: pointer;
}

.pb-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease;
}

.pb-hero:hover img {
  transform: scale(1.04);
}

.pb-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(1, 45, 29, 0.92) 0%, rgba(1, 45, 29, 0.2) 50%, transparent 100%);
}

.pb-hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 2.5rem;
  max-width: 680px;
}

.pb-hero-title {
  font-family: var(--pb-font-headline);
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.15;
  margin-bottom: 1rem;
}

/* ============================================================
   CATEGORY STRIP
   ============================================================ */
.pb-category-strip {
  background-color: var(--pb-background);
  border-bottom: 1px solid rgba(193, 200, 194, 0.15);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.pb-category-strip::-webkit-scrollbar {
  display: none;
}

.pb-category-strip-inner {
  display: flex;
  gap: 2rem;
  padding: 1rem 1.5rem;
  white-space: nowrap;
}

.pb-category-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--pb-outline);
  text-decoration: none;
  transition: color 0.15s ease;
}

.pb-category-link:hover,
.pb-category-link.active {
  color: var(--pb-primary);
  font-weight: 700;
}

/* ============================================================
   AI BOXES — Signature Features
   ============================================================ */

/* AI Summary Box */
.pb-ai-summary {
  background-color: var(--pb-surface-container-low);
  border-left: 4px solid var(--pb-secondary);
  border-radius: var(--pb-radius-xl);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.pb-ai-summary-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--pb-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.pb-ai-summary ul {
  list-style: disc;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pb-ai-summary li {
  font-size: 0.875rem;
  color: var(--pb-on-surface-variant);
  font-weight: 500;
  line-height: 1.5;
}

/* PB Perspective Box */
.pb-perspective {
  background-color: var(--pb-primary);
  color: #ffffff;
  border-radius: var(--pb-radius-xl);
  padding: 2rem;
  margin: 3rem 0;
  position: relative;
  overflow: hidden;
}

.pb-perspective::before {
  content: '';
  position: absolute;
  top: -3rem;
  right: -3rem;
  width: 8rem;
  height: 8rem;
  background-color: rgba(0, 108, 72, 0.2);
  border-radius: 50%;
  filter: blur(2rem);
}

.pb-perspective-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pb-secondary-fixed);
  margin-bottom: 1rem;
}

.pb-perspective-label span.icon {
  background-color: var(--pb-secondary-fixed);
  color: var(--pb-on-secondary-fixed);
  padding: 0.375rem;
  border-radius: var(--pb-radius-md);
  font-size: 1rem;
  line-height: 1;
}

.pb-perspective blockquote,
.pb-perspective p {
  font-family: var(--pb-font-headline);
  font-style: italic;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--pb-primary-fixed);
  margin: 0;
}

/* Community Sourced Card */
.pb-community-sourced {
  background-color: rgba(255, 220, 188, 0.3);
  border: 1px solid rgba(255, 220, 188, 0.5);
  border-radius: var(--pb-radius-xl);
  padding: 2rem;
  margin-top: 3rem;
}

/* ============================================================
   ARTICLE / SINGLE POST
   ============================================================ */
.pb-article-content {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--pb-on-surface);
}

.pb-article-content h2 {
  font-family: var(--pb-font-headline);
  font-style: italic;
  font-size: 1.875rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

.pb-article-content p:first-of-type::first-letter {
  font-family: var(--pb-font-headline);
  font-size: 4rem;
  font-weight: 700;
  float: left;
  line-height: 0.8;
  margin: 0.1em 0.1em 0 0;
  color: var(--pb-primary);
}

/* Language Toggle */
.pb-lang-toggle {
  display: inline-flex;
  background-color: var(--pb-surface-container-high);
  border-radius: var(--pb-radius-full);
  padding: 0.2rem;
  gap: 0.1rem;
}

.pb-lang-toggle button {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--pb-radius-full);
  border: none;
  background: transparent;
  color: var(--pb-outline);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pb-lang-toggle button.active {
  background-color: var(--pb-tertiary-fixed);
  color: var(--pb-on-tertiary-fixed);
}

/* Share Bar */
.pb-share-bar {
  position: sticky;
  top: 5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.pb-share-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--pb-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--pb-surface-container);
  color: var(--pb-on-surface-variant);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pb-share-btn:hover {
  background-color: var(--pb-primary);
  color: #ffffff;
}

/* ============================================================
   BUDDYPRESS — Community Skin
   ============================================================ */

/* Member cards */
#members-list .list-wrap,
.buddypress ul.members-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  list-style: none;
  padding: 0;
}

.buddypress ul.members-list li {
  background-color: var(--pb-surface-container-lowest);
  border-radius: var(--pb-radius-xl);
  padding: 1.5rem;
  box-shadow: var(--pb-shadow-card);
  transition: box-shadow 0.2s ease;
}

.buddypress ul.members-list li:hover {
  box-shadow: var(--pb-shadow-editorial);
}

/* Activity Feed */
#activity-stream .activity-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#activity-stream .activity-item {
  background-color: var(--pb-surface-container-lowest);
  border-radius: var(--pb-radius-xl);
  padding: 1.5rem;
  box-shadow: var(--pb-shadow-card);
  list-style: none;
}

/* EcoScore Badge */
.pb-ecoscore {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background-color: var(--pb-secondary-fixed);
  color: var(--pb-on-secondary-fixed);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--pb-radius-full);
}

/* Groups Grid */
.buddypress ul.groups-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  list-style: none;
  padding: 0;
}

.buddypress ul.groups-list li {
  background-color: var(--pb-surface-container-lowest);
  border-radius: var(--pb-radius-xl);
  overflow: hidden;
  box-shadow: var(--pb-shadow-card);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.buddypress ul.groups-list li:hover {
  box-shadow: var(--pb-shadow-editorial);
  transform: translateY(-2px);
}

/* Profile Header */
.pb-profile-header {
  background: linear-gradient(135deg, var(--pb-primary) 0%, var(--pb-primary-container) 100%);
  padding: 3rem 2rem 5rem;
  position: relative;
  overflow: hidden;
}

.pb-profile-avatar {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  border: 3px solid var(--pb-secondary-fixed);
  object-fit: cover;
}

/* ============================================================
   LAYOUT GRID
   ============================================================ */
.pb-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.pb-grid-news {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}

@media (min-width: 1024px) {
  .pb-grid-news {
    grid-template-columns: 8fr 4fr;
  }
}

.pb-article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.pb-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.pb-sidebar-widget {
  background-color: var(--pb-surface-container-low);
  border-radius: var(--pb-radius-xl);
  padding: 1.5rem;
}

.pb-sidebar-title {
  font-family: var(--pb-font-headline);
  font-size: 1rem;
  font-weight: 600;
  color: var(--pb-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--pb-secondary-fixed);
}

/* ============================================================
   FORMS
   ============================================================ */
.pb-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--pb-surface-container-high);
  border: 1.5px solid transparent;
  border-radius: var(--pb-radius-md);
  font-family: var(--pb-font-body);
  font-size: 0.9375rem;
  color: var(--pb-on-surface);
  transition: border-color 0.15s ease, background-color 0.15s ease;
  outline: none;
}

.pb-input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
  background-color: var(--pb-surface);
  border-color: var(--pb-secondary);
}

/* ============================================================
   MOBILE — Bottom Tab Nav
   ============================================================ */
.pb-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background-color: rgba(251, 249, 243, 0.95);
  backdrop-filter: blur(12px);
  padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom));
  box-shadow: 0 -1px 0 var(--pb-outline-variant);
}

@media (max-width: 768px) {
  .pb-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }

  .site-content,
  #content {
    padding-bottom: 5rem;
  }
}

.pb-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--pb-outline);
  text-decoration: none;
  padding: 0.5rem;
  min-width: 3rem;
}

.pb-bottom-nav-item.active {
  color: var(--pb-primary);
}

.pb-bottom-nav-fab {
  width: 3rem;
  height: 3rem;
  border-radius: var(--pb-radius-full);
  background: linear-gradient(135deg, var(--pb-primary), var(--pb-primary-container));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(1, 45, 29, 0.35);
  margin-top: -1rem;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.pb-text-primary   { color: var(--pb-primary); }
.pb-text-secondary { color: var(--pb-secondary); }
.pb-text-muted     { color: var(--pb-on-surface-variant); }
.pb-text-outline   { color: var(--pb-outline); }

.pb-bg-primary     { background-color: var(--pb-primary); }
.pb-bg-surface     { background-color: var(--pb-surface-container-low); }
.pb-bg-warm        { background-color: rgba(255, 220, 188, 0.3); }

.pb-rounded-xl     { border-radius: var(--pb-radius-xl); }
.pb-rounded-full   { border-radius: var(--pb-radius-full); }

.pb-shadow-card     { box-shadow: var(--pb-shadow-card); }
.pb-shadow-editorial{ box-shadow: var(--pb-shadow-editorial); }

/* Scrollbar hide utility */
.scrollbar-hide {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Glass effect */
.pb-glass {
  background-color: rgba(251, 249, 243, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ============================================================
   FRONT PAGE — LAYOUT FIXES
   Override BuddyX defaults that conflict with the PB-Theme
   full-width news homepage design.
   ============================================================ */

/* Warm parchment body background */
body {
  background-color: #fbf9f3;
}

/* BuddyX adds a .container wrapper in header.php around all
   page content. On the front page we suppress it via the
   page-template-full-width body class, but add a safety
   reset here too so nothing bleeds through. */
body.page-template-full-width #page {
  background-color: #fbf9f3;
}

/* Ensure the front-page main element fills the viewport
   width without extra horizontal padding/margin from
   any ancestor BuddyX container that might remain. */
#pb-front-page {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background-color: var(--pb-background);
}

/* pb-container: max-width + centred, no double-padding */
.pb-container {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  box-sizing: border-box;
}

/* Suppress the BuddyX "home-page" background tint that
   can show through and create the double-hero illusion */
.home-page.page-template-full-width .site-wrapper,
.home-page.page-template-full-width .site-main,
.home-page.page-template-full-width #primary {
  background: transparent;
  padding: 0;
  margin: 0;
}

/* Hero card — ensure no overflow outside its rounded box */
.pb-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate; /* new stacking context, prevents overlay bleed */
}

/* Category strip spans full width inside pb-container */
.pb-category-strip {
  width: 100%;
  background-color: var(--pb-background);
}

/* Responsive: stack grid on tablet */
@media (max-width: 768px) {
  .pb-grid-news {
    grid-template-columns: 1fr;
  }
  .pb-hero {
    height: clamp(260px, 45vw, 400px);
  }
}
