/* Press-center specific styles — supplements the SPA's Tailwind bundle. */

/* Mobile menu overlay (slides from right) */
.press-mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 18, 36, 0.55);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.press-mobile-menu.is-open {
  opacity: 1;
  pointer-events: auto;
}
.press-mobile-menu__panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  left: 1rem;
  max-width: 28rem;
  margin-left: auto;
  background: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 32px 80px rgba(4, 18, 36, 0.35);
  padding: 1.5rem;
  transform: translateY(-12px);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.press-mobile-menu.is-open .press-mobile-menu__panel {
  transform: translateY(0);
}

/* Article body: editor output (TinyMCE produces standard HTML). */
.press-article-body {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: #1f3856;
}
.press-article-body > * + * { margin-top: 1.1em; }
.press-article-body h2 {
  margin-top: 2em;
  font-size: 1.65rem;
  font-weight: 700;
  color: #0a2c52;
  line-height: 1.25;
  font-family: var(--font-plex, ui-sans-serif, system-ui, sans-serif);
}
.press-article-body h3 {
  margin-top: 1.6em;
  font-size: 1.3rem;
  font-weight: 700;
  color: #0a2c52;
  line-height: 1.3;
}
.press-article-body p { margin: 0; }
.press-article-body a {
  color: #0a4ea7;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.press-article-body a:hover { color: #0d5dc2; }
.press-article-body strong { color: #0a2c52; font-weight: 700; }
.press-article-body ul, .press-article-body ol {
  padding-left: 1.5rem;
}
.press-article-body ul { list-style: disc; }
.press-article-body ol { list-style: decimal; }
.press-article-body li + li { margin-top: 0.4em; }
.press-article-body blockquote {
  border-left: 4px solid #0a4ea7;
  background: #eef4fb;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem 1rem 1rem 0.5rem;
  font-style: italic;
  color: #1f3856;
}
.press-article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 1rem;
  display: block;
  margin: 1.5rem auto;
  box-shadow: 0 16px 40px rgba(10, 44, 82, 0.12);
}
.press-article-body figure {
  margin: 1.75rem 0;
}
.press-article-body figure img { margin: 0; }
.press-article-body figcaption {
  margin-top: 0.6rem;
  text-align: center;
  font-size: 0.85rem;
  color: #6b809c;
}
.press-article-body hr {
  margin: 2.5rem auto;
  border: 0;
  border-top: 2px dashed #cdd9ea;
  max-width: 12rem;
}
.press-article-body iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 1rem;
  background: #0a2c52;
}

/* Card grid for the listing page */
.press-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .press-grid { grid-template-columns: repeat(2, 1fr); gap: 1.75rem; } }
@media (min-width: 1024px) { .press-grid { grid-template-columns: repeat(3, 1fr); } }

.press-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1.5rem;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}
.press-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 60px -28px rgba(10, 44, 82, 0.28);
  border-color: rgba(10, 78, 167, 0.25);
}
.press-card__media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #0a4ea7, #041224);
  overflow: hidden;
  position: relative;
}
.press-card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.press-card:hover .press-card__media img { transform: scale(1.05); }
.press-card__media--empty::after {
  content: "АМ";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-plex, ui-sans-serif, system-ui, sans-serif);
  font-weight: 700; font-size: 3rem;
  color: rgba(255,255,255,0.18);
  letter-spacing: 0.1em;
}
.press-card__body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex; flex-direction: column; gap: 0.5rem; flex: 1;
}
.press-card__date {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #6b809c;
  font-weight: 700;
}
.press-card__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0a2c52;
  font-family: var(--font-plex, ui-sans-serif, system-ui, sans-serif);
  line-height: 1.3;
}
.press-card__excerpt {
  color: #4a6181;
  font-size: 0.95rem;
  line-height: 1.55;
  flex: 1;
}
.press-card__link {
  margin-top: auto;
  padding-top: 0.75rem;
  color: #0a4ea7;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Pagination */
.press-pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.press-pagination a, .press-pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.5rem; height: 2.5rem;
  padding: 0 0.85rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.875rem;
  color: #4a6181;
  background: #fff;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}
.press-pagination a:hover { background: #0a4ea7; color: #fff; border-color: #0a4ea7; }
.press-pagination .is-current { background: #0a4ea7; color: #fff; border-color: #0a4ea7; }
.press-pagination .is-disabled { opacity: 0.4; pointer-events: none; }

/* ===== Public gallery (single post page) ===== */
.press-gallery {
  margin: 3rem 0 1rem;
}
.press-gallery__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0a2c52;
  font-family: var(--font-plex, ui-sans-serif, system-ui, sans-serif);
  margin: 0 0 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
/* Social-media style collage: single dark block, tight 2px gutters, no
   per-tile radius (corners are on the container). Layout adapts to count. */
.press-gallery__grid {
  display: grid;
  gap: 2px;
  background: #0a2c52;
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 24px 60px -28px rgba(10, 44, 82, 0.45);
}

/* n=1: hero image, 16:9 */
.press-gallery__grid--n1 { grid-template-columns: 1fr; aspect-ratio: 16 / 9; }

/* n=2: two side-by-side squares */
.press-gallery__grid--n2 { grid-template-columns: repeat(2, 1fr); aspect-ratio: 2 / 1; }

/* n=3: three columns, slightly portrait cells */
.press-gallery__grid--n3 { grid-template-columns: repeat(3, 1fr); aspect-ratio: 3 / 1.4; }

/* n=4: 2x2 square */
.press-gallery__grid--n4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  aspect-ratio: 1 / 1;
}

/* n=5: top row 2 wide cells, bottom row 3 narrower cells (like VK / Instagram) */
.press-gallery__grid--n5 {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 3 / 2;
}
.press-gallery__grid--n5 .press-gallery__tile:nth-child(1),
.press-gallery__grid--n5 .press-gallery__tile:nth-child(2) {
  grid-column: span 3;
}
.press-gallery__grid--n5 .press-gallery__tile:nth-child(3),
.press-gallery__grid--n5 .press-gallery__tile:nth-child(4),
.press-gallery__grid--n5 .press-gallery__tile:nth-child(5) {
  grid-column: span 2;
}

/* n=6: 3x2 grid */
.press-gallery__grid--n6 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  aspect-ratio: 3 / 2;
}

/* n>=7: 3-column dense grid, 1:1 tiles, masonry-like flow */
.press-gallery__grid--n7 {
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
}
.press-gallery__grid--n7 .press-gallery__tile { aspect-ratio: 1 / 1; }

/* Mobile: collapse asymmetric layouts to 2-column 1:1 mosaic */
@media (max-width: 639px) {
  .press-gallery__grid,
  .press-gallery__grid--n3,
  .press-gallery__grid--n4,
  .press-gallery__grid--n5,
  .press-gallery__grid--n6,
  .press-gallery__grid--n7 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: none;
    grid-auto-rows: 1fr;
    aspect-ratio: auto;
  }
  .press-gallery__grid--n2 { grid-template-columns: repeat(2, 1fr); aspect-ratio: 2 / 1; }
  .press-gallery__grid--n2 .press-gallery__tile { aspect-ratio: 1 / 1; }
  .press-gallery__grid--n3 .press-gallery__tile,
  .press-gallery__grid--n4 .press-gallery__tile,
  .press-gallery__grid--n5 .press-gallery__tile,
  .press-gallery__grid--n6 .press-gallery__tile,
  .press-gallery__grid--n7 .press-gallery__tile {
    grid-column: auto;
    aspect-ratio: 1 / 1;
  }
  .press-gallery__grid--n1 .press-gallery__tile { aspect-ratio: 16 / 9; }
  /* Odd count last tile spans full width to avoid empty cell */
  .press-gallery__grid--n3 .press-gallery__tile:nth-child(3),
  .press-gallery__grid--n5 .press-gallery__tile:nth-child(5),
  .press-gallery__grid--n7 .press-gallery__tile:nth-child(2n+1):last-child {
    grid-column: span 2;
    aspect-ratio: 2 / 1;
  }
}

.press-gallery__tile {
  position: relative;
  display: block;
  border: 0;
  padding: 0;
  margin: 0;
  background: #0a2c52;
  cursor: zoom-in;
  overflow: hidden;
  min-width: 0;
}
.press-gallery__tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}
.press-gallery__tile:hover img { transform: scale(1.04); opacity: 0.92; }

/* ===== Lightbox ===== */
.press-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(4, 18, 36, 0.94);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: pressLightboxIn 0.18s ease-out;
}
@keyframes pressLightboxIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.press-lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
  user-select: none;
  -webkit-user-drag: none;
}
.press-lightbox__close,
.press-lightbox__nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
  backdrop-filter: blur(6px);
}
.press-lightbox__close:hover,
.press-lightbox__nav:hover { background: rgba(255, 255, 255, 0.2); }
.press-lightbox__close { top: 1.25rem; right: 1.25rem; }
.press-lightbox__nav { top: 50%; transform: translateY(-50%); font-size: 2rem; }
.press-lightbox__nav:hover { transform: translateY(-50%) scale(1.08); }
.press-lightbox__nav--prev { left: 1.25rem; }
.press-lightbox__nav--next { right: 1.25rem; }
.press-lightbox__count {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0.4rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  backdrop-filter: blur(6px);
}
@media (max-width: 640px) {
  .press-lightbox { padding: 1rem; }
  .press-lightbox__close,
  .press-lightbox__nav { width: 2.5rem; height: 2.5rem; }
  .press-lightbox__close { top: 0.75rem; right: 0.75rem; }
  .press-lightbox__nav--prev { left: 0.5rem; }
  .press-lightbox__nav--next { right: 0.5rem; }
}

/* -------- SSR fallback styles (visible only when JS is disabled) -------- */
.ssr-press-list,
.ssr-press-post {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1a2740;
}
.ssr-press-list h1,
.ssr-press-post h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 1rem;
}
.ssr-press-list ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.ssr-press-item {
  border: 1px solid #e6ebf5;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  padding-bottom: 1rem;
}
.ssr-press-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}
.ssr-press-item h2 {
  font-size: 1.1rem;
  margin: 1rem 1rem 0.5rem;
  color: #0a4ea7;
}
.ssr-press-item a { text-decoration: none; }
.ssr-press-item time {
  display: block;
  margin: 0 1rem 0.5rem;
  font-size: 0.85rem;
  color: #6b7280;
}
.ssr-press-item p {
  margin: 0 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #344155;
}
.ssr-breadcrumbs {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 1rem;
}
.ssr-breadcrumbs a { color: #0a4ea7; text-decoration: none; }
.ssr-press-post .ssr-meta {
  color: #6b7280;
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}
.ssr-cover {
  width: 100%;
  border-radius: 14px;
  margin: 0 0 1.5rem;
}
.ssr-body { font-size: 1rem; line-height: 1.7; }
.ssr-body img { max-width: 100%; height: auto; border-radius: 10px; margin: 1rem 0; }
.ssr-gallery {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin: 2rem 0;
}
.ssr-gallery img { width: 100%; height: 200px; object-fit: cover; border-radius: 10px; }
.ssr-back { display: inline-block; margin-top: 2rem; color: #0a4ea7; }

.ssr-related {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e6ebf5;
}
.ssr-related h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 1.2rem;
  color: #0a2c52;
}
.ssr-related ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.ssr-related li {
  border: 1px solid #e6ebf5;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  padding-bottom: 0.75rem;
}
.ssr-related img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.ssr-related h3 {
  font-size: 1rem;
  margin: 0.75rem 0.75rem 0.5rem;
  color: #0a4ea7;
}
.ssr-related a { text-decoration: none; }
.ssr-related time {
  display: block;
  margin: 0 0.75rem;
  font-size: 0.8rem;
  color: #6b7280;
}
