@font-face {
  font-family: "Cardo";
  src:
    local("Cardo"),
    url("Cardo-Regular.ttf") format("truetype");
}

* {
  box-sizing: border-box;
}

@media (prefers-reduced-motion: no-preference) {
  :root {
    scroll-behavior: smooth;
  }
}

body {
  --content-width: min(95vw, 1200px);
  --bg-main: #f2f2f2;
  --bg-translucent-bright: #ffffffc6;
  --bg-translucent-dark: #00000090;
  --text-main: #1a1a1a;
  --text-faded: #6a6a6a;
  --section-gap: 2rem;

  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: "Cardo", serif, system-ui;
  min-height: 100svh;
  margin: 0;
  gap: var(--section-gap);
}

button {
  font-family: inherit;

  &:hover {
    cursor: pointer;
  }
}

/* UTIL */

.row {
  display: flex;
  align-items: center;
}

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

/* HEADER */

header {
  background-color: var(--bg-main);
  padding-block: 12px;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: 0px 2px 8px var(--text-faded);
}

.header {
  justify-content: space-between;
  margin: auto;
  width: var(--content-width);
}

.logo {
  height: 5rem;

  & img {
    height: 100%;
    width: 100%;
  }
}

.header-links {
  --gap: 2rem;

  font-size: larger;
  gap: var(--gap);
  list-style: none;
  text-transform: uppercase;
  padding: 0;

  & a {
    transition: 120ms;
    text-decoration: none;
    color: inherit;

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

  @media (max-width: 600px) {
    --gap: 1rem;

    font-size: medium;
  }
}

/* MAIN */

main {
  gap: var(--section-gap);
  flex: 1;
  align-self: center;
  width: var(--content-width);
}

#hero-text {
  margin-top: 4rem;
  font-size: 2.5rem;
  font-weight: normal;
  text-align: center;
}

/* GALLERY */

.gallery {
  --column-count: 2;
  --gap: 8px;

  list-style-type: none;
  padding: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--gap);

  & > li {
    --preview-size: calc(
      var(--content-width) / var(--column-count) - var(--gap)
    );

    height: var(--preview-size);
    width: var(--preview-size);
  }

  @media (min-width: 600px) {
    --column-count: 3;
    --gap: 32px;
  }
}

button:has(.product) {
  border: none;
  padding: 0;
  height: 100%;
  width: 100%;
}

.product {
  position: relative;

  & > img {
    display: block;
    height: 100%;
    width: 100%;
  }

  & > figcaption {
    position: absolute;
    background-color: var(--bg-translucent-bright);
    bottom: 0;
    padding: 6px;
    width: 100%;
    font-size: medium;
    text-align: center;
  }
}

.gallery .product {
  aspect-ratio: 1;
  margin-block: 0;
  margin-inline: auto;

  & > img {
    object-fit: cover;
  }

  &:not(:hover) > figcaption {
    visibility: hidden;
  }
}

dialog {
  border: none;
  padding: 0;

  /* Default in Chrome/Firefox is calc(100% - 6px - 2em), too narrow in mobile */
  max-height: unset;
  max-width: unset;

  &::backdrop {
    background-color: var(--bg-translucent-dark);
    backdrop-filter: blur(5px);
  }

  /* The direct child is the "modal" being interacted with */
  & > * {
    margin: 0;
  }

  & > .close-btn {
    position: fixed;
    top: 24px;
    right: 24px;
    background-color: var(--bg-translucent-bright);
    border: none;
    height: 2rem;
    width: 2rem;
    padding: 0;

    &:hover {
      background-color: var(--bg-main);
    }

    & > svg {
      height: 100%;
      width: 100%;
    }
  }
}

#image-viewer img {
  display: block;
  max-height: 95dvh;
  max-width: 95vw;
}

h2 {
  font-size: 2rem;
}

#contact {
  text-align: center;
}

#email {
  font-size: large;

  & > a {
    color: inherit;
    text-underline-offset: 4px;
    transition: 120ms;

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

/* FOOTER */

footer {
  margin-top: 3rem;
  font-size: smaller;
  text-align: center;
}
