/** Critical CSS for the theme. This file is included on every page. */

/* Reset styles inspired by https://www.joshwcomeau.com/css/custom-css-reset/ */
* {
  box-sizing: border-box;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100svh;
  font-family: var(--font-body);
  font-weight: var(--font-body-weight);
  font-size: 1.0625rem;
  line-height: 1.55;
  background-color: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

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

main {
  flex: 1 0 auto;
}

main:focus {
  outline: none;
}

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

input,
textarea,
select,
button {
  font: inherit;
  color: inherit;
}

input,
textarea,
select {
  border-radius: var(--radius);
}

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

dialog {
  background-color: var(--color-bg);
  color: var(--color-text);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

p {
  text-wrap: pretty;
}

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

p:empty {
  display: none;
}

/** Type */
h1,
h2,
.display {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  text-transform: var(--heading-transform);
  line-height: 0.92;
  letter-spacing: 0.005em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.75rem, 6vw, 4.75rem);
}

h2 {
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
}

h3,
h4 {
  font-size: 1.125rem;
  font-weight: var(--font-body-weight-bold);
  line-height: 1.3;
}

.display {
  line-height: 0.8;
  white-space: nowrap;
}

fit-text {
  display: inline-block;
}

.muted {
  color: var(--color-muted);
}

.text-small {
  font-size: 0.875rem;
}

.rte > * + * {
  margin-top: 1em;
}

.rte ul,
.rte ol {
  padding-left: 1.2em;
}

/** Buttons */
.button {
  --button-bg: var(--color-text);
  --button-fg: var(--color-bg);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 3.25rem;
  padding: 0 1.75rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--button-bg);
  color: var(--button-fg);
  font-weight: var(--font-body-weight-bold);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.button:active {
  transform: scale(0.98);
}

.button[disabled],
.button[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.button--full {
  width: 100%;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  cursor: pointer;
}

/** Basket confirmation */
.toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  z-index: 60;
  width: max-content;
  max-width: min(34rem, calc(100% - 2rem));
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius);
  background: var(--color-text);
  color: var(--color-bg);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.2);
  transform: translateX(-50%);
  animation: toast-in 0.25s cubic-bezier(0.2, 0.75, 0.1, 1);
}

.toast:empty {
  display: none;
}

.toast a {
  font-weight: var(--font-body-weight-bold);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, -0.75rem);
  }
}

/** Accessibility */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--color-text);
  color: var(--color-bg);
  border-radius: var(--radius);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

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

/** Section layout utilities */

/**
 * Setup a grid that enables both full-width and constrained layouts
 * depending on the class of the child elements.
 *
 * By default, a minimum content margin is set on the left and right
 * sides of the section and the content is centered in the viewport to
 * not exceed the maximum page width.
 *
 * When a child element is given the `full-width` class, it will span
 * the entire viewport.
 */
.shopify-section {
  --content-width: min(
    calc(var(--page-width) - var(--page-margin) * 2),
    calc(100% - var(--page-margin) * 2)
  );
  --content-margin: minmax(var(--page-margin), 1fr);
  --content-grid: var(--content-margin) var(--content-width) var(--content-margin);

  /* This is required to make <img> elements work as background images */
  position: relative;
  grid-template-columns: var(--content-grid);
  display: grid;
  width: 100%;
}

/* Child elements, by default, are constrained to the central column of the grid. */
.shopify-section > * {
  grid-column: 2;
}

/* Child elements that use the full-width utility class span the entire viewport. */
.shopify-section > .full-width {
  grid-column: 1 / -1;
}

/* A full-width element that re-centres its own content on the page grid. */
.page-grid {
  display: grid;
  grid-template-columns: var(--content-grid);
}

.page-grid > * {
  grid-column: 2;
}

.section-spacing {
  padding-block: clamp(3rem, 8vw, 6.5rem);
}
