/* ============================================
   TILE GRID SYSTEM — Сетка плиток
   ============================================ */

/* ── Основная сетка ── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(80px, auto);
  gap: var(--gap);
  position: relative;
  z-index: 1;
}

/* ── Размеры плиток ── */
.tile-hero {
  grid-column: span 12;
  grid-row: span 6;
}

.tile-large {
  grid-column: span 8;
  grid-row: span 4;
}

.tile-medium {
  grid-column: span 6;
  grid-row: span 3;
}

.tile-small {
  grid-column: span 4;
  grid-row: span 2;
}

.tile-wide {
  grid-column: span 12;
  grid-row: span 2;
}

.tile-square {
  grid-column: span 3;
  grid-row: span 3;
}

.tile-third {
  grid-column: span 4;
  grid-row: span 3;
}

/* ── Базовый стиль плитки ── */
.tile {
  background: var(--tile-bg);
  border: 1px solid var(--tile-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  will-change: transform;
  padding: 28px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* ── Hover эффект — усиленная рамка + свечение ── */
.tile:hover {
  transform: translateY(-4px);
  border-color: var(--accent-cyan);
  box-shadow:
    0 0 0 1px var(--accent-cyan),
    0 0 20px rgba(0, 200, 255, 0.15),
    0 20px 60px rgba(0, 200, 255, 0.1),
    inset 0 1px 0 rgba(0, 200, 255, 0.1);
  background: rgba(10, 18, 40, 0.92);
}

/* ── Угловые акценты L-образные скобки ── */
.tile-corners::after,
.tile-corners::before {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--accent-cyan);
  border-style: solid;
  opacity: 0.5;
  transition: opacity 0.4s ease, border-color 0.4s ease, filter 0.4s ease;
  z-index: 2;
  pointer-events: none;
}

.tile-corners::before {
  top: 8px;
  left: 8px;
  border-width: 2px 0 0 2px;
  border-radius: 4px 0 0 0;
}

.tile-corners::after {
  bottom: 8px;
  right: 8px;
  border-width: 0 2px 2px 0;
  border-radius: 0 0 4px 0;
}

.tile-corners:hover::before,
.tile-corners:hover::after {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(0, 200, 255, 0.5));
}

/* ── Декоративная подсветка внутри плитки ── */
.tile-glow {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.12), transparent 70%);
  pointer-events: none;
  z-index: 0;
  top: -80px;
  right: -80px;
  transition: opacity 0.4s ease;
}

.tile:hover .tile-glow {
  opacity: 1.5;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.18), transparent 70%);
}

/* ── Специальные стили для типов плиток ── */
.tile-hero {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 480px;
}

.tile-hero .tile-glow {
  width: 400px;
  height: 400px;
  top: -100px;
  right: -100px;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.12), rgba(123, 47, 255, 0.05) 50%, transparent 70%);
}

/* ── Сетки для контента внутри секций ── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

/* ── Адаптивность ── */

/* Планшет */
@media (max-width: 1024px) {
  .tile-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .tile-hero {
    grid-column: 1 / -1;
    grid-row: span 4;
    min-height: 380px;
    padding: 36px;
  }

  .tile-large {
    grid-column: 1 / -1;
    grid-row: span 3;
  }

  .tile-medium {
    grid-column: span 3;
    grid-row: span 2;
  }

  .tile-small {
    grid-column: span 3;
    grid-row: span 2;
  }

  .tile-wide {
    grid-column: 1 / -1;
  }

  .tile-square {
    grid-column: span 3;
    grid-row: span 2;
  }

  .tile-third {
    grid-column: span 3;
    grid-row: span 2;
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Мобильные */
@media (max-width: 768px) {
  .tile-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  [class*="tile-"] {
    grid-column: 1 / -1 !important;
    min-height: 0;
  }

  .tile-hero {
    min-height: 240px;
    padding: 18px;
    grid-row: span 2;
  }

  .tile {
    padding: 16px;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .container {
    width: min(var(--container), calc(100% - 16px));
  }
}
