:root {
  interpolate-size: allow-keywords;
}

@keyframes delay-overflow-visible {
  from {
    overflow: hidden;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  line-height: 1.25;
}

.visually-hidden {
  pointer-events: none !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.hidden {
  display: none !important;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100svh;
}

html:has(dialog[scroll-lock][open], details[scroll-lock][open]) {
  overflow: hidden;
}

main.sections {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.section {
  display: contents;

  >.section-container {
    width: 100%;
    display: flex;
    align-items: center;
    flex-direction: column;
    background-color: var(--color-6);

    >.block {
      >.block-container {
        width: 100%;
      }
    }

    .shopify-block {
      display: contents;

      >* {
        max-width: min(100%, var(--content-max-width));
      }
    }

    .block-container {
      display: flex;
      gap: 2rem;
      justify-content: space-between;
      background-color: var(--color-4);

      &.padded {
        padding: 2rem 1rem;

        @media (min-width: 480px) {
          padding: 2rem;
        }
      }

      .block-container {
        background-color: transparent;
      }

      &.two-columns {
        flex-wrap: wrap;

        >.shopify-block>div {
          flex-basis: 320px;
          flex-grow: 1;
          min-width: 200px;
          max-width: 100%;
        }
      }

      &.one-column {
        flex-direction: column;
        justify-content: flex-start;

        >.shopify-block>div {
          flex: 0 0 auto;
        }
      }

      &.quarter-left {
        flex-wrap: wrap;

        >.shopify-block:nth-child(odd)>div {
          flex: 1 1 calc(25% - 1rem);
          min-width: 200px;
          max-width: 100%;
        }

        >.shopify-block:nth-child(even)>div {
          flex: 1 1 calc(75% - 1rem);
          min-width: 200px;
          max-width: 100%;
        }
      }

      &.quarter-right {
        flex-wrap: wrap;

        >.shopify-block:nth-child(odd)>div {
          flex: 1 1 calc(75% - 1rem);
          min-width: 200px;
          max-width: 100%;
        }

        >.shopify-block:nth-child(even)>div {
          flex: 1 1 calc(25% - 1rem);
          min-width: 200px;
          max-width: 100%;
        }
      }
    }
  }
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
textarea,
select {
  font: inherit;
  border-radius: var(--style-border-radius-inputs);
}

select {
  background-color: var(--color-background);
  color: currentcolor;
}

dialog {
  background-color: var(--color-background);
  color: var(--color-foreground);
}

p {
  text-wrap: pretty;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

p:empty {
  display: none;
}

p {
  font-size: calc(var(--magnification) * 1rem);
}

h1 {
  font-size: calc(var(--magnification) * var(--h1-size));
  font-family: var(--font-highlight--family);
}

h2 {
  font-size: calc(var(--magnification) * var(--h2-size));
  font-family: var(--font-highlight--family);
}

h3 {
  font-size: calc(var(--magnification) * var(--h3-size));
}

h4 {
  font-size: calc(var(--magnification) * var(--h4-size));
}

h5 {
  font-size: calc(var(--magnification) * var(--h5-size));
}

h6 {
  font-size: calc(var(--magnification) * var(--h6-size));
}

body {
  font-family: var(--font-body--family);
  background-color: var(--color-background);
  color: var(--color-foreground);
}

a {
  color: inherit;
}

.text, .metafield-rich_text_field, blockquote {
  text-align: var(--text-align);
  display: flex;
  flex-direction: column;
  gap: 2rem;

  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p {
    margin: -.2lh 0;
  }

  a:not([class]) {
    margin: -.2lh 0;
    transition: all .3s;
    text-underline-offset: 0.075em;
    text-decoration-thickness: 0.075em;
    @media (hover: hover) {
      &:any-link:hover {
        filter: saturate(4);
      }
    }
  }

  blockquote {
    margin: 0 1em;
    color: var(--color-primary);
    font-size: 1.125em;
    position: relative;

    * {
      font-size: inherit;
    }
  }
}

.button {
  --button-text: var(--color-4);
  --button-background: var(--color-6);
  --button-shadow: var(--color-4);
  -webkit-filter: drop-shadow(0 0 0 var(--button-shadow));
  filter: drop-shadow(0 0 0 var(--button-shadow));
  transition: all .3s;
  display: block;
  background-color: var(--button-background);
  color: var(--button-text);
  text-decoration: none;
  width: fit-content;
  padding: 0.5em 0.875em 0.5em 1em;
  position: relative;
  margin: 0 .25em 0 .3em !important;
  cursor: pointer;
  letter-spacing: .125em;
  text-transform: uppercase;
  font-weight: bold;
  font-size: 1rem;
  text-align: center;

  &:not(.disabled) {
    @media (hover: hover) {
      &:hover,
      &:focus-visible {
        -webkit-filter: drop-shadow(0.1rem 0.1rem 0 var(--button-shadow));
        filter: drop-shadow(0.1rem 0.1rem 0 var(--button-shadow));
        transform: translate(-0.1rem, -0.1rem);
      }
    }

    &:active {
      -webkit-filter: drop-shadow(0 0 0 var(--button-shadow));
      filter: drop-shadow(0 0 0 var(--button-shadow));
      transform: translate(0, 0);
    }
  }

  &:before {
    content: "";
    position: absolute;
    width: 0.3em;
    height: 100%;
    top: 0;
    left: calc(.5px - 0.3em);
    background-color: var(--button-background);
    clip-path: url(#logo-cap-left);
  }

  &:after {
    content: "";
    position: absolute;
    width: 0.25em;
    height: 100%;
    top: 0;
    left: calc(100% - .5px);
    background-color: var(--button-background);
    clip-path: url(#logo-cap-right);
  }

  &:has(input) {
    padding: 0;
  }

  input {
    padding: 0.5em 0.875em 0.5em 1em;
    background-color: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    font-weight: inherit;
  }
  &:has(input:disabled),
  &.disabled {
    cursor: not-allowed;
    opacity: .75;
    pointer-events: none;
  }
}

svg.clipper {
  position: absolute;
  width: 0;
  height: 0;
}

a.image img {
  transition: all .3s;
}

@media (hover: hover) {
  a.image:any-link:hover,
  a.image:any-link:focus-visible {
    img, .placeholder {
      scale: 1.05;
    }
  }
}

.smooth-details {
  color: var(--text-color);

  a {
    color: var(--text-color);
    text-decoration: none;
  }

  summary {
    list-style: none;
    cursor: pointer;

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

  .heading {
    position: relative;
  }

  &::details-content {
    position: absolute;
    height: 0;
    transition:
      height 600ms ease-out,
      content-visibility 600ms allow-discrete ease-out,
      z-index 1ms 600ms;
    overflow: hidden;
    z-index: 0;
  }

  &[open]::details-content {
    height: auto;
    overflow: visible;
    animation: 1.7s delay-overflow-visible;
    z-index: 1;
    transition:
      height 600ms ease-out,
      content-visibility 600ms allow-discrete ease-out;
  }
}

.shopify-section-group-header-group {
  &.section-menu {
    --text-color: var(--color-3);
    --background-color: var(--color-5);
    --focus-text-color: var(--color-2);
    --focus-background-color: var(--color-6);
    position: sticky;
    top: 0;
    background-color: var(--background-color);
    z-index: 10;
    display: flex;
    justify-content: center;

    a {
      color: var(--text-color);
      text-decoration: none;
    }

    nav {
      width: 100%;
      max-width: min(100%, var(--content-max-width));
      padding: 0 2rem;

      .menu-links {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
      }

      ul {
        list-style-type: none;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        background-color: var(--background-color);

        .menu-icons {
          flex: 1 0 auto;
          display: flex;
          align-items: center;

          &:first-child {
            justify-content: flex-start;
          }

          &:last-child {
            justify-content: flex-end;
          }

          li {
            height: 100%;
            background-color: var(--background-color);
            transition: all .3s;

            svg {
              transition: all .3s;
            }

            @media (hover: hover) {
              &:hover {
                background-color: var(--focus-background-color);

                svg {
                  color: var(--focus-text-color);
                }
              }
            }

            a {
              display: flex;
              height: 100%;
              padding: .5rem;
            }
          }

          .cart-link {
            position: relative;

            &.cart-active {
              &::after {
                content: '';
                position: absolute;
                width: .5rem;
                height: .5rem;
                background-color: var(--color-1);
                border-radius: 100%;
                right: 0.25rem;
              }
            }
          }
        }

        .menu {
          list-style: none;
          /* cursor: pointer; */
          -webkit-tap-highlight-color: transparent;

          > summary {
            display: none;
            list-style-type: none;
            cursor: pointer;
            background-color: var(--background-color);
            color: var(--text-color);
            height: 100%;
            padding: .5rem;

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

          @media screen and (max-width: 480px) {
            flex: 1;
            justify-content: flex-end;
            display: flex;

            .menu-links {
              width: 100vw;
            }

            > summary {
              display: block;
            }

            &::details-content {
              position: absolute;
              top: 100%;
              height: 0;
              transition:
                height 600ms,
                content-visibility 600ms allow-discrete,
                z-index 1ms 600ms;
              overflow: hidden;
              z-index: 0;
              background-color: var(--background-color);
            }

            &[open]::details-content {
              height: auto;
              overflow: visible;
              animation: 1.7s delay-overflow-visible;
              z-index: 1;
              transition:
                height 600ms,
                content-visibility 600ms allow-discrete;
            }
          }
        }

        .menu-links {
          >li>.block-link_list>details>ul {
            --background-color: var(--color-6);
            --text-color: var(--color-2);
            --focus-background-color: var(--color-1);
            --focus-text-color: var(--color-4);

            >li>.block-link_list>details>ul {
              --background-color: var(--color-1);
              --text-color: var(--color-4);
              --focus-background-color: var(--color-3);
              --focus-text-color: var(--color-5);

              >li>.block-link_list>details>ul {
                --background-color: var(--color-3);
                --text-color: var(--color-5);
                --focus-background-color: var(--color-2);
                --focus-text-color: var(--color-6);

                >li>.block-link_list>details>ul {
                  --background-color: var(--color-2);
                  --text-color: var(--color-6);
                  --focus-background-color: var(--color-4);
                  --focus-text-color: var(--color-1);

                  >li>.block-link_list>details>ul {
                    --background-color: var(--color-4);
                    --text-color: var(--color-1);
                    --focus-background-color: var(--color-5);
                    --focus-text-color: var(--color-3);

                    >li>.block-link_list>details>ul {
                      --background-color: var(--color-5);
                      --text-color: var(--color-3);
                      --focus-background-color: var(--color-6);
                      --focus-text-color: var(--color-2);

                      >li>.block-link_list>details>ul {
                        --background-color: var(--color-6);
                        --text-color: var(--color-2);
                        --focus-background-color: var(--color-1);
                        --focus-text-color: var(--color-4);

                        >li>.block-link_list>details>ul {
                          --background-color: var(--color-1);
                          --text-color: var(--color-4);
                          --focus-background-color: var(--color-3);
                          --focus-text-color: var(--color-5);
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }

        li {
          .link {
            display: block;
            padding: 0.5rem 2rem;
            background-color: var(--background-color);
            transition: all .3s;
            text-align: center;

            @media (hover: hover) {
              &:hover {
                background-color: var(--focus-background-color);
                color: var(--focus-text-color);
                /* mask: conic-gradient(from calc(110deg/-2) at bottom, #000 110deg,#0000 0) 50%/1rem; */
              }
            }
          }
        }
      }

      > ul {
        flex-wrap: nowrap;
      }

      .block-link_list {
        >details {
          &::details-content {
            left: 0;
            width: 100%;
          }

          &[open] {
            >summary .heading {
              background-color: var(--focus-background-color);
              color: var(--focus-text-color);
            }
          }
        }

        .heading {
          &::after {
            content: "";
            position: absolute;
            border-style: solid;
            border-width: 0.5rem 1rem 0 1rem;
            border-color: transparent;
            border-top-color: var(--background-color);
            bottom: 0;
            left: 50%;
            translate: -50% 0%;
            transition: all .3s;
            z-index: -1;
            /* mask: conic-gradient(from calc(110deg/-2) at bottom, #000 110deg,#0000 0) 50%/1rem; */
          }

          @media (hover: hover) {
            &:hover,
            &:focus-visible {
              &::after {
                border-top-color: var(--focus-background-color);
                translate: -50% 100%;
              }
            }
          }
        }
      }

      @media screen and (max-width: 480px) {
        padding: 0;

        ul {
          justify-content: center;

          .menu-icons {
            order: -1;
            flex: 0 0 auto;
            justify-content: center;
          }
        }
      }
    }
  }
}

.mystery-mode {
  .product-card[data-categorisation*='Books'] {
    .product-image {
      display: none;
    }

    .product-title {
      width: 6.25em;

      a {
        visibility: hidden;
        white-space: nowrap;

        &::before {
          content: "Mystery Book";
          visibility: visible;
        }
      }
    }
  }
}

.product-grid-container,
.collection-grid-container,
.object-grid-container {
  display: flex !important;
  /* overflow: hidden; */
  flex-direction: column;
  gap: 2rem;

  &:empty {
    display: none !important;
  }
}

.product-grid,
.collection-grid,
.object-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(160px, 25% - .75em)), 1fr));
  gap: 1rem;

  &.scope-highlights {
    display: flex;
    overflow-x: auto;
    margin: 0 -1rem;
    max-width: 100vw !important;
    scroll-snap-type: x mandatory;

    &::-webkit-scrollbar {
      display: none;
    }

    @media (min-width: 480px) {
      margin: 0 -2rem;
    }

    .product-tile,
    .collection-tile,
    .object-tile {
      flex: 0 0 60vw;
      scroll-snap-align: center;

      @media (min-width: 480px) {
        flex: 0 1 calc(25% - 1.75rem);
        min-width: 200px;
      }

      &:first-child {
        margin-left: 1rem;
        
        @media (min-width: 480px) {
          margin-left: 2rem;
        }
      }

      &:last-child {
        margin-right: 1rem;
        
        @media (min-width: 480px) {
          margin-right: 2rem;
        }
      }
    }
  }
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 1rem;

  &:empty {
    display: none;
  }
}