/* ===============================
   1. VARIABLES & RESET
================================ */
:root {
  --bg-body: #000000;
  --bg-card: #141414;
  --bg-card-hover: #1d1d1d;
  --border-color: #292929;
  --text-main: #ffffff;
  --text-dim: #a0a0a0;
  --accent-blue: #ff8f8f;
  --accent-green: #ffc1c1;
  --accent-glow: rgba(255, 143, 143, 0.16);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  padding-bottom: 0;
}

/* ===============================
   2. LAYOUT & CONTAINER
================================ */
.container {
  max-width: 1250px;
  margin: 0 auto;
  padding: 30px 20px;
}

section {
  margin-bottom: 40px;
}

/* ===============================
   3. HIGHLIGHT BOX (The "All Channels" Area)
================================ */
.highlight-box {
  background: linear-gradient(145deg, #1a1a1a, #111);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}

/* Adds a subtle top glow */
.highlight-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-green), transparent);
}

.highlight-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 20px;
  color: #fff;
  text-transform: uppercase;
}

.highlight-box p {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 25px;
  line-height: 1.6;
}

.highlight-links {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.highlight-link {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.highlight-link:hover {
  transform: translateY(-2px);
}

.telegram {
  background: rgba(42, 171, 238, 0.1);
  color: #2aabee;
  border: 1px solid rgba(42, 171, 238, 0.3);
}

.main-link {
  background: rgba(255, 143, 143, 0.1);
  color: #ffc1c1;
  border: 1px solid rgba(255, 143, 143, 0.3);
}

/* ===============================
   4. INFO BOX
================================ */
.info-box {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  border-left: 3px solid var(--accent-blue);
}

.info-box h2 {
  font-size: 18px;
  color: #fff;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-list li {
  color: var(--text-dim);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-list a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
}

.info-list a:hover {
  text-decoration: underline;
}

/* ===============================
   5. CATEGORY HEADERS
================================ */
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #222;
}

.category-header h2 {
  font-size: 20px;
  color: #fff;
  font-weight: 700;
  text-transform: capitalize;
}

/* See More Button */
.toggle-btn {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.toggle-btn:hover { opacity: 0.8; }

/* ===============================
   6. LINK GRID (THE BIG CHANGE)
================================ */
.links-wrapper {
  display: grid;
  /* Auto-fit: Creates columns based on available width */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 15px;
}

.link-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column; /* Better for content structure */
  justify-content: space-between;
  gap: 15px;
  transition: all 0.2s ease;
  position: relative;
}

/* Hover Effect: Glow and Lift */
.link-card:hover {
  transform: translateY(-3px);
  background: var(--bg-card-hover);
  border-color: #444;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.link-left h3 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
  margin-bottom: 4px;
}

.link-images {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px 0 5px;
  scrollbar-color: #555 transparent;
}

.link-images a {
  display: block;
  width: 104px;
  height: 104px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #080808;
}

.link-images img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.link-images a:hover img {
  transform: scale(1.05);
}

.post-feed {
  columns: 3 250px;
  column-gap: 16px;
}

.text-posts-heading {
  margin: 28px 0 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid #292929;
  color: #eee;
  font-size: 19px;
}

.post-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 16px;
  overflow: hidden;
  break-inside: avoid;
  border: 1px solid #292929;
  border-radius: 14px;
  background: #111;
  vertical-align: top;
}

.post-detail {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  border: 1px solid #292929;
  border-radius: 14px;
  background: #111;
}

.post-detail nav,
.post-detail header > p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: #999;
  font-size: 13px;
}

.post-detail nav {
  margin-bottom: 22px;
}

.post-detail nav a,
.post-detail header > p a {
  color: #ffabab;
  text-decoration: none;
}

.post-detail h1 {
  margin: 8px 0;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.post-detail > p {
  margin: 18px 0;
  color: #aaa;
}

.post-detail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
  margin-top: 22px;
}

.post-detail-gallery img {
  display: block;
  width: 100%;
  max-height: 720px;
  border-radius: 10px;
  background: #070707;
  object-fit: contain;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 14px 15px 9px;
}

.post-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid #444;
  border-radius: 50%;
  background: #1d1d1d;
}

.post-author {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.post-author strong {
  color: #f5f5f5;
  font-size: 13px;
}

.post-author > span {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  color: #999;
  font-size: 11px;
}

.post-age-label {
  margin-left: auto;
  padding: 3px 7px;
  border: 1px solid rgba(255, 143, 143, 0.35);
  border-radius: 999px;
  color: #ffabab;
  font-size: 10px;
  font-weight: 800;
}

.post-copy {
  padding: 4px 15px 13px;
}

.post-copy h3 {
  margin: 0 0 4px;
  color: #f5f5f5;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.post-copy p,
.post-dialog-copy p {
  margin: 0;
  color: #aaa;
  font-size: 12px;
  line-height: 1.5;
}

.post-media-preview {
  position: relative;
  display: block;
  width: 100%;
  max-height: 520px;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: #070707;
  cursor: pointer;
}

.post-media-preview > img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  transition: transform 180ms ease;
}

.post-media-preview:hover > img {
  transform: scale(1.025);
}

.post-photo-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px 12px;
  border-top: 1px solid #292929;
}

.post-open-button,
.post-visit-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid #383838;
  border-radius: 8px;
  background: #191919;
  color: #e6e6e6;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.post-open-button:hover {
  border-color: #777;
  background: #222;
}

.post-visit-button {
  border-color: #ff8f8f;
  background: #ff8f8f;
  color: #171010;
}

.post-visit-button:hover {
  background: #ffc1c1;
}

.post-dialog {
  position: fixed;
  inset: 0;
  width: min(980px, calc(100% - 28px));
  max-width: none;
  max-height: min(88dvh, 760px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #383838;
  border-radius: 14px;
  background: #101010;
  color: #fff;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.78);
}

.post-dialog::backdrop {
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
}

.post-dialog-close {
  position: sticky;
  z-index: 1;
  top: 10px;
  float: right;
  display: grid;
  width: 36px;
  height: 36px;
  margin: 10px 10px -46px 0;
  place-items: center;
  border: 1px solid #555;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.post-dialog-layout {
  display: grid;
  min-height: 320px;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
}

.post-dialog-gallery {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  padding: 20px;
  background: #070707;
}

.post-dialog-gallery a {
  display: block;
  max-width: 100%;
}

.post-dialog-gallery img {
  display: block;
  width: 100%;
  max-height: 70dvh;
  object-fit: contain;
}

.post-dialog-no-image {
  display: grid;
  min-height: 320px;
  place-items: center;
  padding: 24px;
  background: #080808;
  color: #888;
  font-size: 13px;
}

.post-dialog-details {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 48px 18px 18px;
}

.post-dialog-details .post-header {
  padding: 0 0 14px;
  border-bottom: 1px solid #2c2c2c;
}

.post-dialog-copy {
  display: grid;
  gap: 12px;
  padding: 18px 0;
}

.post-dialog-copy h2 {
  margin: 0;
  color: #fff;
  font-size: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.post-category-link {
  width: fit-content;
  padding: 4px 9px;
  border: 1px solid #383838;
  border-radius: 999px;
  color: #ffc1c1;
  font-size: 11px;
  text-decoration: none;
}

.post-dialog-copy .post-dialog-disclaimer {
  padding-top: 10px;
  border-top: 1px solid #292929;
  color: #888;
  font-size: 11px;
}

.post-visit-button-dialog {
  width: 100%;
  margin-top: auto;
}

.post-card :focus-visible,
.post-dialog :focus-visible {
  outline: 2px solid #ff8f8f;
  outline-offset: 3px;
}

/* THE BRANDED VISIT BUTTON */
.visit-btn.mega-style {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  
  background: linear-gradient(135deg, #ff9b9b 0%, #ed7777 100%);
  color: #171010;
  
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(255, 143, 143, 0.16);
}

.visit-btn.mega-style:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #ffc1c1 0%, #ff8f8f 100%);
  box-shadow: 0 6px 20px rgba(255, 143, 143, 0.3);
}

/* Logo & Icon Spacing */
.mega-logo {
  width: 18px;
  height: 18px;
  margin-right: 10px;
}

.arrow-icon {
  width: 16px;
  height: 16px;
  margin-left: auto; /* Pushes arrow to the far right */
  opacity: 0.8;
  transition: transform 0.2s ease;
}

.visit-btn.mega-style:hover .arrow-icon {
  transform: translateX(3px); /* Arrow moves slightly on hover */
}

/* text alignment */
.visit-btn.mega-style span {
  letter-spacing: 0.5px;
}

/* Hidden links logic */
.hidden-link {
  display: none !important;
}

/* LINK META (Date & Time) */
.link-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px; /* Space below title */
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim); /* Grayish color */
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Meta Icons */
.meta-item svg {
  width: 12px;
  height: 12px;
  stroke: var(--accent-blue); /* Icons pop in blue */
}

/* Card Adjustment */
.link-left {
  display: flex;
  flex-direction: column;
}

.link-left h3 {
  margin-bottom: 0; /* Let meta handle the spacing */
}

/* ===============================
   MODERN PAGINATION
================================ */
.pagination-container {
  display: flex;
  justify-content: center;
  margin: 50px 0 20px;
}

.pagination-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-card); /* Matches your cards */
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  gap: 8px;
}

/* Base Button Style */
.pag-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.2s ease;
  background: transparent;
  border: 1px solid transparent;
}

/* Hover Effect */
.pag-btn:not(.disabled):hover {
  background: var(--bg-card-hover);
  border-color: #444;
  color: var(--accent-blue);
  transform: translateY(-1px);
}

/* Disabled State */
.pag-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  filter: grayscale(1);
}

/* Page Counter Badge */
.page-counter {
  display: flex;
  align-items: center;
  padding: 0 15px;
  height: 40px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace; /* Looks "techy" */
  font-weight: 700;
}

.current-page {
  color: var(--accent-blue);
  font-size: 16px;
}

.sep {
  margin: 0 8px;
  color: #555;
  font-weight: 300;
}

.total-pages {
  color: var(--text-dim);
  font-size: 14px;
}

/* Mobile Tweak */
@media (max-width: 640px) {
  .pagination-wrapper {
    width: 100%;
    justify-content: space-between;
  }
  
  .pag-btn span {
    display: none; /* Hide "Prev/Next" text on small mobile, keep icons */
  }
  
  .pag-btn {
    padding: 10px;
  }
}

/* ===============================
   7. MOBILE OPTIMIZATION
================================ */
@media (max-width: 640px) {
  .container {
    padding: 20px 15px;
  }
  
  /* Switch grid to 1 column on mobile */
  .links-wrapper {
    grid-template-columns: 1fr; 
  }

  .highlight-links {
    flex-direction: column;
  }

  .highlight-link {
    width: 100%;
    text-align: center;
  }
}

/* ===============================
   SMART REDIRECT PAGE
================================ */
.redirect-card {
  max-width: 520px;
  margin: 80px auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 35px 30px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

.redirect-icon {
  font-size: 38px;
  margin-bottom: 10px;
}

.redirect-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}

.redirect-text {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 25px;
  line-height: 1.6;
}

/* BUTTONS */
.redirect-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.redirect-btn {
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s ease;
}

/* Primary (Direct link) */
.redirect-btn.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff9b9b 0%, #ed7777 100%);
  color: #171010;

}

.redirect-btn.primary:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #ffc1c1 0%, #ff8f8f 100%);
  box-shadow: 0 6px 20px rgba(255, 143, 143, 0.3);
}

/* Secondary (Home) */
.redirect-btn.secondary {
  background: rgba(255, 143, 143, 0.08);
  color: #ffc1c1;
  border: 1px solid rgba(255, 143, 143, 0.25);
}

.redirect-btn.secondary:hover {
  transform: translateY(-2px);
}

/* Loader text */
.redirect-loader {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-dim);
  opacity: 0.8;
}

@media (max-width: 680px) {
  .post-feed {
    columns: 2 190px;
    column-gap: 10px;
  }

  .post-card {
    margin-bottom: 10px;
  }

  .post-header {
    gap: 8px;
    padding: 11px 11px 8px;
  }

  .post-avatar {
    width: 34px;
    height: 34px;
  }

  .post-copy {
    padding-inline: 11px;
  }

  .post-dialog-layout {
    grid-template-columns: 1fr;
  }

  .post-dialog-gallery {
    padding: 12px;
  }

  .post-dialog-gallery img {
    max-height: 50dvh;
  }

  .post-dialog-no-image {
    min-height: 150px;
  }

  .post-dialog-details {
    padding: 16px;
  }
}

@media (max-width: 420px) {
  .post-feed {
    columns: 1;
  }

  .post-dialog {
    width: calc(100% - 16px);
    max-height: 94dvh;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .redirect-card {
    margin: 40px 15px;
    padding: 28px 20px;
  }

  .redirect-actions {
    flex-direction: column;
  }

  .redirect-btn {
    width: 100%;
    text-align: center;
  }
}
