/* Shared CMS block styles included by all themes */

/*
 * Derived tokens live on body, not :root, so they follow the per-site accent,
 * surface and ink chosen in the builder (those are set as inline body styles).
 */
body {
  --muted: color-mix(in srgb, var(--ink) 76%, transparent);
  --card: color-mix(in srgb, var(--surface) 92%, white);
  --soft: color-mix(in srgb, var(--surface) 88%, var(--ink));
  --line: color-mix(in srgb, var(--ink) 20%, transparent);
}

.cms-section { padding: clamp(2.5rem, 6vw, 5rem) 0; color: var(--ink); }
.cms-section.pad-sm { padding: 2rem 0; }
.cms-section.pad-lg { padding: clamp(3.5rem, 8vw, 7rem) 0; }
.cms-section.align-center { text-align: center; }
.cms-section h1, .cms-section h2, .cms-section h3 { color: inherit; }
.cms-section .muted, .cms-section .rich-body, .cms-section figcaption { color: inherit; opacity: .78; }

/* Tones are theme-derived section backgrounds, so a page can alternate without
   anyone picking hex values in the builder. */
.cms-section.tone-default { background: transparent; }
.cms-section.tone-tinted { background: var(--soft); }
.cms-section.tone-dark { background: var(--ink); }
.cms-section.tone-image {
  position: relative;
  isolation: isolate;
  background-image: var(--tone-image);
  background-size: cover;
  background-position: center;
}
.cms-section.tone-image::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, .58);
}

/* Sections with a dark tone or custom dark background get light text and borders. */
.cms-section.on-dark { color: #fff; --line: rgba(255, 255, 255, .28); }
.cms-section.on-dark .btn { background: #fff; color: #111; border-color: #fff; }
.cms-section.on-dark .text-link, .cms-section.on-dark a { color: inherit; }
.cms-section.on-dark .cms-highlights.cards article,
.cms-section.on-dark .cms-reviews blockquote { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .24); }

/* A dark tone paints with the theme ink, so its text has to be the theme
   surface — palettes like Midnight already ship a light ink. */
.cms-section.tone-dark.on-dark { color: var(--surface); }
.cms-section.tone-dark.on-dark .btn { background: var(--surface); color: var(--ink); border-color: var(--surface); }

.narrow-ish { width: min(820px, calc(100% - 40px)); margin: 0 auto; }
.rich-body { font-size: 1.05rem; line-height: 1.7; }
.rich-body p { margin: 0 0 1rem; }

.cms-hero { position: relative; isolation: isolate; overflow: hidden; display: grid; align-items: end; }
.cms-hero.hero-h-sm { min-height: 42vh; }
.cms-hero.hero-h-md { min-height: 58vh; }
.cms-hero.hero-h-lg { min-height: 78vh; }
.cms-hero-media { position: absolute; inset: 0; z-index: -1; background: var(--soft); }
.cms-hero-media img { width: 100%; height: 100%; object-fit: cover; }
/* Flat tint for the whole image, plus a bottom scrim so copy stays readable
   even over bright photographs. */
.cms-hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, .18) 52%, rgba(0, 0, 0, 0) 78%),
    color-mix(in srgb, #000 calc(var(--overlay, .4) * 100%), transparent);
}
.cms-hero.has-image .cms-hero-copy { color: #fff; padding-bottom: 3rem; }
.cms-hero.has-image .cms-hero-copy h1,
.cms-hero.has-image .cms-hero-copy .lead,
.cms-hero.has-image .cms-hero-copy .eyebrow { color: #fff; opacity: 1; text-shadow: 0 1px 24px rgba(0, 0, 0, .45); }
.cms-hero.has-image .cms-hero-copy .lead { opacity: .94; }
.cms-hero.has-image .btn { background: #fff; color: #111; border-color: #fff; }
.cms-hero.has-image .text-link { color: #fff; }
.cms-hero-copy { padding: 3rem 0; }
.cms-hero-copy .lead { font-size: clamp(1.05rem, 2vw, 1.35rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 1.5rem; }

.cms-split { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.cms-split.image-left { grid-template-columns: .95fr 1.05fr; }
.cms-split.image-left .cms-split-media { order: -1; }
.cms-split-media img, .cms-image img { width: 100%; display: block; object-fit: cover; border-radius: var(--radius, 14px); background: var(--soft); }
.cms-image.rounded img { border-radius: calc(var(--radius, 14px) + 4px); }
.cms-image figcaption { margin-top: .75rem; font-size: .9rem; }

/* Responsive layout-builder rows. Desktop follows the selected 1–3 column
   count; mobile stacks by default without requiring a second layout. */
.cms-columns-grid {
  display: grid;
  grid-template-columns: repeat(var(--cms-columns, 2), minmax(0, 1fr));
}
.cms-columns-grid.gap-sm { gap: clamp(.75rem, 2vw, 1.25rem); }
.cms-columns-grid.gap-md { gap: clamp(1.25rem, 4vw, 3rem); }
.cms-columns-grid.gap-lg { gap: clamp(2rem, 6vw, 5rem); }
.cms-columns-grid.align-start { align-items: start; }
.cms-columns-grid.align-center { align-items: center; }
.cms-columns-grid.align-end { align-items: end; }
.cms-columns-grid.align-stretch { align-items: stretch; }
/* Three narrow columns get cramped before the mobile stack kicks in. */
@media (min-width: 861px) and (max-width: 1080px) {
  .cms-columns-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.cms-column { min-width: 0; }
.cms-column-text .btn { margin-top: 1rem; }
.cms-column-image figure { margin: 0; }
.cms-column-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  border-radius: var(--radius, 14px);
  background: var(--soft);
}
.cms-column-image figcaption {
  margin-top: .65rem;
  color: inherit;
  opacity: .72;
  font-size: .85rem;
}
.cms-gallery { display: grid; gap: 12px; }
.cms-gallery.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cms-gallery.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cms-gallery.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cms-gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius, 12px); background: var(--soft); }
.cms-highlights.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.cms-highlights.cards article { background: var(--card, #fff); border: 1px solid var(--line); border-radius: var(--radius, 14px); padding: 1.1rem; }
.cms-highlights.strip { display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: center; }
.cms-highlights.strip article { padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 999px; }
.cms-menu.list { display: grid; gap: 12px; }
.cms-menu.list article { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cms-menu.list img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; background: var(--soft); }
.cms-menu.list h3 { margin: 0 0 .2rem; font-size: 1.05rem; }
.cms-menu.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.cms-menu.grid article { background: var(--card, #fff); border: 1px solid var(--line); border-radius: var(--radius, 14px); overflow: hidden; }
.cms-menu.grid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--soft); }
.cms-menu.grid article > div, .cms-menu.grid article > strong { padding: .85rem 1rem; display: block; }
.cms-reviews { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.cms-reviews blockquote { margin: 0; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius, 14px); background: var(--card, #fff); }
.cms-visit { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: stretch; }
.cms-cta { padding: 1rem 0; }
.cms-form { display: grid; gap: 12px; margin-top: 1.25rem; }
.cms-form label { display: grid; gap: 6px; font-size: .9rem; }
.cms-form input, .cms-form textarea, .cms-form select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: .7rem .85rem; background: #fff; color: #111;
}
.cms-blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.cms-blog-grid img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--radius, 14px); background: var(--soft); }
.blog-article .lead { font-size: 1.2rem; opacity: .8; }

.section-head { margin-bottom: 1.75rem; }
.section-head h2 { margin: 0 0 .35rem; }

@media (max-width: 860px) {
  .cms-split, .cms-split.image-left, .cms-visit { grid-template-columns: 1fr; }
  .cms-columns-grid.stack-mobile { grid-template-columns: 1fr; }
  .cms-split.image-left .cms-split-media { order: 0; }
  .cms-gallery.cols-3, .cms-gallery.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cms-menu.list article { grid-template-columns: 1fr auto; }
  .cms-menu.list img { display: none; }
  .cms-hero.hero-h-lg { min-height: 66vh; }
}
