/*
 * Cozyology shared page foundation
 * Source of truth: ../references/cozyology-web-page-rules.json
 * Load this before page-specific, namespaced CSS.
 */

.cz-page {
  /* Typography: prefer the live Shopify theme, with preview fallbacks. */
  --cz-font-body: var(--base-font-family, var(--font-body-family, "Nunito Sans", Arial, Helvetica, sans-serif));
  --cz-font-heading: var(--heading-font-family, var(--font-heading-family, "American_bt", Arial, sans-serif));
  --cz-font-logo: var(--logo-font-family, Trirong, Georgia, serif);

  /* Semantic colors: inherit live Shopify channels when available. */
  --cz-color-canvas: rgb(var(--body-bg-color, 255 255 255));
  --cz-color-text: rgb(var(--body-text-color, 51 51 51));
  --cz-color-heading: rgb(var(--body-heading-color, 23 23 23));
  --cz-color-muted: #5c5c5c;
  --cz-color-link: rgb(var(--body-link-color, 186 99 82));
  --cz-color-dark: rgb(var(--btn-bg-color, 35 35 35));
  --cz-color-dark-hover: rgb(var(--btn-bg-hover-color, 188 179 172));
  --cz-color-soft: var(--color-scheme-1, #fcfaf3);
  --cz-color-warm: var(--color-scheme-2, #faf2e6);
  --cz-color-line: rgba(0, 0, 0, var(--divider-opacity, 0.14));
  --cz-color-white: #fff;

  /* Layout. */
  --cz-container: var(--page-container-width, 1440px);
  --cz-reading: var(--reading-container-width, 720px);
  --cz-gutter: clamp(20px, 4vw, 64px);
  --cz-hero-height: 400px;
  --cz-hero-height-compact: 300px;
  --cz-hero-height-tall: 500px;

  /* Spacing scale. */
  --cz-space-1: 4px;
  --cz-space-2: 8px;
  --cz-space-3: 12px;
  --cz-space-4: 16px;
  --cz-space-5: 24px;
  --cz-space-6: 32px;
  --cz-space-7: 48px;
  --cz-space-8: 64px;
  --cz-space-9: 80px;
  --cz-space-10: 110px;

  /* Shape and motion. */
  --cz-radius-button: var(--btn-border-radius, 3px);
  --cz-radius-card: 0;
  --cz-radius-round: 999px;
  --cz-duration: 200ms;
  --cz-focus: 0 0 0 3px rgb(186 99 82 / 28%);

  overflow: clip;
  color: var(--cz-color-text);
  background: var(--cz-color-canvas);
  font-family: var(--cz-font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.cz-page,
.cz-page *,
.cz-page *::before,
.cz-page *::after {
  box-sizing: border-box;
}

.cz-page :where(h1, h2, h3, p) {
  text-wrap: pretty;
}

.cz-page :where(h1, h2, h3) {
  margin: 0;
  color: var(--cz-color-heading);
  font-family: var(--cz-font-heading);
  font-style: normal;
  font-weight: 400;
}

.cz-page :where(p) {
  margin-block: 0;
}

.cz-page :where(img, svg, video) {
  display: block;
  max-width: 100%;
}

.cz-page :where(img) {
  width: 100%;
  height: auto;
}

.cz-page :where(a) {
  color: inherit;
}

.cz-page :where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--cz-color-link);
  outline-offset: 3px;
  box-shadow: var(--cz-focus);
}

/* Containers and sections. */

.cz-container {
  width: min(100%, var(--cz-container));
  margin-inline: auto;
  padding-inline: var(--cz-gutter);
}

.cz-reading {
  width: min(100%, var(--cz-reading));
  margin-inline: auto;
}

.cz-section {
  padding-block: clamp(var(--cz-space-9), 8vw, var(--cz-space-10));
}

.cz-section--compact {
  padding-block: var(--cz-space-8);
}

.cz-section--soft {
  background: var(--cz-color-soft);
}

.cz-section--warm {
  background: var(--cz-color-warm);
}

.cz-section--dark {
  color: rgb(255 255 255 / 76%);
  background: var(--cz-color-dark);
}

.cz-section--dark :where(h1, h2, h3) {
  color: var(--cz-color-white);
}

/* Type roles. */

.cz-display {
  font-size: clamp(48px, 6vw, 88px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.cz-title {
  font-size: clamp(34px, 4.2vw, 60px);
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.cz-card-title {
  font-size: clamp(24px, 2.2vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.cz-lead {
  font-size: 18px;
  line-height: 1.65;
}

.cz-small {
  font-size: 14px;
  line-height: 1.55;
}

.cz-caption {
  font-size: 12px;
  line-height: 1.5;
}

.cz-eyebrow {
  margin: 0 0 var(--cz-space-4);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.3;
  text-transform: uppercase;
}

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

/* Spacing compositions. */

.cz-stack > * + * {
  margin-block-start: var(--cz-space-5);
}

.cz-stack--tight > * + * {
  margin-block-start: var(--cz-space-4);
}

.cz-stack--loose > * + * {
  margin-block-start: var(--cz-space-7);
}

.cz-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cz-space-5);
}

.cz-grid-2,
.cz-grid-3,
.cz-grid-4 {
  display: grid;
  gap: var(--cz-space-6);
}

.cz-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cz-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cz-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Buttons and links. */

.cz-button {
  min-height: 48px;
  padding: 14px 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--cz-radius-button);
  background-image: none !important;
  font-family: var(--cz-font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: var(--btn-letter-spacing, 0.08em);
  line-height: 1.2;
  text-align: center;
  text-decoration: none !important;
  text-transform: var(--btn-text-transform, uppercase);
  cursor: pointer;
  transition:
    color var(--cz-duration) ease,
    background-color var(--cz-duration) ease,
    border-color var(--cz-duration) ease;
}

.cz-button::before,
.cz-button::after {
  display: none !important;
  content: none !important;
}

.cz-button--primary {
  border-color: var(--cz-color-dark);
  color: var(--cz-color-white) !important;
  background: var(--cz-color-dark);
}

.cz-button--primary:hover {
  border-color: var(--cz-color-dark-hover);
  background: var(--cz-color-dark-hover);
}

.cz-button--secondary {
  border-color: var(--cz-color-dark);
  color: var(--cz-color-dark) !important;
  background: transparent;
}

.cz-button--secondary:hover {
  color: var(--cz-color-white) !important;
  background: var(--cz-color-dark);
}

.cz-button--light {
  border-color: var(--cz-color-white);
  color: var(--cz-color-dark) !important;
  background: var(--cz-color-white);
}

.cz-button[aria-disabled="true"],
.cz-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cz-text-link {
  color: var(--cz-color-link) !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

/* Reusable content components. */

.cz-hero {
  position: relative;
  height: var(--cz-hero-height);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--cz-color-white);
  background: var(--cz-color-dark);
  isolation: isolate;
}

.cz-hero--compact {
  height: var(--cz-hero-height-compact);
}

.cz-hero--tall {
  height: var(--cz-hero-height-tall);
}

.cz-hero__media,
.cz-hero__scrim {
  position: absolute;
  inset: 0;
}

.cz-hero__media {
  z-index: -2;
}

.cz-hero__media > :where(picture, img, video) {
  display: block;
  width: 100%;
  height: 100%;
}

.cz-hero__media > :where(img, video),
.cz-hero__media > picture > img {
  object-fit: cover;
  object-position: var(--cz-hero-position, 50% 50%);
}

.cz-hero__scrim {
  z-index: -1;
  background: linear-gradient(rgb(0 0 0 / 18%), rgb(0 0 0 / 34%));
}

.cz-hero__content {
  width: min(100%, var(--cz-reading));
  padding: var(--cz-space-6) var(--cz-gutter);
  text-align: center;
}

.cz-hero :where(h1, h2, h3) {
  color: inherit;
}

.cz-hero__content > * + * {
  margin-block-start: var(--cz-space-4);
}

.cz-card {
  padding: var(--cz-space-6);
  border: 1px solid var(--cz-color-line);
  border-radius: var(--cz-radius-card);
  background: var(--cz-color-canvas);
}

.cz-jump-nav {
  min-height: 50px;
  padding: 12px var(--cz-gutter);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--cz-space-5);
  overflow-x: auto;
  border-block: 1px solid var(--cz-color-line);
  white-space: nowrap;
  scrollbar-width: none;
}

.cz-jump-nav::-webkit-scrollbar {
  display: none;
}

.cz-jump-nav :where(a, span) {
  flex: 0 0 auto;
  font-size: 12px;
}

.cz-jump-nav a {
  text-decoration: none;
}

.cz-jump-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.cz-support {
  width: min(calc(100% - (2 * var(--cz-gutter))), calc(var(--cz-container) - (2 * var(--cz-gutter))));
  margin: var(--cz-space-5) auto;
  padding: var(--cz-space-6);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--cz-space-6);
  border: 1px solid var(--cz-color-line);
  background: var(--cz-color-white);
}

.cz-support .cz-title {
  font-size: clamp(28px, 3vw, 42px);
}

.cz-return {
  width: min(calc(100% - (2 * var(--cz-gutter))), calc(var(--cz-container) - (2 * var(--cz-gutter))));
  margin-inline: auto;
  padding-block: var(--cz-space-4) var(--cz-space-6);
  display: flex;
  justify-content: space-between;
  gap: var(--cz-space-5);
  color: var(--cz-color-muted);
  font-size: 12px;
}

.cz-media {
  width: 100%;
  aspect-ratio: var(--cz-media-ratio, 4 / 3);
  overflow: hidden;
  background: var(--cz-color-soft);
}

.cz-media > :where(img, video) {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cz-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.cz-video > :where(iframe, video) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Tablet. */

@media (max-width: 1050px) {
  .cz-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cz-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Mobile. */

@media (max-width: 700px) {
  .cz-page {
    --cz-gutter: 18px;
    --cz-hero-height: 320px;
    --cz-hero-height-compact: 240px;
    --cz-hero-height-tall: 360px;
  }

  .cz-section {
    padding-block: 56px;
  }

  .cz-section--compact {
    padding-block: 40px;
  }

  .cz-display {
    font-size: clamp(42px, 12vw, 58px);
  }

  .cz-title {
    font-size: 34px;
  }

  .cz-card-title {
    font-size: 24px;
  }

  .cz-lead {
    font-size: 17px;
  }

  .cz-grid-2,
  .cz-grid-3,
  .cz-grid-4 {
    grid-template-columns: 1fr;
    gap: var(--cz-space-5);
  }

  .cz-cluster {
    align-items: stretch;
    flex-direction: column;
  }

  .cz-cluster > .cz-button,
  .cz-support .cz-button {
    width: 100%;
  }

  .cz-jump-nav {
    justify-content: flex-start;
  }

  .cz-card {
    padding: var(--cz-space-5);
  }

  .cz-support {
    padding: var(--cz-space-5);
    grid-template-columns: 1fr;
    gap: var(--cz-space-5);
  }

  .cz-support .cz-title {
    font-size: 30px;
  }

  .cz-return {
    flex-direction: column;
    gap: var(--cz-space-2);
  }
}

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