@layer tokens, base, layout, blocks, utils;

@layer tokens {
  :root {
    --bg: #0d1016;
    --bg-2: #12161e;
    --bg-3: #181d26;
    --line: #232a36;
    --text: #eef1f5;
    --dim: #8e97a4;
    --head: #d2eeed;
    --mint: #00cfa6;
    --red: #ff2400;
    --gold: #ffc107;

    --rail: 72px;
    --rail-open: 224px;
    --bar: 64px;
    --gap: 22px;
    --r: 14px;
    --r-lg: 20px;

    --display: clamp(30px, 4.4vw, 58px);
    --h2: clamp(20px, 2.4vw, 30px);
    --base: 15px;

    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.5 Roboto, system-ui, sans-serif;
    -webkit-text-size-adjust: 100%;
  }

  img {
    display: block;
    max-width: 100%;
    height: auto;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  :focus-visible {
    outline: 2px solid var(--mint);
    outline-offset: 3px;
  }

  .pick {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
}

@layer layout {
  .shell {
    max-width: 1280px;
    padding: calc(var(--bar) + 26px) 26px 0 calc(var(--rail) + 26px);
    margin-inline: auto;
  }

  .rail {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: var(--rail);
    padding: 14px 0;
    overflow: hidden;
    background: var(--bg-2);
    border-inline-end: 1px solid var(--line);
    transition: width 0.22s ease;

    &:hover {
      width: var(--rail-open);
      box-shadow: 24px 0 48px #0009;
    }
  }

  .rail__logo {
    display: grid;
    place-items: center;
    height: 44px;
    margin-block-end: 12px;

    & img {
      width: 46px;
      height: auto;
    }
  }

  .rail__nav {
    display: grid;
    gap: 2px;
  }

  .rail__item {
    position: relative;
    display: grid;
    grid-template-columns: var(--rail) 1fr;
    align-items: center;
    height: 46px;
    color: var(--dim);
    white-space: nowrap;
    transition: color 0.18s, background 0.18s;

    & img {
      justify-self: center;
      width: 20px;
      height: 20px;
      object-fit: contain;
      opacity: 0.75;
      transition: opacity 0.18s;
    }

    &::before {
      content: "";
      position: absolute;
      inset-block: 8px;
      inset-inline-start: 0;
      width: 3px;
      background: var(--mint);
      border-radius: 0 3px 3px 0;
      opacity: 0;
      transition: opacity 0.18s;
    }

    &:hover {
      color: var(--text);
      background: #ffffff08;

      & img {
        opacity: 1;
      }

      &::before {
        opacity: 1;
      }
    }
  }

  .bar {
    position: fixed;
    inset-block-start: 0;
    inset-inline: var(--rail) 0;
    z-index: 30;
    display: flex;
    gap: 16px;
    align-items: center;
    height: var(--bar);
    padding-inline: 26px;
    background: #0d1016f2;
    backdrop-filter: blur(10px);
    border-block-end: 1px solid var(--line);
  }

  .bar__nav {
    display: flex;
    gap: 20px;
    margin-inline-end: auto;
    color: var(--dim);

    & a:hover {
      color: var(--text);
    }
  }

  .bar__logo,
  .bar__burger {
    display: none;
  }

  .bar__pill {
    padding: 7px 14px;
    font-size: 13px;
    color: var(--head);
    background: #00cfa614;
    border: 1px solid #00cfa633;
    border-radius: 100px;
    white-space: nowrap;
  }
}

@layer blocks {
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-weight: 700;
    white-space: nowrap;
    border-radius: 100px;
    transition: background 0.18s, border-color 0.18s;
  }

  .btn--red {
    background: var(--red);

    &:hover {
      background: color-mix(in srgb, var(--red) 82%, #fff);
    }
  }

  .btn--line {
    border: 1px solid var(--line);

    &:hover {
      border-color: var(--mint);
      color: var(--mint);
    }
  }

  .hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: var(--gap);
  }

  .hero__card {
    position: relative;
    display: grid;
    align-content: center;
    gap: 6px;
    aspect-ratio: 16 / 8;
    padding: 34px 38px;
    overflow: hidden;
    background: var(--bg-3);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    isolation: isolate;
  }

  .hero__back,
  .hero__face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right bottom;
  }

  .hero__face {
    z-index: 2;
    height: 104%;
    inset-block-start: auto;
    object-fit: contain;
  }

  .hero__glow {
    position: absolute;
    inset: 0;
    z-index: 1;
  }

  .hero__card--sport .hero__glow {
    background: linear-gradient(72deg, #0d1016 22%, #ff240055 58%, #ff240000 82%);
  }

  .hero__card--casino .hero__glow {
    background: linear-gradient(72deg, #0d1016 22%, #00cfa655 58%, #00cfa600 82%);
  }

  .hero__kicker,
  .hero__prize,
  .hero__go {
    position: relative;
    z-index: 3;
  }

  .hero__kicker {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--dim);
  }

  .hero__prize {
    font-size: var(--display);
    font-weight: 700;
    line-height: 1.05;
    color: var(--gold);
  }

  .hero__go {
    justify-self: start;
    padding: 11px 20px;
    margin-block-start: 14px;
    font-weight: 700;
    background: var(--red);
    border-radius: 100px;
    transition: transform 0.18s;
  }

  .hero__card:hover .hero__go {
    transform: translateX(4px);
  }

  .slab {
    padding-block-start: 56px;
  }

  .slab__head {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    align-items: baseline;
    padding-block-end: 20px;

    & h2 {
      position: relative;
      margin: 0;
      font-size: var(--h2);
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      color: var(--head);
      padding-inline-start: 14px;
    }

    & h2::before {
      content: "";
      position: absolute;
      inset-block: 4px 4px;
      inset-inline-start: 0;
      width: 4px;
      background: var(--mint);
      border-radius: 4px;
    }

    & p {
      margin: 0;
      color: var(--dim);
    }
  }

  .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-block-end: 20px;
  }

  .chip {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 9px 16px;
    color: var(--dim);
    cursor: pointer;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 100px;
    transition: color 0.18s, background 0.18s, border-color 0.18s;

    & img {
      width: 18px;
      height: 18px;
      object-fit: contain;
      opacity: 0.7;
    }

    &:hover {
      color: var(--text);
    }
  }

  #t1:checked ~ .chips [for="t1"],
  #t2:checked ~ .chips [for="t2"],
  #t3:checked ~ .chips [for="t3"],
  #t4:checked ~ .chips [for="t4"] {
    color: var(--bg);
    background: var(--mint);
    border-color: var(--mint);

    & img {
      opacity: 1;
    }
  }

  .panes > .mosaic {
    display: none;
  }

  #t1:checked ~ .panes .mosaic:nth-child(1),
  #t2:checked ~ .panes .mosaic:nth-child(2),
  #t3:checked ~ .panes .mosaic:nth-child(3),
  #t4:checked ~ .panes .mosaic:nth-child(4) {
    display: grid;
  }

  .mosaic {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    grid-auto-rows: 1fr;
    gap: 14px;
  }

  .tile {
    position: relative;
    overflow: hidden;
    border-radius: var(--r);
    isolation: isolate;

    & img {
      width: 100%;
      height: 100%;
      aspect-ratio: 300 / 230;
      object-fit: cover;
      transition: transform 0.3s ease, filter 0.3s;
    }

    &:hover img {
      transform: scale(1.06);
      filter: brightness(0.55);
    }
  }

  .tile--wide {
    grid-column: span 2;
    grid-row: span 2;
  }

  .tile__name {
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 2;
    padding: 22px 12px 10px;
    font-size: 12.5px;
    text-align: center;
    background: linear-gradient(#0000, #000c);
  }

  .tile__play {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-content: center;
    font-weight: 700;
    color: var(--mint);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.25s;
  }

  .tile:hover .tile__play {
    opacity: 1;
  }

  .topics {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(230px, 1fr);
    gap: var(--gap);
    padding-block-end: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }

  .topic {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r);
    scroll-snap-align: start;
    transition: border-color 0.18s;

    & img {
      width: 100%;
      aspect-ratio: 240 / 124;
      object-fit: cover;
      opacity: 0.85;
      transition: opacity 0.25s, transform 0.35s;
    }

    & span {
      position: absolute;
      inset-inline: 0;
      inset-block-end: 0;
      padding: 26px 14px 12px;
      font-weight: 500;
      background: linear-gradient(#0000, #000d);
    }

    &:hover {
      border-color: var(--mint);

      & img {
        opacity: 1;
        transform: scale(1.05);
      }
    }
  }

  .long {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 232px;
    gap: 40px;
    padding-block: 56px 0;
    align-items: start;
  }

  .toc {
    position: sticky;
    inset-block-start: calc(var(--bar) + 20px);
    display: grid;
    gap: 9px;
    padding: 18px;
    font-size: 13px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r);

    & b {
      font-size: 11px;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: var(--dim);
    }

    & a {
      color: var(--dim);
      line-height: 1.35;
      transition: color 0.18s;

      &:hover {
        color: var(--mint);
      }
    }
  }

  .prose {
    & h1 {
      margin-block: 0 22px;
      font-size: var(--display);
      font-weight: 700;
      line-height: 1.1;
      color: var(--head);
    }

    & h2 {
      margin-block: 44px 16px;
      font-size: var(--h2);
      font-weight: 700;
      color: var(--head);
      scroll-margin-block-start: calc(var(--bar) + 16px);

      & i {
        display: inline-block;
        padding: 2px 10px;
        margin-inline-start: 8px;
        font-size: 14px;
        font-style: normal;
        color: var(--bg);
        background: var(--mint);
        border-radius: 100px;
        vertical-align: middle;
      }
    }

    & h3,
    & h4 {
      margin-block: 30px 12px;
      font-size: 17px;
      font-weight: 700;
      color: var(--text);
    }

    & p {
      margin-block: 0 18px;
      color: #c8cfd8;
    }

    & ul,
    & ol {
      margin-block: 0 18px;
      padding-inline-start: 20px;
      color: #c8cfd8;
    }

    & li {
      margin-block-end: 6px;
    }

    & blockquote {
      padding: 18px 22px;
      margin: 0 0 18px;
      background: var(--bg-2);
      border-inline-start: 3px solid var(--mint);
      border-radius: 0 var(--r) var(--r) 0;

      & p:last-child {
        margin-block-end: 0;
      }
    }

    & .cta {
      margin-block: 6px 26px;
      text-align: center;
    }
  }

  .scroller {
    margin-block-end: 18px;
    overflow-x: auto;
  }

  .prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;

    & th,
    & td {
      padding: 11px 14px;
      text-align: start;
      border-block-end: 1px solid var(--line);
    }

    & th {
      color: var(--head);
      background: var(--bg-2);
      white-space: nowrap;
    }
  }

  .ask {
    display: grid;
    gap: 10px;
  }

  .ask details {
    overflow: hidden;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    transition: border-color 0.18s;

    &[open] {
      border-color: #00cfa655;
    }
  }

  .ask summary {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 16px 20px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }

    &::after {
      content: "";
      flex: none;
      width: 9px;
      height: 9px;
      margin-inline-start: auto;
      border-inline-end: 2px solid var(--mint);
      border-block-end: 2px solid var(--mint);
      rotate: 45deg;
      transition: rotate 0.25s;
    }
  }

  .ask details[open] summary::after {
    rotate: -135deg;
  }

  .ask__body {
    padding: 0 20px 18px;
    color: var(--dim);

    & p {
      margin: 0;
    }
  }

  .voices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
  }

  .voice {
    padding: 18px 20px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r);

    & header {
      display: flex;
      gap: 10px;
      align-items: center;
      padding-block-end: 10px;
    }

    & img {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      opacity: 0.65;
    }

    & b {
      color: var(--head);
    }

    & time {
      margin-inline-start: auto;
      font-size: 12px;
      color: var(--dim);
    }
  }

  .voice__text {
    font-size: 14px;
    color: #c8cfd8;

    & p {
      margin: 0 0 8px;

      &:last-child {
        margin-block-end: 0;
      }
    }
  }

  .foot {
    padding-block: 40px 48px;
    margin-block-start: 56px;
    text-align: center;
    border-block-start: 1px solid var(--line);

    & p {
      color: var(--dim);
      font-size: 13px;
    }
  }

  .foot__pays {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    justify-content: center;
    padding-block-end: 22px;

    & img {
      opacity: 0.6;
      transition: opacity 0.18s;

      &:hover {
        opacity: 1;
      }
    }
  }
}

@layer utils {
  .veil {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: #000a;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
  }

  @media (width <= 1100px) {
    .long {
      grid-template-columns: minmax(0, 1fr);
    }

    .toc {
      display: none;
    }
  }

  @media (width <= 900px) {
    .shell {
      padding-inline: 18px;
    }

    .bar {
      inset-inline-start: 0;
      gap: 10px;
      padding-inline: 14px;
    }

    .bar__nav,
    .bar__pill {
      display: none;
    }

    .bar__logo,
    .bar__burger {
      display: grid;
    }

    .bar__logo {
      margin-inline-end: auto;
    }

    .bar__burger {
      place-content: center;
      width: 40px;
      height: 36px;
      cursor: pointer;
      background: var(--bg-3);
      border-radius: 10px;

      & span,
      & span::before,
      & span::after {
        display: block;
        width: 16px;
        height: 2px;
        background: var(--text);
        border-radius: 2px;
      }

      & span::before,
      & span::after {
        content: "";
        position: relative;
        inset-block-start: -5px;
      }

      & span::after {
        inset-block-start: 3px;
      }
    }

    .rail {
      width: var(--rail-open);
      translate: -100% 0;
      transition: translate 0.22s ease;
    }

    #rail-open:checked ~ .rail {
      translate: 0 0;
    }

    #rail-open:checked ~ .veil {
      opacity: 1;
      pointer-events: auto;
    }

    .tile--wide {
      grid-column: span 2;
      grid-row: span 1;
    }
  }

  @media (width <= 560px) {
    :root {
      --gap: 14px;
    }

    .hero__card {
      aspect-ratio: 16 / 10;
      padding: 22px;
    }

    .mosaic {
      grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .btn {
      padding: 9px 13px;
      font-size: 13px;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      transition-duration: 0.01ms !important;
    }
  }
}
