/*
 * GTA Game Next 2.4.16 / GTAGame 1.4.27
 * Stabilizacja frontendu i wersji mobilnej.
 *
 * Ten plik jest ładowany po głównym style.css i forum-overrides.css,
 * dzięki czemu poprawki są odseparowane od historycznych reguł motywu.
 */

/* Bezpieczne ograniczenie przepełnień w elastycznych kolumnach. */
html {
  overflow-x: clip;
}

body.gtx-site,
body.gtx-site .gtx-main,
body.gtx-site .gtx-main-content,
body.gtx-site .gtx-forum-content,
body.gtx-site .gtx-panel__body,
body.gtx-site .gtx-news-card__main,
body.gtx-site .gtx-news-card__content,
body.gtx-site .gtx-news-card__body,
body.gtx-site .gtlfg-wrap,
body.gtx-site .gtsc-wrap {
  min-width: 0;
}

body.gtx-site h1,
body.gtx-site h2,
body.gtx-site h3,
body.gtx-site h4,
body.gtx-site h5,
body.gtx-site h6,
body.gtx-site a,
body.gtx-site p,
body.gtx-site li,
body.gtx-site dd,
body.gtx-site td,
body.gtx-site th {
  overflow-wrap: anywhere;
}

/* Media osadzone w newsach, artykułach, forum i pluginach. */
body.gtx-site main img:not(.gtx-forum-emote):not(.gtx-chat-emote),
body.gtx-site main video,
body.gtx-site main canvas,
body.gtx-site main svg,
body.gtx-site .gtx-panel__body img:not(.gtx-forum-emote):not(.gtx-chat-emote) {
  max-width: 100%;
}

body.gtx-site main video,
body.gtx-site main canvas {
  height: auto;
}

body.gtx-site .gtx-responsive-embed {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: #080b12;
  aspect-ratio: var(--gtx-embed-ratio, 16 / 9);
}

body.gtx-site .gtx-responsive-embed > iframe,
body.gtx-site .gtx-responsive-embed > video,
body.gtx-site .gtx-responsive-embed > object,
body.gtx-site .gtx-responsive-embed > embed {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  border: 0;
}

/* Media wykryte dynamicznie nie są przepinane w DOM, aby iframe nie ładował się ponownie. */
body.gtx-site :where(iframe, video, object, embed).gtx-responsive-media {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  border: 0;
  border-radius: 12px;
  background: #080b12;
  aspect-ratio: var(--gtx-embed-ratio, 16 / 9);
}

/* Uniwersalny przewijany kontener dla szerokich tabel e107 i pluginów. */
body.gtx-site .gtx-responsive-table {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

body.gtx-site .gtx-responsive-table:focus-visible {
  outline: 2px solid var(--gtx-cyan, #58ddff);
  outline-offset: 3px;
}

body.gtx-site .gtx-responsive-table > table {
  margin-bottom: 0;
}

body.gtx-site .gtx-responsive-table[data-gtx-overflow="1"]::after {
  content: "Przesuń tabelę w poziomie";
  position: sticky;
  right: .45rem;
  bottom: .35rem;
  display: block;
  width: max-content;
  margin: .35rem .35rem .15rem auto;
  padding: .22rem .45rem;
  border: 1px solid rgba(126, 154, 206, .18);
  border-radius: 999px;
  color: #9eabc0;
  background: rgba(8, 11, 18, .88);
  font-size: .64rem;
  line-height: 1.2;
  pointer-events: none;
}

/* Klawiatura i dotyk: czytelny fokus oraz rozsądne cele interakcji. */
body.gtx-site :where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--gtx-cyan, #58ddff);
  outline-offset: 2px;
}

body.gtx-site pre,
body.gtx-site code,
body.gtx-site .bbcode-code,
body.gtx-site .gtx-forum-post-content__body pre {
  max-width: 100%;
}

body.gtx-site pre,
body.gtx-site .bbcode-code,
body.gtx-site .gtx-forum-post-content__body pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Tablet: panele boczne układają się w dwie kolumny pod treścią. */
@media (min-width: 768px) and (max-width: 991.98px) {
  body.gtx-site .gtx-home-grid > .gtx-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 1rem;
  }

  body.gtx-site .gtx-home-grid > .gtx-sidebar > * {
    min-width: 0;
    margin-bottom: 0;
  }

  body.gtx-site .gtx-home-grid > .gtx-sidebar > .gtx-gta-tree,
  body.gtx-site .gtx-home-grid > .gtx-sidebar > .gtx-ts-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 767.98px) {
  html {
    scroll-padding-top: 68px;
  }

  body.gtx-site .container,
  body.gtx-site .container-fluid,
  body.gtx-site .container-xxl {
    --bs-gutter-x: 1.25rem;
  }

  body.gtx-site .gtx-page {
    padding-top: .9rem;
    padding-bottom: 2rem;
  }

  body.gtx-site .gtx-home-grid {
    gap: .9rem;
  }

  body.gtx-site .gtx-panel,
  body.gtx-site .gtx-welcome,
  body.gtx-site .gtx-auth-card,
  body.gtx-site .gtx-news-card,
  body.gtx-site .gtlfg-card,
  body.gtx-site .gtsc-panel,
  body.gtx-site .gtsc-hero {
    border-radius: 13px;
  }

  body.gtx-site .gtx-panel__header {
    min-height: 44px;
    padding: .7rem .8rem .65rem .95rem;
  }

  body.gtx-site .gtx-panel__body {
    padding-left: .8rem;
    padding-right: .8rem;
  }

  body.gtx-site .gtx-page-heading {
    margin-bottom: .85rem;
    padding: .9rem 1rem;
    border-radius: 13px;
  }

  body.gtx-site .gtx-page-heading h1,
  body.gtx-site .gtx-forum-topic__title,
  body.gtx-site .gtx-news-card--single .gtx-news-card__title {
    font-size: clamp(1.45rem, 7vw, 2rem) !important;
    line-height: 1.12;
  }

  body.gtx-site .gtx-hero__inner {
    padding-top: 1.7rem;
    padding-bottom: 1.7rem;
  }

  body.gtx-site .gtx-hero h1 {
    font-size: clamp(1.8rem, 9vw, 2.35rem);
  }

  body.gtx-site .gtx-hero p {
    font-size: .92rem;
  }

  body.gtx-site .gtx-hero__actions,
  body.gtx-site .gtx-news-card__footer-actions,
  body.gtx-site .gtx-comment-form__actions,
  body.gtx-site .gtx-comment-actions,
  body.gtx-site .gtx-forum-topic__actions,
  body.gtx-site .gtx-forum-topic__footer {
    width: 100%;
    flex-wrap: wrap;
  }

  body.gtx-site .gtx-hero__actions > *,
  body.gtx-site .gtx-news-card__footer-actions > *,
  body.gtx-site .gtx-comment-form__actions > *,
  body.gtx-site .gtx-forum-topic__footer > .btn,
  body.gtx-site .gtx-forum-topic__actions > .btn {
    min-width: 0;
    flex: 1 1 150px;
  }

  /* Brak automatycznego zoomu formularzy w mobilnym Safari. */
  body.gtx-site input:not([type="checkbox"]):not([type="radio"]),
  body.gtx-site select,
  body.gtx-site textarea,
  body.gtx-site .form-control,
  body.gtx-site .form-select {
    min-height: 44px;
    font-size: 16px !important;
  }

  body.gtx-site textarea,
  body.gtx-site textarea.form-control {
    min-height: 112px;
  }

  body.gtx-site .btn,
  body.gtx-site .gtx-btn,
  body.gtx-site .gtlfg-btn,
  body.gtx-site .gtsc-btn,
  body.gtx-site button,
  body.gtx-site input[type="submit"],
  body.gtx-site input[type="button"] {
    min-height: 44px;
  }

  /* Szybki dostęp zajmuje mniej pionowego miejsca na telefonie. */
  body.gtx-site .gtx-quick-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }

  body.gtx-site .gtx-quick-links > a {
    min-width: 0;
    min-height: 68px;
    padding: .65rem;
  }

  body.gtx-site .gtx-quick-links > a > i {
    width: 34px;
    min-width: 34px;
    height: 34px;
  }

  body.gtx-site .gtx-quick-links > a span {
    min-width: 0;
    font-size: .76rem;
  }

  body.gtx-site .gtx-quick-links > a small {
    font-size: .62rem;
    line-height: 1.25;
  }

  /* News i metadane bez wychodzenia poza ekran. */
  body.gtx-site .gtx-news-card--horizontal .gtx-news-card__media {
    aspect-ratio: 16 / 9;
    min-height: 0;
    max-height: none;
  }

  body.gtx-site .gtx-news-card--horizontal .gtx-news-card__media img,
  body.gtx-site .gtx-news-card--horizontal .gtx-news-card__media picture {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
  }

  body.gtx-site .gtx-news-card__header,
  body.gtx-site .gtx-news-card__content,
  body.gtx-site .gtx-news-card__footer,
  body.gtx-site .gtx-news-card--single .gtx-news-card__content {
    padding-left: .9rem;
    padding-right: .9rem;
  }

  body.gtx-site .gtx-news-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  body.gtx-site .gtx-news-meta__item {
    width: auto;
    min-width: 0;
    white-space: normal;
  }

  /* Forum: opcje i treść nie poszerzają karty posta. */
  body.gtx-site .gtx-forum-shell {
    overflow-x: visible;
  }

  body.gtx-site .gtx-forum-shell table {
    min-width: 0;
  }

  body.gtx-site .gtx-forum-post-content {
    padding: .8rem !important;
  }

  body.gtx-site .gtx-forum-post-content__header {
    align-items: stretch !important;
    flex-direction: column;
  }

  body.gtx-site .gtx-forum-post-content__options,
  body.gtx-site .gtx-forum-post-content__options .btn-group,
  body.gtx-site .gtx-forum-post-content__options .dropdown {
    max-width: 100%;
  }

  body.gtx-site .gtx-forum-post-content__body,
  body.gtx-site .forum-thread-text,
  body.gtx-site .gtx-comment-text {
    word-break: break-word;
  }

  body.gtx-site .gtx-forum-attachments,
  body.gtx-site .gtx-forum-attachments a {
    max-width: 100%;
  }

  body.gtx-site .gtx-comment-actions .btn {
    flex: 1 1 120px;
  }

  /* Stopka: większe i wygodniejsze linki dotykowe. */
  body.gtx-site .gtx-footer__grid > div:not(.gtx-footer__brand) > a {
    display: flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
  }
}

@media (max-width: 430px) {
  body.gtx-site .gtx-header__inner {
    padding-left: .75rem;
    padding-right: .75rem;
  }

  body.gtx-site .gtx-brand img {
    width: min(100%, 205px);
    height: auto;
  }

  body.gtx-site .gtx-quick-links,
  body.gtx-site .gtx-news-meta {
    grid-template-columns: 1fr;
  }

  body.gtx-site .gtx-hero__actions > *,
  body.gtx-site .gtx-news-card__footer-actions > *,
  body.gtx-site .gtx-comment-form__actions > *,
  body.gtx-site .gtlfg-hero__actions > *,
  body.gtx-site .gtsc-actions > * {
    width: 100%;
    flex-basis: 100%;
  }

  body.gtx-site .gtx-comment-form {
    grid-template-columns: 1fr;
  }

  body.gtx-site .gtx-comment-form__user {
    display: none;
  }

  body.gtx-site .gtx-comment-user {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: .55rem;
    padding: .7rem;
  }

  body.gtx-site .gtx-comment-avatar > img,
  body.gtx-site .gtx-comment-avatar > a > img {
    width: 52px !important;
    height: 52px !important;
  }

  body.gtx-site .gtx-footer__grid {
    gap: 1rem;
  }
}

/* Użytkownik z ograniczonymi animacjami nie otrzymuje ruchomych efektów. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  body.gtx-site *,
  body.gtx-site *::before,
  body.gtx-site *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
