/* Aurora — default theme for generated CMS sites.
   Variables (--color-*, --font-*, --radius, --container) are injected inline by
   base.html from the live design tokens, so this file stays generic. */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior-y: none; }

body {
  margin: 0;
  font-family: var(--font-body, system-ui, sans-serif);
  color: var(--color-text, #0F172A);
  background: var(--color-bg, #fff);
  line-height: 1.6;
}

h1, h2, h3, h4 { font-family: var(--font-heading, inherit); line-height: 1.2; }

a { color: var(--color-primary, #2563EB); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.container {
  width: 100%;
  max-width: var(--container, 960px);
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header / nav ── */
.site-header {
  border-bottom: 1px solid rgba(0,0,0,.08);
  position: sticky; top: 0; background: var(--color-bg, #fff); z-index: 50;
}
.site-header > .container {
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
.site-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 16px;
}
.site-brand { font-family: var(--font-heading); font-weight: 700; font-size: 1.25rem; color: var(--color-secondary, #1E293B); }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-nav a {
  color: var(--color-text); display: inline-flex; align-items: center;
  min-height: 40px; font-weight: 500;
}
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-right: -8px; padding: 0;
  border: 0; background: none; color: var(--color-text); cursor: pointer;
}

.site-main { min-height: 60vh; }

/* ── Footer ── */
.site-footer {
  margin-top: 64px; padding: 32px 0; border-top: 1px solid rgba(0,0,0,.08);
  color: #64748b; font-size: .9rem;
}

/* ── Blocks ── */
.blk-inner { width: 100%; max-width: var(--container, 960px); margin: 0 auto; padding: 0 20px; }

.blk-hero {
  padding: 96px 0; text-align: center; color: #fff;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  background-size: cover; background-position: center;
}
.blk-hero-title { font-size: clamp(2rem, 5vw, 3.25rem); margin: 0 0 .4em; }
.blk-hero-sub { font-size: clamp(1rem, 2.5vw, 1.25rem); opacity: .92; margin: 0 auto 1.5em; max-width: 640px; }

.blk-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 12px 26px; border-radius: var(--radius, 10px);
  background: var(--color-accent, #F59E0B); color: #fff; font-weight: 600;
}
.blk-btn:hover { text-decoration: none; filter: brightness(.95); }

.blk { padding: 56px 0; }
.blk-heading { text-align: center; font-size: clamp(1.5rem, 3vw, 2.25rem); margin: 0 0 1.5em; }

.blk-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.blk-card { padding: 24px; border: 1px solid rgba(0,0,0,.08); border-radius: var(--radius, 10px); }
.blk-card h3 { margin-top: 0; }

.blk-cta { text-align: center; background: #f8fafc; }
.blk-gallery-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.blk-spacer-sm { height: 24px; padding: 0; }
.blk-spacer-md { height: 48px; padding: 0; }
.blk-spacer-lg { height: 96px; padding: 0; }

.ambivo-widget { max-width: 560px; margin: 0 auto; }
.blk-widget-blocked { color: #b91c1c; text-align: center; }

/* Contact form block */
.blk-form-el { max-width: 560px; margin: 0 auto; display: grid; gap: 14px; }
.blk-form-row { display: grid; gap: 6px; font-weight: 500; }
.blk-form-row input, .blk-form-row textarea {
  width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: var(--radius, 10px);
  font: inherit; min-height: 44px;
}
.blk-form-row textarea { min-height: 120px; }
.blk-form-msg { text-align: center; font-weight: 500; }

/* ── Prose (rich text / blog body) ── */
.blk-prose { font-size: 1.05rem; }
.blk-prose h2, .blk-prose h3 { margin-top: 1.6em; }
.blk-prose img { border-radius: var(--radius, 10px); margin: 1.2em 0; }
.blk-prose pre { background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 8px; overflow-x: auto; }
.blk-prose code { font-family: ui-monospace, monospace; }

/* ── Blog ── */
.blog-index { padding: 56px 0; }
.blog-title { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 1em; }
.post-list { display: grid; gap: 32px; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.post-card-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius, 10px); }
.post-card-title { font-size: 1.25rem; margin: .6em 0 .2em; }
.post-card-date { color: #64748b; font-size: .85rem; }
.post-card-excerpt { color: #334155; }
.post-card-tags, .post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tag {
  font-size: .8rem; padding: 4px 10px; border-radius: 999px;
  background: #eef2ff; color: var(--color-primary, #2563EB);
}

.post { padding: 56px 0; }
.post-title { font-size: clamp(1.9rem, 5vw, 3rem); }
.post-meta { color: #64748b; display: flex; gap: 14px; margin-bottom: 1.5em; }
.post-hero { width: 100%; border-radius: var(--radius, 10px); margin-bottom: 2em; }
.post-back { margin-top: 3em; }

/* ── Mobile nav ── */
@media (max-width: 768px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; flex-wrap: nowrap; gap: 0;
    background: var(--color-bg, #fff);
    border-bottom: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 10px 24px rgba(0,0,0,.10);
    padding: 6px max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
  }
  .site-header.nav-open .site-nav { display: flex; }
  .site-nav a { min-height: 44px; width: 100%; border-top: 1px solid rgba(0,0,0,.06); }
  .site-nav a:first-child { border-top: 0; }
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .blk-hero { padding: 64px 0; }
  .blk { padding: 40px 0; }
}

/* Responsive safety net: keep raw-HTML / embed / prose content inside the
   viewport on phones (audit P1/P2 — iframes with width attrs and markdown
   tables were the only horizontal-overflow risks). */
.blk-html iframe, .blk-html img, .blk-html video, .blk-html embed,
.ambivo-widget iframe { max-width: 100%; }
.blk-prose { overflow-wrap: break-word; }
.blk-prose table { display: block; width: 100%; overflow-x: auto; }

/* ── Carousel block (swipeable, CSS scroll-snap — no JS) ── */
.blk-carousel-track { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; padding-bottom: 8px; scrollbar-width: thin; }
.blk-carousel-item { flex: 0 0 82%; max-width: 640px; scroll-snap-align: center; margin: 0; }
.blk-carousel-item img { width: 100%; height: auto; border-radius: var(--radius, 10px); display: block; }
.blk-carousel-item figcaption { margin-top: 8px; font-size: .9rem; opacity: .75; }
@media (min-width: 768px) { .blk-carousel-item { flex-basis: 48%; } }

/* ── Block animations (scroll-driven entrance + hover lift — no JS) ── */
@keyframes blk-fade-up { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes blk-zoom-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@supports (animation-timeline: view()) {
  .anim-fade-up, .anim-zoom-in { animation: linear both; animation-timeline: view(); animation-range: entry 0% entry 50%; }
  .anim-fade-up { animation-name: blk-fade-up; }
  .anim-zoom-in { animation-name: blk-zoom-in; }
}
.hover-lift { transition: transform .2s ease, box-shadow .2s ease; }
.hover-lift:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,.12); }
@media (prefers-reduced-motion: reduce) {
  .anim-fade-up, .anim-zoom-in { animation: none; }
  .hover-lift { transition: none; }
}


/* ── steps: a timed sequence (see _render_steps) ─────────────────────────────
   `data-amb-state` defaults to "done" in the markup, so with no JS every step is
   fully visible — the fallback is a finished sequence, never a blank row. */
.blk-steps-track { list-style: none; margin: 28px 0 0; padding: 0; display: flex;
  gap: 20px; flex-wrap: wrap; }
.blk-step { flex: 1 1 160px; min-width: 150px; position: relative;
  transition: opacity .45s ease, transform .45s ease; }
.blk-step[data-amb-state="upcoming"] { opacity: .32; transform: translateY(4px); }
.blk-step[data-amb-state="active"]   { opacity: 1; transform: none; }
.blk-step[data-amb-state="done"]     { opacity: 1; transform: none; }
.blk-step-n { display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--primary, #6d28d9); color: #fff; margin-bottom: 10px; }
.blk-step[data-amb-state="upcoming"] .blk-step-n { background: var(--muted, #d4d4d8); color: #52525b; }
.blk-step-icon { display: block; font-size: 22px; line-height: 1; margin-bottom: 6px; }
.blk-step-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.blk-step-body { font-size: 13px; line-height: 1.55; margin: 0; opacity: .8; }
.blk-steps-dots { display: flex; gap: 6px; margin-top: 22px; }
.blk-step-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--muted, #d4d4d8);
  transition: background .3s ease, width .3s ease; }
.blk-step-dot[data-amb-state="done"]   { background: var(--primary, #6d28d9); }
.blk-step-dot[data-amb-state="active"] { background: var(--primary, #6d28d9); width: 18px; }
@media (prefers-reduced-motion: reduce) {
  .blk-step { transition: none; opacity: 1; transform: none; }
}


/* ── tabs + accordion (see _render_tabs / _render_accordion) ─────────────────
   Panels are `hidden` rather than removed, so a no-JS visitor sees the first
   tab and every FAQ answer stays in the markup for search engines. */
.blk-tablist { display: flex; gap: 4px; flex-wrap: wrap; margin: 20px 0 18px;
  border-bottom: 1px solid var(--border, #e4e4e7); }
.blk-tab { appearance: none; border: 0; background: none; cursor: pointer; font: inherit;
  padding: 10px 16px; border-bottom: 2px solid transparent; color: inherit; opacity: .65;
  border-radius: 8px 8px 0 0; }
.blk-tab:hover { opacity: .9; }
.blk-tab[aria-selected="true"] { opacity: 1; font-weight: 600;
  border-bottom-color: var(--primary, #6d28d9); color: var(--primary, #6d28d9); }
.blk-tab:focus-visible { outline: 2px solid var(--primary, #6d28d9); outline-offset: 2px; }
.blk-tabpane { line-height: 1.65; }

.blk-acc-row { border-bottom: 1px solid var(--border, #e4e4e7); }
.blk-acc-q { appearance: none; border: 0; background: none; cursor: pointer; font: inherit;
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 0; text-align: left; font-weight: 600; color: inherit; }
.blk-acc-q:focus-visible { outline: 2px solid var(--primary, #6d28d9); outline-offset: 2px; }
.blk-acc-mark { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 999px; position: relative;
  border: 1px solid var(--border, #e4e4e7); transition: background .2s ease; }
.blk-acc-mark::before, .blk-acc-mark::after { content: ""; position: absolute; inset: 50% 5px auto 5px;
  height: 1.5px; background: currentColor; transform: translateY(-50%); }
.blk-acc-mark::after { transform: translateY(-50%) rotate(90deg); transition: transform .2s ease; }
.blk-acc-q[aria-expanded="true"] .blk-acc-mark { background: var(--primary, #6d28d9); color: #fff;
  border-color: var(--primary, #6d28d9); }
.blk-acc-q[aria-expanded="true"] .blk-acc-mark::after { transform: translateY(-50%) rotate(0deg); }
.blk-acc-a { padding: 0 0 18px; line-height: 1.65; opacity: .85; max-width: 68ch; }
@media (prefers-reduced-motion: reduce) { .blk-acc-mark, .blk-acc-mark::after { transition: none; } }


/* ── block presentation (background / padding / align / width) ───────────────
   A named set the THEME defines, so a site restyles by switching theme rather
   than by editing blocks. Nothing here comes from free-text input. */
.blk-bg-muted  { background: var(--muted-bg, #f6f6f8); }
.blk-bg-accent { background: var(--accent-bg, #f3efff); }
.blk-bg-dark   { background: var(--dark-bg, #111114); color: #f4f4f5; }
.blk-bg-dark a { color: color-mix(in srgb, var(--color-primary) 45%, var(--on-dark)); }
/* Scrim and white text are gated on blk-has-bg-image, which is emitted only when a
   URL is actually present. Keyed off blk-bg-image alone, choosing "Image" and not
   yet pasting a URL painted a black band with invisible text over the section —
   and the editor reveals the URL field only AFTER that choice, so it was one click
   away rather than an edge case. */
.blk-bg-image  { background-size: cover; background-position: center; }
.blk-has-bg-image { background-image: var(--blk-bg-image); position: relative; color: #fff; }
.blk-has-bg-image::before { content: ""; position: absolute; inset: 0;
  background: rgba(0,0,0,.45); pointer-events: none; }
.blk-has-bg-image > * { position: relative; }
.blk-hero.blk-has-hero-image { background-image: var(--blk-hero-image);
  background-size: cover; background-position: center; }

.blk-sub { margin: -4px 0 28px; opacity: .72; max-width: 62ch; }
.blk-acc-h { margin: 0; font-size: inherit; font-weight: inherit; line-height: inherit; }
.blk-widget-empty { padding: 20px; border: 1px dashed var(--border); border-radius: var(--radius);
  color: var(--muted); font-size: .9rem; text-align: center; }
.blk-tabpane:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.blk-carousel-track:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }

.blk-carousel-nav { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.blk-carousel-btn { width: 44px; height: 44px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--color-bg); color: var(--color-text);
  font-size: 1.25rem; line-height: 1; display: inline-flex; align-items: center;
  justify-content: center; }
.blk-carousel-btn:hover { border-color: var(--primary); color: var(--primary); }
.blk-carousel-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.blk-pad-none { padding-top: 0; padding-bottom: 0; }
.blk-pad-sm { padding-top: 24px; padding-bottom: 24px; }
.blk-pad-md { padding-top: 48px; padding-bottom: 48px; }
.blk-pad-lg { padding-top: 80px; padding-bottom: 80px; }
.blk-pad-xl { padding-top: 120px; padding-bottom: 120px; }

.blk-align-left   { text-align: left; }
.blk-align-center { text-align: center; }
.blk-align-right  { text-align: right; }

.blk-w-full .blk-inner      { max-width: none; }
.blk-w-contained .blk-inner { max-width: 1120px; }
.blk-w-narrow .blk-inner    { max-width: 720px; }

/* ── columns ─────────────────────────────────────────────────────────────────
   Stacks to one column under 720px: three 33% columns on a phone is unreadable,
   and every generated app here is held to a mobile-responsive standard. */
.blk-cols-track { display: grid; grid-template-columns: 1fr; }
.blk-gap-sm .blk-cols-track { gap: 16px; }
.blk-gap-md .blk-cols-track { gap: 32px; }
.blk-gap-lg .blk-cols-track { gap: 56px; }
.blk-valign-center .blk-cols-track { align-items: center; }
.blk-valign-bottom .blk-cols-track { align-items: end; }
/* Reset a nested block's own outer spacing so columns control the rhythm — but
   ONLY where the author made no explicit choice. Unconditionally, this out-specified
   .blk-pad-* and .blk-w-* (2-3 selectors vs 1), so the Spacing and Width dropdowns
   rendered, saved, and did nothing for any block inside a column. */
.blk-col > .blk:not([class*="blk-pad-"]) { padding-top: 0; padding-bottom: 0; }
.blk-col > .blk:not([class*="blk-w-"]) > .blk-inner {
  padding-left: 0; padding-right: 0; max-width: none; }
@media (min-width: 720px) {
  .blk-cols-2 .blk-cols-track { grid-template-columns: repeat(2, 1fr); }
  .blk-cols-3 .blk-cols-track { grid-template-columns: repeat(3, 1fr); }
  .blk-cols-4 .blk-cols-track { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .blk-cols-4 .blk-cols-track { grid-template-columns: repeat(4, 1fr); }
}
