/**
 * cf-blocks.css
 * ─────────────────────────────────────────────────────────────────────────
 * Runtime styling for Page Builder blocks that need CSS, not just JS, to
 * actually work: Columns, Tabs, Drawer, and scroll-reveal animations.
 * Referenced by both the canvas iframe (app.js) and every published page
 * (worker.js) — must ship at /css/cf-blocks.css on both.
 *
 * Without this file:
 *  - Tabs: every panel has the SAME specificity/display as the active one,
 *    so all panels show at once instead of only the active tab.
 *  - Drawer: the panel and backdrop are position:fixed with no default
 *    hidden state, so they render open/visible immediately regardless of
 *    whether .cf-drawer-open has been toggled on yet.
 *  - Columns: .cf-cols/.cf-cols-2/3/4 have no grid rules, so columns
 *    stack as plain divs instead of laying out side by side.
 *  - Scroll animations: .cf-anim/.cf-in-view (toggled by interactions.js)
 *    have no opacity/transform rules, so the reveal never visibly happens.
 * ─────────────────────────────────────────────────────────────────────────
 */

/* ---------------- Columns ---------------- */
.cf-cols {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}
.cf-cols-2 { grid-template-columns: repeat(2, 1fr); }
.cf-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cf-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .cf-cols-3:not(.cf-cols-nostack), .cf-cols-4:not(.cf-cols-nostack) { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .cf-cols-2:not(.cf-cols-nostack), .cf-cols-3:not(.cf-cols-nostack), .cf-cols-4:not(.cf-cols-nostack) { grid-template-columns: 1fr; }
  [data-cf-cols]:not(.cf-cols-nostack) { grid-template-columns: 1fr !important; }
}

/* ---------------- Tabs ---------------- */
.cf-tabs .cf-tab-panel { display: none; }
.cf-tabs .cf-tab-panel.cf-tab-panel-active { display: block; }
.cf-tabs .cf-tabs-nav button[data-cf-tab-btn] { color: #64748b; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; }
.cf-tabs .cf-tabs-nav button.cf-tab-active { color: #3b82f6; border-bottom-color: #3b82f6; }

/* ---------------- Drawer ---------------- */
[data-cf-drawer] {
  transform: translateX(105%);
  transition: transform .28s ease;
}
[data-cf-drawer].cf-drawer-open { transform: translateX(0); }
[data-cf-drawer-backdrop] {
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
[data-cf-drawer-backdrop].cf-drawer-open {
  opacity: 1;
  pointer-events: auto;
}

/* ---------------- Modal (native <dialog>) ---------------- */
dialog[data-cf-modal] { margin: auto; }
dialog[data-cf-modal]::backdrop { background: rgba(0, 0, 0, .5); }

/* ---------------- Scroll-reveal animations ---------------- */
.cf-anim {
  opacity: 0;
  transition-property: opacity, transform;
  transition-duration: var(--cf-anim-duration, 600ms);
  transition-delay: var(--cf-anim-delay, 0ms);
  transition-timing-function: ease-out;
}
.cf-anim-fade-up    { transform: translateY(24px); }
.cf-anim-fade-down  { transform: translateY(-24px); }
.cf-anim-fade-left  { transform: translateX(24px); }
.cf-anim-fade-right { transform: translateX(-24px); }
.cf-anim-fade-in    { transform: none; }
.cf-anim-zoom-in    { transform: scale(.92); }

.cf-anim.cf-in-view {
  opacity: 1;
  transform: none;
}
