*, *::before, *::after {
  box-sizing: border-box;
  /* outline: 1px solid red; */
}

.visually-hidden:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

:root {
  background-color: white;
  color: var(--primary);
  font-family: "Work Sans", sans-serif;
  line-height: 1.6;
  scroll-behavior: smooth;

  /* CSS variables: */
  --container-width: 100vw;
  --container-card-ratio: 5.45;
  --sidescroller-height: calc(var(--container-width) * 1.6 / var(--container-card-ratio));
  --card-width: calc(var(--container-width) / var(--container-card-ratio));
  --sidescroller-gap: 1vw;
  --border-radius-small: 0.5em;
  --border-radius: 1em;
  --border-radius-large: 3em;
  --box-shadow: 0 0 .75em .5em oklch(0 0 0 / .5);
  --header-y-spacing: 1.5rem;

  @media (min-width: 80em) {
    --container-width: 80em;
  }

  /* Colors: */
  --primary: oklch(18.604% 0.00261 248.156);
  --secondary: oklch(97.541% 0.00851 325.034);
  --blue: oklch(45.676% 0.18203 261.541);
  --red: oklch(54.045% 0.22179 29.223);
  --light-grey: oklch(93.657% 0.00183 249.169);
  --grey: oklch(85.324% 0.00268 230.193);
  --dark-grey: oklch(41.283% 0.00005 271.152);
  --darkest-grey: oklch(31.714% 0.00004 271.152);
  --gradient-bluepurple-blue: oklch(17.484% 0.10724 271.243);
  --gradient-bluepurple-violet: oklch(44.177% 0.2011 305.738);
  --gradient-bluepurple-purple: oklch(25.914% 0.11887 320.044);
  --gradient-bluepurple: linear-gradient(
    to right,
    var(--gradient-bluepurple-blue),
    var(--gradient-bluepurple-violet),
    var(--gradient-bluepurple-purple)
  );
  --gradient-bluepurple-dark: linear-gradient(
    to left,
    oklch(from var(--gradient-bluepurple-blue) calc(l * 0.75) c h / 1),
    oklch(from var(--gradient-bluepurple-violet) calc(l * 0.55) c h / 1),
    oklch(from var(--gradient-bluepurple-purple) calc(l * 0.75) c h / 1)
  );
  --gradient-bluepurple-blue-light: oklch(33.717% 0.21925 270.942);
  --gradient-bluepurple-purple-light: oklch(44.821% 0.23131 301.407);
  --gradient-bluepurple-light: linear-gradient(
    to left in oklch shorter hue,
    var(--gradient-bluepurple-blue-light),
    var(--gradient-bluepurple-purple-light)
  );
}

/* Typography */
@font-face {
  font-family: "Work Sans";
  font-style: normal;
  src: url("./assets/fonts/WorkSans-VariableFont_wght.woff2") format("woff2");
}

@font-face {
  font-family: "Work Sans";
  font-style: italic;
  src: url("./assets/fonts/WorkSans-Italic-VariableFont_wght.woff2") format("woff2");
}

h3 {
  font-size: 1.2em;
  line-height: 1.3;
  margin-block-start: 3rem;
  margin-block-end: 1rem;

  + p {
    margin-block-start: 0;
  }
}

h2 {
  font-size: 1.8em;
  line-height: 1.2;
  margin-block-start: 3rem;
  margin-block-end: 1rem;

  &:has(+ h3) {
    margin-block-end: 0.5rem;
  }
  + p, + h3 {
    margin-block-start: 0;
  }
}

h1 {
  font-size: 2.7em;
  line-height: 1.1;
  margin-block-start: 3rem;
  margin-block-end: 1rem;

  &:has(+ h2) {
    margin-block-end: 0.5rem;
  }
  + p, + h2 {
    margin-block-start: 0;
  }
}

p {
  margin-block: 1.5rem;
}

.mx-tenth {
  margin-inline: 10%;
}

.fs-2 {
  font-size: 2em;
}

.fs-2-5 {
  font-size: 2.5em;
}

.fs-3 {
  font-size: 3em;
}

.fs-3-5 {
  font-size: 3.5em;
}

.gradient-title {
  font-weight: 800;
  letter-spacing: .04em;
  word-spacing: .4em;
  max-width: max-content;

  /* Create gradient underline effect: */
  border-image: var(--gradient-bluepurple-light);
  /* Slice 100% from the gradient bottom edge: */
  border-image-slice: 0 0 100% 0;
  border-width: 0.4rem;
  border-style: solid;

  /* Create gradient text effect: */
  background: var(--gradient-bluepurple-light);
  background-clip: text;
  color: transparent;
}
/*----------------------------------------------------------*/

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.container {
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: 1em;

  &.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-block-start: var(--header-y-spacing);
  }
  &.main {
    padding-block-start: 4vh;
    padding-block-end: 12vh;

    section:has([data-collection="favourites"]) {
      padding-block: 2vh;
    }
  }
}

header, footer {
  background: var(--gradient-bluepurple);
  color: var(--secondary);
}

footer {
  display: flex;
  justify-content: center;
  align-items: center;
}

header {
  .container {
    @media (min-width: 40em) {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .navlist {
        display: flex;
        gap: 1em;
        margin-block-end: 0;

        li {
          a {
            width: auto;

            &[aria-current="page"] {
              display: inline-block;
              position: relative;
            }

            &::before {
              width: 0;
              margin-inline-end: 0;
            }

            &[aria-current="page"]::before {
              content: "▾";
              position: absolute;
              width: 1em;
              top: -.4em;
              left: calc(50% - 0.5em);
            }
          }
        }
      }
    }

    font-size: 1.125rem;

    a {
      color: inherit;
    }

    #search-toggle {
      background: none;
      border: none;
      cursor: pointer;
    }

    #nav-container {
      position: relative;
      padding-block-end: var(--header-y-spacing);

      /* Searchbar container */
      div {
        position: absolute;
        z-index: 100;
        top: 0.2em;
        left: -100%;
        width: 100%;
        height: 100%;
        width: 0;
        opacity: 0;
        /* overflow: hidden; */
        transition: width 0.3s ease-in-out, opacity 0.3s ease-in-out, left 0.3s ease-in-out;
        /* Push it to the left when deactivated: */
        margin-inline-end: auto;

        form {
          display: flex;
          align-items: center;

          /* Searchbar: */
          input {
            padding-inline: 0.75em;
            padding-block: 0.5em;
            border: 1px solid var(--light-grey);
            border-radius: var(--border-radius-large);
            width: 100%;

            &:focus {
              outline: none;
            }
          }
          button {
            position: absolute;
            border-radius: var(--border-radius-large);
            font-weight: bold;
            top: 0;
            right: -4rem;
          }
        }
      }

      /* Searchbar is open: */
      &.active {
        div {
          left: 0;
          width: 100%;
          opacity: 1;
          padding-left: 0.5em;
        }

        .navlist {
          a:hover {
            background-color: initial;
            pointer-events: none;
          }
        }
      }
    }
  }
}

.navlist {
  padding: 0;
  margin: 0;
  list-style: none;

  a, button {
    display: inline-block;
    padding: 0;
    color: inherit;
  }
  &.main {
    li {
      a {
        text-decoration: none;
        padding-block: 0.5em;
        padding-inline: 0.75em;
        border-radius: var(--border-radius-large);

        &:hover {
          background-color: var(--secondary);
          color: var(--gradient-bluepurple-violet);
        }
        &::before {
          content: "";
          display: inline-block;
          width: 1em; /* reserve space for ► arrow */
          margin-inline-end: .5em;
        }
        &[aria-current="page"]::before {
          content: "►";
          margin-inline-end: .5em;
        }
      }
    }
  }
}

.nav.icons {
  padding-block: 0.5em;
}

.blocklink {
  display: inline-block;
  width: 100%;
  height: 100%;
  color: oklch(55.098% 0.13529 261.892);;
  text-decoration: none;
}

.error {
  color: var(--red);
}

.py-1 {
  padding-block: 1rem;
}

.px-1 {
  padding-inline: 1rem;
}

.my-1 {
  margin-block: 1rem;
}

.mt-1 {
  margin-block: 1rem;
}

.mt-2 {
  margin-block: 2rem;
}

.mx-1 {
  margin-inline: 1rem;
}

.ml-1 {
  margin-inline-start: 1rem;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.row-around {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.favicon {
  display: inline-block;
  mask: url("./assets/images/favicon.svg") no-repeat center;
  background-color: currentColor;
  min-width: 2em;
  min-height: 2em;
  transform: scale(1);
  transition: transform 0.25s ease-out;

  &:hover {
    transform: scale(1.5);
  }
}

.icon {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  transform: scale(1);
  transition: transform 0.25s ease-out;

  &.search {
    width: 2em;
    height: 2em;
  }
  &:hover {
    transform: scale(1.5);
  }
}

.page-title {
  margin: 16px 0;
  font-size: 24px;
  color: #2b2f77;
}


.game {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
}

.game-img {
  flex: 1;
  min-width: 260px;
}
.game-img img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  border: 1px solid #e5e7eb;
}

.game-info {
  flex: 2;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
}

.game-name {
  margin: 0 0 8px 0;
  font-size: 22px;
}

.tags-row {
  display: flex;
  gap: 1.5em;
  align-items: flex-start;
}

.tags {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
  gap: 8px;
  flex-wrap: wrap;

  li {
    background-color: #f1efff;
    color: #392c8a;
    border: 1px solid #d8d5ff;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 13px;
  }
}

.rating {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;

  > div {
    width: 150px;
    height: 10px;
    background: #eee;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ddd;

    > div {
      height: 100%;
      background: #22c55e;
    }
  }
}

.explanation { margin: 10px 0; }

.price { margin: 8px 0 0 0; font-weight: bold; }
.price-now {
  background: #e7f8ee;
  color: #185d35;
  padding: 2px 6px;
  border: 1px solid #bfe9cf;
  border-radius: 6px;
}


@media (max-width: 820px) {
  .game { flex-direction: column; }
  .game-img { min-width: auto; }
}

.sidebar {
  height: 100%;
  width: 300px;
  color: white;
  background-color: var(--gradient-bluepurple-blue);
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  color: white;
}

.sidebar a {
  color: white;
  text-decoration: none;
}

.sidebar a:hover {
  text-decoration: underline;
}

.sidebar-container {
  display: flex;
  flex-direction: row;
  height: 100%;
  padding: 0;
  margin: 0;
}

.sidescroller {
  display: flex;
  width: 100%;
  height: var(--sidescroller-height);
  margin-block: 3rem;
}

.svg {
  display: inline-block;
  vertical-align: bottom;
  background-color: currentColor;

  &.large {
    width: 5rem;
    height: 5rem;
  }
}

.chevron-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  min-width: calc(var(--card-width) * 0.5);
  border-radius: var(--border-radius);
  cursor: pointer;
  opacity: 0.5;
  background: linear-gradient(var(--gradient-direction), var(--dark-grey), var(--light-grey));

  &:first-child {
    --gradient-direction: to right;
    --translate-x: -0.5rem;
  }
  &:last-child {
    --gradient-direction: to left;
    --translate-x: 0.5rem;
  }

  &:hover {
    opacity: 0.7;
    transform: scaleX(1.2) translateX(var(--translate-x));
    transition: transform 0.3s ease-out;

    .chevron {
      transform: scaleY(1.25);
      transition: transform 0.3s ease-out;
    }
  }

  &.right {
    .chevron {
      mask: url("./assets/images/chevron_right.svg") no-repeat center;
    }
  }
  &.left {
    .chevron {
      mask: url("./assets/images/chevron_left.svg") no-repeat center;
    }
  }

  .svg {
    background-color: black;
  }
}

.sidescroll-list {
  display: flex;
  gap: var(--sidescroller-gap);
  flex-wrap: nowrap; /* Prevent cards from wrapping */
  overflow-x: scroll; /* Enable horizontal scrolling when content overflows */
  scrollbar-width: none; /* Hide scrollbar! */
  scroll-behavior: smooth;
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  padding-inline: calc(var(--sidescroller-gap) / 2);
  margin-inline: calc(var(--sidescroller-gap) / 2);

  .game-card {
    min-width: var(--card-width);
    height: 100%;
    list-style: none;
    border-radius: var(--border-radius);
    scrollbar-width: none; /* Hide scrollbar on hover effect! */
    overflow: inherit;
    /* background-color: oklch(from var(--blue) calc(l * .5) calc(c * .6) h / .89); */
    background-color: black;
    color: var(--light-grey);

    > div {
      position: relative;
      display: flex;
      flex-direction: column;
      transition: all 0.3s ease-out;
      height: 100%;
      width: 100%;

      .rating, .tags-row, .game-summary {
        display: none;
      }

      img {
        order: -1;
        width: 100%;
        max-height: 82%;
        object-fit: cover;
      }
      h2 {
        font-size: 1rem;
        padding-inline: 1rem;
        margin-block-start: 0.3rem;
        margin-block-end: auto;
        line-height: 1.2;
        text-align: center;
      }
      a {
        position: absolute;
        inset: 0;
        text-indent: 120%;
        overflow: hidden;
        white-space: nowrap;

        &:hover {
          background-color: oklch(from var(--blue) calc(l * .5) calc(c * .6) h / .15);
        }
      }
    }

    &:hover {
      overflow: hidden;
      box-shadow: var(--box-shadow);

      div {
        margin-top: -0.25rem;
        transform: translateY(-0.25rem) scale(1.025);
      }
    }
  }
}

#single-game-result {
  a {
    display: none;
  }

  .game-card {
    height: 100%;
    list-style: none;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--darkest-grey);
    color: var(--secondary);

    > div {
      position: relative;
      display: flex;
      flex-direction: column;
      height: 100%;
      width: 100%;

      @media (min-width: 60em) {
        flex-direction: row;
      }

      > div {
        display: flex;
        flex-direction: column;
        gap: 0.25em;
        padding: 2em;

        h2 {
          margin-block-start: 0.5rem;
        }
        .rating {
          margin-block-end: 1.5em;
        }
        .tags-row {
          margin-inline-start: 1.5rem;

          &:nth-child(3) {
            margin-block-end: 0.5em;

            span {
              margin-inline-end: 1.3rem;
            }
          }
          .Platforms-list {
            li {
              background-color: oklch(96.762% 0.04211 150.734);
              color: oklch(34.6% 0.10769 145.37);
              border: 1px solid oklch(94.241% 0.09625 150.787);
            }
          }
        }
      }

      img {
        order: -1;
        min-width: 50%;
        max-width: 100%;
        object-fit: cover;
      }
    }
  }
}

#map-container {
  min-height: 300px;
  max-height: 700px;
  height: 70vh;

  iframe {
    border: none;
  }
}

/* Profile page: */
.button {
  padding: 0.5em;
  background-color: #f1f1f1;
  cursor: pointer;
  font-size: 0.875em;
  border-radius: var(--border-radius-small);
  border: 1px solid var(--grey);
}

.tab-container {
  width: 400px;
  margin-block: 2em;
  border: 1px solid #ccc;
  border-radius: var(--border-radius);
  overflow: hidden;
  background-color: #fff;

  /* Tab buttons styling */
  .tab-buttons {
    display: flex;
    border-bottom: 1px solid #ccc;

    .tab-button {
      /* Makes buttons fill the width: */
      flex-grow: 1;
      padding: 0.75em;
      border: none;
      background-color: #f1f1f1;
      cursor: pointer;
      font-size: 1em;
      transition: background-color 0.3s;

      &:hover {
        background-color: #ddd;
      }
      /* Style for the active (selected) tab */
      &.active {
        background-color: #fff;
        border-bottom: 2px solid var(--blue);
        font-weight: bold;
      }
    }
  }

  /* Content Pane Styling */
  .tab-content {
    padding-inline: 1.25em;

    .tab-pane {
      /* Initially hide all panes: */
      display: none;

      /* Only display the active pane: */
      &.active {
        display: block;
      }

      input {
        border-radius: var(--border-radius-small);
        border: 1px solid var(--grey);
        padding-inline: 0.75em;
        padding-block: 0.25em;
        outline: none;
      }
    }
  }
}

.hidden {
  display: none;
}