/** 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;
}

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

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

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;
}

:is(p, h1, h2, h3, h4, h5, h6):first-child,
:empty:first-child + :where(p, h1, h2, h3, h4, h5, h6) {
  margin-block-start: 0;
}

:is(p, h1, h2, h3, h4, h5, h6):last-child,
:where(p, h1, h2, h3, h4, h5, h6) + :has(+ :empty:last-child) {
  margin-block-end: 0;
}

/** Theme styles below */

/** 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;
}

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

/* ---------- Galerie foundation ---------- */
html {
  -webkit-text-size-adjust: 100%;
  /* Theme settings > Typography > Body text size (the whole rem scale follows). */
  font-size: calc(100% * var(--body-scale, 1));
}

body {
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-body--family);
  font-style: var(--font-body--style);
  font-weight: var(--font-body--weight);
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.heading {
  font-family: var(--font-heading--family);
  font-style: var(--font-heading--style);
  font-weight: var(--font-heading--weight);
  line-height: 1.02;
  letter-spacing: -0.01em;
}

h1,
.heading--xl {
  font-size: calc(clamp(2.75rem, 1.6rem + 5vw, 6.5rem) * var(--heading-scale));
}

h2,
.heading--l {
  font-size: calc(clamp(2rem, 1.4rem + 2.6vw, 3.75rem) * var(--heading-scale));
}

/* Small uppercase caption used for room numbers, label metadata, nav. */
.eyebrow {
  font-family: var(--font-body--family);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

:focus-visible {
  outline: 1px solid currentcolor;
  outline-offset: 3px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 1px solid var(--color-button, var(--color-foreground));
  border-radius: var(--style-border-radius-inputs);
  /* Button colours come from the section's colour scheme. */
  background: var(--color-button, var(--color-foreground));
  color: var(--color-button-text, var(--color-background));
  font: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.button:hover {
  background: transparent;
  color: var(--color-button, var(--color-foreground));
}

.button--ghost {
  border-color: var(--color-foreground);
  background: transparent;
  color: var(--color-foreground);
}

.button--ghost:hover {
  border-color: var(--color-button, var(--color-foreground));
  background: var(--color-button, var(--color-foreground));
  color: var(--color-button-text, var(--color-background));
}

.button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* The gallery "red dot": marks sold works. */
.sold-dot {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--color-sold-dot);
  vertical-align: middle;
}

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

.store-clock {
  display: inline-flex;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  transform: translateY(-200%);
}

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

main {
  flex: 1;
}

.form-error {
  color: var(--color-sold-dot);
}

[aria-busy='true'] {
  cursor: progress;
  opacity: 0.6;
}

/* Shared full-screen / side panel dialogs (menu, search, cart). */
dialog {
  --color-foreground: var(--color-ink);
  --color-foreground-muted: var(--color-ink-muted);
  --color-hairline: var(--color-ink-hairline);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.4);
}

/* Pause control for self-moving content (WCAG 2.2.2). */
.is-paused,
.is-paused * {
  animation-play-state: paused !important;
}

.motion-toggle {
  padding: 0.25rem 0.5rem;
  border: 1px solid currentcolor;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.motion-toggle[data-paused='true'] .motion-toggle__pause,
.motion-toggle[data-paused='false'] .motion-toggle__play {
  display: none;
}

/* Shopify wraps every theme block in div.shopify-block. Let the block's own
   element be the grid/flex/list item, so layouts work with or without it. */
.shopify-block:not(.shopify-app-block) {
  display: contents;
}

/* Without JavaScript there is no pause control, so nothing animates. */
html:not(.js) .motion-toggle {
  display: none;
}

/* Preloader (optional brand moment). */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--color-ink);
  color: var(--color-background);
  transition: opacity 400ms ease;
}

.preloader[hidden] {
  display: none;
}

.preloader.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.preloader__mark {
  font-family: var(--font-heading--family);
  font-size: calc(clamp(2.5rem, 1rem + 6vw, 6rem) * var(--heading-scale));
  animation: preloader-in 600ms ease both;
}

@keyframes preloader-in {
  from {
    opacity: 0;
    letter-spacing: 0.08em;
  }
}
