@font-face {
  font-family: 'Average Sans';
  font-style: normal;
  font-weight: 400;
  src: url("/f/AverageSans-Regular.woff") format('woff');
}

:root {
  --magpie-red: #fc5f60;
  --magpie-orange: #fdb225;
  --magpie-yellow: #fddf3c;
  --magpie-green: #98c76e;
  --magpie-blue: #5cbbda;
  --magpie-purple: #996ad5;

  --font-family-base: 'Average Sans', sans-serif;
  --font-size-body: 1.2rem;
  --font-size-caption: 1.1rem;
  --font-size-nav: 1rem;
  --font-size-button: 1.4rem;
  --font-size-input: 1rem;
  --font-size-footer: 0.625rem;
  --font-size-heading-3: 1.25rem;
  --font-size-heading-2: 1.875rem;
  --font-size-heading-1: 1.875rem;
}

/* Base styles */
html,
body {
  overflow-x: hidden;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-content: center;

  a {
    border: none;
    outline: none;
    color: inherit;
  }

  a:visited {
    color: inherit;
  }



  a.button-link {
    font-size: var(--font-size-button);
    background-color: black;
    color: white;
    border-radius: 100vmax;
    border: none;
    outline: none;
    padding: 1rem 2rem;
    display: inline-block;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
  }

  a.button-link:hover {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
  }

  h1 {
    font-size: var(--font-size-heading-1);
    font-weight: 500;
  }

  h2 {
    font-size: var(--font-size-heading-2);
    font-weight: 500;
  }

  h3 {
    font-size: var(--font-size-heading-3);
    font-weight: 500;
  }
}

button,
input,
textarea,
select {
  font-family: inherit;
}

.policy {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: start;

  h1 {
    margin: 0;
    flex: 1 1 20rem;
  }

  div {
    flex: 1 3 20rem;

    p {
      margin: 0 0 2em 0;
    }
  }
}

/* Section base styles and color scheme */
section {
  min-height: 10rem;
  padding: 2em 4em 2em 4em;

  @media screen and (max-width: 900px) {
    padding: 1rem 1rem 1rem 1rem;
  }
}

section:nth-of-type(6n+0) {
  background-color: var(--magpie-blue);
  color: white;
}

section:nth-of-type(6n+1) {
  background-color: var(--magpie-purple);
  color: white;

  a.button-link {
    background-color: var(--magpie-yellow);
    color: black;
  }
}

section:nth-of-type(6n+2) {
  background-color: var(--magpie-red);
  color: white;

  a.button-link {
    background-color: var(--magpie-blue);
  }
}

section:nth-of-type(6n+3) {
  background-color: var(--magpie-orange);
  color: black;

  a.button-link {
    background-color: var(--magpie-green);
    color: black;
  }
}

section:nth-of-type(6n+4) {
  background-color: var(--magpie-yellow);
  color: black;
}

section:nth-of-type(6n+5) {
  background-color: var(--magpie-green);
  color: black;
}

/* Global mobile button styles */
@media screen and (max-width: 500px) {
  a.button-link {
    width: fit-content;
    min-width: 80%;
    max-width: calc(100vw - 1rem);
    margin: 0.5rem auto;
    display: block;
    white-space: nowrap;
    box-sizing: border-box;
  }
}

header {
  color: white;
  background-color: var(--magpie-blue);
  padding: 0.5rem 1rem;
  display: grid;
  grid-template-columns: minmax(2rem, 4rem) minmax(0, 1fr) auto;
  gap: 0.1rem 1.5rem;
  align-items: center;

  a {
    text-decoration: none;
  }

  img {
    justify-self: start;
    width: 100%;
  }

  search {
    justify-self: start;
    white-space: nowrap;
    margin: 0 0;
    width: 100%;
    max-width: 100rem;
    position: relative;

    .search-wrapper {
      position: relative;
      width: 100%;
    }

    input {
      height: 4ex;
      width: 100%;
      border-radius: 100vmax;
      border: none;
      outline: none;
      padding: 0.375rem;
      font-size: var(--font-size-input);
      background-color: white;
      color: black;
    }

    button {
      font-size: var(--font-size-input);
      position: absolute;
      right: 0.1rem;
      background-color: transparent;
      border: none;
      outline: none;
      padding: 0.4rem;
      margin: 0;
      min-width: 1rem;
    }

    svg {
      fill: none;
      stroke: grey;
      stroke-width: 2.5px;
      stroke-linecap: round;
      stroke-linejoin: round;
      height: 14pt;
      width: 14pt;
    }
  }

  .store-controls {
    justify-self: end;
    display: flex;
    flex-wrap: nowrap;
    max-width: 12em;
    gap: 1rem;

    a {
      display: block;
      width: 2.5rem;
      height: 2.5rem;
      position: relative;
    }

    svg {
      fill: none;
      stroke: currentColor;
      stroke-width: 2px;
      stroke-linecap: round;
      stroke-linejoin: round;
      width: 2.5rem;
      height: 2.5rem;
    }

    div.ec-cart-widget {
      position: absolute;
      right: 0.25rem;
      bottom: 0;
    }

    .ec-minicart__counter::after {
      background-color: transparent !important;
    }
  }

  div.menu {
    grid-column: 2 / 4;
    display: flex;
    justify-content: space-between;
    gap: 2em;
    font-size: var(--font-size-nav);
    text-wrap: nowrap;

    nav {
      display: flex;
      gap: 1rem;
      text-decoration: none;
    }

    @media screen and (max-width: 900px) {
      nav.contact {
        display: none;
      }
    }
  }

  @media screen and (max-width: 500px) {
    padding: 0.25rem 0.5rem;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 0.25rem;
    display: grid;

    >a {
      grid-column: 1;
      grid-row: 1;
      width: 75%;
      max-width: 3rem;
      order: 1;
    }

    .store-controls {
      grid-column: 3;
      grid-row: 1;
      transform: scale(0.7);
      transform-origin: right center;
      justify-self: end;
      order: 3;
    }

    search {
      grid-column: 1 / 4;
      grid-row: 2;
      justify-self: stretch;
      margin: 0;
      order: 4;
    }

    search input::placeholder {
      color: transparent;
    }

    div.menu {
      grid-column: 1 / 4;
      grid-row: 3;
      order: 5;
      display: contents;
    }

    div.menu nav[aria-label="Product Categories"] {
      grid-column: 2;
      grid-row: 1;
      justify-self: center;
      align-self: center;
      font-size: 1rem;
      line-height: 1.2;
      text-align: center;
      font-weight: normal;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-content: center;
      gap: 0.25rem;
      order: 2;
      width: fit-content;
    }

    @media screen and (max-width: 450px) {
      div.menu nav[aria-label="Product Categories"] {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 0.25rem;
        width: auto;
      }

      div.menu nav[aria-label="Product Categories"] a {
        flex: none;
      }
    }

    div.menu nav[aria-label="Product Categories"] a {
      display: block;
      margin: 0;
      padding: 0.1rem 0.3rem;
    }

    div.menu nav:nth-child(2) {
      display: none;
    }

    div.menu nav.contact {
      display: flex;
      justify-content: space-between;
      grid-column: 1 / 4;
      grid-row: 3;
      order: 6;
    }
  }

  @media screen and (max-width: 500px) {
    div.menu {
      grid-column: 1 / 3;
    }
  }
}

section#hero,
section#four-oh-four {
  padding: 0;
  background: url("i/magpiekids_flag-noborder-optimized.svg") center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;


  h1 {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    position: absolute;
    width: 100%;
    top: 1rem;
    color: black;
  }

  div {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    position: absolute;
    width: 100%;
    bottom: 10%;
  }

  a.button-link {
    background-color: var(--magpie-purple);
    color: white;
    margin: 1rem;
    min-width: 16rem;
  }

  @media screen and (max-width: 500px) {
    div {
      bottom: 5%;
      flex-direction: column;
      align-items: center;
    }

    a.button-link {
      min-width: 80%;
      margin: 0.5rem;
    }
  }
}

/* Shared paragraph styling for text-heavy sections */
section#about,
section#story,
section#karen,
section#deborah,
section#amy,
section#tia {
  p {
    font-size: var(--font-size-body);
    line-height: 2em;
    max-width: 50rem;
  }

  figcaption {
    font-size: var(--font-size-body);
    line-height: 2em;
    max-width: 50rem;
  }
}

section#about {
  @media screen and (max-width: 500px) {
    align-items: center;

    a.button-link {
      font-size: calc(var(--font-size-button) * 0.8);
      width: 100%;
    }
  }
}

section#featured {
  div#ecom-featured {
    max-width: 1400px;
  }

  .grid__categories {
    display: none;
  }

  .ec-page-title {
    text-align: left !important;
    color: white !important;
    font-family: "Average Sans", sans-serif !important;
    font-weight: normal !important;
    font-size: var(--font-size-heading-1) !important;
    margin-bottom: 2rem !important;
  }

  .grid-product__title-inner {
    color: white !important;
    font-family: "Average Sans", sans-serif !important;
    font-weight: normal !important;
    font-size: var(--font-size-caption) !important;
  }

  .ec-pager,
  .grid__categories {
    display: none !important;
  }

  .grid__products {
    justify-content: center !important;
  }

  .grid__product {
    margin: 1rem !important;
  }

  div.more-buttons {
    display: flex;
    justify-content: stretch;
    max-width: 1000rem;
  }
}

section#brands {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4rem;

  div {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 320px));
    gap: 1rem;
    justify-content: center;

    a {
      display: block;
      text-decoration: none;
    }

    .brand-card {
      display: flex;
      flex-direction: column;
      width: 100%;
    }

    figure {
      position: relative;
      display: block;
      margin: 0;
      padding: 0;
      width: 100%;
      aspect-ratio: 1;
      overflow: hidden;
    }

    figure>img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      background-color: black;
      transition: transform 0.2s ease;
    }

    .brand-card:hover img {
      transform: scale(1.1);
    }

    a:hover {
      img {
        filter: none;
      }

      filter: none !important;
    }

    figcaption {
      font-size: var(--font-size-caption);
      color: white;
      text-align: center;
      font-weight: normal;
      margin: 0;
      padding: 0;
      display: block;
    }
  }

  @media screen and (max-width: 500px) {
    align-items: center;

    div {
      grid-template-columns: repeat(auto-fill, minmax(120px, 160px));
    }

    a {
      max-width: 160px;
    }
  }
}

section#category-list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;

  div {
    flex: 1 1 45%;
    min-width: 16rem;
  }

  a {
    text-decoration: none;
  }

  a:hover {
    text-decoration: underline;
  }

  nav ul {
    list-style-type: none;
    margin: 0.5em -2em;
  }
}

section#storefront {
  display: flex;
  justify-content: center;

  img {
    width: 100%;
    max-width: 1920px;
    height: auto;
    margin: 4rem 1rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
  }

  @media screen and (max-width: 500px) {
    img {
      margin: 2rem 0rem;
    }
  }
}

section#visit {
  display: flex;
  justify-content: left;
  gap: 2em;

  h1 {
    font-size: var(--font-size-heading-2);
    margin: 0 0 1em 0;
  }

  h2 {
    font-size: var(--font-size-heading-3);
    margin: 0.2em 0;
  }

  p {
    margin: 0;
  }

  div {
    padding-bottom: 2rem;

    a {
      text-decoration: none;
      max-width: 100em;
    }

    a:hover {
      text-decoration: underline;
      max-width: 100em;
    }
  }

  figure {
    min-width: 10rem;
    flex-grow: 4;
    flex-shrink: 2;
    display: flex;
    flex-direction: column;
    align-items: end;
    gap: 0.5rem;
    box-sizing: border-box;

    iframe {
      box-sizing: border-box;
      width: 100%;
      height: 100%;
      box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
      border-radius: 4px;
      border: none;
    }
  }

  @media screen and (max-width: 500px) {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 1rem 2rem 1rem;

    figure {
      width: 100%;
      align-items: center;
      margin: 0;
      padding: 0.25rem;
      display: block;
      text-align: center;
      box-sizing: border-box;
    }

    figure iframe {
      margin: 0.5rem;
      width: 100%;
      height: 300px;
      aspect-ratio: 1 / 1;
      display: block;
    }

    figure a {
      font-size: 0.75rem;
    }
  }
}

/* Individual person sections - shared figure styling */
section#karen,
section#deborah,
section#amy,
section#tia {
  figure {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    margin: 0;
    max-width: 80rem;
  }

  figure img {
    flex: 0 1 400px;
    width: 100%;
    max-width: 400px;
    min-width: 250px;
    height: auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
  }

  figure figcaption {
    flex: 1 1 auto;
    min-width: 0;
  }

  @media screen and (max-width: 500px) {
    figure {
      flex-direction: column;
      gap: 1.5rem;
    }

    figure img {
      order: -1;
      max-width: 100%;
      min-width: auto;
      flex: none;
    }
  }
}

/* Alternate image positioning for right-aligned sections */
section#deborah,
section#tia {
  figure {
    flex-direction: row-reverse;
  }

  @media screen and (max-width: 500px) {
    figure {
      flex-direction: column;
    }

    figure img {
      order: -1;
    }
  }
}

section#story div {
  max-width: 80rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
}

section#story h1,
section#story p {
  grid-column: 1;
  margin-bottom: 1rem;
}

section#story img {
  grid-column: 2;
  width: 100%;
  max-width: 300px;
  min-width: 200px;
  height: auto;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

section#story img:nth-of-type(1) {
  grid-row: 2 / 4;
  align-self: start;
  margin-bottom: 2rem;
}

section#story img:nth-of-type(2) {
  grid-row: 4 / 6;
  align-self: start;
}

@media screen and (max-width: 500px) {
  section#story div {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  section#story img {
    max-width: 100%;
    min-width: auto;
  }

  /* Reorder content elements: first image after first paragraph, second image after third paragraph */
  section#story h1 {
    order: 1;
  }

  section#story p:nth-of-type(1) {
    order: 2;
  }

  section#story img:nth-of-type(1) {
    order: 3;
  }

  section#story p:nth-of-type(2) {
    order: 4;
  }

  section#story p:nth-of-type(3) {
    order: 5;
  }

  section#story img:nth-of-type(2) {
    order: 6;
  }

  section#story p:nth-of-type(4) {
    order: 7;
  }

  section#story p:nth-of-type(5) {
    order: 8;
  }
}

section#buttons {
  div {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
  }

  a.button-link {
    background-color: var(--magpie-orange);
    color: black;
  }

  @media screen and (max-width: 500px) {
    div {
      flex-direction: column;
      align-items: center;
    }

    a.button-link {
      width: 80%;
    }
  }
}

footer {
  min-height: 10rem;
  color: black;
  background-color: var(--magpie-yellow);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2em;

  p {
    text-align: center;
  }

  div {
    margin-top: 4em;
    display: flex;
    gap: 2em;
    justify-content: space-evenly;
    font-size: var(--font-size-footer);

    a {
      text-decoration: none;
      max-width: 100em;
    }

    a:hover {
      text-decoration: underline;
      max-width: 100em;
    }
  }
}