@layer tokens, base, layout, blocks, utils;

@layer tokens {
  :root {
    --bg: #0d1016;
    --bg-soft: #14181f;
    --bg-card: #282828;
    --line: #2a2f38;
    --text: #fff;
    --text-dim: #9aa3ad;
    --head: #d2eeed;
    --mint: #00cfa6;
    --red: #ff2400;
    --green: #1f8f6a;

    --aside: 210px;
    --header: 60px;
    --gap: 24px;
    --radius: 12px;
    --radius-lg: 24px;

    --h1: clamp(22px, 2.2vw, 32px);
    --h-block: clamp(28px, 3.4vw, 48px);
    --base: 14px;

    color-scheme: dark;
  }
}

@layer base {
  @font-face {
    font-family: Roboto;
    src: url("../fonts/RobotoRegular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
  }

  @font-face {
    font-family: Roboto;
    src: url("../fonts/RobotoMedium.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
  }

  @font-face {
    font-family: Roboto;
    src: url("../fonts/RobotoBold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 var(--base) / 1.25 Roboto, system-ui, sans-serif;
    -webkit-text-size-adjust: 100%;
  }

  img {
    display: block;
    max-width: 100%;
    height: auto;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    border: 0;
    background: none;
  }

  :focus-visible {
    outline: 2px solid var(--mint);
    outline-offset: 2px;
  }
}

@layer layout {
  .page {
    padding-block-start: var(--header);
    padding-inline-start: var(--aside);
  }

  .wrap {
    max-width: 1137px;
    margin-inline: auto;
    padding-inline: 16px;
  }

  .top {
    position: fixed;
    inset-block-start: 0;
    inset-inline: var(--aside) 0;
    z-index: 20;
    height: var(--header);
    background: var(--bg);
  }

  .top__in {
    display: flex;
    align-items: center;
    gap: var(--gap);
    height: 100%;
    padding-inline: 24px;
  }

  .top__menu {
    display: flex;
    gap: 22px;
    margin-inline-end: auto;
  }

  .top__menu a {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    color: var(--text-dim);
    transition: color 0.2s;

    &:hover {
      color: var(--text);
    }
  }

  .side {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 30;
    width: var(--aside);
    padding: 15px 0;
    overflow-y: auto;
    background: var(--bg);
    border-inline-end: 1px solid var(--line);
  }

  .side__logo {
    display: block;
    width: 97px;
    margin: 4px 0 26px 24px;
  }

  .side__nav {
    display: grid;
  }

  .side__nav a {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 9px 24px;
    color: var(--text);
    transition: background 0.2s;

    &:hover {
      background: var(--bg-soft);
    }

    & img {
      width: 20px;
      height: 20px;
      object-fit: contain;
    }
  }
}

@layer blocks {
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-weight: 700;
    border-radius: 5px;
    transition: background 0.2s;
  }

  .btn--red {
    background: var(--red);

    &:hover {
      background: color-mix(in srgb, var(--red) 85%, #000);
    }
  }

  .btn--ghost {
    background: var(--bg-card);

    &:hover {
      background: color-mix(in srgb, var(--bg-card) 80%, #fff);
    }
  }

  .top__promo {
    color: var(--head);
    font-weight: 500;
    white-space: nowrap;
  }

  .promos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--gap);
    padding-block: 24px;
  }

  .promo {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    aspect-ratio: 557 / 320;
    padding: 32px;
    overflow: hidden;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    isolation: isolate;
  }

  .promo::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--wash-under);
  }

  .promo__wash {
    position: absolute;
    inset: 0;
    background: var(--wash-over, none);
  }

  .promo--sport {
    --wash-under: radial-gradient(84.73% 98.43% at 100% 60.83%, red, #f000);
  }

  .promo--casino {
    --wash-under: linear-gradient(45deg, #00ffb2cc, transparent);
    --wash-over: radial-gradient(105.93% 112.43% at 114.58% 68.81%, #00ffb2, #00ffd100);
  }

  .promo--casino .promo__bg {
    object-fit: cover;
  }

  .promo__bg,
  .promo__fg {
    position: absolute;
    inset-block: 0 0;
    inset-inline: 0 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: bottom right;
  }

  .promo__fg {
    z-index: 1;
    height: 110%;
    inset-block-start: auto;
  }

  .promo__title,
  .promo__value,
  .promo .btn {
    position: relative;
    z-index: 2;
  }

  .promo__title {
    font-size: clamp(24px, 2.6vw, 36px);
    font-style: italic;
    font-weight: 700;
  }

  .promo__value {
    margin-block: 12px 24px;
    font-size: clamp(26px, 3vw, 40px);
    font-weight: 700;
    color: #ffc107;
  }

  .promo .btn {
    align-self: flex-start;
  }

  .head {
    padding-block: 28px 20px;
    text-align: center;
  }

  .head__title {
    margin: 0;
    font-size: var(--h-block);
    font-weight: 700;
    color: var(--head);
    text-transform: uppercase;
  }

  .head__sub {
    color: var(--text-dim);
  }

  .tabs__radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }

  .tabs__bar {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding-block: 12px 24px;
  }

  .tabs__label {
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 12px;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: var(--radius);
    transition: color 0.2s, background 0.2s;

    & img {
      width: 24px;
      height: 24px;
      object-fit: contain;
      opacity: 0.6;
      transition: opacity 0.2s;
    }

    &:hover {
      color: var(--text);
    }
  }

  .tabs__panel {
    display: none;
  }

  #tab-1:checked ~ .tabs__bar [for="tab-1"],
  #tab-2:checked ~ .tabs__bar [for="tab-2"],
  #tab-3:checked ~ .tabs__bar [for="tab-3"],
  #tab-4:checked ~ .tabs__bar [for="tab-4"] {
    color: var(--text);
    background: var(--bg-soft);

    & img {
      opacity: 1;
    }
  }

  #tab-1:checked ~ .tabs__panels .tabs__panel:nth-child(1),
  #tab-2:checked ~ .tabs__panels .tabs__panel:nth-child(2),
  #tab-3:checked ~ .tabs__panels .tabs__panel:nth-child(3),
  #tab-4:checked ~ .tabs__panels .tabs__panel:nth-child(4) {
    display: block;
  }

  .games {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap);
    justify-content: center;
    --cols: 4;
  }

  .game {
    display: grid;
    flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
    gap: 8px;

    & img {
      width: 100%;
      aspect-ratio: 300 / 230;
      object-fit: cover;
      border-radius: var(--radius);
      transition: transform 0.25s;
    }

    &:hover img {
      transform: scale(1.03);
    }
  }

  .game__name {
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
  }

  .subscribe {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    margin-block: 24px;
    background: var(--bg-soft);
    border-radius: var(--radius);
  }

  .themes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--gap);
    padding-block-end: 32px;
  }

  .theme {
    display: grid;
    gap: 10px;
    justify-items: center;
    padding: 18px;
    background: var(--bg-soft);
    border-radius: var(--radius);
    transition: background 0.2s;

    &:hover {
      background: color-mix(in srgb, var(--bg-soft) 70%, #fff);
    }

    & img {
      aspect-ratio: 240 / 124;
      object-fit: contain;
    }
  }

  .article {
    & h1 {
      margin-block: 0 20px;
      font-size: var(--h1);
      font-weight: 900;
      line-height: 1.2;
      color: var(--head);
    }

    & h2,
    & h3 {
      margin-block: 28px 16px;
      font-size: var(--base);
      font-weight: 900;
      color: var(--head);
    }

    & p {
      margin-block: 0 20px;
      line-height: 1.25;
    }

    & ul,
    & ol {
      margin-block: 0 20px;
      padding-inline-start: 22px;
    }

    & li {
      margin-block-end: 4px;
    }

    & a {
      color: var(--mint);
      text-decoration: underline;
    }

    & .cta {
      margin-block: 4px 24px;
      text-align: center;

      & a {
        color: var(--text);
        text-decoration: none;
      }
    }

    & blockquote {
      padding: 16px 20px;
      margin-block: 0 20px;
      background: var(--bg-soft);
      border-inline-start: 3px solid var(--mint);
      border-radius: 0 var(--radius) var(--radius) 0;

      & p:last-child {
        margin-block-end: 0;
      }
    }
  }

  .table-scroll {
    margin-block-end: 20px;
    overflow-x: auto;
  }

  .article table {
    width: 100%;
    border-collapse: collapse;

    & th,
    & td {
      padding: 10px 14px;
      text-align: start;
      border: 1px solid var(--line);
    }

    & th {
      background: var(--bg-soft);
      color: var(--head);
    }
  }

  .faq {
    display: grid;
    gap: 12px;
    margin-block-end: 32px;
  }

  .faq details {
    background: var(--bg-soft);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .faq summary {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 15px 20px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }

    &::before {
      content: "+";
      display: grid;
      flex: none;
      place-items: center;
      width: 20px;
      height: 20px;
      background: #444547;
      border-radius: 50%;
      transition: transform 0.3s;
    }
  }

  .faq details[open] summary::before {
    transform: rotate(45deg);
  }

  .faq__body {
    padding: 0 20px 20px 52px;
    color: var(--text-dim);

    & p {
      margin: 0;
      line-height: 1.5;
    }
  }

  .reviews {
    display: grid;
    gap: 12px;
    margin-block-end: 32px;
  }

  .reviews__top {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;

    & h2 {
      margin: 0;
      font-size: var(--h1);
      font-weight: 900;
      color: var(--head);
    }

    & span {
      display: inline-block;
      padding: 2px 10px;
      margin-inline-start: 8px;
      font-size: 13px;
      color: var(--bg);
      background: var(--mint);
      border-radius: 20px;
      vertical-align: middle;
    }
  }

  .review {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-soft);
    border-radius: var(--radius);
    border-inline-start: 3px solid transparent;
    transition: border-color 0.2s;

    &:hover {
      border-inline-start-color: var(--mint);
    }
  }

  .review__face {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    opacity: 0.6;
  }

  .review__who {
    font-weight: 700;
    color: var(--head);
  }

  .review__when {
    margin-inline-start: 10px;
    font-size: 12px;
    color: var(--text-dim);
  }

  .review__text {
    margin-block-start: 8px;
    line-height: 1.55;

    & p {
      margin: 0 0 8px;

      &:last-child {
        margin-block-end: 0;
      }
    }
  }

  .foot {
    padding-block: 32px;
    margin-block-start: 32px;
    border-block-start: 1px solid var(--line);
  }

  .foot__pays {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: center;
    padding-block-end: 24px;

    & img {
      height: 24px;
      opacity: 0.7;
      transition: opacity 0.2s;

      &:hover {
        opacity: 1;
      }
    }
  }

  .foot__note {
    color: var(--text-dim);
    text-align: center;
    line-height: 1.6;
  }
}

@layer utils {
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  @media (width <= 1024px) {
    .page {
      padding-inline-start: 0;
    }

    .side {
      transform: translateX(-100%);
      transition: transform 0.25s;
    }

    .top {
      inset-inline-start: 0;
    }

    #menu:checked ~ .side {
      transform: none;
    }

    #menu:checked ~ .overlay {
      opacity: 1;
      pointer-events: auto;
    }

    .overlay {
      position: fixed;
      inset: 0;
      z-index: 25;
      background: #000c;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s;
    }
  }

  @media (width > 1024px) {
    .burger,
    .overlay,
    .top__logo {
      display: none;
    }
  }

  .top__logo {
    flex: none;
    margin-inline-end: auto;
  }

  .top__logo img {
    width: 97px;
    height: 28px;
  }

  @media (width <= 1024px) {
    .games {
      --cols: 3;
    }
  }

  @media (width <= 760px) {
    .games {
      --cols: 2;
    }
  }

  @media (width <= 640px) {
    :root {
      --gap: 14px;
    }

    .top__menu,
    .top__promo {
      display: none;
    }

    .top__in {
      gap: 8px;
      padding-inline: 12px;
    }

    .top__in .btn {
      padding: 8px 12px;
      font-size: 13px;
      white-space: nowrap;
    }

    .top__logo {
      min-width: 0;
    }

    .top__logo img {
      width: auto;
      height: 22px;
    }
  }

  @media (width <= 400px) {
    .top__in {
      gap: 6px;
      padding-inline: 10px;
    }

    .top__in .btn {
      padding: 7px 9px;
      font-size: 12px;
    }

    .top__logo img {
      height: 19px;
    }

    .promo {
      aspect-ratio: 343 / 220;
      padding: 20px;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before {
      transition-duration: 0.01ms !important;
      animation-duration: 0.01ms !important;
    }
  }
}
