/** Critical CSS for FLYER. Included on every page. */

/* --- Reset --- */
* {
  box-sizing: border-box;
  margin: 0;
}

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

/* Completes the sticky-footer pattern: without this the footer floats up on
   short pages instead of sitting at the bottom of the viewport. */
main {
  flex: 1 0 auto;
  min-width: 0;
}

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

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

/* --- Base --- */
body {
  font-family: var(--font-body-family);
  font-style: var(--font-body-style);
  font-weight: var(--font-body-weight);
  /* Typography > Body scale */
  font-size: calc(var(--font-size-base) * var(--body-scale, 1));
  line-height: 1.6;
  background-color: var(--color-bg);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading-family);
  font-style: var(--font-heading-style);
  font-weight: var(--font-heading-weight);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: calc(var(--font-size-base) * var(--heading-scale) * var(--heading-scale) * var(--heading-scale));
}
h2 {
  font-size: calc(var(--font-size-base) * var(--heading-scale) * var(--heading-scale));
}
h3 {
  font-size: calc(var(--font-size-base) * var(--heading-scale));
}

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

:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

::selection {
  background: var(--color-ink);
  color: var(--color-bg);
}

/* Offset used by sticky columns so they clear the sticky header.
   Overridden by the header section when sticky mode is on. */
:root {
  --sticky-offset: 24px;
}

/* --- Accessibility utilities --- */
.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: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--color-ink);
  color: var(--color-bg);
  border-radius: var(--radius-btn);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus-visible {
  transform: none;
}

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

/* --- Buttons --- */
.fl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  min-height: 44px;
  font: inherit;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: var(--color-on-accent);
  background: var(--color-accent);
  /* The scheme's primary_button_border role is the button colour, not the ink. */
  border: var(--btn-border-width, 1px) solid var(--color-accent);
  border-radius: var(--radius-btn);
  box-shadow: var(--btn-shadow);
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.fl-btn:hover {
  opacity: 0.85;
}
.fl-btn:disabled,
.fl-btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
}
.fl-btn--secondary {
  color: var(--color-outline-label, var(--color-ink));
  background: transparent;
  border-color: var(--color-outline-label, var(--color-ink));
}
.fl-btn--secondary:hover {
  opacity: 1;
  background: var(--color-surface);
}

/* --- Forms --- */
.fl-input,
.fl-select,
.fl-textarea {
  width: 100%;
  padding: 12px 14px;
  min-height: 44px;
  color: var(--color-ink);
  background: var(--color-bg);
  border: var(--input-border-width, 1px) solid
    rgba(var(--color-ink-rgb), var(--input-border-opacity, 0.55));
  border-radius: var(--radius-input);
  box-shadow: var(--input-shadow);
}
.fl-input:focus-visible,
.fl-select:focus-visible,
.fl-textarea:focus-visible {
  outline-offset: 0;
  border-color: var(--color-ink);
}
.fl-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875em;
  color: var(--color-muted);
}
.fl-field {
  margin-bottom: 18px;
}
.fl-form-status {
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-input);
  background: var(--color-surface);
}
.fl-form-status--error {
  border-color: currentcolor;
}

/* --- Type utilities --- */
.fl-eyebrow {
  display: block;
  margin-bottom: 10px;
  font-size: 0.75em;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.fl-section-head {
  margin-bottom: 32px;
}
.fl-section-head--center {
  text-align: center;
}

/* --- Shared primitives driven by theme settings --- */

/* Media > border / radius / shadow */
.fl-media {
  overflow: hidden;
  background: var(--color-surface);
  border: var(--media-border-width, 0) solid
    rgba(var(--color-ink-rgb), var(--media-border-opacity, 0.1));
  border-radius: var(--media-radius, 8px);
  box-shadow: var(--media-shadow);
}

/* Content containers > border / radius / shadow */
.fl-box {
  border: var(--box-border-width, 0) solid
    rgba(var(--color-ink-rgb), var(--box-border-opacity, 0));
  border-radius: var(--box-radius, 8px);
  box-shadow: var(--box-shadow);
}

/* Popups > border / radius / shadow */
.fl-popup {
  background: var(--color-bg);
  border: var(--popup-border-width, 1px) solid
    rgba(var(--color-ink-rgb), var(--popup-border-opacity, 0.1));
  border-radius: var(--popup-radius, 8px);
  box-shadow: var(--popup-shadow);
}

/* Drawers > border / shadow */
.fl-drawer {
  background: var(--color-bg);
  border-inline-start: var(--drawer-border-width, 1px) solid
    rgba(var(--color-ink-rgb), var(--drawer-border-opacity, 0.1));
  box-shadow: var(--drawer-shadow);
}

/* Typography > Heading capitalisation */
h1,
h2,
h3,
h4,
h5,
h6 {
  text-transform: var(--heading-case, none);
}

/* Animations > Reveal sections on scroll. The section is only hidden once JS
   has confirmed it can reveal it again, so no-JS visitors always see content. */
.fl-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.fl-reveal.is-revealed {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .fl-reveal {
    opacity: 1;
    transform: none;
  }
}

/* Pagination — shared by collection, search, blog and quick order list.
   Lives here because {% stylesheet %} blocks are concatenated into one file
   with no scoping: four sections each defining .fl-pagination meant the last
   one compiled silently restyled the other three. */
.fl-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}
.fl-pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  color: var(--color-muted);
  text-decoration: none;
  border-radius: var(--radius-btn);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.fl-pagination__item:hover {
  color: var(--color-ink);
  background: var(--color-surface);
}
.fl-pagination__item--current {
  color: var(--color-ink);
  border: 1px solid var(--color-ink);
}
.fl-pagination__item--label {
  padding: 0 14px;
}
.fl-pagination__gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 44px;
  color: var(--color-muted);
}

/* --- Rich text rendered from Liquid (article.content, page.content) --- */
.fl-rte > * + * {
  margin-top: 1.2em;
}

.fl-rte h2,
.fl-rte h3,
.fl-rte h4 {
  margin-top: 1.8em;
}

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

.fl-rte li + li {
  margin-top: 0.4em;
}

.fl-rte blockquote {
  margin-inline: 0;
  padding-left: 20px;
  border-left: 2px solid var(--color-line);
  color: var(--color-muted);
}

.fl-rte img {
  width: 100%;
  border-radius: var(--radius-card);
}

.fl-rte a {
  text-decoration: underline;
}

.fl-rte table {
  width: 100%;
  border-collapse: collapse;
}

.fl-rte :is(th, td) {
  padding: 10px 12px;
  border: 1px solid var(--color-line);
  text-align: left;
}

/* --- Badges --- */
.fl-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75em;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: var(--badge-radius, 40px);
  background: var(--color-bg);
  color: var(--color-ink);
}

/* --- Product card (markup in snippets/product-card.liquid) --- */
.fl-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  /* Fill the grid row so the quick-add button sits on the same baseline across
     a row, whatever the title length. */
  height: 100%;
  text-align: var(--card-text-align, left);
  border: var(--card-border-width, 0) solid
    rgba(var(--color-ink-rgb), var(--card-border-opacity, 0.1));
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* "Card" style wraps the whole tile in the card colour scheme. */
.fl-card--boxed {
  padding: var(--card-image-padding, 0);
  background: var(--color-bg);
}

/* Theme setting: Animations > Hover effect */
.fl-card--lift:hover {
  transform: translateY(-4px);
}

.fl-card__media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--color-surface);
}
.fl-card__media img,
.fl-card__placeholder {
  width: 100%;
  aspect-ratio: var(--card-ratio);
  object-fit: cover;
  transition: transform 0.4s ease;
}

/* Shopify's placeholder SVGs inherit `fill`, which defaults to solid black. */
.fl-card__placeholder {
  fill: var(--color-muted);
  opacity: 0.35;
}
/* Theme setting: Animations > Hover effect (image zoom) */
.fl-card--zoom:hover .fl-card__media img {
  transform: scale(1.03);
}
/* Corner comes from the Badges theme setting; the four rules below are toggled
   by the position class written on the card. */
.fl-card__badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
}
.fl-card__badges--top-right {
  top: 10px;
  right: 10px;
  left: auto;
}
.fl-card__badges--bottom-left {
  top: auto;
  bottom: 10px;
  left: 10px;
}
.fl-card__badges--bottom-right {
  top: auto;
  right: 10px;
  bottom: 10px;
  left: auto;
}
.fl-card__link {
  text-decoration: none;
}
.fl-card__link::after {
  content: '';
  position: absolute;
  inset: 0;
}
.fl-card__title {
  font-size: 1em;
  font-weight: 500;
}
.fl-card__vendor {
  font-size: 0.8125em;
  color: var(--color-muted);
}
.fl-card__info {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  gap: 4px;
}
.fl-card__quick {
  position: relative;
  z-index: 1;
  /* Pushed to the bottom of the card so buttons line up across a row. */
  margin-top: auto;
  padding-top: 8px;
  align-self: flex-start;
}

/* --- Price (markup in snippets/price.liquid) --- */
.fl-price {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}
.fl-price__compare {
  color: var(--color-muted);
  text-decoration: line-through;
}
.fl-price--sale .fl-price__current {
  font-weight: 600;
}
.fl-price__unit {
  font-size: 0.8125em;
  color: var(--color-muted);
}

/* --- Grid helper for product listings --- */
.fl-product-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols, 4), minmax(0, 1fr));
  gap: var(--grid-gap-y, 28px) var(--grid-gap-x, 20px);
}
@media (max-width: 989px) {
  .fl-product-grid {
    grid-template-columns: repeat(var(--grid-cols-tablet, 3), minmax(0, 1fr));
  }
}
@media (max-width: 749px) {
  .fl-product-grid {
    grid-template-columns: repeat(var(--grid-cols-mobile, 2), minmax(0, 1fr));
    gap: 24px 12px;
  }
}

/* --- Section layout grid (full-width | constrained) --- */
.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);

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

.shopify-section > * {
  grid-column: 2;
}

/* Layout > Space between sections. Main-template sections carry their own
   padding, so this setting only adds separation and is safe to leave at 0. */
main > .shopify-section + .shopify-section {
  margin-top: var(--section-spacing, 0);
}

.shopify-section > .full-width {
  grid-column: 1 / -1;
}

/* --- Overlay primitives (drawers, dialogs) --- */
.fl-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgb(0 0 0 / 40%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.fl-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
