/* Telegram kanalidan olingan postlar: kartochkalar + batafsil modal.
   natijalar.css bilan birga ishlaydi (.nat, .filters, .stat shu yerdan). */

.posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* <li> katak balandligiga choʻziladi, kartochka esa katakni toʻliq toʻldiradi.
   Busiz kalta kartochka baland katak ichida osilib qoladi. */
.posts > li {
  display: flex;
}

.posts > li > .post {
  flex: 1 1 auto;
  width: 100%;
}

.post {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.post:hover {
  border-color: #c3d3e8;
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.post:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.post__cover {
  position: relative;
  /* 4:3 — 16/10 da kvadrat va portret suratlarning yuzi qirqilib qolardi */
  aspect-ratio: 4 / 3;
  background: #e8edf5;
}

/* Rasm absolyut joylashadi — aks holda uning tabiiy balandligi
   ota-elementning aspect-ratio nisbatini bosib ketadi va muqovalar
   har xil balandlikda chiqadi. */
.post__cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* tepadan kesadi — odam suratlarida yuz saqlanib qoladi */
  object-position: center top;
  display: block;
}

.post__cover--none {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #11386b, #2a5fa8);
  color: rgba(255, 255, 255, 0.5);
  font-size: 40px;
}

.post__cat {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--navy);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.post__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
  flex: 1;
}

.post__date {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.post__date span { display: inline-flex; align-items: center; gap: 5px; }

.post__title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* Sarlavhaga doim 3 qator joy — kartochkalar bir xil balandlikda turadi. */
  min-height: calc(3 * 1.42em);
}

.post__more {
  margin-top: auto;
  padding-top: 10px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
}

.post__more i { font-size: 11px; margin-left: 4px; }

/* ---------- batafsil modal ---------- */

.pmodal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 17, 34, 0.62);
  backdrop-filter: blur(3px);
}

.pmodal[hidden] { display: none; }

.pmodal__box {
  position: relative;
  width: min(820px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(8, 17, 34, 0.35);
}

.pmodal__close {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.16);
}

.pmodal__close:hover { background: #fff; }
.pmodal__close:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.pmodal__scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pmodal__hero img {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  display: block;
}

.pmodal__inner { padding: 24px 28px 28px; }

.pmodal__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--ink-3);
  font-size: 13px;
}

.pmodal__meta b {
  padding: 4px 10px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--navy);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pmodal__title {
  margin: 0 0 14px;
  font-size: clamp(19px, 2.2vw, 24px);
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.02em;
}

.pmodal__text {
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.72;
  white-space: pre-line;
}

.pmodal__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.pmodal__gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.pmodal__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.pmodal__src {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.pmodal__src:hover { background: #0d2d5c; color: #fff; }

.pmodal__nav {
  display: flex;
  gap: 8px;
}

.pmodal__nav button {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}

.pmodal__nav button:hover:not(:disabled) { border-color: var(--navy); color: var(--navy); }
.pmodal__nav button:disabled { opacity: 0.42; cursor: default; }
.pmodal__nav button:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }

body.pmodal-open { overflow: hidden; }

/* ---------- koʻproq yuklash ---------- */

.loadmore {
  display: block;
  margin: 28px auto 0;
  padding: 13px 30px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--navy);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.loadmore:hover { border-color: var(--navy); }
.loadmore:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

@media (max-width: 700px) {
  .posts { grid-template-columns: 1fr; }
  .pmodal { padding: 0; }
  .pmodal__box { max-height: 100vh; border-radius: 0; width: 100%; }
  .pmodal__inner { padding: 20px 18px 24px; }
  .pmodal__hero img { max-height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  .post { transition: none; }
  .post:hover { transform: none; }
}
