/*
 * PhoneStamp sites, core CSS for markup v1. It loads on every page before the design, which is either the classic
 * design (classic.css) or the site's own CSS, and holds only what every design needs and that looks like nothing:
 * the fonts, the design properties' fallbacks, a light normalization, focus outlines, the skip link and the
 * mechanics of the menus, the gallery's lightbox, the app banner and the cookie banner.
 *
 * Every selector is inside :where(), so it has no specificity but that of a pseudo-element after it, and the core loads
 * first, so every rule of the design beats it. What a design
 * must not break by accident is locked with !important: [hidden], a closed popover and the menu switch at 40rem; a
 * design overrides a lock only with an !important of its own. The core is part of the markup contract: within v1
 * it only gains additions, since every site's own CSS runs on it. Every URL is under /static/.
 */

@font-face {
  font-family: "Lato";
  src: url("/static/sites/fonts/lato/Lato-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Lato";
  src: url("/static/sites/fonts/lato/Lato-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Lato";
  src: url("/static/sites/fonts/lato/Lato-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url("/static/sites/fonts/playfair-display/PlayfairDisplay.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url("/static/sites/fonts/playfair-display/PlayfairDisplay-Italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}

:where(:root) {
  --ps-primary: #1f2937;
  --ps-secondary: #2563eb;
  /* Black or white, whichever reads on the colour; browsers without relative colours inherit the text colour */
  --ps-on-primary: oklch(from var(--ps-primary) clamp(0, (0.65 - l) * 1000, 1) 0 0);
  --ps-on-secondary: oklch(from var(--ps-secondary) clamp(0, (0.65 - l) * 1000, 1) 0 0);
  /* Neutral colours follow the page's color-scheme, which comes from the app's theme */
  --ps-surface: light-dark(#ffffff, #121212);
  --ps-text: light-dark(#6c757d, #adb5bd);
  --ps-heading: light-dark(#212529, #f8f9fa);
  --ps-border: light-dark(rgb(33 37 41 / 0.12), rgb(248 249 250 / 0.15));
  /* Header, footer and hero each have their own surface and text colour, dark in both themes by default; the
     home page's header lies over the hero, so the two go together there */
  --ps-header-surface: #000000;
  --ps-on-header: #ffffff;
  --ps-footer-surface: #000000;
  --ps-on-footer: #ffffff;
  --ps-hero-surface: #000000;
  --ps-on-hero: #ffffff;
  --ps-heading-weight: 400;
  --ps-font-body: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ps-font-heading: "Playfair Display", Georgia, "Times New Roman", serif;
  /* The brand colours as text on the page: dark enough on a light page and light enough on a dark one,
     whatever the colour; browsers without relative colours use the colour as it is */
  --ps-link: var(--ps-primary);
  --ps-link: light-dark(oklch(from var(--ps-primary) min(l, 0.5) c h), oklch(from var(--ps-primary) max(l, 0.75) c h));
  --ps-link-hover: var(--ps-secondary);
  --ps-link-hover: light-dark(oklch(from var(--ps-secondary) min(l, 0.5) c h), oklch(from var(--ps-secondary) max(l, 0.75) c h));
  --ps-radius: 0.25rem;
  --ps-gap: 1.5rem;
  --ps-width: 72rem;
}

/* Browsers without light-dark() get the light theme */
@supports not (color: light-dark(#000, #fff)) {
  :where(:root) {
    --ps-surface: #ffffff;
    --ps-text: #6c757d;
    --ps-heading: #212529;
    --ps-border: rgb(33 37 41 / 0.12);
  }
}

/* Normalization */

:where(*),
:where(*)::before,
:where(*)::after {
  box-sizing: border-box;
}

:where(body) {
  margin: 0;
}

:where(img) {
  max-width: 100%;
  height: auto;
}

/* Locked: an element the server hides stays hidden, whatever display a design gives its class */
:where([hidden]) {
  display: none !important;
}

:where(:focus-visible) {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

:where(.ps-skip-link) {
  position: absolute;
  left: -9999px;
}

:where(.ps-skip-link:focus) {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--ps-surface);
}

/* Menu: the direct list on wide screens and the menu that opens on narrow ones, never both. Locked, so a design that
   sets display on .ps-nav__list or .ps-nav__mobile does not show the menu twice */

:where(.ps-nav__list, .ps-languages__list) {
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.ps-nav__toggle, .ps-languages__toggle) {
  cursor: pointer;
}

@media not all and (max-width: 40rem) {
  :where(.ps-nav__mobile) {
    display: none !important;
  }
}

@media (max-width: 40rem) {
  :where(.ps-nav > .ps-nav__list) {
    display: none !important;
  }

  :where(.ps-nav__mobile) {
    position: relative;
  }

  /* The open menu lies over the page under its toggle */
  :where(.ps-nav__list--mobile) {
    position: absolute;
    right: 0;
    z-index: 5;
    background: var(--ps-header-surface);
    color: var(--ps-on-header);
  }
}

:where(.ps-languages) {
  position: relative;
}

:where(.ps-languages__list) {
  position: absolute;
  right: 0;
  z-index: 5;
  background: var(--ps-header-surface);
  color: var(--ps-on-header);
}

/* App banner on phones, linking the app in its store; wide screens do not show it. It is kept at the bottom of the
   screen, and the page leaves room for it */

:where(.ps-app-banner) {
  display: none;
}

@media (max-width: 40rem) {
  :where(.ps-app-banner) {
    position: fixed;
    inset: auto 0 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--ps-surface);
    color: var(--ps-text);
    border-top: 1px solid var(--ps-border);
  }

  :where(.ps-body:has(> .ps-app-banner)) {
    padding-bottom: 4rem;
  }
}

/* Gallery: each image opens its lightbox, a popover over the page */

:where(.ps-gallery) {
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.ps-gallery__open) {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

:where(.ps-lightbox) {
  max-width: 90vw;
  max-height: 90vh;
  padding: 0;
  border: 0;
  background: transparent;
}

:where(.ps-lightbox)::backdrop {
  background: rgb(0 0 0 / 0.85);
}

:where(.ps-lightbox__close) {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

/* Locked: a closed popover stays closed, whatever display a design gives its class */
@supports selector(:popover-open) {
  :where([popover]:not(:popover-open)) {
    display: none !important;
  }
}

/* Without popovers the lightboxes would show every image a second time under the gallery, so they are hidden, and
   the gallery's images open nothing */
@supports not selector(:popover-open) {
  :where(.ps-lightbox) {
    display: none !important;
  }

  :where(.ps-gallery__open) {
    pointer-events: none;
    cursor: default;
  }
}

/* Cookie banner: the dialog at the bottom of the screen, and the button that opens it again, neutral and usable
   under any design */

:where(.ps-cookie) {
  position: fixed;
  inset: auto 1rem 1rem;
  z-index: 20;
  display: flex;
  justify-content: center;
}

:where(.ps-cookie__dialog) {
  position: static;
  width: 100%;
  max-width: 40rem;
  margin: 0;
  padding: 1.5rem;
  border: 1px solid var(--ps-border);
  border-radius: var(--ps-radius);
  background: var(--ps-surface);
  color: var(--ps-text);
  box-shadow: 0 0.5rem 2rem rgb(0 0 0 / 0.25);
}

:where(.ps-cookie__accept, .ps-cookie__reject, .ps-cookie__settings, .ps-cookie__open) {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--ps-border);
  border-radius: var(--ps-radius);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

:where(.ps-cookie__accept) {
  border-color: var(--ps-primary);
  background: var(--ps-primary);
  color: var(--ps-on-primary);
}

:where(.ps-cookie__settings) {
  border-color: transparent;
  text-decoration: underline;
}

:where(.ps-cookie__open) {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 19;
  background: var(--ps-surface);
}
