/* Federation Tech & Machinery Wire v2.3.3 — 4 Professional RTL News Layouts + Theme-Immune Article View */
@font-face {
  font-family: "Vazirmatn";
  src: url("https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.spn-grid-shell {
  container-type: inline-size;
  container-name: spngrid;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-wrap: anywhere;
  direction: rtl;
  text-align: right;
  font-family: "Vazirmatn", "IRANSans", "Dana", "Tahoma", system-ui, -apple-system, sans-serif;
  margin: 18px 0;
}

.elementor-widget-shortcode:has(.spn-grid-shell),
.elementor-widget-shortcode:has(.spn-grid-shell) > .elementor-widget-container,
.elementor-shortcode:has(.spn-grid-shell) {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.spn-grid-shell *,
.spn-single-article *,
.spn-standalone-shell * {
  box-sizing: border-box;
}

.spn-grid-shell a,
.spn-single-article a {
  color: inherit;
  text-decoration: none !important;
}

.spn-grid-shell h2,
.spn-grid-shell h3,
.spn-grid-shell h4,
.spn-grid-shell p,
.spn-grid-shell figure {
  margin: 0 !important;
  padding: 0 !important;
  overflow-wrap: anywhere;
}

.spn-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px !important;
  min-width: 0;
}

.spn-source-label {
  color: #0f766e;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.spn-media-wrap {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background: #f1f5f9;
  overflow: hidden;
}

.spn-media-wrap img {
  position: absolute !important;
  inset: 0 !important;
  z-index: 2;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  transition: transform 0.35s ease;
}

.spn-media-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  background: #f1f5f9;
}

.spn-media-is-empty .spn-media-placeholder {
  display: flex !important;
}

/* LAYOUT 1: Magazine Grid */
.spn-magazine-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 18px !important;
  align-items: stretch !important;
  color: #0f172a;
}

.spn-card-hero,
.spn-card-medium,
.spn-ed-card {
  display: flex !important;
  flex-direction: column !important;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.spn-card-hero:hover,
.spn-card-medium:hover,
.spn-ed-card:hover { border-color: #94a3b8; transform: translateY(-2px); }

.spn-hero-media,
.spn-medium-media,
.spn-compact-media,
.spn-ed-media,
.spn-list-media,
.spn-digest-thumb,
.spn-related-media {
  position: relative !important;
  display: block !important;
  overflow: hidden !important;
  background: #f1f5f9;
}

.spn-hero-media { width: 100% !important; aspect-ratio: 16 / 10; min-height: 210px; }
.spn-medium-media { width: 100% !important; aspect-ratio: 16 / 9; min-height: 140px; }
.spn-ed-media { width: 100% !important; aspect-ratio: 16 / 9; min-height: 160px; }
.spn-compact-media { flex: 0 0 76px !important; width: 76px !important; height: 76px !important; border-radius: 8px; }
.spn-digest-thumb { flex: 0 0 80px !important; width: 80px !important; height: 64px !important; border-radius: 8px; }
.spn-list-media { flex: 0 0 144px !important; width: 144px !important; aspect-ratio: 16 / 10; border-radius: 8px; }
.spn-related-media { width: 100% !important; aspect-ratio: 16 / 9; min-height: 120px; }

.spn-card-hero:hover .spn-hero-media img,
.spn-ed-card:hover .spn-ed-media img { transform: scale(1.03); }

.spn-hero-body { padding: 18px 20px 22px !important; display: flex; flex-direction: column; flex: 1; }
.spn-hero-title {
  margin: 0 0 10px !important;
  font-size: 19px !important;
  line-height: 1.55 !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.spn-hero-excerpt {
  font-size: 14px !important;
  line-height: 1.75 !important;
  color: #475569 !important;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.spn-medium-col { display: grid !important; grid-template-rows: 1fr 1fr; gap: 16px; }
.spn-medium-body, .spn-ed-body { padding: 14px 16px !important; display: flex; flex-direction: column; flex: 1; }
.spn-medium-title, .spn-ed-title {
  margin: 0 0 6px !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.spn-medium-excerpt, .spn-ed-excerpt {
  font-size: 13px !important;
  line-height: 1.65 !important;
  color: #475569 !important;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.spn-compact-col { display: flex !important; flex-direction: column !important; justify-content: space-between; gap: 10px; }
.spn-card-compact {
  display: flex !important;
  align-items: center !important;
  gap: 12px;
  padding: 10px !important;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.spn-card-compact:hover { border-color: #94a3b8; background: #f8fafc; }
.spn-compact-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.spn-compact-title {
  font-size: 13.5px !important;
  line-height: 1.55 !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.spn-compact-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; font-size: 11.5px; color: #64748b; min-width: 0; }
.spn-compact-time { white-space: nowrap; }

/* LAYOUT 2: Editorial Uniform 3-Col Grid */
.spn-editorial-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 18px !important;
}

/* LAYOUT 3: Ticker Showcase (Auto-Rotating Overlay Hero + Pale-Blue Active Digest Column) */
.spn-showcase-top {
  display: grid !important;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) !important;
  gap: 18px !important;
  align-items: stretch !important;
}
.spn-showcase-hero {
  position: relative !important;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  min-height: 390px !important;
  height: 100%;
  background: #0f172a;
}
.spn-showcase-slide {
  position: absolute !important;
  inset: 0 !important;
  z-index: 1;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s ease, visibility 0.45s ease;
  margin: 0 !important;
  padding: 0 !important;
}
.spn-showcase-slide.is-active {
  z-index: 2 !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
.spn-showcase-hero-link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}
.spn-showcase-hero-link .spn-media-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.spn-showcase-scrim {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.93) 0%, rgba(15, 23, 42, 0.42) 55%, rgba(15, 23, 42, 0.12) 100%);
}
.spn-showcase-overlay {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 4;
  padding: 24px 24px 30px;
  color: #ffffff;
}
.spn-showcase-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 8px;
}
.spn-showcase-meta strong { color: #5eead4; }
.spn-showcase-overlay h2 {
  font-size: 20px !important;
  line-height: 1.5 !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  margin-bottom: 8px !important;
}
.spn-showcase-overlay p {
  font-size: 13.5px !important;
  line-height: 1.7 !important;
  color: #e2e8f0 !important;
}
.spn-showcase-controls {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  border-radius: 8px;
  padding: 4px 8px;
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 600;
}
.spn-showcase-btn {
  border: 0 !important;
  background: transparent !important;
  color: #ffffff !important;
  cursor: pointer;
  padding: 2px 6px !important;
  font-size: 16px !important;
  line-height: 1 !important;
  border-radius: 4px;
}
.spn-showcase-btn:hover { background: rgba(255, 255, 255, 0.16) !important; }
.spn-showcase-counter { padding: 0 4px; direction: ltr; }
.spn-showcase-dots {
  position: absolute;
  bottom: 12px;
  left: 24px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
}
.spn-showcase-dot {
  border: 0 !important;
  padding: 0 !important;
  height: 6px !important;
  width: 6px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.45) !important;
  cursor: pointer;
  transition: width 0.25s ease, background-color 0.25s ease;
}
.spn-showcase-dot.is-active {
  width: 20px !important;
  background: #38bdf8 !important;
}
.spn-showcase-digest {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.spn-digest-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  border-right: 4px solid transparent;
  transition: background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.spn-digest-row:last-child { border-bottom: 0; }
.spn-digest-row:hover { background: #f8fafc; }
.spn-digest-row.is-active {
  background: rgba(56, 189, 248, 0.14) !important;
  border-right-color: #0284c7 !important;
  box-shadow: inset 0 0 18px rgba(56, 189, 248, 0.16), inset 0 0 0 1px rgba(56, 189, 248, 0.22) !important;
}
.spn-digest-order {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: #f1f5f9;
  color: #64748b;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.spn-digest-row.is-active .spn-digest-order {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.45);
}
.spn-digest-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.spn-digest-info h4 {
  font-size: 13px !important;
  line-height: 1.5 !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.spn-digest-row.is-active .spn-digest-info h4 a {
  color: #0369a1 !important;
}

/* LAYOUT 4: Broadsheet Compact List */
.spn-list-board {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}
.spn-list-row {
  display: flex !important;
  align-items: center !important;
  gap: 16px;
  padding: 16px !important;
  border-bottom: 1px solid #e2e8f0;
}
.spn-list-row:last-child { border-bottom: 0; }
.spn-list-row:hover { background: #f8fafc; }
.spn-list-body { flex: 1; min-width: 0; }
.spn-list-title {
  margin: 0 0 6px !important;
  font-size: 16px !important;
  line-height: 1.55 !important;
  font-weight: 700 !important;
  color: #0f172a !important;
}
.spn-list-excerpt {
  font-size: 13.5px !important;
  line-height: 1.75 !important;
  color: #475569 !important;
}

.spn-empty-grid {
  padding: 24px;
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: #64748b;
  font-family: "Vazirmatn", "IRANSans", "Tahoma", sans-serif;
}

@container spngrid (min-width: 621px) and (max-width: 900px) {
  .spn-magazine-grid, .spn-editorial-grid { grid-template-columns: 1fr 1fr !important; }
  .spn-showcase-top { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) !important; }
  .spn-compact-col { grid-column: 1 / -1; display: grid !important; grid-template-columns: 1fr 1fr !important; }
}
@container spngrid (max-width: 620px) {
  .spn-magazine-grid, .spn-editorial-grid, .spn-showcase-top, .spn-medium-col, .spn-compact-col {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
  }
  .spn-compact-col { grid-column: auto !important; }
  .spn-showcase-hero { min-height: 300px !important; height: 300px !important; }
  .spn-showcase-overlay { padding: 54px 16px 28px !important; }
  .spn-showcase-overlay h2 { font-size: 16.5px !important; line-height: 1.5 !important; }
  .spn-showcase-overlay p { font-size: 12.5px !important; line-height: 1.65 !important; }
  .spn-showcase-controls { top: 10px !important; left: 10px !important; }
  .spn-showcase-dots { bottom: 10px !important; left: 16px !important; }
  .spn-list-row { flex-direction: column !important; align-items: stretch !important; padding: 14px !important; gap: 12px !important; }
  .spn-list-media { width: 100% !important; flex: none !important; aspect-ratio: 16 / 9 !important; }
}

@media (min-width: 769px) and (max-width: 980px) {
  .spn-magazine-grid, .spn-editorial-grid { grid-template-columns: 1fr 1fr !important; }
  .spn-showcase-top { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) !important; }
  .spn-compact-col { grid-column: 1 / -1; display: grid !important; grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 820px) {
  /* Prevent Elementor Flexbox / Gutenberg multi-column rows containing news grids from squeezing side-by-side on phones */
  .e-con:has(> .e-con .spn-grid-shell),
  .e-flexbox-base:has(> .e-con .spn-grid-shell),
  .elementor-section:has(.spn-grid-shell) .elementor-container:has(.spn-grid-shell),
  .elementor-section:has(.spn-grid-shell) .elementor-row:has(.spn-grid-shell),
  .wp-block-columns:has(.spn-grid-shell) {
    flex-direction: column !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
  }
  .e-con:has(.spn-grid-shell) > .e-con:has(.spn-grid-shell),
  .elementor-section:has(.spn-grid-shell) .elementor-column:has(.spn-grid-shell),
  .wp-block-columns:has(.spn-grid-shell) > .wp-block-column:has(.spn-grid-shell) {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 768px) {
  .spn-magazine-grid, .spn-editorial-grid, .spn-showcase-top, .spn-medium-col, .spn-compact-col {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
    gap: 14px !important;
  }
  .spn-compact-col { grid-column: auto !important; }
  .spn-hero-media { min-height: 185px !important; }
  .spn-medium-media, .spn-ed-media { min-height: 150px !important; }
  .spn-showcase-hero { min-height: 300px !important; height: 300px !important; }
  .spn-showcase-overlay { padding: 54px 16px 28px !important; }
  .spn-showcase-overlay h2 { font-size: 16.5px !important; line-height: 1.5 !important; }
  .spn-showcase-overlay p { font-size: 12.5px !important; line-height: 1.65 !important; }
  .spn-showcase-controls { top: 10px !important; left: 10px !important; }
  .spn-showcase-dots { bottom: 10px !important; left: 16px !important; }
  .spn-digest-row { padding: 10px 12px !important; gap: 10px !important; }
  .spn-digest-thumb { flex: 0 0 70px !important; width: 70px !important; height: 58px !important; }
  .spn-list-row { flex-direction: column !important; align-items: stretch !important; padding: 14px !important; gap: 12px !important; }
  .spn-list-media { width: 100% !important; flex: none !important; aspect-ratio: 16 / 9 !important; }
}

/* Admin Panel Styling */
.spn-admin-wrap { max-width: 1080px; font-family: "Vazirmatn", "Tahoma", sans-serif; }
.spn-admin-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #fff; border: 1px solid #dcdcde; border-radius: 8px; padding: 18px 22px; margin: 16px 0; }
.spn-admin-header h1 { margin: 0 0 6px; padding: 0; font-size: 20px; font-weight: 700; }
.spn-admin-subtitle { margin: 0; color: #50575e; }
.spn-card { background: #fff; border: 1px solid #dcdcde; border-radius: 8px; padding: 18px 22px; margin-bottom: 16px; }
.spn-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.spn-card h2 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.spn-feeds-list { display: flex; flex-direction: column; gap: 10px; }
.spn-feed-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spn-checkbox-inline { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.spn-ajax-log-panel { background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 14px 18px; margin-bottom: 16px; }
.spn-ajax-log-panel h3 { margin: 0 0 10px; color: #fff; font-size: 14px; }
.spn-log-lines { font-family: monospace; font-size: 12.5px; line-height: 1.7; max-height: 220px; overflow-y: auto; }
