:root {
  --nsb-events-ivory: #fffaf2;
  --nsb-events-paper: #fffdf9;
  --nsb-events-maroon: #7d0f3d;
  --nsb-events-maroon-dark: #5f0a2e;
  --nsb-events-gold: #c69433;
  --nsb-events-gold-dark: #a7741d;
  --nsb-events-green: #178248;
  --nsb-events-red: #a51e36;
  --nsb-events-text: #382b2d;
  --nsb-events-muted: #76676a;
  --nsb-events-border: rgba(198, 148, 51, .31);
  --nsb-events-shadow: 0 14px 34px rgba(94, 43, 42, .09);
}

.nsb-events-section,
.nsb-event-page,
.nsb-events-archive,
.nsb-events-section *,
.nsb-event-page *,
.nsb-events-archive * {
  box-sizing: border-box;
}

.nsb-events-section,
.nsb-event-page,
.nsb-events-archive {
  color: var(--nsb-events-text);
  font-family: "Noto Naskh Arabic", Tahoma, Arial, sans-serif;
}

/* Homepage section */
.nsb-events-section {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 2.6vw, 34px) 18px clamp(30px, 3.8vw, 50px);
  background:
    radial-gradient(circle at 50% 0, rgba(255,255,255,.96), rgba(255,250,242,.9) 48%, rgba(255,246,244,.82) 100%),
    var(--nsb-events-ivory);
}

.nsb-events-section__inner {
  width: min(1320px, 100%);
  margin: 0 auto;
}

.nsb-events-heading {
  margin: 0 auto clamp(17px, 2vw, 25px);
  text-align: center;
}

.nsb-events-heading h2 {
  margin: 0;
  color: var(--nsb-events-maroon);
  font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif;
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 700;
  line-height: 1.75;
}

.nsb-events-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  direction: rtl;
  gap: 17px;
  align-items: stretch;
}

.nsb-events-grid > .nsb-event-card { min-width: 0; }

/* Cards */
.nsb-event-card {
  display: flex;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--nsb-events-border);
  border-radius: 18px;
  background: rgba(255,253,249,.98);
  box-shadow: var(--nsb-events-shadow);
}

.nsb-event-card__media {
  position: relative;
  display: block;
  overflow: hidden;
  min-height: 176px;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #3b1c29, #95612c);
}

.nsb-event-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 320ms ease, filter 220ms ease;
}

.nsb-event-card:hover .nsb-event-card__media img,
.nsb-event-card:focus-within .nsb-event-card__media img { transform: scale(1.025); }

.nsb-event-card__placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: inherit;
  color: rgba(255,244,215,.9);
  font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif;
  font-size: clamp(56px, 6vw, 82px);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 5px 18px rgba(0,0,0,.2);
}

.nsb-event-badge {
  position: absolute;
  z-index: 2;
  top: 13px;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 7px 18px rgba(0,0,0,.14);
}

.nsb-event-badge--special { right: 13px; background: var(--nsb-events-maroon); }
.nsb-event-badge--status { left: 13px; background: var(--nsb-events-green); }
.nsb-event-badge--upcoming,
.nsb-event-badge--ongoing { background: var(--nsb-events-green); }
.nsb-event-badge--past,
.nsb-event-badge--completed { background: var(--nsb-events-red); }
.nsb-event-badge--postponed { background: #a86d13; }
.nsb-event-badge--cancelled { background: var(--nsb-events-red); }

.nsb-event-card__content {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 17px 17px 16px;
}

.nsb-event-card__title {
  display: -webkit-box;
  overflow: hidden;
  min-height: 76px;
  margin: 0 0 7px;
  color: var(--nsb-events-maroon-dark);
  font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif;
  font-size: clamp(20px, 1.65vw, 24px);
  font-weight: 700;
  line-height: 1.72;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.nsb-event-card__title a { color: inherit; text-decoration: none; }

.nsb-event-card__meta {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.nsb-event-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #5c4d50;
  font-size: 13px;
  line-height: 1.58;
}

.nsb-event-meta-row__icon {
  flex: 0 0 auto;
  color: var(--nsb-events-gold-dark);
  font-size: 16px;
  line-height: 1.45;
}

.nsb-event-meta-row strong,
.nsb-event-meta-row span,
.nsb-event-meta-row time,
.nsb-event-meta-row small { display: block; }
.nsb-event-meta-row strong { color: var(--nsb-events-maroon-dark); font-weight: 700; }
.nsb-event-meta-row small,
.nsb-event-local-zone { color: #89797c; font-size: 11px; }

.nsb-event-card__actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: auto;
  padding-top: 15px;
}

.nsb-event-button,
.nsb-event-channel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 41px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none !important;
  transition: transform 170ms ease, box-shadow 170ms ease, opacity 170ms ease;
}

.nsb-event-button:hover,
.nsb-event-channel:hover { transform: translateY(-1px); }
.nsb-event-button--primary { width: 100%; color: #fff !important; background: linear-gradient(135deg, var(--nsb-events-maroon), #a10d4a); }
.nsb-event-button--outline { color: var(--nsb-events-maroon) !important; border-color: var(--nsb-events-border); background: #fff; }

.nsb-event-live-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 7px;
  width: 100%;
}

.nsb-event-channel { position: relative; min-height: 38px; padding: 7px 8px; color: #fff !important; font-size: 12px; direction: ltr; }
.nsb-event-channel--youtube { background: #e62117; }
.nsb-event-channel--facebook { background: #1877f2; }
.nsb-event-channel--tiktok { background: #171717; }
.nsb-event-channel__dot { display: none; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #fff; }
.nsb-event-channel.is-live .nsb-event-channel__dot { display: inline-block; animation: nsb-event-live-blink 1s ease-in-out infinite; }
.nsb-event-channel.is-live { animation: nsb-event-live-glow 1.1s ease-in-out infinite; }

@keyframes nsb-event-live-blink { 0%,100% { opacity: 1; } 50% { opacity: .15; } }
@keyframes nsb-event-live-glow { 0%,100% { box-shadow: 0 0 0 0 rgba(165,30,54,.16); } 50% { box-shadow: 0 0 0 5px rgba(165,30,54,.14); } }

/* Past event treatment: ribbon stays red while card content is desaturated. */
.nsb-event-card.is-past { background: #f7f5f2; border-color: rgba(120,112,108,.26); }
.nsb-event-card.is-past .nsb-event-card__media img { filter: grayscale(1); }
.nsb-event-card.is-past .nsb-event-card__placeholder { filter: grayscale(1); opacity: .7; }
.nsb-event-card.is-past .nsb-event-card__content { filter: grayscale(.92); opacity: .76; }
.nsb-event-card.is-past:hover .nsb-event-card__content { opacity: .9; }

.nsb-events-all-link-wrap { margin-top: 14px; text-align: center; }
.nsb-events-all-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 4px 5px;
  border-bottom: 2px solid rgba(198,148,51,.65);
  color: var(--nsb-events-maroon) !important;
  font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif;
  font-size: 19px;
  font-weight: 700;
  text-decoration: none !important;
}

.nsb-event-card__title a:focus-visible,
.nsb-events-all-link:focus-visible,
.nsb-event-button:focus-visible,
.nsb-event-channel:focus-visible {
  outline: 3px solid rgba(198,148,51,.55);
  outline-offset: 3px;
}

/* Single event page and archive */
.nsb-event-page,
.nsb-events-archive {
  min-height: 60vh;
  padding: clamp(20px, 3vw, 42px) 18px clamp(36px, 5vw, 70px);
  background: var(--nsb-events-ivory);
}

.nsb-event-single,
.nsb-events-archive__header,
.nsb-events-archive__section,
.nsb-events-archive__none {
  width: min(1160px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.nsb-event-single {
  overflow: hidden;
  border: 1px solid var(--nsb-events-border);
  border-radius: 22px;
  background: var(--nsb-events-paper);
  box-shadow: var(--nsb-events-shadow);
}

.nsb-event-single__hero {
  position: relative;
  display: grid;
  min-height: clamp(280px, 42vw, 520px);
  place-items: center;
  background: linear-gradient(135deg, #321824, #95612c);
}

.nsb-event-single__hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nsb-event-single__placeholder { color: rgba(255,244,215,.82); font-family: "Noto Nastaliq Urdu", serif; font-size: clamp(82px, 13vw, 160px); font-weight: 700; }
.nsb-event-single__hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(37,8,22,.78), rgba(37,8,22,.04) 65%); }
.nsb-event-single__overlay { position: absolute; z-index: 2; right: clamp(22px,5vw,56px); bottom: clamp(22px,5vw,50px); left: clamp(22px,5vw,56px); color: #fff; }
.nsb-event-single__overlay .nsb-event-badge { position: static; margin-bottom: 10px; }
.nsb-event-single__overlay h1 { margin: 0; color: #fff; font-family: "Noto Nastaliq Urdu", serif; font-size: clamp(32px,5vw,56px); line-height: 1.65; }
.nsb-event-single__body { padding: clamp(24px,5vw,54px); }
.nsb-event-single__facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.nsb-event-fact { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--nsb-events-border); border-radius: 12px; background: #fff; }
.nsb-event-fact > span { color: var(--nsb-events-gold-dark); font-size: 21px; }
.nsb-event-fact strong { color: var(--nsb-events-maroon-dark); }
.nsb-event-fact p { margin: 3px 0; line-height: 1.75; }
.nsb-event-fact small { color: var(--nsb-events-muted); }
.nsb-event-single__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.nsb-event-single__actions .nsb-event-live-buttons { width: auto; min-width: min(100%, 360px); }
.nsb-event-single__content { font-size: 17px; line-height: 2; }

.nsb-events-archive__header { margin-bottom: 22px; text-align: center; }
.nsb-events-archive__header h1 { margin: 0; color: var(--nsb-events-maroon); font-family: "Noto Nastaliq Urdu", serif; font-size: clamp(30px,3.8vw,44px); line-height: 1.6; }
.nsb-events-archive__header p { margin: 0; color: var(--nsb-events-gold-dark); font-family: "Noto Nastaliq Urdu", serif; font-size: clamp(17px,2vw,21px); line-height: 1.8; }
.nsb-events-archive__section { margin-top: 0; }
.nsb-events-archive__grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); direction: rtl; gap: 18px; align-items: stretch; }
.nsb-events-archive__none { padding: 32px; border: 1px solid var(--nsb-events-border); border-radius: 14px; background: #fff; text-align: center; }

/* v0.1.9: archive-only live-button arrangements for four-card rows. */
.nsb-events-archive .nsb-event-live-buttons--count-1 {
  grid-template-columns: 1fr;
}

.nsb-events-archive .nsb-event-live-buttons--count-1 .nsb-event-channel {
  min-height: 41px;
  font-size: 14px;
}

.nsb-events-archive .nsb-event-live-buttons--count-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nsb-events-archive .nsb-event-live-buttons--count-3 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "facebook tiktok"
    "youtube youtube";
}

.nsb-events-archive .nsb-event-live-buttons--count-3 .nsb-event-channel--facebook { grid-area: facebook; }
.nsb-events-archive .nsb-event-live-buttons--count-3 .nsb-event-channel--tiktok { grid-area: tiktok; }
.nsb-events-archive .nsb-event-live-buttons--count-3 .nsb-event-channel--youtube {
  grid-area: youtube;
  min-height: 41px;
  font-size: 14px;
}

@media (max-width: 1000px) {
  .nsb-events-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .nsb-events-archive__grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 650px) {
  .nsb-events-grid { grid-template-columns: 1fr; }
  .nsb-event-single__facts { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .nsb-events-section { padding: 17px 10px 32px; }
  .nsb-events-heading { margin-bottom: 14px; }
  .nsb-events-heading h2 { font-size: 23px; }
  .nsb-events-grid { grid-template-columns: 1fr; gap: 12px; }
  .nsb-event-card__media { min-height: 190px; }
  .nsb-event-card__title { min-height: auto; font-size: 22px; }
  .nsb-event-card__content { padding: 16px 15px; }
  .nsb-event-meta-row { font-size: 13px; }
  .nsb-events-all-link { font-size: 18px; }
  .nsb-event-page,
  .nsb-events-archive { padding: 16px 10px 36px; }
  .nsb-events-archive__grid { grid-template-columns: 1fr; }
  .nsb-event-single { border-radius: 16px; }
  .nsb-event-single__hero { min-height: 270px; }
  .nsb-event-single__overlay h1 { font-size: 31px; }
  .nsb-event-single__body { padding: 20px 16px 28px; }
  .nsb-event-single__actions { display: grid; }
  .nsb-event-single__actions .nsb-event-live-buttons { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .nsb-event-card__media img,
  .nsb-event-button,
  .nsb-event-channel,
  .nsb-event-channel.is-live,
  .nsb-event-channel.is-live .nsb-event-channel__dot { transition: none; animation: none; }
}

/* Automatic homepage mount: hidden only until positioned by JavaScript. */
.nsb-events-auto-mount { width: 100%; }
.nsb-events-auto-mount:not(.is-mounted) { visibility: hidden; }
.nsb-events-auto-mount.is-mounted { visibility: visible; }

/* v0.1.4 compact share controls and live indicators */
.nsb-event-card__image-link {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none !important;
}

.nsb-event-share {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  direction: rtl;
  min-height: 38px;
  padding: 5px 8px;
  border: 1px solid rgba(198,148,51,.34);
  border-radius: 999px;
  color: var(--nsb-events-maroon-dark);
  background: rgba(255,253,249,.96);
  box-shadow: 0 7px 18px rgba(56,28,34,.11);
}

.nsb-event-share--compact {
  position: absolute;
  z-index: 5;
  bottom: 10px;
  left: 10px;
  min-height: 34px;
  padding: 4px 6px 4px 9px;
  border-color: rgba(255,255,255,.62);
  background: rgba(255,250,242,.92);
  backdrop-filter: blur(7px);
}

.nsb-event-share__label {
  color: var(--nsb-events-maroon-dark);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.nsb-event-share__button {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  border-radius: 50%;
  color: #fff !important;
  text-decoration: none !important;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.nsb-event-share__button:hover { transform: translateY(-1px) scale(1.04); }
.nsb-event-share__button--whatsapp { background: #168b52; }
.nsb-event-share__button--email { background: var(--nsb-events-gold-dark); }
.nsb-event-share__button svg { width: 15px; height: 15px; fill: currentColor; }

.nsb-event-channel__dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 50%;
  background: #ef263d;
  box-shadow: 0 0 0 2px rgba(239,38,61,.18), 0 0 8px rgba(239,38,61,.7);
}

.nsb-event-channel.is-live .nsb-event-channel__dot {
  display: inline-block;
  animation: nsb-event-live-blink .9s ease-in-out infinite;
}

.nsb-event-single__actions > .nsb-event-share {
  min-height: 41px;
  align-self: flex-start;
}

@media (max-width: 560px) {
  .nsb-event-share--compact .nsb-event-share__label { display: none; }
  .nsb-event-share--compact { padding: 4px; }
  .nsb-event-share__button { width: 29px; height: 29px; flex-basis: 29px; }
}

@media (prefers-reduced-motion: reduce) {
  .nsb-event-share__button,
  .nsb-event-channel.is-live .nsb-event-channel__dot { transition: none; animation: none; }
}
