﻿/* ========================================
   Template15 - Responsive Styles
   Gaming Portal 2025-2026
   ======================================== */

/* ===== Extra Small Devices (phones, < 576px) ===== */
@media (max-width: 575.98px) {
  /* Typography */
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.125rem; }
  h5 { font-size: 1rem; }
  h6 { font-size: 0.875rem; }

  /* Header */
  .page-head {
    padding: var(--spacing-sm) 0;
  }

  .rd-navbar-inner {
    padding: 0 var(--spacing-sm);
  }

  .rd-navbar-toggle {
    display: flex;
  }

  .rd-navbar-nav-wrap {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-glass);
    flex-direction: column;
    padding: var(--spacing-xl);
    gap: var(--spacing-lg);
    transition: right var(--transition-normal);
    z-index: 1001;
    overflow-y: auto;
  }

  .rd-navbar-nav-wrap.active {
    right: 0;
  }

  .rd-navbar-nav {
    flex-direction: column;
    width: 100%;
    gap: 0;
  }

  .menu-item {
    width: 100%;
    border-bottom: 1px solid var(--border-glass);
  }

  .menu-item a {
    padding: var(--spacing-md) 0;
    font-size: 1rem;
  }

  /* Carousel - 1 card on mobile */
  .carousel-slide {
    flex: 0 0 calc(100% - var(--spacing-lg));
  }

  .carousel-slide .post-image-wrapper {
    aspect-ratio: 4/3;
  }

  .carousel-post-title {
    font-size: 0.75rem;
  }

  .menu-item a::before {
    display: none;
  }

  .nav-search {
    width: 100%;
  }

  .nav-search input {
    width: 100%;
  }

  .nav-search input:focus {
    width: 100%;
  }

  .theme-toggle {
    margin-top: var(--spacing-md);
  }

  /* Hero Banner */
  .hero-banner {
    min-height: 70vh;
    margin-top: 60px;
  }

  .hero-content {
    padding: var(--spacing-lg);
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .hero-buttons .btn {
    width: 100%;
  }

  /* Banner Section */
  .banner-section {
    min-height: 40vh;
    margin-top: 60px;
  }

  .banner-content {
    padding: var(--spacing-lg);
  }

  .banner-title {
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
  }

  .banner-search .search-form {
    max-width: 100%;
  }

  .banner-search .search-input {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.9rem;
  }

  /* Banner Top Wrapper - Mobile */
  .banner-top-wrapper {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-sm) 0;
  }

  .banner-top-wrapper img,
  .banner-top-wrapper iframe,
  .banner-top-wrapper div {
    max-width: 100%;
    height: auto;
  }

  /* Grid */
  .grid-container {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .grid-container-4col {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .featured-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .news-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .guides-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  /* Cards */
  .card-body {
    padding: var(--spacing-md);
  }

  .card-title {
    font-size: 1rem;
  }

  /* Post */
  .post-body {
    padding: var(--spacing-md);
  }

  /* Article Content - Mobile */
  .article-content {
    font-size: 1rem;
    line-height: 1.7;
  }

  /* Post Title - Mobile */
  .post-title {
    font-size: 1.5rem;
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
  }

  .article-content p {
    margin-bottom: var(--spacing-lg);
    text-align: left; /* Отключаем justify на мобильных для лучшей читаемости */
  }

  .article-content h1,
  .article-content h2,
  .article-content h3,
  .article-content h4,
  .article-content h5,
  .article-content h6 {
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
  }

  .article-content img {
    margin: var(--spacing-lg) 0;
    border-radius: var(--radius-md);
  }

  /* Отключаем плавающие картинки на мобильных */
  .article-content img.alignleft,
  .article-content img.align-left,
  .article-content img.alignright,
  .article-content img.align-right {
    float: none;
    margin: var(--spacing-lg) 0;
    max-width: 100%;
  }

  .article-content ul,
  .article-content ol {
    margin-bottom: var(--spacing-lg);
    padding-left: var(--spacing-lg);
  }

  .article-content blockquote {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md) var(--spacing-lg);
  }

  .article-content table {
    font-size: 0.875rem;
  }

  .article-content th,
  .article-content td {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  /* Range */
  .range {
    gap: var(--spacing-md);
  }

  .cell-xs-12 { width: 100%; }
  .cell-sm-6 { width: 100%; }
  .cell-lg-4 { width: 100%; }
  .cell-lg-8 { width: 100%; }
  .cell-md-7 { width: 100%; }

  /* Sidebar */
  .related-articles {
    width: 100%;
    order: 3;
    margin-top: var(--spacing-lg);
  }

  /* Pagination */
  .pagination a {
    min-width: 36px;
    height: 36px;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
  }

  /* Pager */
  .pager {
    flex-direction: column;
  }

  /* Footer */
  .page-footer {
    padding: var(--spacing-lg) 0 var(--spacing-md);
  }

  .social-icons {
    justify-content: center;
  }

  /* Section */
  .section {
    padding: var(--spacing-lg) 0;
  }

  /* Alert */
  .alert {
    flex-direction: column;
    align-items: flex-start;
  }

  .alert .close {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
  }

  /* Search Form */
  .search-input-wrapper {
    width: 100%;
  }

  /* Error Page */
  .error-content {
    padding: var(--spacing-lg);
  }

  /* Utility Classes */
  .reveal-xs-flex {
    display: flex;
  }

  .offset-xs-left-10 {
    margin-left: 0.625rem;
  }

  .offset-xs-top-0 {
    margin-top: 0;
  }

  .text-xs-center {
    text-align: center;
  }
}

/* ===== Small Devices (landscape phones, 576px - 767.98px) ===== */
@media (min-width: 576px) and (max-width: 767.98px) {
  /* Header */
  .rd-navbar-toggle {
    display: flex;
  }

  .rd-navbar-nav-wrap {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-glass);
    flex-direction: column;
    padding: var(--spacing-xl);
    gap: var(--spacing-lg);
    transition: right var(--transition-normal);
    z-index: 1001;
    overflow-y: auto;
  }

  .rd-navbar-nav-wrap.active {
    right: 0;
  }

  .rd-navbar-nav {
    flex-direction: column;
    width: 100%;
  }

  .menu-item {
    width: 100%;
    border-bottom: 1px solid var(--border-glass);
  }

  .menu-item a::before {
    display: none;
  }

  /* Grid */
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-container-4col {
    grid-template-columns: repeat(2, 1fr);
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .news-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .guides-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Hero */
  .hero-banner {
    min-height: 75vh;
  }

  /* Banner Section */
  .banner-section {
    min-height: 45vh;
  }

  .banner-title {
    font-size: 2.5rem;
  }

  /* Sidebar */
  .related-articles {
    width: 100%;
    order: 3;
    margin-top: var(--spacing-lg);
  }

  /* Banner Top Wrapper - Tablet */
  .banner-top-wrapper {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-sm) 0;
  }

  /* Range */
  .cell-sm-6 { width: calc(50% - var(--spacing-md)); }
  .cell-lg-4 { width: 100%; }
  .cell-lg-8 { width: 100%; }
  .cell-md-7 { width: 100%; }

  /* Utility */
  .reveal-xs-flex {
    display: flex;
  }

  .offset-xs-top-0 {
    margin-top: 0;
  }

  /* Carousel - 2 cards on small tablets */
  .carousel-slide {
    flex: 0 0 calc(49% - var(--spacing-lg));
  }

  .carousel-slide .post-image-wrapper {
    aspect-ratio: 4/3;
  }

  .carousel-post-title {
    font-size: 0.8rem;
  }

  /* Article Content - Small Tablets */
  .article-content {
    font-size: 1.0625rem;
  }

  .article-content img.alignleft,
  .article-content img.align-left,
  .article-content img.alignright,
  .article-content img.align-right {
    max-width: 45%;
  }
}

/* ===== Medium Devices (tablets, 768px - 991.98px) ===== */
@media (min-width: 768px) and (max-width: 991.98px) {
  /* Header */
  .rd-navbar-toggle {
    display: flex;
  }

  .rd-navbar-nav-wrap {
    position: fixed;
    top: 0;
    right: -100%;
    width: 60%;
    max-width: 350px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-glass);
    flex-direction: column;
    padding: var(--spacing-xl);
    gap: var(--spacing-lg);
    transition: right var(--transition-normal);
    z-index: 1001;
    overflow-y: auto;
  }

  .rd-navbar-nav-wrap.active {
    right: 0;
  }

  .rd-navbar-nav {
    flex-direction: column;
    width: 100%;
  }

  .menu-item {
    width: 100%;
    border-bottom: 1px solid var(--border-glass);
  }

  .menu-item a::before {
    display: none;
  }

  /* Grid */
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-container-4col {
    grid-template-columns: repeat(2, 1fr);
  }

  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .news-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .guides-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Hero */
  .hero-banner {
    min-height: 80vh;
  }

  /* Banner Section */
  .banner-section {
    min-height: 50vh;
  }

  .banner-title {
    font-size: 3rem;
  }

  /* Banner Top Wrapper - Desktop */
  .banner-top-wrapper {
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-md) 0;
  }

  /* Sidebar */
  .related-articles {
    width: 250px;
    order: 2;
  }

  /* Range */
  .cell-sm-6 { width: calc(50% - var(--spacing-lg)); }
  .cell-lg-4 { width: calc(50% - var(--spacing-lg)); }
  .cell-lg-8 { width: 100%; }
  .cell-md-7 { width: 100%; }

  /* Utility */
  .reveal-md-inline-block {
    display: inline-block;
  }

  .offset-top-md-0 {
    margin-top: 0;
  }

  .text-md-left {
    text-align: left;
  }

  /* Carousel - 3 cards on tablets */
  .carousel-slide {
    flex: 0 0 calc(32.333% - var(--spacing-lg));
  }

  .carousel-slide .post-image-wrapper {
    aspect-ratio: 4/3;
  }

  .carousel-post-title {
    font-size: 0.825rem;
  }

  /* Article Content - Medium Tablets */
  .article-content {
    font-size: 1.0625rem;
  }

  .article-content img.alignleft,
  .article-content img.align-left,
  .article-content img.alignright,
  .article-content img.align-right {
    max-width: 48%;
  }
}

/* ===== Large Devices (desktops, 992px - 1199.98px) ===== */
@media (min-width: 992px) and (max-width: 1199.98px) {
  /* Grid */
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-container-4col {
    grid-template-columns: repeat(3, 1fr);
  }

  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .news-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .guides-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Hero */
  .hero-banner {
    min-height: 85vh;
  }

  /* Banner Section */
  .banner-section {
    min-height: 50vh;
  }

  /* Sidebar */
  .related-articles {
    width: 280px;
    order: 2;
  }

  /* Range */
  .cell-lg-4 { width: calc(33.333% - var(--spacing-lg)); }
  .cell-lg-8 { width: calc(66.666% - var(--spacing-lg)); }
  .cell-md-7 { width: calc(58.333% - var(--spacing-lg)); }

  /* Utility */
  .reveal-md-inline-block {
    display: inline-block;
  }

  .text-lg-left {
    text-align: left;
  }

  /* Article Content - Large Desktops */
  .article-content {
    font-size: 1.125rem;
  }

  .article-content img.alignleft,
  .article-content img.align-left,
  .article-content img.alignright,
  .article-content img.align-right {
    max-width: 50%;
  }
}

/* ===== Extra Large Devices (large desktops, >= 1200px) ===== */
@media (min-width: 1200px) {
  /* Grid */
  .grid-container {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-container-4col {
    grid-template-columns: repeat(4, 1fr);
  }

  .featured-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .news-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .guides-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Hero */
  .hero-banner {
    min-height: 90vh;
  }

  /* Banner Section */
  .banner-section {
    min-height: 50vh;
  }

  /* Sidebar */
  .related-articles {
    width: 300px;
    order: 2;
  }

  /* Utility */
  .reveal-md-inline-block {
    display: inline-block;
  }

  .text-lg-left {
    text-align: left;
  }

  /* Carousel - 4 cards on desktop */
  .carousel-slide {
    flex: 0 0 calc(24% - var(--spacing-lg));
  }

  .carousel-slide .post-image-wrapper {
    aspect-ratio: 4/3;
  }

  .carousel-post-title {
    font-size: 0.875rem;
  }

  /* Article Content - Extra Large Desktops */
  .article-content {
    font-size: 1.125rem;
  }

  .article-content img.alignleft,
  .article-content img.align-left,
  .article-content img.alignright,
  .article-content img.align-right {
    max-width: 50%;
  }
}

/* ===== Print Styles ===== */
@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  .page-head,
  .page-footer,
  .banner-main,
  .hero-banner,
  .banner-section,
  .sidebar,
  .related-articles,
  .pagination,
  .pager,
  .search-form,
  .theme-toggle,
  .rd-navbar-toggle {
    display: none !important;
  }

  .page-content {
    margin: 0;
    padding: 0;
  }

  .post-default {
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .article-content {
    color: #000000;
  }

  a {
    color: #000000;
    text-decoration: underline;
  }

  img {
    max-width: 100%;
    page-break-inside: avoid;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== High Contrast Mode ===== */
@media (prefers-contrast: high) {
  :root {
    --border-glass: rgba(255, 255, 255, 0.3);
    --text-muted: #c0c0c0;
  }

  .glass {
    border: 2px solid var(--border-glass);
  }

  .btn-neon,
  .btn-outline,
  .btn-purple,
  .btn-warning,
  .btn-primary {
    border: 2px solid currentColor;
  }
}

/* ===== Landscape Orientation ===== */
@media (orientation: landscape) and (max-height: 600px) {
  .hero-banner {
    min-height: 100vh;
  }

  .hero-content {
    padding: var(--spacing-lg);
  }

  .hero-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }

  .hero-subtitle {
    font-size: 0.875rem;
  }

  .banner-section {
    min-height: 60vh;
  }

  .banner-content {
    padding: var(--spacing-lg);
  }

  .banner-title {
    font-size: clamp(2rem, 4vw, 3rem);
  }
}

/* ===== Portrait Orientation ===== */
@media (orientation: portrait) {
  .hero-banner {
    min-height: 70vh;
  }

  .banner-section {
    min-height: 40vh;
  }

  .featured-card {
    aspect-ratio: 4/3;
  }
}

/* ===== Hover States (Touch Devices) ===== */
@media (hover: none) {
  .card:hover,
  .post:hover,
  .news-card:hover,
  .guide-card:hover,
  .featured-card:hover {
    transform: none;
  }

  .menu-item a:hover::before {
    width: 0;
  }

  .btn:hover {
    transform: none;
  }
}

/* ===== Focus Visible (Keyboard Navigation) ===== */
@media (hover: none) and (focus-visible) {
  a:focus-visible,
  button:focus-visible,
  input:focus-visible {
    outline: 3px solid var(--cyan-neon);
    outline-offset: 3px;
  }
}
